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
fix(cli): wait for the current turn to finish before an auto-update restart
main() schedules checkForUpdates 100ms after spawning the binary. When it
finds a newer version it stages the download and then unconditionally
SIGTERMs (SIGKILL after 5s) the running process to install it -- with no way
to know whether the user is mid-turn, because the wrapper is a separate
process that only sees the child's exit event, not its React state. A
download that lands a few seconds into a session therefore kills a turn
that is still running, which is what #994 reports.
Adds a small cross-process signal in the spirit of the existing
terminal-watchdog marker files: the binary writes an activity marker for the
duration of a turn (subscribed once to the store's isChainInProgress, so
every current and future call site is covered) and removes it when idle or
on exit. The wrapper waits for that marker to clear before stopping the
process for an update.
Best-effort and bounded in both directions: a missing marker (already idle,
an older binary that predates this file, a process that died without
cleaning up) resolves immediately and preserves today's restart-right-away
behavior, and a turn that never ends stops blocking the update after
10 minutes.
Tests: three for the marker's write/remove/idempotence, three for
waitForRunIdle's immediate, waits-then-clears, and gives-up-at-the-bound
paths, plus the existing checkForUpdates source-order check extended to
require the wait between staging and stopping. Confirmed red against the
unfixed code, green after; the full cli suite shows the same 34 pre-existing
failures before and after.
Claude-Session: https://claude.ai/code/session_018vPhyqaaoKa8cgs7GEnyq5
0 commit comments