Repository navigation
fix(agent): stop a held sibling pass rewriting specs every tick - #32804
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix records the generation and the time of the held pass, so the 2-second retries stop re-running it. The hourly wake can still make the pass due again explicitly. Notes
[DESIGN-REVIEWED] 4ea8deb Description read[DESCRIPTION-READ] 84a6679f7cb76eb3a0d38680004583fbfd3492eaa43fc5f386027cba1f3138f8 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix belongs at the cause. It ships two retry triggers for the held pass where one, the existing hourly wake, already covers the job. Notes
What this change shipsInventory (5 items) — 2 justifiedIntent: stop the gateway rewriting every sibling spec and logging a warning every 2 s while the agents directory is unreadable. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 4ea8deb Description read[DESCRIPTION-READ] 5e74de140d65bbeb89aca726f58b44d339b309c5f23c2379822ce06eca37ed9d That sha256 names the PR description this verdict read. 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: |
With kirocrew.json unreadable, the rebuild skips and runs the sibling pass (service, conductor and fork specs) once per governance generation. A pass that held a sibling write (a second unreadable spec, a held conductor) never recorded its generation, so while a default model change was pending the config watcher's 2-second retry re-ran the whole pass on every tick, rewriting every sibling spec each time. A held pass now records its generation and the time it ran, and runs again under the same generation only after HELD_SIBLING_PASS_RETRY_SECS (30 min), which the hourly maintenance wake always reaches. A pass that raised, or a deferred boot refresh, still records nothing.
67a3c88 to
4ea8deb
Compare
|
span=52bfbc939a26
|
With kirocrew.json unreadable, the rebuild skips and runs the sibling pass (service, conductor and fork specs) once per governance generation. A pass that held a sibling write (a second unreadable spec, a held conductor) never recorded its generation, so while a default model change was pending the config watcher's 2-second retry re-ran the whole pass on every tick, rewriting every sibling spec each time. A held pass now records its generation and the time it ran, and runs again under the same generation only after HELD_SIBLING_PASS_RETRY_SECS (30 min), which the hourly maintenance wake always reaches. A pass that raised, or a deferred boot refresh, still records nothing. (cherry picked from commit 217b335)
With kirocrew.json unreadable, the rebuild skips and runs the sibling pass (service, conductor and fork specs) once per governance generation. A pass that held a sibling write (a second unreadable spec, a held conductor) never recorded its generation, so while a default model change was pending the config watcher's 2-second retry re-ran the whole pass on every tick, rewriting every sibling spec each time. A held pass now records its generation and the time it ran, and runs again under the same generation only after HELD_SIBLING_PASS_RETRY_SECS (30 min), which the hourly maintenance wake always reaches. A pass that raised, or a deferred boot refresh, still records nothing. (cherry picked from commit 217b335)
Problem / Motivation
Goal: While
kirocrew.jsoncannot be read and a sibling spec cannot be written either, a pending default-model change no longer rewrites every sibling spec on each 2-second config-watch tick.With
kirocrew.jsonunreadable,_skip_unreadable_main_speckeeps the file and runs the sibling pass (service, conductor and fork specs) once per governance generation. A pass that held a sibling write never recorded its generation. That happens when a second spec (kirocrew-heartbeat, the worker, a conductor) is also unreadable, which is the usual case because ownership, mode or an antivirus lock hit the whole agents directory. ThenConfigWatch._cycleretries the pending model change everyDEFAULT_POLL_INTERVAL_SECS(2 s), each retry lands in the skip, andgeneration != _main_spec_skip_generationstays true, so the whole pass runs every tick: it rewrites the knowledge, research, mate, team-lead and conductor specs, runs a fork refresh and hook repair, and logs a WARNING each time. Found by Opus on the 0.12.1 port of #27535 (#32758); the same code is onmain.Why it matters
For as long as the directory stays unreadable, the gateway rewrites half a dozen spec files and logs a warning every 2 seconds, and kiro-cli reloads the watched specs each time.
Not a goal
What changed (motivation → approach → change)
agent_parts/spec_unreadable.py: a pass that completed (raised nothing, refresh not deferred) now records its generation whether or not it held. If it held, it also records the time it ran (_main_spec_held_pass_at, on an injectable_held_pass_clock), and the same generation runs the pass again only onceHELD_SIBLING_PASS_RETRY_SECS(30 min) have passed. That is shorter than the hourly maintenance wake (retry_held_conductor_specs), so the wake always finds the retry due and a tightened ceiling still reaches a held conductor spec. A pass that holds nothing clears the time; closing the episode clears both. A raising pass still records nothing and re-runs on the next skip.agent.pyre-exports the two new names;test/conftest.pyresets the new state with the others.docs/system-specs/modules/governance.mdsays when a held pass runs again.Backwards compatibility
Compatible. A held sibling pass now runs again after 30 minutes under the same generation, or when the generation moves, instead of on every skip. The hourly maintenance retry still re-runs it, so a held conductor spec is retried exactly as often as before through that path.
Reader: src/kiro_crew/agent_parts/spec_rebuild.py:retry_held_conductor_specs -- release -- its hourly rebuild lands in the skip after HELD_SIBLING_PASS_RETRY_SECS, so the held pass still re-runs; test_a_held_sibling_pass_is_retried_under_the_same_generation
Tests
Proof: PROVEN test/test_agent_unreadable_main_spec.py::TestUnreadableMainSpec::test_a_held_sibling_pass_waits_out_the_retry_interval (head 67a3c88)
test_a_held_sibling_pass_waits_out_the_retry_interval: main spec unreadable, conductor held, ten 2-second ticks run the pass once (assert 10 == 1on the old code), and the first skip after the interval runs it again.test_a_held_sibling_pass_is_retried_under_the_same_generation,test_a_mirror_re_filter_that_fails_keeps_the_sibling_pass_owedandtest_a_deferred_fork_refresh_leaves_the_generation_unrecordednow step the clock past the interval and assert the held time instead of an unrecorded generation.spec_unreadable, the skip, the_main_spec_state,retry_held_conductor_specs,_spec_hold_openoragent_parts(52 files) plus the flake ratchet: 2222 passed.Manual verification
N/A - the tick loop is driven deterministically in the new test with an injected clock.
Screenshots / video
Related Issues
Found on #32758 (the 0.12.1 port of #27535).
Sibling sweep
Siblings: none --
_skip_unreadable_main_specis the only place the sibling pass is gated on a recorded generation;retry_held_conductor_specsand the profile watch keep their own backoffs.Pattern harvest
Not generalizable: the gate is specific to the unreadable-spec episode.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.