Skip to content

fix(session): keep a resumed scratch cwd on native windows - #30910

Merged
buluoray merged 1 commit into
mainfrom
crew/slack/fix-windows-delegated-scratch-cwd
Nov 7, 2026
Merged

buluoray merged 1 commit into
mainfrom
crew/slack/fix-windows-delegated-scratch-cwd

Conversation

@buluoray

@buluoray buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

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 off as 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_SCRATCH lose their place on every resume: the agent's next commands run in the wrong directory.

Not a goal

  • Changing the macOS or Linux behaviour of the check.
  • Changing which spawns Windows delegates or how the sandbox masks anything.

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: with IS_WINDOWS set and sandbox mode auto, 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.py 59 passed; test_flake_pattern_ratchet.py 66 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.py already answer the masking question elsewhere.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 6, 2026 00:15
@buluoray
buluoray requested a review from iamwhatever November 6, 2026 00:15
@buluoray
buluoray enabled auto-merge (squash) November 6, 2026 00:16
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 5ec4acf8eb12a894ff06b2bd11f37ca034fe51c6 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the diff only adds a test, and it pins the Windows early return that main already has.

Notes

  • The description says it changes code (_stored_cwd_is_hidden_scratch "now returns False on native Windows", and the spec update). That code is already on the base at get_or_create.py:99 and session.md:865, so this PR adds no fix. The fix(session): title should be test(session):, matching the commit. Otherwise the PR looks like it carries a behaviour change it doesn't contain.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 5ec4acf8eb12a894ff06b2bd11f37ca034fe51c6 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 5ec4acf8eb12a894ff06b2bd11f37ca034fe51c6 — this comment is updated in place on each push.

Review details

Test-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 5ec4acf8eb12a894ff06b2bd11f37ca034fe51c6.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5ec4acf8eb12a894ff06b2bd11f37ca034fe51c6 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision 5ec4acf8eb12a894ff06b2bd11f37ca034fe51c6 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Does not block merge.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 5ec4acf8eb12a894ff06b2bd11f37ca034fe51c6 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5ec4acf

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5ec4acf8eb12a894ff06b2bd11f37ca034fe51c6 false-positive: <reason, 20 to 500 characters>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 6, 2026
@buluoray
buluoray force-pushed the crew/slack/fix-windows-delegated-scratch-cwd branch from 005435b to d67d81f Compare November 6, 2026 14:13
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 6, 2026
@buluoray
buluoray force-pushed the crew/slack/fix-windows-delegated-scratch-cwd branch from d67d81f to a1534df Compare November 6, 2026 15:51
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 6, 2026
bolichen97
bolichen97 previously approved these changes Nov 6, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving a1534df. I read the whole diff.

  • session_allocation_parts/get_or_create.py: _stored_cwd_is_hidden_scratch now returns False on 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 = False so it keeps covering the POSIX path. The spec in session.md matches.

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.

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 6, 2026
@buluoray
buluoray force-pushed the crew/slack/fix-windows-delegated-scratch-cwd branch from a1534df to f0da6ed Compare November 6, 2026 18:16
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 6, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 6, 2026
@buluoray
buluoray force-pushed the crew/slack/fix-windows-delegated-scratch-cwd branch from f0da6ed to 55bb071 Compare November 6, 2026 20:09
#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.
@buluoray
buluoray force-pushed the crew/slack/fix-windows-delegated-scratch-cwd branch from 55bb071 to 5ec4acf Compare November 6, 2026 21:48
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 6, 2026
@buluoray
buluoray merged commit c4fd384 into main Nov 7, 2026
197 of 214 checks passed
@buluoray
buluoray deleted the crew/slack/fix-windows-delegated-scratch-cwd branch November 7, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants