Metadata
| Status | done |
|---|---|
| Assigned | agent-895 |
| Agent identity | 603daf069cd2ae4a26357aa66e8c6124154b648711a0816ffd8b660ee3b23815 |
| Created | 2026-07-26T16:43:37.159016409+00:00 |
| Started | 2026-07-26T17:57:05.879675351+00:00 |
| Completed | 2026-07-26T18:08:57.140054510+00:00 |
| Tokens | 4128042 in / 26073 out |
Description
Objective
Amend docs/design-pi-session-watchdog.md so the five-minute value is a soft observation threshold only. It may emit suspicion and a read-only probe, but elapsed time is never completion/failure evidence and 300s + probe grace is not a universal interruption deadline. Define the evidence-driven completion/finalization protocol and the conservative conditions under which WG may resume a genuinely stalled Pi task worker. No production-code changes.
Also update the downstream implement-pi-stalled task metadata so it implements the amended policy rather than the superseded “300s + bounded grace => fence” rule. Do not change unrelated task metadata.
Architectural invariants
Completion proof is layered, never temporal
- A Pi tool call is only a success intent when the lifecycle kernel durably accepts a current
(task, generation, attempt, attempt_fence, process_epoch, toolCallId)wg_donereceipt.agent_end,agent_settled, stdout/EOF, exit 0/nonzero, silence, files appearing, evaluator opinion, a completion prompt, or elapsed runtime cannot substitute for that receipt. - The accepted success intent still does not make the task Done. Done requires the exact current-epoch terminal receipt, a quiescence/current-worktree-manifest receipt, creation/binding of the candidate checkpoint, required validation/evaluation evidence, and the authoritative finalization/merge event. State the proof tuple and which kernel/finalizer layer owns each transition.
wg_failand correlatedwg_waitlikewise require accepted current-epoch receipts for their own dispositions, but do not use the success candidate/finalization path. First-terminal-wins remains authoritative; old-epoch receipts are late evidence only.- Time can only authorize observation or make a safe continuation eligible. It never proves success, failure, abandonment, quiescence, or absence of a side effect.
Required observation/action decision table
Replace any rule that funnels all quiet states through one 300s+grace deadline with an explicit table containing at least these distinct rows:
| Observation | Required action |
|---|---|
accepted current-epoch wg_done | disarm watchdog; quiesce exact process; hand terminal + manifest receipts to candidate validation/evaluation/finalization; do not label Done early |
accepted current-epoch wg_fail / correlated wg_wait | disarm and follow the matching lifecycle disposition; no completion inference |
agent_settled with no terminal receipt | enter NeedsFinalization (a nonterminal watchdog classification, not success), promptly quiesce/reconcile and issue one bounded same-session completion prompt; do not wait five minutes because Pi has declared no autonomous continuation |
| exact process exit/EOF with no terminal receipt | enter NeedsFinalization; classify tool/effect ambiguity and, when safe, promptly reopen the exact same session/attempt/route/worktree for the bounded completion prompt; exit code does not choose success/failure |
| provider/model request in flight with no meaningful output | at 300s emit Suspect + read-only probe only; keep the current process/provider operation intact until a separately configured phase/route hard-resume eligibility threshold and grace pass |
| advancing token/thinking/tool-call/session/worktree progress | remain Active, advance the monotonic progress sequence, cancel stale suspicion; total runtime is irrelevant (a progressing 20-minute task remains untouched) |
| valid declared long-tool lease | remain LongTool and protect through lease/renewal/hard-cap rules; on expiry use effect-specific reconcile/receipt/operator-hold behavior, not the provider timer |
| accepted explicit user wait | watchdog disarmed and lifecycle parked; only the correlated wake follows normal lifecycle behavior; prose/UI waiting is not authority |
| alive but phase/ownership/effect evidence is unknown | suspect/probe conservatively, then hold for operator/continued observation; never guess that it is a provider stall and never auto-kill under a generic silence threshold |
| silent/no-terminal but no safe same-session, route, process, or side-effect proof | StalledOperatorRequired; no fresh session, fallback route, duplicate effect, inferred failure, or automatic new attempt |
Explain that NeedsFinalization means “Pi stopped autonomously without completing the WG protocol”; it is not evidence that work is complete and is not a canonical Done state.
Two clocks, not one deadline
- Keep
meaningful_silence_secs = 300as the initial static soft-suspect threshold. Crossing it appends evidence and performs a read-only probe; the probe itself does not reset progress and cannot authorize a prompt, TERM/KILL, or lifecycle disposition. - Introduce a separate, explicit
hard_resume_after_secs(or equivalent) resolved from the frozen route and current phase. It is a conservative not-before eligibility threshold, not a promise to interrupt at that instant. The initial free/low-QoS provider/TTFT and generation/inter-token thresholds must be no lower than 900s and may be longer by explicit route policy. There is no automatic hard threshold forUnknown, active progress, accepted wait, or a valid long tool. - Start hard-resume grace only after the phase-specific hard threshold, not at the five-minute suspect point. At eligibility, automatic fencing still requires an unchanged progress/session/process CAS, a read-only probe showing no new evidence, exact process identity and containment, safe tool/effect classification, no terminal reservation, available finite budget, and same-session/route/worktree attestation. Any failed/unknown check holds instead of killing.
- Settled and exited states are prompt/finalization eligible because of explicit quiescence evidence, not because a timer expired. Preserve exact fence/reap rules for an exited/replaced process.
- Keep thresholds static and configuration-validated in the first release. Record route/model/QoS, phase, input size/tokens, TTFT, provider duration, inter-token gaps, tool/worktree progress, suspect/probe outcomes, false suspects, resume latency/success, and possible duplicate inference cost. Telemetry cannot rewrite/decrease policy. Any future p99 adaptation requires a separate ratified design with a safety floor.
Same-session completion prompt and finite recovery
Define one short, versioned stock prompt for NeedsFinalization/safe continuation. It must neutrally state only observed no-progress/no-terminal facts, require inspection of the durable same Pi session, leased worktree, task contract, candidate state, tests, and receipt summaries, prohibit repeating side effects, and require exactly one explicit wg_done, wg_fail, or correlated wg_wait outcome. It must not blame the model or claim the task is incomplete/complete. Prompt wording is guidance, never the side-effect or completion proof.
The prompt append/send is idempotent by a durable action ID and (attempt, process_epoch, continuation_epoch, prompt_version/digest); replay first inspects the session marker and never sends a second copy for the same action. Preserve the exact session/branch, attempt/fence, worktree lease, frozen Pi route, and process fencing. No fresh session, new attempt, route fallback, or duplicate owner is allowed.
Retain durable finite automatic budgets (replacement epochs and reserved elapsed time), charged before launch and never reset/refunded by ticks/restarts. Clarify that these are recovery-exposure budgets, not normal task-runtime deadlines. At exhaustion or ambiguous effect, hold for an audited finite manual grant or lifecycle abort/fail; do not infer failure. Long-tool handling remains clamped/effect-aware rather than blindly killed at a budget edge.
Required document edits
Reconcile all conflicting text, configuration examples, diagrams, status output, rationale, implementation seams, and tests—especially §§1, 2–5, 8–9, 11, 13, 15–17. Remove/replace statements that imply 300s + max 180s grace automatically fences every Active provider/generation phase. Preserve the source design's strong same-session proof, exact-route freeze, side-effect receipts, process fencing/reap, first-terminal CAS, lifecycle single-writer boundary, and finalizer ownership.
Amend implement-pi-stalled metadata after the document is internally consistent. Its RED matrix and PTY smoke must test the exact new state table and soft-vs-hard clocks rather than the superseded universal grace behavior.
Validation
- The amended design answers “how do we know it is really Done?” with the current-epoch terminal receipt + quiescence/manifest + candidate checkpoint + validation/evaluation + authoritative finalization evidence; no elapsed-time or process heuristic can satisfy it.
-
The decision table gives different actions for terminal receipt,
agent_settled, process exit, provider in-flight, active progress, valid long tool, accepted user wait, unknown alive silence, and unsafe/no-terminal proof. - Configuration and algorithm separate the 300s soft suspect/probe from phase/route hard-resume eligibility; low/free-QoS defaults are >=900s, hard grace starts only then, and Unknown has no automatic kill deadline.
- Fake-Pi virtual-clock cases cover 300s soft suspicion, no fence at 300s+old grace, 899s hold, phase-policy eligibility at/after 900s plus hard grace, progress reset, a progressing 20-minute run, exit, settled, provider retry/in-flight, unknown, wait, tool, and explicit terminal receipt.
-
agent_settledand safe process exit enter nonterminalNeedsFinalizationand receive a prompt promptly without waiting 300s; neither observation becomes Done/Failed. - The stock prompt is short/versioned, same-session, neutral, receipt-aware, and sent once per durable action; prompt replay and finite epoch/elapsed budgets are crash-idempotent.
- Initial thresholds are conservative/static, telemetry is observational only, and future adaptation is explicitly deferred to separate ratification.
-
implement-pi-stalledmetadata and the design’s file/test seams use the amended policy consistently. Markdown links/fences and repository checks appropriate to documentation/task-metadata changes pass.
Depends on
Required by
Log
- 2026-07-26T16:47:20.345649012+00:00 Spawn failed (attempt 2/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T16:47:20.433594896+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T16:47:21.578497210+00:00 Spawn failed (attempt 3/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T16:47:24.327660019+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T16:47:25.456886410+00:00 Spawn failed (attempt 4/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T16:47:29.331803754+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T16:47:30.453793105+00:00 Spawn failed (attempt 5/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T16:47:30.453793105+00:00 Circuit breaker tripped: spawn failed 5 times. Last error: spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi. Task marked incomplete for evaluator review.
- 2026-07-26T16:52:33.590859562+00:00 Spawn circuit breaker reset (cooldown decay).
- 2026-07-26T16:52:34.220421109+00:00 Spawn failed (attempt 1/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:21:32.417333091+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:21:33.554396926+00:00 Spawn failed (attempt 2/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:21:35.468311753+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:21:36.605597965+00:00 Spawn failed (attempt 3/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:21:40.472504320+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:21:41.604934407+00:00 Spawn failed (attempt 4/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:21:43.511186571+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:21:44.653085401+00:00 Spawn failed (attempt 5/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:21:44.653085401+00:00 Circuit breaker tripped: spawn failed 5 times. Last error: spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi. Task marked incomplete for evaluator review.
- 2026-07-26T17:26:47.399979342+00:00 Spawn circuit breaker reset (cooldown decay).
- 2026-07-26T17:26:48.018994522+00:00 Spawn failed (attempt 1/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:35:26.949247361+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:35:28.104069696+00:00 Spawn failed (attempt 2/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:35:31.958348244+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:35:33.084180436+00:00 Spawn failed (attempt 3/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:35:35.035786002+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:35:36.189602770+00:00 Spawn failed (attempt 4/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:35:40.071538514+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:35:41.215095468+00:00 Spawn failed (attempt 5/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:35:41.215095468+00:00 Circuit breaker tripped: spawn failed 5 times. Last error: spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi. Task marked incomplete for evaluator review.
- 2026-07-26T17:39:54.972416202+00:00 Task unclaimed
- 2026-07-26T17:39:55.031240420+00:00 Future route pin cleared atomically: cleared_fields=[none (already unpinned)]; considered_fields=[model,reasoning,provider,endpoint,profile,tier,session_id]; inheritance=dynamic-at-dispatch; current_profile=pi-codex generation=b3:c3378a663ed5ba39c43dd9ce64c5c84104f997323e3e2e6448f7d30d551674ea currently_resolves handler=pi model=pi:openai-codex:gpt-5.6-sol reasoning=high. Unlike `wg retry --current-profile`, no route snapshot was written and task status/attempt history were unchanged.
- 2026-07-26T17:40:34.429292390+00:00 Spawn failed (attempt 1/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:40:37.837771033+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:40:38.983820254+00:00 Spawn failed (attempt 2/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:40:42.844476421+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:40:43.980729752+00:00 Spawn failed (attempt 3/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:40:44.068540233+00:00 Reconciliation: stale-claim cleared (was Open, agent: agent-894)
- 2026-07-26T17:40:45.227388679+00:00 Spawn failed (attempt 4/5): spawn transaction for agent-894 rolled back (task remains dispatchable; rollback diagnostics: task claim: refused to roll back task 'amend-pi-watchdog' because claim ownership changed from agent-894). exec_mode=default, executor=pi
- 2026-07-26T17:42:55.604937814+00:00 Task unclaimed (was assigned to @agent-894)
- 2026-07-26T17:49:20.398973895+00:00 Task unclaimed (was assigned to @agent-894)
- 2026-07-26T17:57:05.520157416+00:00 Task unclaimed (was assigned to @agent-894)
- 2026-07-26T17:57:06.035274579+00:00 Spawned by wg spawn --executor pi --model openai-codex:gpt-5.6-sol --isolation required-worktree
- 2026-07-26T17:57:19.042398181+00:00 Starting design amendment: inspecting prior WIP, source design, and downstream metadata; staying inline because both edits must be reconciled sequentially against one policy.
- 2026-07-26T18:04:08.908835917+00:00 Amended the design's authority model, layered Done proof, explicit observation/action table, static soft-vs-hard clocks, NeedsFinalization prompt path, recovery budgets, diagnostics, seams, rationale, and Fake-Pi/PTY matrices. Now reconciling implement-pi-stalled metadata to that policy.
- 2026-07-26T18:07:46.939489459+00:00 Updated implement-pi-stalled description only (all dependencies/title/route/priority unchanged) with the amended lifecycle table, soft/hard RED matrix, NeedsFinalization cases, layered Done proof, and installed-binary PTY requirements.
- 2026-07-26T18:08:29.681589619+00:00 Committed: 23261c59 — pushed to remote (docs/design-pi-session-watchdog.md). Downstream implement-pi-stalled metadata was updated via wg edit.
- 2026-07-26T18:08:44.743443775+00:00 Validated task criteria: DoneProofV1 requires current terminal + quiescence/manifest + candidate + validation/evaluation + authoritative finalization; ten-row decision table present; 300s soft probe separated from frozen >=900s free/low-QoS hard policy and later grace; NeedsFinalization/prompt/budgets are nonterminal and crash-idempotent; Fake-Pi and PTY matrices cover all requested states.
- 2026-07-26T18:08:44.791641780+00:00 Validated repository/document checks: full amended document re-read; Markdown fences balanced; local links exist; stale universal-grace phrases absent; implement-pi-stalled metadata markers verified; git diff --check and cargo fmt --check pass; no production code changed; worktree clean and commit pushed.
- 2026-07-26T18:08:57.140054780+00:00 Task marked as done