Repository navigation
fix(work-ledger): wake a conductor once per item per reason, not once per repeat - #37883
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix is aimed at the cause: dedupe keys now follow what the wake is about, not the report timestamp. The ask-record stall hold rides along with no reported case behind it. Notes
What this change shipsInventory (6 items) — 4 justifiedIntent: stop a conductor being woken again and again about a work item when nothing new happened on it. FIX.
[FIRST-PRINCIPLES-REVIEWED] 13863b2 Description read[DESCRIPTION-READ] 91889a2641430aa8872bbe96f5752c55abe1316b57bda767cf788504190ab625 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS The design fixes the dedupe key itself, not the symptom, and keeps the board's Notes
[DESIGN-REVIEWED] 13863b2 Description read[DESCRIPTION-READ] 0f34a822bf7852ae7938eda18f5f8a97a4685193ef49995b691db511326a26ba 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: |
… per repeat A stall wake is keyed on its episode (status, the newest report of another status, an unanswered decide, wake_at, session gone) instead of the last report's stamp, so a worker that reports progress and stops again is one stall; the observation key carries the episode so the kernel mask does not hide a re-armed stall. A blocked or question report that repeats the worker's previous report wakes nothing even across the conductor's own decide, unless its reason differs from the cause last delivered or a question's summary changed. An item with an open ask record raises no stall wake while its worker session is open.
b8ac24b to
13863b2
Compare
|
Head 13863b2 answers both blocking findings on b8ac24b:
|
Code change approver recommendation: A person should decideWhy: the decider raised 2 possible problems and estimates a 55% chance that this change introduces a defect; a person should check them. The core dedupe fixes are sound and tested: a stall token built from what the silence is about, and blocked/question repeats that skip the conductor's own writes while a new reason (via the cause token) still wakes. The PR also adds a stall hold keyed on Things to check (possible problems the decider raised; at this confidence many turn out to be fine):
An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (5 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: work-ledger probe wakes a conductor once per item per reason instead of once per repeated report; plus tests. Spec files changed as a ride-along (a minority of the diff on both file count and changed lines), not reviewed as a design decision: docs/request-for-change/rfc-permanent-patrol.md, docs/system-specs/modules/monitor-architecture.md.
|
This merged while my review of 13863b2 was still running, so here is its one finding as a follow-up item.
Smallest follow-up: drop the hold (the line, its guard, the matching |
Problem / Motivation
Goal: a conductor's work-ledger patrol wakes it at most once per item per reason; a repeat of the same cause, with nothing new on that item, does not wake it again.
An owner review of 75 delivered work-ledger wakes on one conductor session found repeats that carried no news:
reason=stallthree times in about 40 minutes for one item (2026-11-15 19:51, 20:13, 20:30Z). The worker reportedprogressat 19:32, 19:58 and 20:15, each time after the conductor nudged it, and stopped again. Each stall came 15 minutes after the previousprogress.reason=stallthree times (20:45, 21:19, 21:46Z) for an item the conductor had parked with adecide("hold, report progress and wait"). The worker answered each park with aprogressreport and waited.status=blockedtwice within a minute for one item (2026-11-16 02:28:57 and 02:29:47Z):blocked(reasonneeds_human), the conductor'sdecide, then the sameblocked/needs_humanagain with a re-worded summary.Why it matters
Each repeat costs the conductor a model turn that reads a board it already read, and it lands mid-turn on other work. The owner reads these wakes as noise.
Not a goal
spec_prompts.py,crewmate_prompts.json).monitor.py/gate.py(RC1/RC2, fix(monitor): wake the session once when its watched PR merges or closes #37776).decide's free text.What changed (motivation → approach → change)
Why the existing filter (#33602) let these through:
stall:<last_report_at>. Everyprogressreport moves that stamp, so each "still waiting" report minted a new token, and the seen set treated it as a new stall once the 15-minute window ran out again.ledger_wake.repeats_statuscompares a report only with the event right before it. The conductor's owndecisionsat between the twoblockedreports, so the second one counted as news.The change stays inside that filter:
src/kiro_crew/ledger_wake.py:stall_episodebuilds the stall token from what the silence is about: the item's status, the newest worker report of another status (read from the tail the probe already loads), adecidethe worker has not answered yet, itswake_at, and whether its session is gone. Aprogressthat keeps the status changes none of these. A status change, a new unanswered decide, a newwake_ator a closed session do.src/kiro_crew/ledger_wake.py:previous_report/repeats_wait. Ablockedorquestionthat repeats the worker's previous report, skipping the conductor's own writes, is a repeat. Aquestionalso needs the same summary. Events carry noreason, so the probe keeps the last delivered wait's cause (cause_token,cause:<status>:<reason>) in the seen set it already has (note_wake(cause=...)). The newest report is a repeat only when its cause matches. A new reason wakes.src/kiro_crew/probes/work_ledger.py: uses both.donekeeps the back-to-back rule from fix: wake a conductor only on a changed worker status; longer floor for a PR waiting on review #33602.replyand any new status still wake.src/kiro_crew/probes/work_ledger.py: the stall observation key carries the episode, so the kernel'srealert_secsmask cannot hide a re-armed stall (a closed session, a new unanswered decide).src/kiro_crew/probes/work_ledger.py: an item with an openaskrecord (the conductor waits on a person for it;decide/closeclear it) raises no stall wake while its worker session is open. This is the owner's rule for this PR ("an item that waits on a person is not stale"). It lives in the probe only:work_ledger.is_staleand the board'sstaleflag are unchanged.staleflag is unchanged on reads, and the patrol's floor turn still shows it. So a worker that really died is still found.docs/system-specs/modules/monitor-architecture.md(repeat rule, stall token and key, ask) anddocs/request-for-change/rfc-permanent-patrol.md§4 (the repeat rule it states).Bot conductors and conductor mode arm the same
watch="work-ledger"probe, so both get this.Backwards compatibility
Compatible: no field, validator or key is removed or renamed. The rate file gains
cause:tokens in an existing list. An old stall tokenstall:<stamp>is replaced by the first episode token, which costs at most one extra stall per open item after upgrade.Removes nothing: the change only suppresses wakes that repeat a delivered cause. Every value it reads stays on the board.
Tests
test/test_probe_work_ledger.py:test_the_same_wait_after_the_conductors_decision_does_not_wake: blocked / decide / the same blocked → no second wake (the it_bc232b0e case).test_the_same_status_with_a_new_reason_wakes: a new reason wakes, across a decide and back to back.test_an_identical_question_across_a_decide_does_not_wake_but_a_new_one_does.test_progress_reports_that_keep_the_status_raise_one_stall: replacestest_many_stalls_cannot_evict_a_report_still_in_the_tail, which pinned one stall per progress report. Now it is one stall per status run, and the blocked report still wakes once.test_a_parked_worker_answering_each_decide_with_progress_stalls_once(the it_d2445efa case).test_an_unanswered_decide_re_arms_the_stall,test_a_closed_session_re_arms_the_stall.test_an_item_waiting_on_a_person_raises_no_stall: anaskrecord holds the stall wake but not the board flag; a closed session still raises, and the nextdecidere-arms it.test_a_re_armed_stall_is_delivered_through_the_kernel_mask: a re-armed stall gets past the kernel's mask viairq.run.test_a_bot_conductor_gets_the_same_once_per_reason_filter[conductor-mode|bot].test_the_same_status_after_the_conductors_decision_wakes: it pinned the opposite of the new rule.Proof: PROVEN test/test_probe_work_ledger.py::test_the_same_wait_after_the_conductors_decision_does_not_wake, test/test_probe_work_ledger.py::test_the_same_status_with_a_new_reason_wakes, test/test_probe_work_ledger.py::test_an_identical_question_across_a_decide_does_not_wake_but_a_new_one_does, test/test_probe_work_ledger.py::test_progress_reports_that_keep_the_status_raise_one_stall, test/test_probe_work_ledger.py::test_a_parked_worker_answering_each_decide_with_progress_stalls_once (head 13863b2)
With the source hunks stashed, all 11 new tests fail. Run locally under the shared test lock with
-n 2:test_probe_work_ledger.py126 passed.test_conductor_wake,test_autonudge_ledger_extension,test_autonudge_person_wait_hold,test_autonudge_ledger_quiet_floor,test_conductor_base_work_ledger,test_work_ledger*,test_remote_dispatch_hub_ingest/pullerandtest_mate_worker_parity: 665 passed.Manual verification
N/A: unit coverage. The three cases above are replayed as tests from the transcript and worker logs.
Related Issues
N/A
Sibling sweep
Swept: git grep -nE "repeats_status|_STALL_KEY|last_report_at or 'none'" -- src/
Sibling: src/kiro_crew/conductor_wake.py -- not affected -- it only pulls the tick forward; the probe decides whether a turn is spent
Pattern harvest
Not generalizable: the defect is a dedupe key that tracked a timestamp instead of the cause, specific to this probe's token.
Checklist
Contribution License Agreement
Contributed under Apache-2.0.