Repository navigation
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The per-path log with eviction watermarks, lost-open sets and two bounds exists only to track paths; its own in-flight check already gives that up. Not justified as shipped
What this change shipsInventory (5 items) — 4 justifiedIntent: stop a file-change chip showing a wrong "before" when another session makes the same edit to the same file during the turn. FIX (#17619).
[FIRST-PRINCIPLES-REVIEWED] 4d8751e Description read[DESCRIPTION-READ] 9f825d8d3fecbb5c7fa6b8ac87cbe15b9beb79b34376dd0b13a26b8c0c41cb41 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that every turn exit reaches [DESIGN-REVIEWED] 4d8751e Description read[DESCRIPTION-READ] 5898ed3eeeb51b8c2b6ce1e0e03d2e7d55418763069738fedbf9be265fc7d175 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 |
0be9349 to
5417e3b
Compare
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/dashboard/chat_turn/file_changes.py:659 -- Array-valued shell commands now abort chat turns
[BLOCK-MERGE] 4d8751e Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 (fenced). This happens on every Codex shell call, not in some rare edge case. The Codex replay corpus at False positive or not applicable? A repository writer can comment: |
5417e3b to
43e6d9a
Compare
|
Review disposition for
Local, targeted: |
43e6d9a to
a9b09ee
Compare
|
Review disposition for
Local, targeted: |
a9b09ee to
4d8751e
Compare
|
Review disposition for
Residual, stated in the PR body and the spec rather than claimed fixed: an auto-approved write that kiro-cli lands before its tool-call event reaches the dashboard has no record anywhere until that event arrives. A flush inside that gap cannot see it. The gap is bounded by ACP event latency, which I did not measure on this host. Local, targeted: |
|
First Principles CONCERNS on A per-slot log makes ANY write by ANY other session during the turn keep the fragment. That would not be an occasional false positive: on a host running several agent sessions at once, the case this deferral exists for, concurrent writes to different files are the normal state. The deferred resolution from #17367 would then almost never settle, and those users would be back to the If the owner prefers the smaller per-slot shape and accepts that trade-off, it is a straight subtraction, and I will make it on request. |
…red strReplace path The writer-id gate that guards a deferred strReplace "before" only sees writes recorded on its own slot. A second session making the same edit on the same file inside the turn window could leave the turn-end read equal to the forward substitution, so the flush settled an intermediate state as the before. Every recorded write is now also noted on a process-wide per-path log keyed by slot. _run_chat marks the turn start, the flush closes the slot's paths at turn end, and resolution is skipped for a path another slot wrote after this turn began or still holds open in its own unfinished turn. The log is bounded and an eviction fails closed. Closes #17619
4d8751e to
2d98b18
Compare
|
Review disposition for
Enumerated: Local, targeted: 396 passed across |
|
Closing this draft without merging. Five review rounds each found a new concurrency edge case in the write log this PR adds (watermark, open-write tracking, close re-stamp, in-flight mark, and now a cancelled snapshot clearing its in-flight mark before the write is recorded). The defect it fixes is rare and cosmetic: a wrong diff in the file-change chip, never a change to files on disk. About 200 lines of concurrency code is not worth that, so the recommendation is to keep #17619 as a documented limitation. The branch is kept; this can be reopened if the owner disagrees. |
Problem / Motivation
Goal: A file-change chip never shows an intermediate "before" when a second session makes the same strReplace on the same file during the turn.
The deferred-strReplace "before" resolution is guarded by a writer-id gate in
_record_turn_snapshot, but that gate only sees writes recorded on the current slot. A second, concurrent session making a byte-identical strReplace on the same file inside the turn window is never seen, so the turn-end read can equal the forward substitution and the saved chip shows an intermediate before (one deleted line missing).Why it matters
The chip is the user's record of what the agent changed. The file on disk is correct, but the chip under-reports the change with no flag. It needs two sessions editing the same narrow file shape at once, so it is rare, but it is a silent wrong answer rather than a visible fallback.
Not a goal
turn_had_shell), unchanged here.What changed (motivation → approach → change)
pending_str_replace._PathWriteLog(ownerchat_turn/file_changes.py, instancechat_runner._PATH_WRITESbecause the composition contract keeps runner state on the runner) maps canonical path → slot →[last_seq, open]._record_turn_snapshotnotes every recorded write on it;_run_chatmarks the turn start (_begin_turn_path_writes, stored in the new_ChatSlot._file_changes_since);_flush_file_changescloses the slot's paths at turn end and skips resolution when another slot wrote the path after this turn began OR still holds it open in an unfinished turn (a permission-gated write is recorded at request time and can land later)._ChatSlot._path_write_token), never a reusableid().docs/system-specs/modules/learn-cron-dashboard.md(File-change snapshots) records the new guard.Signatures the guard is meant to cover:
turn_had_shell, unchanged._record_turn_snapshot. Same as before this PR.Backwards compatibility
Compatible: a deferred before is now settled in strictly fewer cases; every case that stops settling keeps the fragment it showed before #17367.
Removes nothing: no field, key or public function is removed or tightened; one slot attribute and module helpers are added.
Tests
test/test_file_change_snapshots.py:test_identical_edit_by_another_session_keeps_the_fragment— two slots record the same deferred edit; the first keeps the fragment. Red with the flush check stubbed out.test_other_session_still_in_its_turn_keeps_the_fragment— a slot that recorded before this turn and is still open counts. Red with the flush check stubbed out.test_other_session_finished_before_this_turn_still_resolves— control: a finished earlier turn does not block resolution. Red with_close_turn_path_writesstubbed out.TestPathWriteLog— an evicted closed write counts only for older turns; evicting old closed history leaves later turns resolvable; an evicted open write stays foreign until its turn closes; a path re-created after eviction still counts as foreign; writers per path are bounded and a drop fails closed; closing re-stamps records; closing a slot with forgotten open writes fails closed; an in-flight write snapshot counts until it ends and only write tools are marked; slot tokens are minted once; own writes never count; closed old writes do not.Run:
pytest -n0 test/test_file_change_snapshots.py test/test_chat_runner_composition_contract.py test/test_crew_recency.py→ 396 passed. black, isort, flake8 and mypy clean on the touched files.Manual verification
N/A — the race needs two live sessions editing one file within one turn window; the unit tests drive the same record/flush entry points the turn loop calls, and the existing turn-loop tests (
TestPendingStrReplaceThroughTheTurnLoop) pass with_run_chatnow marking the turn start.Related Issues
Closes #17619
Pattern harvest
Not generalizable: the defect is that one specific gate was scoped to a slot while the resource it guards is shared; the fix is the cross-slot signal that gate needed.
Decision for the owner
The decision is whether a deferred strReplace before may be settled when another session wrote the same file during the turn. This draft says no and adds a bounded process-wide per-path write log that keeps the fragment in that case, rather than accepting the documented limitation.
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.