Repository navigation
fix(session): don't resume in an earlier process's hidden scratch dir - #30129
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: skipping a stored cwd the new process cannot read fixes the start-up crash, and a revert undoes it cleanly. Notes
[DESIGN-REVIEWED] 81ceb6d Description read[DESCRIPTION-READ] 286e9587bdc12d1ca269be43d76b2a850792cc62b088ff2d4e2a5f30daa45882 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 Nothing blocks. The resume-cwd skip fixes the mechanism at the only resume path that starts a sandboxed child in a recorded directory. If its premise is wrong, the session starts in its default directory and still runs. What this change shipsInventory (5 items) — 3 justifiedIntent: let an older chat that last worked in an earlier process's scratch tree resume and answer, instead of failing at start-up with
[FIRST-PRINCIPLES-REVIEWED] 81ceb6d Description read[DESCRIPTION-READ] 98d801c9a156f1a392b051f12e4d997024a7ad62053f497de2d4d565f5b4f416 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 — ✅ human override acceptedHuman judgment by @buluoray overrides the GPT 6.1 finding for [GPT-OVERRIDE] 81ceb6d This comment is updated in place on each push. The model was not re-run because an authorized human decision supersedes it. False positive or not applicable? A repository writer can comment: |
35d414c to
dc0e0d3
Compare
|
Disposition for head Opus 5.5 / GPT 6.1 F1 ( Backend Tests (3.12, 7) / (Windows) (7): the three |
A conversation that worked in its $KIROCREW_SCRATCH records that tree as its cwd. Its next process gets a fresh scratch tree and the sandbox hides the old one, but the gateway still starts the child there, so kiro-cli cannot read its own working directory and exits at start-up (EPERM, uv_cwd on macOS), shown as process exited (rc=None). Skip a stored cwd inside the scratch root unless it lies in the tree the spawn shares, and log the skipped directory.
dc0e0d3 to
81ceb6d
Compare
|
Disposition for head Opus 5.5: no blocking findings. GPT 6.1 F1 (
An override for this lane needs a maintainer decision. |
|
Owner decision on GPT 6.1 F1 (get_or_create.py:105, delegated sandbox): accepted as is. A resume on a delegated spawn (Windows Kiro, or macOS with the Kiro internal sandbox on) whose recorded cwd is another process scratch tree starts in the default directory with a warning. This only happens within the hour before the sweep removes that tree, and it fails safe. Copying the wrap_argv delegation decision into session allocation is not worth it. Rebuttal: #30129 (comment) |
|
/ai-review override gpt 81ceb6d owner-decision: Delegated-sandbox resume of another process scratch cwd only falls back to the default dir with a warning, inside the hour before the sweep removes that tree; fails safe, no data or privilege impact. Decision: #30129 (comment) |
Human judgment recorded@buluoray recorded a owner-decision release (class
This decision applies only to this commit. A new push requires a new judgment. |
Cherry-picked with -x from main onto release/0.12.0 for 0.12.1, in main merge order. Every pick applied clean. - #29990 fix(approvals): resolve an approval by id only in the session it was shown in (cherry picked from commit 4d2b8a5) - #30129 fix(session): don't resume in an earlier process's hidden scratch dir (cherry picked from commit 599e33e) - #30205 fix(acp): let Crew's MCP servers defer on the KAS engine bundle (cherry picked from commit 3d4e4a6) - #30279 fix: keep one more credential value out of log output (cherry picked from commit 9fcf80f) - #30195 fix(acp): answer KAS user-input questions instead of letting Deny read as yes (cherry picked from commit bbf4e6d) - #30199 fix: redact four log lines and tighten two small checks (cherry picked from commit 16ff876) Co-authored-by: Bolin Chen <17506219+bolichen97@users.noreply.github.com> Co-authored-by: Joe Guo <12429733+iamwhatever@users.noreply.github.com>
Cherry-picked with -x from main onto release/0.12.0 for 0.12.1, in main merge order. Every pick applied clean. - #29990 fix(approvals): resolve an approval by id only in the session it was shown in (cherry picked from commit 4d2b8a5) - #30129 fix(session): don't resume in an earlier process's hidden scratch dir (cherry picked from commit 599e33e) - #30205 fix(acp): let Crew's MCP servers defer on the KAS engine bundle (cherry picked from commit 3d4e4a6) - #30279 fix: keep one more credential value out of log output (cherry picked from commit 9fcf80f) - #30195 fix(acp): answer KAS user-input questions instead of letting Deny read as yes (cherry picked from commit bbf4e6d) - #30199 fix: redact four log lines and tighten two small checks (cherry picked from commit 16ff876) Co-authored-by: Bolin Chen <17506219+bolichen97@users.noreply.github.com> Co-authored-by: Joe Guo <12429733+iamwhatever@users.noreply.github.com>
Problem / Motivation
Goal: An older chat whose recorded working directory was an earlier process's scratch tree resumes and answers, instead of dying at start-up with
process exited (rc=None).On macOS some older chat sessions fail every turn with
process exited (rc=None)while new sessions work. The kiro-cli start-up log showsEPERM: operation not permitted, uv_cwd: the child cannot read its own working directory.Why it matters
The chat is unusable and the card gives no hint why. Agents are told to put clones and worktrees in
$KIROCREW_SCRATCH, andset_projectinto such a worktree is common, so any conversation that did this breaks once its process ends (gateway restart, idle reap, crash).Not a goal
process exitedcard text or which stderr lines it shows.What changed (motivation → approach → change)
EPERM ... uv_cwd; the card saysprocess exited (rc=None).get_or_createuses the cwd the session map recorded if it is still a directory (src/kiro_crew/session_allocation_parts/get_or_create.py, thestored_cwdblock). The check runs in the gateway, which can see every scratch tree. The new process gets a fresh scratch tree, and the sandbox masks the scratch root except that tree (sandbox_leaves.pyscratchleaf; Seatbeltdeny file-read*over the mask with only the private window,sandbox_seatbelt.py). The child is still created in the old tree (acp/launch.pyprocess_directory→host._spawn_work_dir), so itsgetcwd()is denied._stored_cwd_is_hidden_scratchskips a stored cwd that resolves insideagent_scratch.scratch_root()unless it lies in theshared_scratchtree this spawn is handed (that one is re-exposed). The session then starts in its default directory, and a warning names the skipped directory. A stored cwd outside the scratch root is kept exactly as before.shared_scratchfromrecorded_treeafter this check runs. Once both land, that lookup should move before this check (or this check should read the recorded tree) so a resumed cwd inside the recorded tree is kept.Backwards compatibility
Compatible: only a stored cwd under the scratch root, outside the spawn's shared tree, is skipped, and such a cwd already failed to start under the sandbox.
Removes nothing: the stored cwd stays in the session map; only this spawn does not start in it.
Tests
test/test_session_get_or_create.py::TestGetOrCreatePoolClaim::test_resume_skips_a_stored_cwd_in_an_earlier_process_scratch: a resume whose stored cwd is in an old scratch tree starts with no cwd; a stored cwd outside the scratch root is still used; a stored cwd inside theshared_scratchtree is still used.Proof: PROVEN test/test_session_get_or_create.py::TestGetOrCreatePoolClaim::test_resume_skips_a_stored_cwd_in_an_earlier_process_scratch (head 81ceb6d)
Ran:
test/test_session_get_or_create.py,test/test_session_map_cwd.py,test/test_subagent_shared_scratch.py(124 passed, single process).Manual verification
N/A — not reproduced on a macOS host; the unit test covers the cwd choice, and the sandbox mask that denies the old tree is existing behaviour.
Related Issues
Related: #26229, #28595 (EPERM from a masked path at MCP start-up), #30062 (resume keeps its scratch tree).
Sibling sweep
Swept: git grep -n "get_cwd(" -- src/
Sibling: src/kiro_crew/teams/renderer.py:140 -- not affected -- reads the cwd to render a path, spawns nothing
Pattern harvest
Not generalizable: the only resume path that starts a sandboxed child in a recorded directory is this one.
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.