Record launch evidence on vanished incidents
## Epic requirement (verbatim, Task 9453 body)
Task 9440 analysed prod's broken sessions for Oct 18–23 (28 breaks, 12 incidents). The attached report has the evidence and code references. Fix these root causes:
1. Relaunch into the task's own held slot dies after an operator Stop or a runner's task_fail (16 breaks: tasks 7456, 7543, 8212, 8683, 9255). The pane log attached to the "vanished" attempt is the predecessor's.
- Fence kill_runner intents on launch_session_id / slot generation, not task id alone (apps/api/app/fleet_verdicts.py build_kill_intent; apps/api/app/routes/tasks/slots.py). An intent minted for a predecessor must never kill a successor launched into the same slot.
- Lease drain relaunches into a held slot only after the node reports the predecessor gone.
- Do not auto-retry a runner's own task_fail when it follows an answered question round; land it system_failed with the runner's reason.
- A vanished incident records the node, the launch id and whether the pane log is the predecessor's.
2. A retry returns to the node that just failed the launch (7 breaks; 7789 failed 4× on h5-3 across 3 accounts).
- launch_failed counts toward the per-node skip (apps/api/app/launch_failures.py).
- When one node fails the same task's launch across different accounts, refund the attempt.
3. Silent stalls are never recorded (8683 sat active 27 h 35 m, 9255 1 h 4 m, after "Runner started" with no session).
- Add a task-level silence detector: an active task with no session attached, heartbeat or transcript write for ~20 min records a break and is reclaimed.
4. The merge lane retries a forge auth rejection ("Invalid username or token", task 7765) until its attempts run out.
- Treat it as a credential blocker: one fresh credential mint and one retry in place, then stop re-dispatching and alert the operator, naming the credential.
5. Misclassified breaks.
- Break classification on the settle/transcript path skips background-subagent task-notification records (apps/jaahd/hooks/break_cause.py), as rs_stopfailure already skips agent_id events.
- Gemini "This client is no longer supported for Gemini Code Assist for individuals" becomes a terminal cause, not auth_expired.
Out of scope: the broken-session collection UI; purge/archival of old incidents; dev control plane; investigating h5-3's hardware/OS beyond what item 2 needs; any other break causes.
Done means:
- Each item ships with a test that reproduces its failure first: a kill minted for launch A does not kill launch B in the same slot; a second launch_failed on node N places the retry on another node; an active task silent past the threshold records a break; a lane auth rejection does not re-dispatch more than once; a subagent limit notification does not classify the session as usage_limit; the Gemini sentence maps to the terminal cause.
- After deploy, `tools/broken_sessions.py list` on prod shows no new held-slot "vanished" incidents following a Stop→Run or task_fail over a 5-day window.
Required checks: ./dc check full
(Item 1c — task_fail after an answered blocker round lands system_failed — already shipped in Task 9264 (`58b8ffd9b`); NOT part of any child.)
Settled inputs: the full PRD (Task 9451) and Architecture (Task 9452) are the epic's `prd` / `architecture` artifacts; this child is the Architecture's section named below. Evidence report: attachment 9076_report.html (Task 9440). Every new test must FAIL on today's develop first — cite the red run in the PR.
---
# Child C3 — Record launch evidence on vanished incidents
## Scope (this child)
Epic item 1, bullet 4 (PRD R1d; Architecture §C3, decision D4). Verbatim ask: "A vanished incident records the node, the launch id and whether the pane log is the predecessor's."
PRD R1d (verbatim): A `vanished` (and `launch_failed`) incident body records: the node (name and id), the launch id of the attempt that vanished, and a predecessor-pane marker with three states — `yes` (the attached pane log was last written by a different launch than the vanished one), `no` (written by the vanished launch), `unknown` (no pane log or no launch id to compare). The observer label stays.
## Approach (Architecture, settled)
- D4: "launch id" = the slot's `dispatch_id` plus `generation` at reclaim, rendered `"<dispatch_id> gen <generation>"`. Marker by time: `yes` if the attached session's `pane_log_written_at` is earlier than this attempt's launch time (`worktrees.acked_at`, else the task's `github_synced_at`), `no` if at/after, `unknown` if either is missing. (Session-id comparison rejected: ids are reused across a relaunch.)
- `runner_settle._VanishedTrace` (`apps/api/app/routes/tasks/runner_settle.py:470-528`) gains `launch`, `pane_log_written_at`, `launch_at`, read in `_vanished_trace` from the session row it already selects.
- Pure function `runner_breaks.predecessor_pane(pane_written_at, launch_at) -> "yes" | "no" | "unknown"`.
- `runner_breaks.incident_body` and `record` gain `launch: str = ""` and `predecessor_pane: str = ""`, rendered as fields `launch` and `predecessor pane`.
- `node` renders `name (uuid)` only when the node belongs to the task's org (same `own_node` rule as `_vanished_trace`); otherwise `uuid (shared node)` — decided for tenancy over R1d's literal "name".
- `task_pipeline_cp._record_vanished_runner` (`apps/api/app/task_pipeline_cp.py:166-195`) passes these values; `_reclaim_active` (`:198-216`) reads the trace before `end_attempt` clears the binding.
- Seam with C5: `_reclaim_active(task_id, observed_by, *, cause: Optional[str] = None)` — C5 adds the `cause` kwarg; this child extends only what is recorded. Neither depends on the other (file overlap resolves at rebase). C4 also adds `account` to `_VanishedTrace` (file overlap only).
- Quality: the body must read cleanly for an operator scanning `tools/broken_sessions.py` output — labelled fields, no `None`/empty-field noise when a value is missing (render `unknown`).
## Credentials & reach
| Oracle | Credential / identity / environment | Status |
|---|---|---|
| AC1d (unit and API tests) | Nothing beyond the worktree's own `./dc` stack | verified — runs in any leased worktree, no roster credential needed |
| AC-RC `./dc check full` | Merge lane's worktree, no credential | verified — the lane runs it per project config |
| AC-D2 `tools/broken_sessions.py list` on prod | This node's own `NODE_TOKEN` (agent API `/api/agent/runner-breaks`), prod CP | verified — read-only probe from node h8agi5dw (2026-10-23) returned prod rows (incidents 9256, 9024, 8961); no roster credential needed. **deferred** for evaluation: only decidable 5 days after the prod deploy (Finish stage) |
Out of scope (PRD §7, verbatim) — do NOT touch:
- MUST NOT change the broken-session collection UI (console pages listing runner-break incidents) beyond the incident **body text** R1d requires.
- MUST NOT add purge/archival of old incidents or change `tools/broken_sessions.py purge` / `runner_breaks.stale_escalations`.
- MUST NOT change dev control plane config or data; no dev-only behaviour.
- MUST NOT investigate or change h5-3's hardware/OS, node packaging or host setup beyond what item 2's placement/refund needs.
- MUST NOT add or reclassify any other break cause (e.g. `timeout`, `api_error`, `crashed`, `unknown` rules) beyond `stalled` and `client_unsupported`; the unexplained 8569 break is not addressed.
- MUST NOT re-implement 1c (Task 9264 shipped it) or widen it to non-blocker interview rounds.
- MUST NOT change coder-runner push/credential handling (merge lane only for item 4).
Epic out of scope: the broken-session collection UI; purge/archival of old incidents; dev control plane; investigating h5-3's hardware/OS beyond what item 2 needs; any other break causes.
No feature flag, setting or operator toggle may gate the fix (PRD: on by default once deployed).
Architecture boundary: body TEXT only — no console UI change; do NOT change the kill fence (C1), drain gate (C2) or stall cause (C5).
Done means:
- AC1d: A `vanished` incident body shows node, launch id and predecessor-pane `yes`/`no`/`unknown`; each of the three states has a test case. — API test over `runner_breaks.incident_body` / `_record_vanished_runner` → pass (red on develop first): three `predecessor_pane` cases plus one body-render case asserting node, launch and the marker; plus the shared-node render case.
- AC-D2: Post-deploy, 5 days from the prod deploy of the change: `tools/broken_sessions.py list --limit 1000` on prod shows no new `vanished` incident on a held slot whose task's preceding event was an operator Stop→Run or a runner `task_fail`. — Run on prod after the 5-day window; for each new `vanished` row, read its body's predecessor-pane marker (R1d) — must be none with `yes`. (deferred — only decidable 5 days after prod deploy; the Finish stage records it)
- AC-RC: Full gate green — `./dc check full` (merge lane) → green.
Required checks: ./dc check full
Outcome
Vanished/launch_failed incident bodies now record node (name (uuid), or uuid (shared node)), launch id (dispatch_id gen N) and predecessor-pane yes/no/unknown. 10 tests red on develop, green after; quick gate green. PR #6762 queued to the lane. AC-D2 deferred to Finish. Memory: none applied.
Artifacts
Activity
- Draft
- Ready
- Runner started
- Runner ended (done)