Repository navigation
fix(cron): rebind a cron session record whose selection a tab agent switch moved - #23150
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (5 items) — 5 justifiedIntent: keep a scheduled job firing after someone switches the agent on its dashboard tab (closes #23134). This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] afedb1a Description read[DESCRIPTION-READ] 2d6b60afd04d630c8005f99c2dd8e8c0656aa5994e0b3e40d88c3513c8dcf2c0 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the repair now covers every field the tab-switch writer changes, and identity fields are still refused. Notes
[DESIGN-REVIEWED] afedb1a Description read[DESCRIPTION-READ] 748f2d7bbfebf6916ab106f62f54ba64d28926928d87a84aa6cd17aa56a17702 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
fa1b05e to
9917c88
Compare
|
self-added: no
|
f78fa66 to
5ef3228
Compare
|
Shared cause for the shard-3 reds (from chat-46, which is leading on #23146): |
|
Not caused by this PR: |
5ef3228 to
63d6571
Compare
|
Neither remaining red is from this diff. |
63d6571 to
afedb1a
Compare
|
Rebased once onto main for the #23264 Windows fix. |
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed current head afedb1a78cba506a42aa480dc485d35a9daffe89 as Tier 2. Deep review found no blocking issue.
Security check: member identity, store, memory mode, and app equality remain required. The CAS-bound rebind does not grant cross-member access. Auto-merge remains subject to branch protection.
Problem / Motivation
Goal: A scheduled job keeps running after someone switches the agent on its dashboard tab, instead of failing every fire with "session already belongs to another execution".
A persistent single-agent cron fails on every fire with
UnknownMemoryStore: Execution memory is unavailable: session already belongs to another execution; Global was not used. A gateway restart does not clear it, and changing the job's agent does not clear it either. The only ways out today are archiving the session or recreating the schedule.Why it matters
Any operator who touches the agent picker on a cron's tab silently breaks that schedule for good. Each fire logs an error, and the job can walk itself into auto-pause. The remedy the log offers (recreate the schedule) loses the job's history and configuration.
Not a goal
cron:<id>record at all. That is a separate UX/design question.What changed (motivation → approach → change)
The cron tab runs under the schedule's own
cron:<id>key. Switching its agent rewrites that record with a new template, the picked name, and a freshselection_revision. Before each fire,rebind_cron_session_templateinsrc/kiro_crew/cron_service/identity.pyrestores the record to the job's capture, but only when the two differ intemplate_idalone. So it declined this record. The plainbind_session_executionat dispatch then refused it on every fire.Now the rebind treats every selection field as the schedule's own:
template_id,selection_revisionselection_kind,selection_namemember_idnames the member, or both sides select a templatemember_id,store,memory_mode,appThe middle row has one exception. A legacy member with no persisted
member_idis named by itsselection_kindandselection_name, so those two still must match. The rewrite stays a compare-and-set against the value just read, unvouched. It only ever moves the record toward the job's own capture, which is what dispatch runs anyway. The per-agent cron section ofdocs/system-specs/modules/learn-cron-dashboard.mdstates the same rule.Backwards compatibility
Compatible: the rebind accepts strictly more records than before (a superset of the template-only case), and every record it refused for an identity difference is still refused.
Removes nothing: no key, path, validator or record is removed; one more record shape is repaired instead of left alone.
Tests
test/test_cron_update_agent_capture.py:test_a_dashboard_agent_switch_on_the_cron_tab_does_not_wedge_the_schedule[other-agent|same-agent]is the reporter's sequence: a fire publishes, the tab switches agent (another one, or the same one, which differs by revision alone), thencron updateand the next fire. It asserts that the record equals the capture and the plain bind succeeds. It fails onmain(2/2 red with the fix reverted) and passes with the fix.test_a_session_record_on_another_store_is_left_alonechecks that a store difference is still left alone and still refused at dispatch.test_a_legacy_member_named_only_by_selection_is_left_alonechecks that a member identified only byselection_kind/selection_nameis not rewritten.Determinism: the file is 20/20 green on repeats, green in reversed order, and green under
-n 4. The tests use onlytmp_pathstores, with no clock, network or ordering dependence.Manual verification
N/A: unit coverage drives the same functions the fire calls (
rebind_cron_session_templatethenbind_session_execution) and the same writer the tab switch calls (record_agent_selection(replace=True)).Related Issues
Closes #23134
Pattern harvest
Rule candidate: review-prompt
Pattern: a "repair if only X differs" compare that enumerates one field while another writer to the same record changes sibling fields (
replace(current, x=...) != expected). The repair's field set must match what every writer of that record can change.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)