Repository navigation
fix(dashboard): keep an idle chat's project change across a restart - #36784
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS This fixes the root cause by marking the slot dirty where the project actually changes, the same way the sibling writers already do. It takes nothing away and adds no new surface. [DESIGN-REVIEWED] 6762015 Description read[DESCRIPTION-READ] 236c7350e5aa4c0d6d3bfeb263f08886d2235148fad008fc3445d9fb022232d3 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 Both project writers that skipped the dirty flag now set it, using the convention every other slot-field writer already follows. Nothing new is added. What this change shipsInventory (3 items) — 3 justifiedIntent: when a user clears or changes an idle chat's project, it stays that way after a restart. FIX.
[FIRST-PRINCIPLES-REVIEWED] 6762015 Description read[DESCRIPTION-READ] 5fce5b332b9406d63ad39af255e6bd5f465615194ad13f55d4322d89241f6d11 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: |
Code change approver recommendation: ApproveWhy: the decider estimates a 7% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes. I recommend approving. The bug is real and the fix is narrow: the dashboard saves a chat's settings to disk only when the chat (internally a "slot") is marked Checked in the code:
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 |
|
Coverage Gate is red on main, not from this diff: |
31b06a8 to
a4fec8b
Compare
a4fec8b to
6762015
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Thanks for the fix. We checked this head: the new test passes 4 of 4 here and fails 4 of 4 with the two source files reverted to the merge base. Removing any one of the three added _dirty marks turns at least one case red. In the HTTP handler, the mark comes after every rollback exit and the 409, so a rejected change is never saved. A same-value set still marks nothing. The flush consumer keeps a mark that is set during a flush.
Well done: the test drives the real path (restore from disk, change over HTTP or by directive, periodic flush, restore again) for both clear and move, and it asserts what the user sees after a restart.
Optional:
- In
_set_project, re-readold_projectjust beforeslot.project = rp, as the clear branch already does after its await. A concurrent project change during the awaits could otherwise skip the mark. That stale read was already on main. - Add a case that sets the project the slot already holds and asserts
slot._dirtystays False. Right now the "a same-value set marks nothing" claim has no test. - The body's sibling sweep lists fewer writers than its own grep finds (for example slot_create.py, worker_slots.py, chat_fork.py and transcript_binding.py). None of them needs a code change. A one-line reason for each would make the list complete.
Problem / Motivation
Goal: A project cleared or changed on an idle chat stays that way after a restart.
Clear an idle chat's project (or move it to another directory), send nothing more, and restart. The chat comes back scoped to the old directory, and its next session spawns there. This happens through both the project endpoint and the agent's
set_projectdirective.Why it matters
Nothing errors. The user sees the clear succeed, and after a restart the agent runs in the directory they removed, reading and writing files there.
Not a goal
retract_cwd/clear_cwd) already drops that on a clear, and this PR does not touch it.What changed (motivation → approach → change)
_dirtyis set. A project change on an idle chat appends no transcript row, and neither project writer marked the slot, so the line kept the oldproject.api_chat_slot_projectand theset_projectdirective (_set_project) setslot._dirtywhen the project actually changes, as the workspace and agent switches already do.A same-value set still changes nothing and marks nothing.
Backwards compatibility
Compatible: the only effect is that a slot whose project changed is written by the next flush.
Removes nothing: the change only adds a save.
Tests
Proof: PROVEN test/test_cleared_project_survives_restart.py::test_an_idle_chats_cleared_project_stays_cleared_after_a_restart[http], test/test_cleared_project_survives_restart.py::test_an_idle_chats_cleared_project_stays_cleared_after_a_restart[directive], test/test_cleared_project_survives_restart.py::test_an_idle_chats_new_project_survives_a_restart[http], test/test_cleared_project_survives_restart.py::test_an_idle_chats_new_project_survives_a_restart[directive] (head 31b06a8)
test/test_cleared_project_survives_restart.py(new) restores a real open tab with a stored project, changes the project over HTTP or by directive, runs the periodic flush, then restores again from disk:All 4 fail on main and pass with the fix. They pass 10 times in a row and in reversed order. The #11722 suites (
test_cleared_project_drops_stored_cwd.py,test_cleared_project_not_resurrected.py) still pass.Manual verification
N/A — the tests drive the real restore, flush and both writers; only the session map is faked.
Related Issues
Closes #36772
Sibling sweep
Swept: git grep -nE "slot.project = " -- src/
Sibling: src/kiro_crew/dashboard/chat_api/session_relaunch.py:552 -- not affected -- the workspace switch already sets _dirty
Sibling: src/kiro_crew/dashboard/chat_api/agent_switch.py:965 -- not affected -- the agent switch already sets _dirty
Sibling: src/kiro_crew/dashboard/crewmate_worktree_scope.py:92 -- not affected -- sets _dirty beside the write
Sibling: src/kiro_crew/dashboard/handlers/members_thread.py -- not affected -- line 104 sets _dirty beside the write; line 347 stamps a newborn slot, persisted at birth
Sibling: src/kiro_crew/apps/builtins/spec_builder/backend/runtime.py:201 -- not affected -- re-derived from the spec on every worker start, never a user choice
Pattern harvest
Rule candidate: review-prompt
Pattern: a handler that mutates a persisted slot field without setting
_dirtyis lost on restart when no transcript row follows.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)