[fix] Unblock editing schedule and subscription triggers - #5552
Conversation
…ual cues for removability
… tests for run version references
…tion schema and improve schema readiness checks
…hedule and subscription forms
…ser message handling
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe update improves trigger message mapping, makes schedule times editable with validation and duplicate prevention, centralizes workflow-version binding interpretation, preserves stored references during submission, hides deployed-version options, and adjusts schedule message editing warnings. ChangesTrigger scheduling behavior
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ScheduleForm
participant RunVersionField
participant BindingHelpers
participant ReferenceBuilder
ScheduleForm->>RunVersionField: select workflow or environment binding
ScheduleForm->>BindingHelpers: evaluate stored references and bind mode
BindingHelpers-->>ScheduleForm: versionChosen
ScheduleForm->>ReferenceBuilder: build references with stored fallback
ReferenceBuilder-->>ScheduleForm: submission references
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/RunVersionField.tsx (1)
144-181: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
hideEnvironmentstrands legacy "Deployed" bindings with no way to re-bind. The root cause isRunVersionField.tsx's render condition, which shows the Pinned picker wheneverhideEnvironmentis true even if the storedbindModeis"environment", and the rail offers no way to switchbindModeback; both drawers trigger this by passinghideEnvironmentunconditionally to an entity that may already be environment-bound.
web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/RunVersionField.tsx#L144-L181: haveonRevisionSelect's caller (or this component) resetbindModeto"revision"when a revision is picked whilehideEnvironmentis true, so the picked revision isn't silently discarded on save.web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerScheduleDrawer.tsx#L840-L863: once the above is fixed, verify picking a revision here correctly flipsbindModeand persists on save for a schedule that was previously environment-bound.web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerSubscriptionDrawer.tsx#L1047-L1061: same verification for subscriptions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1f9f3e6c-c5b8-4176-a31d-3b438818fd04
📒 Files selected for processing (7)
web/packages/agenta-entities/src/gatewayTrigger/core/messageInputs.tsweb/packages/agenta-entities/tests/unit/gatewayTriggerMessageInputs.test.tsweb/packages/agenta-entity-ui/src/gatewayTrigger/drawers/ScheduleBuilderField.tsxweb/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerScheduleDrawer.tsxweb/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerSubscriptionDrawer.tsxweb/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/RunVersionField.tsxweb/packages/agenta-entity-ui/tests/unit/runVersionReferences.test.ts
Railway Preview Environment
Updated at 2026-07-29T20:23:04.587Z |

Context
Editing an existing schedule or subscription trigger hit several dead ends. The worst: opening a validly-bound trigger and changing an unrelated field (the cron, the message) failed to save with "Bind a workflow", even though the binding was untouched. The save guard only accepted a leaf revision id from the picker, but the backend also binds by artifact, variant, or slug, and by an id the picker can't display. So a perfectly good binding read as "nothing bound".
A few smaller edit-flow issues rode along: schedule messages stored as a
messagespayload showed blank, run times could only be replaced by delete-and-re-add, and the message editor dropped you into raw JSON on edit.Fixed 4 Trigger drawer issue
9:00time update was not editable by defaultChanges
Saving a bound trigger no longer requires re-picking the workflow.
RunVersionFieldgains three shared helpers backed by one bind-key table (application/evaluator/workflow, each ×_revision/_variant/bare), mirroring the prefix scan intriggers/service.py::_validate_references:hasBoundWorkflow— does the stored family already pin a workflow? Accepts an artifact- or variant-level ref with no revision, and slug-keyed refs. Excludes a deployed family (environment) so Pinned can't silently resend an environment ref.extractBoundWorkflowId— the most-specific bound id the picker can resolve, or null.isRunVersionBound— the single source of truth the save guard and the section header both read, so the header can't say "complete" while save refuses.Both drawers now compute
versionChosenfromisRunVersionBound(...)and drop the duplicated three-key id extraction in favor ofextractBoundWorkflowId.A
messagespayload edits as a message even when the schema says completion.The bound agent may be unresolved (schema selectors report "completion" until it loads), or the mapping may have been written by the API.
getScheduleMessage/setScheduleMessagenow key off the payload's own shape (Array.isArray(obj.messages)), not just theisChatflag. The getter and setter check the same shape so an edit writes back where it was read from.Before, opening this in the composer showed a blank message field:
{"messages": [{"role": "user", "content": "publish an article"}]}
Now it reads "publish an article".
Run times are inline-editable instead of static chips.
TimesFieldswaps each removableTagfor a liveTimePicker, so "this is editable" needs no discovering. The last time can't be removed (an empty list emits0 0 * * *and silently reschedules to midnight). The cross-product guard and its warning are unchanged.The message editor opens on the message, not raw JSON.
MessageComposerno longer auto-switches to "Advanced (raw JSON)" on edit. It always opens on the friendly message; when the stored mapping is richer than one user message, it shows an inline warning ("typing here replaces it. Edit it under Advanced") instead of silently collapsing it. The now-unusedisEditprop is removed.The Deployed (environment) bind option is temporarily hidden.
RunVersionFieldtakes ahideEnvironmentflag that leaves a Pinned-only rail; both drawers set it and comment out the environment-query wiring behind restore notes. The tool "Reference by" control still offers both modes.Tests
runVersionReferences.test.ts(new, 157 lines):hasBoundWorkflowacross leaf/artifact/slug/deployed families,extractBoundWorkflowIdspecificity and artifact fallback,isRunVersionBoundfor both modes, andbuildRunVersionReferencesresend/route behavior.gatewayTriggerMessageInputs.test.ts: added cases for reading and writing amessagespayload under a completion schema.What to QA
messagespayload. The message field shows the text, not blank, and editing it saves back intomessages.