You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
session-flow: keep away.py state in a location the Bash sandbox can write #17388
With the Bash sandbox on, the state directory away.py uses under the plugin data dir is read-only inside the sandbox, so every away.py write runs outside the sandbox. In a permission mode where that prompts, refresh during an absence is refused and the report goes stale. The hooks keep working, so the failure is quiet.
A state location the sandbox can write would remove this.
This is design-bearing: it changes where the hooks read their state.
Done looks like
away.py keeps its state in a location writable inside the Bash sandbox (or has a documented fallback), chosen with the hooks' read path in mind.
The hooks read state from the same location.
With the sandbox on, start and refresh run without leaving the sandbox, shown by a live run.
Existing tests pass; the state location is covered by a test.
Size: Medium
Complexity: Medium
Uncertainty: Knowable
Flags: none
Blocked by: none
Blast radius: plugins/session-flow (away.py, the Stop hook, the refresh prompt and rules.md) and anyone who runs the step-away flow with the Bash sandbox on.
Reversible: yes; revert the change. State location and read path stay as they are.
Open questions: none
The decision below settles the open questions. It picks option (a): the hooks do the writes during the absence, the refresh prompt is dropped, and the watched-folder scan moves to end. The state location is unchanged. It also accepts that start, end and deliver still run outside the sandbox, but only while the person is present. The earlier refinement questions about a .work/away location and a hooks fallback no longer apply. The per-Stop transcript scan cost is to be measured in the PR.
Decision recorded.
Question (Q229, hub morning report 2026-11-19): where should away.py state live so it works with the Bash sandbox on? Options: (a) the hooks do the writes during the absence (Stop hook regenerates the refused and external-action blocks, the refresh prompt is dropped, the watched-folder scan moves to end), state location and security surface unchanged; (b) state under the git-ignored <launch checkout>/.work/away/<session>/ (trust-boundary change); (c) a documented sandbox.filesystem.allowWrite entry for the data directory (loosens a sandbox control). Recommendation: (a).
Owner answer (2026-11-19, 9:5x AM EST, in the hub session): "go w/ recomendations"
Decision: (a). The owner accepts the changed criterion: start, end and deliver still run outside the sandbox, but only while the person is present (under Q228 (a), start is always attended). The per-Stop transcript scan cost is to be measured in the PR.
Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed - [ ] criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).
Recommended approach (draft for the owner's decision)
Facts: a sandboxed command can write only to the working directory, the per-user temp directory and added directories, and hooks run outside the sandbox (sandboxing, Filesystem isolation). State lives in <plugin data>/away/<session>/ (away.py:225). refresh fails because it appends refused.jsonl and takes the lock there (away.py:862-869).
A. Hooks do the writes during the absence (recommended). The Stop hook regenerates the refused and external-action blocks, and the prompt to run refresh is dropped (away.py:1086, rules.md:81).
The watched-folder scan moves to end, because its 60 s budget (away.py:73) equals the Stop hook's timeout (hooks/hooks.json).
The state location and the hooks' read path stay as they are. The security surface does not change.
Cost: a transcript scan on every Stop, which needs measuring.
B. State under <launch checkout>/.work/away/<session>/ when ignored. This is the same rule choose_report_path uses (away.py:468-475). Hooks would locate it through CLAUDE_PROJECT_DIR, which is exported to hooks (plugins-reference), and fall back to the data directory.
It meets every criterion. But state.json becomes writable by any sandboxed command with no prompt, so a command could switch the refusals off.
It could also redirect report_path, which an unsandboxed end writes (away.py:946-948). Every path read from state must be confined.
Trust-boundary change: owner decides.
C. Document a sandbox.filesystem.allowWrite entry for the data directory. No code changes. It loosens a sandbox control in user settings, with B's tamper exposure. Owner decides.
Rejected: $TMPDIR. Sandboxed and unsandboxed commands resolve it to different directories (Temporary directories).
melodic-automation-lanes commented on Nov 19, 2026
Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.
Intended outcome: away.py keeps its per-session state in a sandbox-writable location (most likely the project's .work/away), the hooks read it from there with the old plugin-data path as fallback, and a test covers the location.
Which sandbox-writable location should hold away state: the project working directory (e.g. .work/away/<session>, beside the report that choose_report_path already puts there) or a per-user TMPDIR path?
RECOMMENDED: Project .work/away/<session>. The working directory is writable by default in the sandbox, while TMPDIR is per-user and may differ between a sandboxed command and a hook. Basis: https://code.claude.com/docs/en/sandboxing; plugins/session-flow/scripts/away.py:468
How should the hooks find state in the new location, and should the old plugin-data path stay as a read fallback?
RECOMMENDED: Hooks look under the hook payload's cwd first, then fall back to the old data root in hook_state, so already-running absences stay readable. The old path is the documented fallback when the new one is not writable. Basis: plugins/session-flow/scripts/away.py:1127
Should this wait for #17383 (shared plugin_paths.py move), or land first with the new root helper added in plugin_paths.py?
RECOMMENDED: Add the helper in plugin_paths.py and land independently, noting the overlap with #17383 for merge order. Basis: judgment
The done-when asks for a live sandboxed run of start and refresh. An unattended run cannot do that; should it be a person-run check, with the test covering the location?
RECOMMENDED: Yes. Make the live run a manual check by a person, and have the automated criterion be a test that start and refresh write only under the chosen location. Basis: judgment
Sources read
plugins/session-flow/scripts/away.py:4: state lives in <plugin data>/away/<session>/ as state.json, refused.jsonl and lock
https://code.claude.com/docs/en/sandboxing: sandboxed Bash writes the working directory, added directories and TMPDIR; ~/.claude is not writable by default
To answer, post a comment that starts with this line:
**Decision recorded.** <answer>
Automated refinement by the lanes App. Answer with a comment whose first line is **Decision recorded.**.
Question (Q229, hub morning report 2026-11-19): where should away.py state live so it works with the Bash sandbox on? Options: (a) the hooks do the writes during the absence (Stop hook regenerates the refused and external-action blocks, the refresh prompt is dropped, the watched-folder scan moves to end), state location and security surface unchanged; (b) state under the git-ignored <launch checkout>/.work/away/<session>/ (trust-boundary change); (c) a documented sandbox.filesystem.allowWrite entry for the data directory (loosens a sandbox control). Recommendation: (a).
Owner answer (2026-11-19, 9:5x AM EST, in the hub session): "go w/ recomendations"
Decision: (a). The owner accepts the changed criterion: start, end and deliver still run outside the sandbox, but only while the person is present (under Q228 (a), start is always attended). The per-Stop transcript scan cost is to be measured in the PR.
Delivered by #17436 (merged as a54dfa1), option A, which the owner chose: the Stop hook writes the report's refused-actions and external-actions blocks itself, outside the sandbox, so no refresh runs during an absence.
Remaining done-when items, settled by that choice rather than built:
State in a sandbox-writable location (or a documented fallback): the state stays under the plugin data directory; only hooks and attended commands (start, end, deliver) write it.
Hooks read state from the same location: unchanged, since the location did not move.
start and refresh run inside the sandbox, shown live: refresh is no longer needed while away; start, end and deliver run attended, outside the sandbox.
State location covered by a test: not applicable while the location is unchanged.
Activity
github-actions commentedon Nov 19, 2026
Size: Medium
Complexity: Medium
Uncertainty: Knowable
Flags: none
Blocked by: none
Blast radius:
plugins/session-flow(away.py, the Stop hook, therefreshprompt and rules.md) and anyone who runs the step-away flow with the Bash sandbox on.Reversible: yes; revert the change. State location and read path stay as they are.
Open questions: none
The decision below settles the open questions. It picks option (a): the hooks do the writes during the absence, the
refreshprompt is dropped, and the watched-folder scan moves toend. The state location is unchanged. It also accepts thatstart,endanddeliverstill run outside the sandbox, but only while the person is present. The earlier refinement questions about a.work/awaylocation and a hooks fallback no longer apply. The per-Stop transcript scan cost is to be measured in the PR.Decision comment: #17388 (comment)
Automated triage. A maintainer reviews it.
melodic-automation-lanes commentedon Nov 19, 2026
Not admitted to the issue lane: no trusted-human acceptance criteria: a listed human must put the confirmed
- [ ]criteria in the body or post them as their own comment, or, on an issue a listed human filed, intake's newest refinement comment must hold them unedited. Admission takes the issue once each of those is met, when intake triages it again (.github/actions/resolve-config/admission-rules.json).kyle-sexton commentedon Nov 19, 2026
Recommended approach (draft for the owner's decision)
Facts: a sandboxed command can write only to the working directory, the per-user temp directory and added directories, and hooks run outside the sandbox (sandboxing, Filesystem isolation). State lives in
<plugin data>/away/<session>/(away.py:225).refreshfails because it appendsrefused.jsonland takes the lock there (away.py:862-869).A. Hooks do the writes during the absence (recommended). The Stop hook regenerates the refused and external-action blocks, and the prompt to run
refreshis dropped (away.py:1086, rules.md:81).end, because its 60 s budget (away.py:73) equals the Stop hook's timeout (hooks/hooks.json).start,endanddeliverstill leave the sandbox, but they run while the person is present. The "start runs inside the sandbox" criterion is unmet as written; with session-flow: let continue-in-background take a leading slash command so a background session starts armed #17386 option A,startis always attended.B. State under
<launch checkout>/.work/away/<session>/when ignored. This is the same rulechoose_report_pathuses (away.py:468-475). Hooks would locate it throughCLAUDE_PROJECT_DIR, which is exported to hooks (plugins-reference), and fall back to the data directory.state.jsonbecomes writable by any sandboxed command with no prompt, so a command could switch the refusals off.report_path, which an unsandboxedendwrites (away.py:946-948). Every path read from state must be confined.C. Document a
sandbox.filesystem.allowWriteentry for the data directory. No code changes. It loosens a sandbox control in user settings, with B's tamper exposure. Owner decides.Rejected:
$TMPDIR. Sandboxed and unsandboxed commands resolve it to different directories (Temporary directories).melodic-automation-lanes commentedon Nov 19, 2026
Refinement. A read-only run explored this repository, searched its issues and pull requests, and read the allowed docs to draft what follows. On an issue a listed human filed, it counts as the issue's spec once posted, while unedited; it is still model text, so check it.
Intended outcome: away.py keeps its per-session state in a sandbox-writable location (most likely the project's .work/away), the hooks read it from there with the old plugin-data path as fallback, and a test covers the location.
Related work
Open questions
RECOMMENDED: Project .work/away/<session>. The working directory is writable by default in the sandbox, while TMPDIR is per-user and may differ between a sandboxed command and a hook. Basis: https://code.claude.com/docs/en/sandboxing; plugins/session-flow/scripts/away.py:468
RECOMMENDED: Hooks look under the hook payload's cwd first, then fall back to the old data root in hook_state, so already-running absences stay readable. The old path is the documented fallback when the new one is not writable. Basis: plugins/session-flow/scripts/away.py:1127
RECOMMENDED: Add the helper in plugin_paths.py and land independently, noting the overlap with #17383 for merge order. Basis: judgment
RECOMMENDED: Yes. Make the live run a manual check by a person, and have the automated criterion be a test that start and refresh write only under the chosen location. Basis: judgment
Sources read
To answer, post a comment that starts with this line:
Automated refinement by the lanes App. Answer with a comment whose first line is
**Decision recorded.**.docs(session-flow): drop the sandbox restatement from the step-away g…
kyle-sexton commentedon Nov 19, 2026
Decision recorded.
Question (Q229, hub morning report 2026-11-19): where should away.py state live so it works with the Bash sandbox on? Options: (a) the hooks do the writes during the absence (Stop hook regenerates the refused and external-action blocks, the
refreshprompt is dropped, the watched-folder scan moves toend), state location and security surface unchanged; (b) state under the git-ignored<launch checkout>/.work/away/<session>/(trust-boundary change); (c) a documentedsandbox.filesystem.allowWriteentry for the data directory (loosens a sandbox control). Recommendation: (a).Owner answer (2026-11-19, 9:5x AM EST, in the hub session): "go w/ recomendations"
Decision: (a). The owner accepts the changed criterion:
start,endanddeliverstill run outside the sandbox, but only while the person is present (under Q228 (a),startis always attended). The per-Stop transcript scan cost is to be measured in the PR.fix(session-flow): guard the away report rewrite and keep the Stop hold
fix(session-flow): let older absences end and report a refused rewrite
kyle-sexton commentedon Nov 19, 2026
Delivered by #17436 (merged as a54dfa1), option A, which the owner chose: the Stop hook writes the report's refused-actions and external-actions blocks itself, outside the sandbox, so no
refreshruns during an absence.Remaining done-when items, settled by that choice rather than built:
start,end,deliver) write it.startandrefreshrun inside the sandbox, shown live:refreshis no longer needed while away;start,endanddeliverrun attended, outside the sandbox.Closing as completed.