Repository navigation
fix(session): keep a resumed scratch cwd on native windows - #30910
Conversation
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the diff only adds a test, and it pins the Windows early return that Notes
[DESIGN-REVIEWED] 5ec4acf Description read[DESCRIPTION-READ] 1054d4bd157ad5db972c692dd87426d6fc2d38edef09f70f97effb192b5f1ee5 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 |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsTest-only change; no candidates. Missing-tests/test quality isn't a finding category here. No findings. [OPUS-REVIEWED] 5ec4acf Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
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: |
005435b to
d67d81f
Compare
d67d81f to
a1534df
Compare
bolichen97
left a comment
There was a problem hiding this comment.
Approving a1534df. I read the whole diff.
session_allocation_parts/get_or_create.py:_stored_cwd_is_hidden_scratchnow returnsFalseon native Windows, after the scratch-root check. A Kiro spawn there is delegated to Kiro's own sandbox and Crew applies no scratch-root mask, so a resumed scratch cwd is kept instead of being dropped for the default folder.- The new test pins the Windows case, and the existing resume test pins
IS_WINDOWS = Falseso it keeps covering the POSIX path. The spec insession.mdmatches.
Note: #31391 carries the same Windows check, so whichever lands second may need a small rebase.
Keeps a working directory rather than refusing one, and no new regex. All checks pass on this head (97 ok, 0 red, 0 pending), and no human has an open change request. Auto-merge was already enabled by the author, so I left it as is.
a1534df to
f0da6ed
Compare
f0da6ed to
55bb071
Compare
#31391 brought the native-Windows rule into _stored_cwd_is_hidden_scratch (Windows masks no scratch tree, so a resumed chat keeps its stored scratch cwd) but no test pins the Windows branch. Add one: with IS_WINDOWS set and sandbox mode auto, a resume keeps the stored scratch cwd. Removing the branch fails it.
55bb071 to
5ec4acf
Compare
Problem / Motivation
Goal: On native Windows, a resumed chat whose saved working directory is in its scratch tree starts there again, instead of in the default workspace.
#30129 drops a resumed session's stored cwd when it lies inside an earlier process's scratch tree, because the sandbox hides those trees. It treats every sandbox mode except
offas hiding them. Native Windows hides none: a Kiro spawn is delegated to Kiro's own sandbox (sandbox_wrap.wrap_argv), and Crew has no Windows sandbox backend. So the old tree stays readable, and the resume still moves the chat to the default workspace. Relative file and git operations then run against a different directory.Found by the GPT review lane on the release backport #30809.
Why it matters
Windows users who work in
$KIROCREW_SCRATCHlose their place on every resume: the agent's next commands run in the wrong directory.Not a goal
What changed (motivation → approach → change)
_stored_cwd_is_hidden_scratch(session_allocation_parts/get_or_create.py) now returns False on native Windows (platform_compat.IS_WINDOWS), the same way it already does when the sandbox is off. The session spec says so.Backwards compatibility
Compatible: only native Windows changes, and only back to keeping the stored cwd, which is main's behaviour before #30129.
Removes nothing: the check keeps dropping hidden scratch cwds on macOS and Linux.
Tests
test_resume_keeps_a_stored_scratch_cwd_on_windows: withIS_WINDOWSset and sandbox modeauto, a resume keeps the stored scratch cwd.Proof: not provable -- other: prove.py was not run; removing the two new lines makes the new test fail (checked by hand)
Local, one process, no xdist:
test/test_session_get_or_create.py59 passed;test_flake_pattern_ratchet.py66 passed. The commit also cherry-picks cleanly onto #30809's head (36477d5), where the same file passes 59/59.Manual verification
Not done on a Windows host; the branch is a single platform check covered by the unit test.
Related Issues
Part of #15979
Follow-up to #30129; needed by the release backport #30809.
Sibling sweep
Swept: git grep -n "_clamp_sandbox_mode(configured_sandbox_mode())" -- src/kiro_crew/session_allocation_parts/
Siblings: none -- the stored-cwd check is the only reader of the sandbox mode in session allocation
Pattern harvest
Not generalizable: a single place read "sandbox mode not off" as "scratch is masked"; the delegation predicates in
sandbox_spawn.pyalready answer the masking question elsewhere.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)