Skip to content

Kill a husk only on positive evidence of death; never bank a stale Copilot directory - #249

Merged
scgopi merged 1 commit into
mainfrom
fix/husk-kill-guard
Sep 2, 2026
Merged

scgopi merged 1 commit into
mainfrom
fix/husk-kill-guard

Conversation

@scgopi

@scgopi scgopi commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #248 from its review, before the fix goes to a wider beta.

  • The pane's husk kill needs positive evidence. It keyed off the liveness check failing, which also happens on a listing row zmx marks err=: a busy daemon missing its one-second probe, which zmx itself refuses to clean up on. Opening a loop under load could zmx kill a live agent mid-turn. The kill now requires the session's own row to carry ended= (ZmxSessionLauncher.sessionEndedCheckCommand). The same rule stops it racing the daemon: a relaunch typed into a husk clears the mark at once.
  • No stale Copilot bank. The daemon's bank task no longer falls back to the pre-launch directory when no new one appears in time. A cold copilot still at its trust dialog would have had the dead conversation banked over it, recreating the orphaning Resume a local Copilot loop instead of relaunching it under the same name #248 ends. An unbanked node falls back to discovery by newest directory.
  • History appends use O_APPEND, since the daemon and the app can now both bank the same node at the same instant.
  • LocalSessionResumeTests is serialized; it swaps the process-global Copilot state directory.

Verification

  • xcodebuild test in the worktree: 1479 passed, 0 failed.
  • swiftlint lint: 0 errors. swift format lint --strict: clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Tqv8Rx8SGsLCjJQYCUjiFr

…e Copilot directory

Review of #248 found the pane's husk branch keyed off the liveness check
failing, which also happens on a listing row zmx marks `err=` — a busy
daemon missing its one-second probe, which zmx itself refuses to clean
up on. Opening a loop under load could `zmx kill` a live agent mid-turn.
The kill now requires the session's own row to carry `ended=`; the same
rule keeps it from racing the daemon, whose relaunch into a husk clears
that mark the instant the command is typed in.

The daemon's Copilot bank task no longer falls back to the pre-launch
directory when no new one appears within the wait: a cold `copilot`
still at its trust dialog would have had the old, dead conversation
banked over it, recreating the orphaning #248 set out to end. Nothing
banked costs nothing — discovery by newest directory already covers it.

History lines are appended with O_APPEND rather than seek-then-write,
since the daemon's bank task and the app's bank-on-open can now land on
the same file at once. The resume tests are serialized: they swap the
process-global Copilot state directory.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tqv8Rx8SGsLCjJQYCUjiFr
@scgopi
scgopi merged commit e672e70 into main Sep 2, 2026
1 check passed
scgopi added a commit that referenced this pull request Sep 2, 2026
Revert the local Copilot resume work (#248, #249) back to beta7
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.

1 participant