Skip to content

fix(#856): surface externally-terminated runs as aborts; stop logging them as success - #877

Merged
admarble merged 15 commits into
mainfrom
feature/856-nested-phase-claude-that-hangs-after-its-turn-
Jul 31, 2026
Merged

admarble merged 15 commits into
mainfrom
feature/856-nested-phase-claude-that-hangs-after-its-turn-

Conversation

@admarble

@admarble admarble commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Implements AC-4 and the three related defects from #856, and closes AC-3 by measurement. AC-1/AC-2 remain unchecked — see "Deliberately not done" below.

The problem

A sequant run killed mid-flight reported success three separate ways:

  1. The process exited 0.
  2. The run log recorded status: "success", summary.passed: 1 — with an empty phases[] and totalDurationSeconds: 0.
  3. Any lock it leaked read as fresh forever, silently blocking that issue from ever running again.

The killer itself is upstream — Claude Code 2.1.220's [bg-pty] host-dead watchdog issuing a process-group SIGKILL. SIGKILL is uncatchable, so this PR does not prevent the kill. It makes the aftermath honest and recoverable.

Root causes

Defect Root cause
Logged as success log-writer.ts seeded status: "success" in startIssue, and only logPhase ever revised it. An issue whose first phase never completed was written out as a pass. Reinforced by deriveIssueLogStatus([]) also returning "success".
Leaked locks run-orchestrator.ts registers a release cleanup plus a sync process.on("exit") net. Neither can run under SIGKILL. The only possible fix is recovery on next start.
Recycled PIDs read as fresh classifyStaleness returned null (fresh) whenever a same-host PID was alive, with no age bound at all. A PID is only a stable identity while its process lives; once the OS recycles it, an abandoned lock points at an unrelated process forever. Confirmed live: 505.lock (2026-05-14), 708.lock, 803.lock — 76/56/4 days old, all blocking their issues.
Not surfaced shutdown.ts printed "Interrupted. Cleanup complete." and called exit(0). Because this path exits the process, displaySummary's existing abortReason rendering is never reached — that banner is all the user sees.

Changes

AC-4 — surface external termination

  • ShutdownManager exits 128+signum (SIGINT 130, SIGTERM 143) and prints the abort with its cause. SIGTERM additionally points at docs/incidents/856/, since nothing interactive sends SIGTERM by hand.
  • Cleanup tasks now receive an AbortContext so they can record the cause.
  • sequant logs renders an aborted run as ABORTED, naming the signal.

Defect 1 — aborted run logged as success

  • completeIssue derives status from the phase list instead of the seed; an abort forces failure even over a green prefix of phases (an in-flight pipeline that never reached a terminal state is not a pass).
  • deriveIssueLogStatus([]) returns failure.
  • Additive aborted / abortReason / abortedBy fields and a summary.aborted sub-count — following the capped (feat(orchestrator): preserve partial output for turn-capped phases in phase-executor #739) precedent of a boolean over a new enum value, so the persisted schema stays stable at version: 1. All new fields optional; old logs still parse.

Defects 2 & 3 — leaked and recycled-PID locks

  • classifyStaleness gains an absolute 24h ceiling, checked before the same-host PID branch and binding regardless of host, PID liveness, or skipPidCheck. 24h is ~48× the 30-minute phase timeout and 4× the 6h skill TTL, so no real run can reach it — while every leaked lock becomes self-clearing. Env override SEQUANT_MAX_LOCK_AGE_MS.
  • Chose an age ceiling over process-start-time recycle detection: the latter is more precise but needs ps subprocesses and per-platform parsing, where this stays a pure function with no I/O.

Test race fixed along the way

lock-manager.integration.test.ts had process A release on a fixed 1s timer, which process B's tsx boot loses whenever the transform cache is cold — i.e. right after any edit to this module, exactly when the test matters most. It failed 3/3 with my changes and passed 3/3 with them stashed, which looks like a regression; it was the harness measuring an empty window. A now holds until the test closes its stdin, removing the window rather than widening it.

Verification

Full suite: 231 files, 4774 passed, 1 expected fail, 2 skipped — fully green. eslint --max-warnings 0 clean, prettier clean, tsc --noEmit clean.

Earlier revisions of this PR carried a caveat about src/ui/tui/App.test.tsx flaking under load, which I attributed to a pre-existing flake without proving it. That was settled properly instead of asserted: checking out the base commit in the same worktree and running the full suite there came back fully green, which located the difference in the branch rather than the environment. The cause was that this branch was based on 0da7e446, before #880 (give the Ink render tests a local timeout above the unit project's 5s) landed on main — a known, already-fixed defect, not a flake and not caused by these changes. Merging origin/main in brings that fix and the suite is now green across consecutive runs.

Mutation verification (per CLAUDE.md — each gate test shown to fail when its target is reverted):

# Mutation Tests killed
1 Remove the max-age-exceeded ceiling 3 — exactly the ceiling unit tests; both negative controls still passed
2 Revert abort ? "failure" : … in completeIssue 1 — "does not let a green prefix turn an abort into a pass"
3 Remove the empty-phases guard in deriveIssueLogStatus 3 — the two derivation tests + the zero-phase log test
4 Revert this.exit(code) to this.exit(0) 4 — every exit-code assertion
5 Drop the aborted/abortReason marking 2 — both abort-field tests
6 Drop the SIGTERM incident-doc pointer 1 — "points SIGTERM victims at the known bg-pty cause"
7 Revert run-orchestrator to a bare finalize() — the original defect 1 — the orchestrator-wiring gate test
8 Remove the ceiling, against the integration suite 1 — the recycled-PID test; the recent-lock control still passed

Also verified independently: classifyStaleness returns null for a fresh same-host live PID and max-age-exceeded at 30h, and a live two-process contention repro correctly blocks the second acquirer.

Gaps closed since first review

The first round of this PR listed three things under "Not tested". All three are now covered:

  • End-to-end abort wiring. The unit tests covered each half of the mechanism, but the original defect was neither half — it was finalize() called with no argument. abort-logging.integration.test.ts now sends a real SIGTERM/SIGINT to a real process and reads the resulting log off disk.
  • That test's own blind spot. It embeds a copy of the orchestrator's wiring, so it would pass even if run-orchestrator.ts regressed. A third test asserts the real registerCleanup block forwards its abort argument, scoped to that block so a stray comment can't satisfy it (mutation 7).
  • Recycled-PID recovery against a real lock file. Previously unit-only. Now writes a 30-day-old lock whose PID is 1 — always alive, never ours, kill(1, 0) throws EPERM which reads as alive — so only the age ceiling can free it, plus a control proving a recent lock on a live PID is still respected.

AC-3 — answered by measurement

Flipped exactly the variable --no-mcp flips (the Agent SDK's mcpServers option), 3 reps per arm, alternating, everything else held constant:

Arm MCP servers Teardown gap Mean
MCP ON 15 1.69s, 0.82s, 1.17s 1.23s
MCP OFF 0 1.23s, 1.52s, 1.54s 1.43s

MCP shutdown does not cause the hang. Both arms sit ~50x below the 58-96s victim band, and the MCP-off arm was marginally slower. MCP costs ~5s of startup, not teardown. This confirms AC-2's redirect empirically instead of by argument.

The method is validated against the incident itself — it reproduces the published 92.7s and 58.0s victim gaps at their exact death timestamps. The metric is TurnEnd -> SessionEnd, not SessionStop -> SessionEnd; SessionStop is a session phase transition that pairs for only 10 of 555 sessions and gives multi-day gaps.

Limits, stated plainly: n=3 per arm on a trivial prompt, and no hang occurred in any run — so this shows MCP presence alone does not produce a 58-96s gap. It cannot prove MCP is irrelevant during a hang, since no hang was reproduced. These were direct SDK queries, not full sequant run phases.

Both measurement scripts are preserved in docs/incidents/856/tools/, including the trap that cost two runs: reading MCP servers from ~/.claude.json instead of the desktop config silently yields zero servers and turns the treatment arm into a second control.

Bonus data point: on the incident day 8 sessions had a 30-120s teardown gap and 6 survived — a long post-turn hang is necessary but not sufficient for the kill.

Second self-audit

A "any gaps?" pass over the gap-fix commits themselves found two more, both now fixed:

  • --force --signal-other could SIGTERM an innocent process. signalOther had no age bound, so a lock abandoned weeks ago — exactly the 505.lock case this PR added the ceiling for — would have its recycled PID signalled, killing whatever unrelated program now owns that number. The liveness probe cannot catch it: a recycled PID is alive. The hazard predates this branch, but the earlier commits made it an inconsistency — acquire treated a >24h lock as abandoned while signalOther still trusted its PID. Both sides now agree via a stale-pid-untrusted refusal, surfaced in the locks CLI and the orchestrator log line. Mutation-verified.
  • Docs and CHANGELOG were left describing the old rules. docs/reference/concurrency.md listed three stale-recovery situations with no mention of the 24h ceiling and described --signal-other as "same host, alive only" with no refusal case. The CHANGELOG had no entry at all for the exit-code change, which is script-visible: anything checking $? around sequant run now sees 130/143 instead of 0 on an interrupted run. Both updated, with the exit-code change filed under Changed with a migration note.

I also verified two suspected gaps that turned out not to be real, rather than assuming: --dry-run does emit phase logs (so the deriveIssueLogStatus([]) change cannot turn dry runs into failures), and the early-abort paths that complete an issue with zero phases are corrected by that change rather than regressed.

Deliberately not done

AC-1 and AC-2 stay unchecked. They require a live capture of an intermittent hang under sudo dtrace, which the issue body itself states is not reproducible on demand. Rather than leave that work in a GitHub comment that .sequant/ rotation would outlive, the full investigation is now in docs/incidents/856/ — including the corrected dtrace predicate: the original captures only signal 15, but the primary kill is a group SIGKILL, so a 15-only trace could record nothing and falsely exonerate.

Honest scope limit: AC-4 is satisfiable only for catchable signals. Nothing in-process can react to SIGKILL, which is what the bg-pty watchdog actually sends. For that case the recovery story is defects 2/3's self-clearing locks, not the abort banner.

Incidental finding — filed as #881

Correcting an earlier description of this: it is not a test writing the marker. /exec's parallel-group protocol creates /tmp/claude-parallel-group-1.marker under a hardcoded, globally-shared name, and pre-tool.sh globs that namespace and takes the first hit with no project scoping. So a parallel group in any project redirects worktree enforcement for every concurrent session on the machine — and the session that loses the race has its guard silently pointed at an unrelated directory, which is worse than the blocked edit that made it visible. Filed as #881; unrelated to #856's cause.

Advances #856 — AC-3/AC-4 and all three related defects. Deliberately NOT a Fixes link: AC-1/AC-2 (the live-capture diagnosis) remain open and #856 stays their single tracker, rather than closing it and minting a clone issue.

admarble added 2 commits July 29, 2026 23:02
… them as success

A `sequant run` killed mid-flight reported success three ways: the process
exited 0, the run log recorded `status: "success"` with an empty `phases[]`,
and any lock it leaked blocked its issue permanently.

The killer itself is upstream (Claude Code 2.1.220's `[bg-pty]` host-dead
watchdog issuing a process-group SIGKILL — see docs/incidents/856/). SIGKILL
is uncatchable, so this commit does not prevent the kill. It makes the
aftermath honest and recoverable.

AC-4 — surface external termination:
- ShutdownManager exits 128+signum (SIGINT 130, SIGTERM 143) instead of 0, and
  prints the abort with its cause. SIGTERM additionally points at the incident
  doc, since nothing interactive sends SIGTERM by hand.
- Cleanup tasks now receive an AbortContext so they can record the cause.
- `sequant logs` renders an aborted run as ABORTED, naming the signal.

Related defect 1 — aborted run logged as success:
- `startIssue` seeded `status: "success"`, and only `logPhase` revised it, so an
  issue whose first phase never completed persisted as a pass. `completeIssue`
  now derives from the phase list, and an abort forces `failure` even over a
  green prefix.
- `deriveIssueLogStatus([])` returns `failure` — zero completed phases is never
  a pass.
- Additive `aborted`/`abortReason`/`abortedBy` fields plus a `summary.aborted`
  sub-count, following the `capped` (#739) precedent of a boolean over a new
  enum value so the persisted schema stays stable at version 1.

Related defects 2 and 3 — leaked and recycled-PID locks:
- `classifyStaleness` gains an absolute 24h ceiling checked before the same-host
  PID branch. That branch treated a live PID as proof of freshness, but a PID is
  only a stable identity while its process lives; once recycled, an abandoned
  lock read as fresh forever (505.lock from 2026-05-14 still blocking #505).
  The ceiling is also the only recovery path for locks leaked by a SIGKILL,
  where no in-process release handler can run.

Also removes a real race in lock-manager.integration.test.ts: process A released
on a fixed 1s timer, which process B's `tsx` boot loses whenever the transform
cache is cold — i.e. right after any edit to this module. A now holds until the
test closes its stdin, removing the window rather than widening it.

AC-1/AC-2/AC-3 remain unchecked: they require capturing an intermittent hang
under `sudo dtrace`. The investigation to date is preserved in
docs/incidents/856/, including the corrected predicate (the original captured
only signal 15; the primary kill is SIGKILL, so a 15-only trace would falsely
exonerate).
admarble added 13 commits July 30, 2026 00:08
Follow-up to the previous commit's "Not tested" list.

End-to-end abort surfacing (new abort-logging.integration.test.ts):
The unit tests covered each half of the mechanism, but the original defect was
neither half — it was the wiring, `finalize()` called with no argument. These
tests send a real SIGTERM/SIGINT to a real process wiring LogWriter +
ShutdownManager as run-orchestrator does, then read the log off disk: exit 143
/ 130, `aborted: true`, `abortedBy`, `summary.passed: 0`.

They embed a copy of the orchestrator's wiring, so they'd still pass if someone
reverted run-orchestrator.ts itself. A third test closes that by asserting the
real `registerCleanup("Finalize run logs", ...)` block forwards its abort
argument — scoped to that block, not the file, so a stray comment can't satisfy
it. Mutation-verified: reverting the orchestrator to a bare `finalize()` fails
exactly that test.

Recycled-PID lock recovery (lock-manager.integration.test.ts):
Previously unit-tested only. Now writes a real 30-day-old lock file whose PID is
1 — always alive, never ours, and `kill(1, 0)` throws EPERM which
`defaultIsPidAlive` reads as alive, so it is indistinguishable from a live
holder by PID alone. Only the age ceiling can free it. Plus a negative control
proving a *recent* lock on a live PID is still respected. Mutation-verified:
removing the ceiling fails the recycled-PID test and leaves the control passing.

AC-3 — answered by measurement, not argument:
Flipped exactly the variable `--no-mcp` flips (the SDK's `mcpServers` option),
3 reps per arm. Teardown gap: 1.23s mean with 15 MCP servers vs 1.43s with
none — no difference, both ~50x below the 58-96s victim band. MCP costs ~5s of
startup, not teardown. So MCP shutdown does not cause the hang.

The method is validated against the incident itself: it reproduces the published
92.7s and 58.0s victim gaps at their exact death timestamps. Note the metric is
`TurnEnd -> SessionEnd`, not `SessionStop -> SessionEnd`; `SessionStop` is a
session phase transition that pairs for only 10 of 555 sessions and yields
multi-day gaps.

Also recorded: on the incident day, 8 sessions had a 30-120s teardown gap and 6
of them survived. A long post-turn hang is necessary but not sufficient for the
kill.

Both measurement scripts are preserved under docs/incidents/856/tools/ with the
trap that cost two runs documented — reading MCP servers from ~/.claude.json
instead of the desktop config silently yields zero servers and turns the
treatment arm into a second control.
Runtime inspection contradicts part of what the previous commit asserted.

The doc claimed the bg-pty watchdog as the cause with "high confidence". That
was overstated — it rested on strings extracted from the binary, never on
observed runtime behaviour. Two findings from actually watching it:

1. Background tasks run under CLAUDE_BG_BACKEND="daemon". bg-pty hosts are real
   but are spawned by that daemon as a spare pool, and the daemon is transient —
   it exits 5s after its last client. With no daemon up, a backgrounded task is
   a plain child of the interactive claude with no host and no socket. Any check
   that assumes a host is present reports a false negative; the harness now says
   "not testable right now" instead of "not found".

2. Stronger lead: the daemon lost its auth token at 06:04:22Z, 17.6 minutes
   before the first death. All three victims started inside that window and no
   run has died outside it. An unauthenticated supervising daemon would explain
   both halves at once — an agent blocking on auth-dependent teardown, and a
   supervisor tearing the tree down. Three samples is correlation, not cause,
   but unlike the intermittent hang it is inducible on demand.

Also recovered live: the killed run's own stdout is still on disk at
tasks/b6byn5iih.output. It shows "Received SIGTERM" then "Aborted 1 active
phase" and stops with no cleanup task reported — so the first signal is
catchable (observable without dtrace), and the SIGTERM->SIGKILL escalation is
caught in the act. This also confirms the code path this PR fixes is the one
that actually runs.

Test plan is now three tiers, cheapest first: induce the auth window (no sudo,
best lead), induce a wedged host via SIGSTOP (deterministic test of the bg-pty
theory), then dtrace to name the sender (SIP may block it — the script
preflights the probe so an empty capture reads as "unknown", not "nothing
sent").

Harness bug found by dry-running it: a loose `grep bg-pty` matched the script's
own command line and SIGSTOPped the parent shell. Target selection is now strict
and refuses self/parent, mirroring LockManager.signalOther's guard. Also dropped
mapfile and %3N date — macOS ships bash 3.2.
The status line said 'cause NOT settled' while the summary two paragraphs below
still asserted the bg-pty watchdog as the killer, and the 'no other mechanism
keys on that state' claim was scoped to binary strings without saying so — the
sweep behind it never inspected the daemon. Both now present two unconfirmed
candidates instead of one conclusion.
…ent the ceiling

Self-audit of the previous commits found an inconsistency they introduced and
two stale docs.

signalOther: `--force --signal-other` reads the previous holder from
forceAcquire and SIGTERMs its PID if alive on this host. There was no age
bound, so a lock abandoned weeks ago — exactly the `505.lock` case the age
ceiling was added for — would have its recycled PID signalled, killing whatever
unrelated program now owns that number. The liveness probe cannot catch it: a
recycled PID *is* alive.

The hazard predates this branch, but the previous commits made it an
inconsistency: `acquire` now treats a >24h lock as abandoned while `signalOther`
still trusted its PID. Both sides now agree, via a new `stale-pid-untrusted`
SignalReason surfaced in both the locks CLI and the run-orchestrator log line.

Docs were left describing the old rules:
- docs/reference/concurrency.md listed three stale-recovery situations and the
  2h/6h TTLs with no mention of the 24h ceiling, and described --signal-other
  as "same host, alive only" with no refusal case.
- CHANGELOG had no entry for the exit-code change, which is script-visible:
  anything checking `$?` around `sequant run` now sees 130/143 instead of 0 on
  an interrupted run. Filed under Changed with the migration note, plus Fixed
  entries for the success-logging and lock defects.

Mutation-verified: removing the age guard fails exactly the new refusal test
and leaves the recent-holder control passing.
…ase-claude-that-hangs-after-its-turn-

# Conflicts:
#	CHANGELOG.md
…the broken preflight

"How do we test a live capture?" exposed that the rig itself was untested — and
its preflight was wrong in four ways, each of which would have produced a
confident but meaningless result:

  - it sent SIGTERM to `$$`, killing the watcher instead of a target;
  - it used `timeout`, which macOS does not ship, so the preflight errored out
    and the failure read as "SIP blocked it";
  - it probed only signal 15, so it could pass while SIGKILL — the primary kill
    here — went unobserved;
  - it never checked the arg fields populate, so SIP could allow the probe and
    still blank the sender.

This matters more than a normal test gap. The event is one-shot: rare,
self-destructing, unrepeatable on demand. A broken rig yields an empty capture,
and an empty capture is indistinguishable from "nothing killed anything" — it
reads as exoneration. Every negative result depends on first proving the
instrument fires on a known positive.

New verify-capture.sh stages a sacrificial process group shaped like the real
victim, group-kills it with the same TERM->KILL escalation the recovered run
output showed, and asserts: the poller records the deaths; dtrace captures both
9 and 15; dtrace's fields are populated rather than SIP-blanked; and the rig
outlives the kill it is watching (a watcher inside the victim's group dies with
it and loses exactly the tail you needed — the failure most likely to go
unnoticed).

macOS has neither `setsid` nor `timeout`; the victim group is created via bash
job control (`set -m`) and bounded runs via a background timer.

Verified by running it: 3-process victim group staged and killed, poller
observed all 3, rig survived, isolation confirmed. Without sudo it reports
PARTIALLY verified rather than verified — the poller half is proven, the
sender-identification half is not, and saying otherwise would license the exact
false-exoneration the script exists to prevent. The sudo half needs a human.
The README gained shell scripts but kept a two-Node-scripts framing, so the
inventory line described a directory that no longer existed. Replaced with a
table naming each script, its purpose, and whether it needs sudo.
…en D script

The sudo run failed with `invalid probe specifier` alongside SIP's
"some features will not be available" warning, and the script reported it
flatly as "SIP is blocking it". Those are two different conditions with
opposite remedies: an unavailable provider means tier 3 cannot work on this
machine and the plan must route around it, while a compile error in our own D
code is a bug fixable in minutes. Reporting the first when it is the second
would abandon a working capture layer for no reason.

The verifier now runs `dtrace -l -n 'proc:::signal-send'` before arming and
branches its diagnosis on whether the probe is listed. Checked against the
system headers: `pr_pgid` and `pr_fname` are both real members of macOS's
psinfo_t (/usr/lib/dtrace/darwin.d:171,180), so the field references in the
action block are valid — which makes a missing provider the likelier of the
two, but the probe listing settles it rather than assuming.
… the probe

`sudo dtrace -l -n 'proc:::signal-send'` settles it:

    dtrace: failed to match proc:::signal-send: System Integrity Protection is on

Not restricted — withheld. Tier 3 as designed cannot run on this machine, and
disabling SIP to debug a bug is a bad trade. (The probe-existence check added in
the previous commit is what distinguished this from a bug in our own D script:
`pr_pgid`/`pr_fname` are valid psinfo_t members per darwin.d, so the action
block was fine.)

signal-canary.c replaces it. A handler installed with SA_SIGINFO receives
siginfo_t.si_pid — the sending process — and reading your own signal's metadata
requires no privileges. The canary execs the real command as a child in the same
process group so a group-directed signal hits both, logs the sender, then
restores the default disposition and re-raises so the child's shutdown path is
unaffected.

This is only viable because the incident's first signal is CATCHABLE: the
recovered stdout (tasks/b6byn5iih.output) shows `Received SIGTERM` before the
truncated cleanup. The following SIGKILL stays unobservable in-process, but it
comes from the same actor.

The handler is async-signal-safe by construction — log fd opened before any
signal can arrive, hand-rolled integer formatting, write(2) only. printf or
malloc in a handler can deadlock, which would corrupt exactly the capture we
need.

Verified by positive control, not by inspection: a direct SIGTERM and a
GROUP-directed SIGTERM each record the true sender pid. verify-capture.sh now
exercises this layer and reports 5/5 with no sudo, and its verdict names which
layers are proven rather than claiming blanket verification.
`~/.claude/daemon-auth-status.json` still reads `{"status":"auth_required",
"since":1785305062628}` — 2026-07-29T06:04:22.628Z, matching the daemon.log auth
failure to the millisecond, and unchanged 33 hours later.

Against the timeline, all three deaths (06:21:57 / 06:36:05 / 06:39:36) fall
inside [auth lost 06:04:22 .. daemon idle-exit 09:48:23], and none has occurred
in the 33 hours since. That window is ~3.7 hours of a multi-day record; three
deaths inside it and none outside is a far tighter fit than "backgrounded
launch", which describes many surviving runs too.

Candidate necessary conditions are now BOTH: the daemon is alive, and it is in
auth_required state. This explains the intermittency without appeal to luck —
the window opens when auth fails and closes when the daemon idle-exits.

Confirmed by direct observation rather than inference: with the daemon down (its
current state), a backgrounded task is a plain child of the interactive claude
in its own pgid — no daemon spawns, no bg-pty host, no socket under
/tmp/cc-daemon-502/. Both candidate mechanisms need the daemon up, so neither is
reproducible until it restarts, which the auth_required cooldown prevents.

Recorded with an explicit falsifiable prediction, so the next attempt can
disprove it rather than accumulate more correlation.
…not sufficient

A canary-instrumented backgrounded task, launched from inside an interactive
Claude session (the configuration every victim shared), ran the full 200s and
exited 0 with an empty canary log — no catchable signal ever delivered.

200s is nearly double the ~106s threshold, so this rules out any unconditional
"backgrounded tasks are killed at ~106s" rule, which is how the workaround has
been stated until now. The real condition is narrower and checkable: daemon
alive AND in auth_required (`~/.claude/daemon-auth-status.json`).

Recorded explicitly as a negative CONTROL, not as evidence about the auth
window — the daemon was down, i.e. the state already known to be
non-vulnerable, so it cannot speak to the hypothesis. Its value is bounding the
claim and showing the canary runs stably for the full duration without
perturbing the child.
…, not current

The previous commit told readers to check ~/.claude/daemon-auth-status.json
before backgrounding a run. That advice inverts the answer.

Observed 2026-07-31: the file still read {"status":"auth_required","since":...}
— 33 hours stale — while `claude auth status` reported loggedIn: true on a
healthy max subscription, and no daemon process existed at all. The file records
the last state a daemon observed; nothing clears it when the daemon idle-exits
or when auth is later restored.

Anyone following the old advice would see auth_required and conclude they were
in the dangerous window when they were not — and, worse, would keep believing it
indefinitely, since the file never self-corrects.

Replaced with checks that read live state: `claude auth status` for auth,
`tail ~/.claude/daemon.log` and `ls /tmp/cc-daemon-502/` for whether a daemon is
actually up. Daemon liveness is the first condition to establish anyway, since
the vulnerable state needs both.

Also recorded: `claude agents --json` reads a persisted roster from disk and
does NOT start the daemon, so it cannot be used to bring one up.
The actual fix lives in Claude Code, not sequant — sequant is the victim of a
group-directed kill it cannot prevent in-process. The draft consolidates the
evidence a maintainer needs (timeline to the second, the auth-window
correlation, extracted watchdog constants and telemetry names, the recovered
`Received SIGTERM` stdout, the ruled-out matrix) plus the three concrete asks.

Kept as a draft in-repo rather than filed immediately: filing on a third-party
tracker under the user's identity is their call, and the report only gets
stronger if the armed canary catches a recurrence first.
@admarble
admarble merged commit 97b08e9 into main Jul 31, 2026
5 checks passed
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