Repository navigation
perf(session-flow): clear a delivered absence's away state - #17396
Conversation
deliver now removes the session's away state (state.json, refused.jsonl, lock and the end copy of the report) and then away/ itself when it is empty, so the away hooks' shell gate exits before Python again in later sessions. A report kept inside the state dir moves to <plugin data>/away-reports/ first, and deliver prints where the report lasts. Removal runs under the session lock; other sessions' delivered state left by an earlier version is swept only when its lock is free. Co-authored-by: Claude Opus 5.5 <[email protected]>
The settings reads behind the launch warnings (managed, user, project and local files) are their own concern; moving them out keeps away.py under the 1000-line size reference. Co-authored-by: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 900dddd764
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
claude-security-review reviewed Security review: PR #17396 (head 5ce3059)I found no security issues. I read every hunk of all 6 changed files in What I checked
critical-findings: 0 |
|
claude-review reviewed No blocking findings. This lane already reviewed an earlier head ( What checks out
Closing issue #17389
Verification: I ran nothing. The author's "548 passed" and "549 passed", and their ruff results, are their claims and unverified. Other notes
Verifier dropped 0 of 0 candidates. |
A deliver interrupted after the report moved to away-reports/ but before state.json was removed left the state pointing at the old path, so a retried deliver reported a report path that no longer existed. Write the archive path to the state before the move, so a retry names where the report went. Co-authored-by: Claude Opus 5.5 <[email protected]>
Lane run report
Failed GitHub API calls
|
…vered-away-state # Conflicts: # plugins/session-flow/skills/step-away/SKILL.md
Closes #17389
Summary
A delivered absence's state stayed under
<plugin data>/away/<session>/, so once any absence had run, every later session's PermissionRequest, Elicitation, Stop and UserPromptSubmit hook started Python instead of exiting in the shell gate ofhooks/run-away-hook.sh.away.py delivernow removes the session's state andaway/itself once it is empty, so idle hooks return to the cheap path.Fix
delivertakes the session lock, refuses an active absence as before, then removesstate.json,refused.jsonl, the end copyreport.mdand (POSIX) the lock file while still holding the lock; after releasing it, it removes the session dir andaway/, each withrmdirso a dir with anything unexpected in it stays..work/away/stays where it is. A report kept inside the state dir (not-git-ignored case), or the end copy when the original is gone, moves to<plugin data>/away-reports/<stamp>-<session8>.mdfirst.delivernow printsreport=<lasting path>and the step-away SKILL.md tells the agent to give the person that path.away/non-empty, so the not-git-ignored case would never regain the cheap path, which is the issue's goal (run-away-hook.sh:8gates on-d "$DATA/away").away-reports/is a sibling the gate does not look at.deliveralso sweeps other sessions' already-delivered state (left by the version before this one), each only when its lock is free (locked(..., wait=0)); a held lock leaves that dir in place.deliver, or one with no state, printsstatus=noneand exits 0.startafterdeliverbegins with fresh state, refusals included.grep -c '"allow"' plugins/session-flow/scripts/away.pyis 0.away.pytoscripts/away_launch.py, a separate concern, soaway.pystays under the repository's 1000-line size reference (the pre-push size check failed without it).Retention: reports in
away-reports/are kept until the person deletes them; nothing prunes them.Verification
uvx --with pytest pytest plugins/session-flow/scripts/tests -q -p no:cacheprovider: 548 passed. New or changed cases:test_deliver_once,test_deliver_moves_a_report_kept_beside_the_state,test_deliver_keeps_a_git_ignored_report_in_place,test_deliver_keeps_another_sessions_absence,test_deliver_sweeps_an_old_delivered_absence_unless_its_lock_is_held,test_start_after_delivery_begins_new_absence, and the deliver case oftest_hook_note_command_names_data_root. All 7 fail against the previousaway.py.scripts/run-ruff.sh checkon the three Python files: clean. No shell changed.Idle hook cost, measured with
printf '{"session_id":"00000000-0000-0000-0000-000000000000"}' | /usr/bin/time -f '%e s' env CLAUDE_PLUGIN_DATA=<dir> CLAUDE_PLUGIN_ROOT=<plugin> node <plugin>/hooks/exec-bash.mjs <plugin>/hooks/run-away-hook.sh Stop, after onestart/end/deliverin a freshsession-flow-*data dir. Before = data dir delivered by the old code (away/remains); after = data dir delivered by this code (away/gone). Runs interleaved on the same host, which was under load, so absolute values are above the issue's 0.09 s / 0.02 s:Related
🤖 Generated with Claude Code