Repository navigation
fix(crew-mode): keep a cap-refused owed turn out of the stored pause map - #35526
dodgeblaster wants to merge 2 commits into
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix works at the cause level: cap-refused owed turns now live beside the stored map instead of inside it. The Notes
What this change shipsInventory (6 items) — 5 justifiedIntent: when the pause file is at its size cap, Resume all and a member's own Continue still unpause crews while the refused owed turn is kept. FIX.
[FIRST-PRINCIPLES-REVIEWED] 020960a Description read[DESCRIPTION-READ] 6803ebf7d69bd582555626eb12333cb029a1f8da1c78d7b0072aa6a066f6df46 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 — 🔴 changes requested (blocking)GPT 6.1 found at least one blocking issue that must be resolved before merging This comment is updated in place on each push. BLOCKING -- src/kiro_crew/crew_pause.py:262 -- Rollback deletes an already persisted owed turn [BLOCK-MERGE] 020960a Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 (fenced). The harm is a lost resume obligation. B's interrupted turn is not continued automatically by Resume all; it is visible, and the user can recover it by hand by pressing Continue on B. Nothing is exposed and no ceiling is affected. Every condition the finding needs is in the code:
The trim is the documented trade-off. Without it, the refused undo raises ( [ADJUDICATION] 020960a total=0 uphold=0 downgrade=0 [ADJUDICATION-FENCED] 020960a fenced=1 flagged=1 🏷️ Fenced finding(s) machine-flagged as likely edge caseThe security fence keeps these findings blocking regardless of adjudication; the only clearance path is a human override. The annotate-only pass judged the condition combination each one requires extreme, and pre-drafted the override rationale below. A repository writer must independently verify a rationale before posting it — it is machine-authored, and a wrong override on a security-class finding ships exactly the class the fence exists to stop.
Replace False positive or not applicable? A repository writer can comment: |
1f1bca7 to
869a306
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Keeping cap-refused owed turns beside the stored map fixes the cause: a write that shrinks the file now always fits. Nothing blocks. Notes
[DESIGN-REVIEWED] 020960a Description read[DESCRIPTION-READ] ec39ba989619423ab8979dc03c954c84ab84af5d93d871e91b98564f7bc4523e 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 |
869a306 to
97ce546
Compare
97ce546 to
5751aa6
Compare
5751aa6 to
442efa3
Compare
442efa3 to
dc23b9e
Compare
dc23b9e to
3b0886b
Compare
|
Stale-PR cleanup: rebased on main and addressed the GPT 6.1 finding from dc23b9e in 3b0886b. A write the size cap would refuse now first moves owed turns that were memory only (and a later write stored) back to memory only, so crew A's refused Continue can always rehold even after crew C's Continue used the room. Readers still see those turns. New test: |
|
Stale-PR cleanup: my fix round (3b0886b) for the earlier GPT finding drew two new GPT findings in the same code, so the cleanup stops here rather than start a second round. Suggested direction for @dodgeblaster: (1) only let the rollback write move a stored turn back to memory: pass a flag from |
An owed turn the pause file's 256 KiB cap refused stayed in the map every later write stores, so a write that shrinks the file (Resume all on another crew, a member's own Continue) still hit the cap and failed, leaving that crew paused. Keep those owed turns beside the stored records, in memory only: readers see both, each write first tries to store both, and a write the cap refuses with them stores the records alone. Release and rehold carry a member's memory-only turns, so a refused Continue puts them back as they were, and a released one cannot shadow a later Pause all's fresh stop. Fixes #32819
3b0886b to
91a7a3b
Compare
|
Fix round for the two GPT 6.1 findings on 3b0886b, now in 91a7a3b (rebased on main):
|
…fused Continue needs the room GPT 6.1 review on dc23b9e: crew A's Continue freed room kept for its undo, then crew C's Continue stored crew B's memory-only owed turn in that room, so A's rehold passed the cap and raised. A write the cap would refuse now first moves owed turns that were memory only, and a later write stored, back to memory only; readers still see them.
91a7a3b to
020960a
Compare
|
@bolichen97 I saw you picked up #32819 on Nov 15 and are building on this PR, so I'd like your call before we take the next step. Where it stands: head Options:
Which do you prefer? I won't push or post an override until you reply. |
Problem / Motivation
Goal: When the pause file is at its 256 KiB size cap, Resume all and a member's own Continue still work while an owed turn the file refused is kept in memory.
crew_pause.owe_turnkeeps an owed turn in memory when the pause-file write is refused, so Resume all still continues it (#32524). When the refusal came from the size cap, that entry stayed in the map every later write stores, so the map stayed over the cap. Resume all on a different, smaller crew, or a member's own Continue (release), then failed withOSErrorand that crew stayed paused.Why it matters
Only reachable with a pause file already at the cap (thousands of member keys across paused crews), but the failure is a crew that will not resume until some other write happens to free enough bytes.
Not a goal
What changed (motivation → approach → change)
Symptom: a write that shrinks the pause file failed at the cap. Cause: the cap-refused owed turn lived inside the stored map, so every write tried to store it again.
Approach: keep those owed turns beside the stored records, never inside them, and never for an entry the file already stores. Readers see both. Each write first tries to store both, and when the cap refuses that, it stores the records alone, so a write that shrinks the file always fits. The issue's three edge cases:
rehold) puts a memory-only turn back in memory, including when the release had ended the whole record. A refused Resume all already stores the record's memory-only turns asresuming, so the hand-back write holds them again.releaseandresumecan be undone, so they store memory-only turns only when the records their undo writes back would fit with them too. When the cap refused a turn, the room they free stays free for the undo; without this, a Continue that freed room for another member's memory-only turn could leave its ownreholdover the cap. A turn only the disk refused still fits, so the next write stores it, as on main.Backwards compatibility
Compatible: the file format is unchanged, and
release()adds amemory_onlykey to its result only when it took a memory-only turn.continue_turn.pypasses that result straight back torehold()and reads onlyfields.Removes nothing: no field, key, function or stored record is removed; memory-only turns are added beside the stored map.
Tests
test/test_crew_pause.pyadds:test_a_write_that_shrinks_the_file_fits_while_an_owed_turn_is_kept_in_memory: Resume all on a smaller crew and a member's Continue both succeed at the cap (edge case 1).test_resume_all_continues_an_owed_turn_kept_in_memory: the memory-only turn is continued and stored asresuming.test_a_released_owed_turn_does_not_strip_a_later_pauses_fresh_stop(edge case 2).test_a_refused_continue_puts_back_an_owed_turn_kept_in_memory[record kept / record ended](edge case 3,rehold).test_a_refused_resume_holds_an_owed_turn_kept_in_memory_again(edge case 3, the Resume all hand-back).test_an_owed_turn_kept_in_memory_is_stored_once_the_file_has_room.test_a_refused_continue_fits_back_beside_another_owed_turn_kept_in_memory: a Continue that frees room keeps it for its own undo.test_an_owed_turn_the_disk_refused_is_stored_by_the_next_continue_or_resume[continue / resume_all]: a turn the disk refused is stored by the next write even when that write can be undone.test_a_stop_a_later_pause_stored_stays_stored_through_a_refused_continue: a stop a later Pause all stored is never treated as memory-only, so a refused Continue keeps it in the file.Proof: PROVEN test/test_crew_pause.py::test_an_owed_turn_kept_in_memory_is_stored_once_the_file_has_room, test/test_crew_pause.py::test_a_refused_continue_fits_back_beside_another_owed_turn_kept_in_memory (head dc23b9e)
I also tested each mechanism with its own mutant. Dropping the records-only fallback fails 5 of the new tests. Leaving a released member's memory-only turns behind fails the fresh-stop test. Storing a reheld memory-only turn fails the
reholdtest. Lettingreleaseandresumealways store memory-only turns fails 2 tests; never storing them there fails both disk-refused tests. Keeping a memory-only entry the file already stores fails the stored-stop test on its final assertion (['w1'] == ['w1', 'w2']). Determinism: the new tests pass in 5 repeated runs, and the whole file (95 tests) passes in a seeded shuffled order.Nearby inputs to the same write path:
pause,settle_stopped,keep_pendingandforget_resumingoperate on the stored records and are covered by the existing 84 tests, all passing unchanged. The disk-full variant ofowe_turnis covered by the existingtest_a_turn_owed_when_its_write_is_refused_is_still_continued[disk_full].Manual verification
N/A: the defect lives in the pause store's in-memory and file state, which the unit tests drive directly with a reduced cap.
Related Issues
Fixes #32819
Sibling sweep
Swept: git grep -n "MAX_FILE_BYTES" -- src/kiro_crew/crew_pause.py src/kiro_crew/dashboard/
Sibling: src/kiro_crew/crew_pause.py:410 -- not affected -- a refused hand-back is reported as pause_file_unsaved and stays owed in the file's resuming, so nothing is lost
Pattern harvest
Not generalizable: specific to one store that keeps a cap-refused entry in memory, which no other capped store in the repo does.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)