Skip to content

fix(session): don't start a chat in an earlier process's scratch dir - #31391

Merged
buluoray merged 1 commit into
mainfrom
crew/slack/fix-31319-slot-subagent-session
Nov 6, 2026
Merged

buluoray merged 1 commit into
mainfrom
crew/slack/fix-31319-slot-subagent-session

Conversation

@buluoray

@buluoray buluoray commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A dashboard chat whose folder was in an earlier run's temporary scratch folder starts and answers after a gateway restart, instead of failing every turn with KAS managed MCP initialization failed: ... spawn ... ENOENT.

After a restart, one chat fails on every turn and every background start. Every MCP server fails with spawn <path> ENOENT, even ones whose binary exists. Other chats on the same gateway work. Switching that chat's folder back to the normal workspace makes it work again, and the conversation is kept (#31319).

Why it matters

The chat is stuck until the user finds the folder switch by hand, and the error points at the interpreter path, so users chase an install problem that does not exist. Agents are told to put clones and worktrees in $KIROCREW_SCRATCH and to set_project into them, so any chat that did this breaks at the next restart.

Not a goal

  • Carrying a scratch folder across a restart (fix(scratch): resume a conversation into the scratch tree it had #30062 does that).
  • Changing what the sandbox hides.
  • Explaining how the chat's latest session in the session tree came to be a sub-agent session. The failure does not depend on it: the same session loads once the folder is changed.
  • Rewording the MCP start-up error itself.

What changed (motivation → approach → change)

  • Symptom: every MCP server in the chat's session fails with spawn ... ENOENT.
  • Cause: the chat's folder is inside an earlier process's scratch tree. A new process gets a fresh tree, and the sandbox masks the scratch root except that tree (on Linux an empty tmpfs), so the folder does not exist for it. Node's spawn with a missing cwd reports ENOENT naming the command. fix(session): don't resume in an earlier process's hidden scratch dir #30129 already skips such a folder when a resume reads it from the session map, but the dashboard passes the chat's folder as an explicit cwd, which bypassed that check (src/kiro_crew/session_allocation_parts/get_or_create.py, the effective_cwd block).
  • Change: the same check now also runs on an explicit cwd, but only for a caller that opts in with fallback_hidden_cwd=True: the dashboard chat's turn claim (src/kiro_crew/dashboard/chat_turn/turn_admission.py) and its eager start (src/kiro_crew/dashboard/chat_turn/eager_spawn.py), which show the notice. Any other caller, such as a sub-agent continuing in a recorded cwd, keeps its cwd, so its start fails loudly instead of running in another repository. When it fires, this start runs in the default folder and the provider carries a startup_notice. The chat's stored folder is never changed. Native Windows masks no scratch tree, so there the check keeps the cwd, with the same one-line predicate change as fix(session): keep a resumed scratch cwd on native windows #30910 (identical hunk, so either merge order is clean).
  • Notice: the dashboard shows it at most once per chat per gateway run, from an in-memory flag on the chat slot (src/kiro_crew/dashboard/state_parts/chat_slot.py, src/kiro_crew/dashboard/state_parts/slot_session.py, read in _surface_startup_notice in src/kiro_crew/dashboard/chat_turn/turn_spec_hooks.py). Other start notices are never held back. The text is translated: website/src/pages/chat/ErrorCard.tsx maps the hidden_scratch_cwd_skipped kind to pages.chat.errorCard.hidden_scratch_folder, in all 12 locales under website/src/i18n/locales/, as the two cloud-session notices are; the English wire text stays the channel fallback.
  • The turn describes the folder the session runs in, not the stored scratch folder (_fallback_turn_project, called from src/kiro_crew/dashboard/chat_turn/turn_admission.py after the claim); the session is released if that read is cancelled, as the reprojection just above it already does).
  • Spec: docs/system-specs/modules/session.md says the check covers both cwds, that the stored folder is never changed, and how the notice is limited.

builder-security checked: the change only picks a working folder for a child process inside the existing sandbox. It adds no listener, route, bind, auth change or exposure.

Backwards compatibility

Compatible: only a cwd inside the scratch root, outside the spawn's shared tree, with the sandbox on, is dropped for that start. Such a cwd already failed every MCP start.

Removes nothing: the chat's stored folder is never changed; the user can pick another folder at any time.

Tests

  • test/test_session_get_or_create.py::TestGetOrCreatePoolClaim::test_a_given_cwd_in_an_earlier_process_scratch_is_skipped_with_a_notice: an explicit cwd in an old scratch tree starts with no cwd and leaves the notice; an explicit cwd outside the scratch root, or inside the shared tree, is kept with no notice.
  • The same test also starts a caller that did not opt in with a scratch cwd: it keeps the cwd and gets no notice.
  • test/test_hidden_scratch_notice.py::test_the_notice_shows_once_per_chat_and_never_hides_another_notice: two starts of one chat show one notice, another chat shows its own, and a cloud notice after them still shows.
  • test/test_hidden_scratch_notice.py::test_the_turn_describes_the_folder_the_session_runs_in: a turn whose stored folder is old scratch describes the session's folder; any other folder, even a missing one, is kept.
  • test/test_hidden_scratch_notice.py::test_native_windows_keeps_a_chat_scratch_folder: on native Windows a chat's scratch folder is kept and the turn describes it.
  • test/test_hidden_scratch_notice.py::test_a_turn_cancelled_while_reading_its_folder_releases_the_session: a turn cancelled during the folder read hands the session back.
  • website/src/test/ErrorCard.test.tsx: the notice kind renders the catalog sentence, not the wire text.
  • The existing resume tests for the stored cwd still pass unchanged.

Proof: not provable -- other: prove.py reverts the notice constant with the hunks, so the test errors at import. Mutating by hand: disabling the cwd check fails 2 tests, dropping the notice call fails 1, disabling the once-per-run flag fails the notice test, and keeping the stored folder in the turn fails the turn-folder test. Dropping the native-Windows check fails the Windows test. Ignoring the opt-in fails the explicit-cwd test. Dropping the release on cancel fails the cancellation test.

Ran: test/test_hidden_scratch_notice.py, test/test_session_get_or_create.py, test/test_eager_spawn.py, test/test_kiro_cloud_sandbox_notice.py, test/test_chat_runner_composition_contract.py, test/test_chat_runner_turn_plumbing.py, test/test_no_config_dir_in_async.py (single process). black, flake8, isort and mypy clean on the touched files. Frontend: tsc -p tsconfig.app.json clean; vitest run src/test/ErrorCard.test.tsx src/i18n/ 1267 passed; i18n:check diff-scoped checks all PASS (its key-refs step could not run locally: the worktree's typescript package failed to resolve).

Manual verification

N/A — not reproduced against a live gateway restart; the unit test covers the cwd choice and the notice, and the sandbox mask that hides the old tree is existing behaviour.

Screenshots / video

Why no screenshot: the error card's layout is unchanged; for one notice kind it now shows the catalog sentence instead of the English wire text, which ErrorCard.test.tsx pins.

Related Issues

Closes #31319

Related: #30129 (same check for a resumed cwd), #30910 (same check on native Windows), #30062 (keep the scratch tree across a resume).

Sibling sweep

Swept: git grep -n "_stored_cwd_is_hidden_scratch|shared_scratch" -- src/kiro_crew/session_allocation_parts src/kiro_crew/subagent_manager
Sibling: src/kiro_crew/subagent_manager/run_turn.py -- not affected -- a sub-agent passes its parent's tree as shared_scratch, which the check keeps

Pattern harvest

Not generalizable: the session start is the one place that picks a child's cwd from caller or session-map state, and both now pass through the same check.

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 11:46
@buluoray
buluoray requested a review from Zedmor November 6, 2026 11:46
@buluoray
buluoray enabled auto-merge (squash) November 6, 2026 11:46
@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

UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

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

UX-Verdict: PASS

cannot evaluate: missing a screenshot of the new chat notice. The PR adds a message that appears in the chat after a restart, and no image shows it, so the blind read was not performed.

Evidence gaps

  • The hidden_scratch_cwd_skipped notice. After a restart, the chat now shows "This chat's folder was a temporary folder from an earlier run and can't be opened anymore. The chat now works in the default folder." It renders in ErrorCard through append_and_surface(... "error", ..., "msg msg-err"), so an informational message appears in error styling. Users have never seen this card state before. The "no-visual-delta" note says the layout is unchanged, but that doesn't cover a new message and a new state. The blind-read report says "BLIND READ NOT PERFORMED: the PR description carries no image attachment". To close the gap, attach a screenshot of a chat showing this card, in light and dark themes.

Notes

  • The translated sentence leaves out the folder path that the English wire text includes (This chat's folder {skipped_cwd} ...). Users can't tell which folder was dropped. Pass the path into pages.chat.errorCard.hidden_scratch_folder as {{folder}}.
  • The notice states the outcome but gives the user nothing to do. Put the existing folder picker in the card, e.g. a "Choose folder" button, so the user can switch to the folder they meant.

[UX-REVIEWED] f02f92d

Description read

[DESCRIPTION-READ] 93d971c2c6be6c433ad7b2f3e2ade4677b2ed22e6369f0023c9ad86fe223f3e9

That sha256 names everything this verdict read: the PR description, plus the 3 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

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of f02f92d9f6e02f09dc44c36030146d59c4f1da7f — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

The fix targets the mechanism (#31319, tests that fail on base). The only open point is a note: three of the added pieces exist only because the chat keeps its dead folder stored.

Notes

  • Items 3–4 — oversized: "The chat's stored folder is never changed", yet no harm is named for keeping a path that no later process can open (fix(scratch): resume a conversation into the scratch tree it had #30062 is unmerged and is listed under "Not a goal"). Keeping that path is what forces _hidden_scratch_notice_shown, _fallback_turn_project and the release-on-cancel try block in turn_admission.py. Subtraction: clear slot.project once when the fallback fires (the same switch the user makes by hand today), and delete those three.

What this change ships

Inventory (7 items) — 5 justified

Intent: after a gateway restart, a dashboard chat whose folder was an earlier run's scratch folder starts and answers instead of failing every turn. FIX.

  1. A chat whose folder was an earlier run's scratch folder now starts in the default folder — justified
  2. A notice row says the folder could not be reopened, in 12 locales — justified
  3. That notice shows at most once per chat per gateway run — oversized, exists only because the stored folder is kept
  4. The turn reports the folder the session actually runs in, not the stored one — oversized, same cause
  5. Opt-in fallback_hidden_cwd start flag; both dashboard callers pass it, other callers keep their cwd — justified
  6. Native Windows keeps a scratch cwd (both resumed and explicit) — justified
  7. Session spec updated to say both cwds are checked — justified

[FIRST-PRINCIPLES-REVIEWED] f02f92d

Description read

[DESCRIPTION-READ] 2408f44b547dd101e74eb4aaa571119aab8ca0a5fd6f218e4c57fbf8488d1612

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design-level concerns. The scratch-folder check that resume already runs now also covers the dashboard chat's explicit cwd. Only callers that opt in get the fallback, and the stored folder is never rewritten.

Notes

  • The stored folder is kept, so this chat falls back to the default folder on every restart until the user picks a new folder or fix(scratch): resume a conversation into the scratch tree it had #30062 lands. The notice shows once per gateway run, but the agent may still run commands that assume it is in its old clone. Say in the notice text that the agent's context may still refer to the old folder.

[DESIGN-REVIEWED] f02f92d

Description read

[DESCRIPTION-READ] d4d6c4672deaf0ac144b7b6db7991cb54bc989f85ecb2b425dc4d31cb7d09ee9

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

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] f02f92d

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

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] f02f92d

Verdict parsed from the review's SHA-scoped output markers for commit f02f92d9f6e02f09dc44c36030146d59c4f1da7f.

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

@buluoray
buluoray force-pushed the crew/slack/fix-31319-slot-subagent-session branch from 9765db0 to d1c2c67 Compare November 6, 2026 11:57
@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-31319-slot-subagent-session branch from d1c2c67 to b1d350b Compare November 6, 2026 12:37
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 6, 2026
@buluoray
buluoray force-pushed the crew/slack/fix-31319-slot-subagent-session branch from b1d350b to 0cea3c4 Compare November 6, 2026 12:58
@buluoray

buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

span=26cc9b6e03a3

  • fixed: folder adoption invalidates the recovered eager session (0cea3c4)

Legitimate. adopt_start_folder wrote slot.project before the bindings guard compared _slot_binding(slot) with _bound, so the guard always removed the eager session.
The call now runs after the guard and passes _bound[2], the folder the start asked for.
Test: test_eager_spawn.py::test_a_scratch_folder_fallback_keeps_the_eager_session; moving the call back before the guard turns it red.

@buluoray

buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

span=d5d66fca2778

  • fixed: folder adoption overwrites a concurrent project selection (0cea3c4)

Legitimate. The write was unconditional after the dispatch lock was released.
adopt_start_folder now takes the folder the start was asked for (selected_binding[1] on the turn path, _bound[2] on the eager path) and writes only while slot.project still equals it.
Test: test_session_get_or_create.py::test_a_folder_picked_while_the_start_ran_is_never_replaced; dropping the check turns it red.

@buluoray

buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

span=2df48fba51e4

  • fixed: eager-start adoption runs before the bindings guard (0cea3c4)

Legitimate. Same root cause as the GPT finding: the early slot.project write made the guard remove the session it had just started, and could replace a folder picked during the handshake.
The call now runs after the guard and writes only while the chat's folder is still the one the start asked for.
Tests: test_eager_spawn.py::test_a_scratch_folder_fallback_keeps_the_eager_session and test_session_get_or_create.py::test_a_folder_picked_while_the_start_ran_is_never_replaced; each turns red when its half of the fix is reverted.

@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-31319-slot-subagent-session branch from 0cea3c4 to ae3996f Compare November 6, 2026 13:25
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 6, 2026
@buluoray

buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

span=4803882cd425

  • fixed: concurrent folder selection leaves the running turn scoped to skipped scratch

Outcome: fixed in ae3996f
Legitimate. When a folder picked mid-start blocked the save, adopt_start_folder returned "", so _turn_project kept the skipped scratch path.
It now returns the fallback folder whenever the start fell back, saving it only while the chat's folder is still the one requested, so the turn describes the folder the session runs in.
Test: test_session_get_or_create.py::test_a_folder_picked_while_the_start_ran_is_never_replaced asserts the return value; returning "" again turns it red.
self-added: yes
mechanism: adopt_start_folder return value names the session's folder, separate from whether it was saved

@buluoray

buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

span=2a19189fa717

  • fixed: the hidden-scratch notice shows in English in every locale

Outcome: fixed in ae3996f
Legitimate. ErrorCard.tsx only mapped the two cloud-session notice kinds to catalog keys.
hidden_scratch_cwd_skipped now maps to pages.chat.errorCard.hidden_scratch_folder, translated in all 12 locales; the English wire text stays the channel fallback.
Test: website/src/test/ErrorCard.test.tsx renders the kind and asserts the catalog sentence replaces the wire text; vitest src/i18n/ passes.
self-added: yes

@buluoray
buluoray force-pushed the crew/slack/fix-31319-slot-subagent-session branch from ae3996f to 427783c Compare November 6, 2026 13:46
@buluoray

buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

resolution: removed -- the folder-saving step (adopt_start_folder) is gone, on the maintainer's call after a read-only retrospective

Head 427783c drops the step that rewrote the chat's stored folder, which every blocking finding on b1d350b and 0cea3c4 sat in (GPT 26cc9b6e03a3, d5d66fca2778, 4803882cd425; Opus 2df48fba51e4). The chat's stored folder is now never changed:

  • Each start whose folder is an earlier run's hidden scratch folder runs in the default folder (unchanged from the first head).
  • The translated notice (Opus 2a19189fa717 fix kept) shows at most once per chat per gateway run, from an in-memory flag on the slot. No file is written.
  • The turn describes the folder the session runs in, on every turn of such a chat, not only after a race.

With nothing writing slot.project, the eager bindings guard and the "folder picked mid-start" handling have nothing left to protect, so both are removed with it.

@buluoray
buluoray force-pushed the crew/slack/fix-31319-slot-subagent-session branch from 427783c to 4d3e5fb Compare November 6, 2026 14:01
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 6, 2026
@buluoray
buluoray force-pushed the crew/slack/fix-31319-slot-subagent-session branch from 9e4bb06 to 161e9e6 Compare November 6, 2026 15:02
@buluoray

buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

span=2a19189fa717

  • fixed: the explicit-cwd fallback applied to every caller, not just dashboard chats

Outcome: fixed in 161e9e6
Legitimate. A sub-agent continuing in a recorded scratch cwd would have run silently in the default project, the wrong-repository write continuation.recorded_cwd_impl refuses to risk.
The explicit-cwd fallback is now opt-in: fallback_hidden_cwd=True, passed only by the dashboard chat's turn claim and eager start, which show the notice. Every other caller keeps its cwd and fails loudly as before; the resumed stored-cwd fallback is unchanged.
Test: test_session_get_or_create.py::test_a_given_cwd_in_an_earlier_process_scratch_is_skipped_with_a_notice now also starts a non-opted-in caller and asserts it keeps its cwd; ignoring the opt-in turns it red.
self-added: yes

@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-31319-slot-subagent-session branch from 161e9e6 to 83c9c34 Compare November 6, 2026 15:24
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 6, 2026
@buluoray

buluoray commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

span=0bbdc6f6edee

  • fixed: a new await between the claim and _acquired = True could leak the session lease

Outcome: fixed in 83c9c34
Legitimate. A Stop or disconnect cancelling the turn during the folder read left the claimed session with no owner, since _turn_release_session releases only when _acquired is set.
The read is now wrapped like the reprojection above it: except BaseException: state.sessions.release(session_key); raise. No other await sits in that window.
Test: test/test_hidden_scratch_notice.py::test_a_turn_cancelled_while_reading_its_folder_releases_the_session cancels the read and asserts the release; dropping the release turns it red.
self-added: yes

A chat whose project was set to a folder in its $KIROCREW_SCRATCH
breaks after a gateway restart. The new process gets a fresh scratch
tree and the sandbox hides the old one (on Linux an empty tmpfs over
the scratch root), so the chat's folder does not exist for it. Every
MCP server the session starts there fails with "spawn ... ENOENT",
even for binaries that exist, and every retry hits the same wall.

The resume path already skipped such a folder when it came from the
session map. The dashboard passes the chat's project as an explicit
cwd, which skipped that check. Run the same check on an explicit cwd
too and start in the default folder instead. The chat's stored folder
is never changed. A translated startup notice says the folder was not
reopened, at most once per chat per gateway run (in memory), and the
turn describes the folder the session actually runs in.
@buluoray
buluoray force-pushed the crew/slack/fix-31319-slot-subagent-session branch from 83c9c34 to f02f92d Compare November 6, 2026 16:05
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels 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 f02f92d. I read the product hunks in get_or_create.py, turn_admission.py, turn_spec_hooks.py, eager_spawn.py, the chat slot files and ErrorCard.tsx.

  • A dashboard chat whose stored project is an earlier process's hidden scratch folder now starts in the default folder instead of in a folder the sandbox hides, where every MCP server would fail to spawn. Only callers that opt in (fallback_hidden_cwd=True, the chat turn and its prefetch) fall back; any other caller keeps its explicit cwd, so it still fails loudly rather than running somewhere else.
  • The chat says so once per chat per gateway run (HIDDEN_SCRATCH_CWD_NOTICE, shown through the existing error card), and a notice the start already left is not overwritten. The new string is in every locale.
  • The turn's project follows the folder the session really runs in, and the session hold is released if that await is cancelled.
  • Native Windows applies no scratch mask, so the cwd is kept there as before.

This turns a broken start into a working one with a notice; it adds no refusal. 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.

@buluoray
buluoray merged commit 4023e84 into main Nov 6, 2026
151 of 164 checks passed
@buluoray
buluoray deleted the crew/slack/fix-31319-slot-subagent-session branch November 6, 2026 18:10
buluoray added a commit that referenced this pull request Nov 6, 2026
#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.
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 6, 2026
buluoray added a commit that referenced this pull request Nov 6, 2026
Partial backport of #31391 (main 4023e84) to the 0.12 line.

Carried:
- get_or_create.py: native Windows keeps a scratch cwd, because no
  scratch-root mask applies there (a Kiro spawn is delegated to Kiro's
  own sandbox). This is the Windows branch the GPT review asked for.
- get_or_create.py: a caller that opts in (fallback_hidden_cwd) and
  names an earlier process's hidden scratch tree as its own cwd starts
  in the default directory instead.
- turn_admission.py and eager_spawn.py: the dashboard chat opts in
  with fallback_hidden_cwd=True.
- test_session_get_or_create.py: #31391's tests, without the notice
  assertions, plus a Windows test adapted from main's
  test_hidden_scratch_notice.py.

Left out: the chat start notice (_note_skipped_hidden_cwd and
HIDDEN_SCRATCH_CWD_NOTICE), _fallback_turn_project in
turn_spec_hooks.py, the ErrorCard and i18n strings, and
test_hidden_scratch_notice.py. The notice surface (startup_notice)
comes from #25347, which is not on 0.12.

The fallback is kept on 0.12 for #31319: without it every MCP server
in that chat fails with ENOENT and the chat is dead, and the hidden
folder is unreachable from the process anyway. With no chat notice
on 0.12, the existing WARNING log line names the hidden folder and
says the session starts in the default directory.

(cherry picked from commit 4023e84, partial)
buluoray added a commit that referenced this pull request Nov 6, 2026
#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 added a commit that referenced this pull request Nov 6, 2026
#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 added a commit that referenced this pull request Nov 6, 2026
Partial backport of #31391 (main 4023e84) to the 0.12 line.

Carried:
- get_or_create.py: native Windows keeps a scratch cwd, because no
  scratch-root mask applies there (a Kiro spawn is delegated to Kiro's
  own sandbox). This is the Windows branch the GPT review asked for.
- get_or_create.py: a caller that opts in (fallback_hidden_cwd) and
  names an earlier process's hidden scratch tree as its own cwd starts
  in the default directory instead.
- turn_admission.py and eager_spawn.py: the dashboard chat opts in
  with fallback_hidden_cwd=True.
- test_session_get_or_create.py: #31391's tests, without the notice
  assertions, plus a Windows test adapted from main's
  test_hidden_scratch_notice.py.

Left out: the chat start notice (_note_skipped_hidden_cwd and
HIDDEN_SCRATCH_CWD_NOTICE), _fallback_turn_project in
turn_spec_hooks.py, the ErrorCard and i18n strings, and
test_hidden_scratch_notice.py. The notice surface (startup_notice)
comes from #25347, which is not on 0.12.

The fallback is kept on 0.12 for #31319: without it every MCP server
in that chat fails with ENOENT and the chat is dead, and the hidden
folder is unreachable from the process anyway. With no chat notice
on 0.12, the existing WARNING log line names the hidden folder and
says the session starts in the default directory.

(cherry picked from commit 4023e84, partial)
buluoray added a commit that referenced this pull request Nov 7, 2026
…ws (#30910)

#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard chat permanently fails after gateway restart: slot resumes a subagent KAS session, all MCP spawns fail with ENOENT

2 participants