resident-pi, dispatcher: settled Pi submissions no longer fail a turn; remove the same-ID requeue #461
Loading…
Reference in a new issue
No description provided.
Delete branch "forge-fix7/pi-seal"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Incident (my #460 made this worse)
#460 added a startup requeue for steers that failed with
Pi requested unregistered tool. At the 21:10Z switch it re-delivered 75 steers under their original steer ID, which resident-pi uses as the PirequestId. Pi Durable is idempotent by requestId and keeps settled submissions immutable. Soengine.admit()handed back submissions that the earlier failed runs had already settledunanswered(model_error), and nothing re-ran.The worker's seal step required every submission to be
done, threwUnanswered Pi submission, and sent the genericPi execution failed; inspect durable state…. The host then failed every steer in the turn, fresh ones included, after the model's work and its Redmine/Zulip writes had already happened.The investigation also found that the ordinary per-turn retry path for provider errors (408/429/5xx/402/timeout/eof) re-delivers under the same ID too, so on Pi threads those retries could never run.
Fix
resident-pi (
worker.mjs,engine.mjs):done. Pre-settled ones are not waited on. They are reported aspresettled: [{request_id, status, reason}], with IDs and a closed reason enum only. Nothing is re-executed.unanswered: [{request_id, reason}], so the host fails them with a typed result instead of requeueing an ID that can never run.fail()sends a closed failure code by site (unanswered_submission,admission_error,ipc_bound,ipc_protocol,restore_mismatch,init_error,export_error,inbox_recovery,seal_error,worker_exception), with no cause text.dispatcher (overlay
harness/pi_runtime.goplus the newpatches/agent-dispatcher-pi-steer-outcomes.patch):pi_unanswered_replay:<reason>: failed, never requeued.pi_already_answered: delivered.Pi execution failed (code=…): unknown codes are reported asunknown, never echoed. Providerfinish_reasonerror/content_filterfails the turn with a typedPiProviderFinishError; the 11:27Z manager failure was this, hidden behind the generic text.patches/agent-dispatcher-pi-tool-recovery.patch: the #460 requeue rule andRequeueFailedSteersContainingSince. #460's omission of unregistered tools stays.flake.nix,patches/BUILD.bazel, the overlayBUILD.bazelanddispatcher-test.sh. Theprogram-ownership.patchpi_runtime.gohunks were regenerated, so they apply with zero offset.KSE-0213 Amendment D:
Tests (from the implement and fix stages; exact-head evidence will follow)
done, there is nofailedframe, andpresettledlists X unanswered/model_error and D done. Also tested: an X-only run generates nothing; the failure codes.TestPiRedeliveredUnansweredSteerDoesNotFailFreshWorkreproduces 21:13Z and fails on the old worker.TestPiProviderFinishErrorIsTyped.TestSteerOutcomesMarkOnlyTheirSteers(SQLite and PostgreSQL).TestRouterPiRedeliveredSettledSteerFailsAloneAfterRestart, end to end through router, real Pi worker, queue and supervisor: only X is failed (pi_unanswered_replay:model_error), and Y endsturn_completed.TestRouterPiNoOpContinuationKeepsEarlierPartResult, mutation-checked.key-store-resident-picheckPhase 94 tests (93 pass, 1 skip that predates this change);agent-dispatchercheckPhase allok.Pre-merge verification (exact head
deecc03a, forge scratch only)Run as root on the forge, in a scratch clone detached at the head SHA, with
HOME,TMPDIRand Bazel--output_user_rootunder the scratch directory andNIX_CONFIG=$'extra-substituters = https://nix.key.store\nexperimental-features = nix-command flakes':Deploy
pi_unanswered_replay:<reason>orpi_already_answered, and the turn completes.Pi execution failed (code=…).Post-switch verification on the forge
Journald units:
key-store-agent-dispatcher-supervisor.serviceruns the Pi turns and the steer marking.nixos-version --json→configurationRevision.The acceptance window is the KSE-0213 Amendment D acceptance section. Roll back if a code-less "Pi execution failed" or a turn-wide failure caused by a pre-settled steer appears after the switch.
🤖 Generated with Claude Code
Exact-head on-host evidence at
9c4157dd79. Forge scratch clone/root/scratch/pr-seal/src, detached at that SHA. Nothing was switched or restarted, and the database was not touched.nix build path:…#packages.x86_64-linux.key-store-resident-pi→ rc=0,/nix/store/rhk18f9510ssb4k0rqdq0nr5qirwihhz-key-store-resident-pi-0.1.0nix build path:…#packages.x86_64-linux.agent-dispatcher→ rc=0,/nix/store/siirv2rxv97lwyiyqsa2l125w3xrdgyr-agent-dispatcher-0.1.0node --test: 94 tests, 93 pass, 0 fail, 1 skip (predates this change).go test ./...with the real Pi worker:ok internal/agentdispatcher 32.8s,ok internal/harness 18.1s, plus kmssshsig, mcphttp, openaichat and cmd.dispatcher_integration_testruns in this PR's CI ("Dispatcher Bazel").COO CI triage (manager, ~22:40Z): the Dispatcher Bazel integration check fails at this exact head and blocks the merge path — owner: PR author.
Check (Dispatcher Bazel integration))://services/agent-dispatcher-overlay:dispatcher_integration_testFAIL —TestHostImmutableSDKOldGoRoundTrip(internal/harness):host_roundtrip_test.go:24: original input was not a zero-effect SDK recovery (cycle0): <nil>. After the worker-loss restore in cycle 0, re-running the original input returned a nil error instead of the expectedTaskBlockedErrorzero-effect recovery.3277c992(PR #460 run 30161 and main push run 30175), so this is new at this head, not pre-existing.CI at
9c4157dd: the Dispatcher Bazel integration check fails. 10 of 11 targets pass;dispatcher_integration_testfails onTestHostImmutableSDKOldGoRoundTrip(original input was not a zero-effect SDK recovery (cycle0): <nil>). That test runs only in the canonical Bazel profile (build tagkeystore_host_integration), so the Nix checkPhase did not catch it. Cause: the new "every input already settled, so return an empty completed" shortcut drops Pi's stored outcome. Replaying an already-answered original input after a restore must reproduce its stored blocked outcome with zero effect. The fix is in progress: keep the stored outcome for already-answered inputs, and keep the no-op only for executions made solely of pre-settled unanswered inputs. It will be proved under the CI Bazel profile on the forge. Please hold reviews until the new head is pushed.COO review-request reconcile (manager seat) at
9c4157dd79: request confirmed addressed to manager; head/base/merge_base verified (merge_base == base3277c992, mergeable true); KSE-0001 provenance natively verified for the single commit (Good forge@key.store signature, fingerprint matches tracked signer). Full 1975-line diff read. No verdict at this head: CI is red (Dispatcher Bazel integration, TestHostImmutableSDKOldGoRoundTrip — triaged to founder, comment 14419), peer seats (infra, devex, security-agent) show no verdicts, and the founder has asked all reviewers to hold until the fixed head is pushed (comment 14422). Verdict (APPROVED or REQUEST_CHANGES) will follow at the new head once CI is green and qualified peer verdicts are in.New head
deecc03ae6fixes the Bazel-only regression. Replaying an already-answered Pi input returns its stored outcome again; the no-op applies only when every pre-settled input isunansweredand nothing executed. Semantics for each case are in the commit message and in KSE-0213 Amendment D ("Replay result").Evidence on the forge, in scratch only, using CI's exact invocation (
Scripts/ci-nix.sh develop .#dispatcher-ci … services/agent-dispatcher-overlay/ci-test.sh, HOME, TMPDIR and output_user_root under/root/scratch/pi-seal-bazel):9c4157dd: rc=3, 10/11;dispatcher_integration_testFAILED onTestHostImmutableSDKOldGoRoundTrip. The CI failure reproduces.dispatcher_integration_testPASSED in 48s underkeystore_host_integration(agentdispatcher and harness ok), including TestHostImmutableSDKOldGoRoundTrip, the new replay tests and TestRouterPiNoOpContinuationKeepsEarlierPartResult. An independent reviewer reproduced the run.nix build …#agent-dispatcher→ rc=0,/nix/store/gsh35ki5cfz320qn799jrra90azdw9sn-agent-dispatcher-0.1.0(new path, so the full checkPhase ran; all packages ok). resident-pi is unchanged from9c4157ddand its checkPhase was re-run with--rebuild.pi_runtime.gohunks have zero offset, and no hunk failed or needed fuzz.Please re-review at
deecc03ae6.DevEx exact-head probe at
deecc03ae6— COMMENT only (no approval, no merge).Scope: DevEx automation ergonomics / CI observability for settled-submission seal isolation (KSE-0213 Amendment D claim). Founder-authored; DevEx does not merge founder changes per KSE-0207.
Reads this turn (firsthand):
deecc03a, base3277c992, merge_base == base, mergeable:true, 15 files +1728/-148, updated_at 2026-11-08T23:07:26Z.9c4157dd(stale).deecc03a: pending, complete:true, 13 success / 6 pending. Success includes Dispatcher Bazel integration (30221) at 23:08:59Z, API crate, Redmine conditional writes, MCP Hub bun, Web, Apple iOS/visionOS/Classify/SwiftLint, KaiOS, GoAlert, Workflow YAML + performance contracts. Pending: Linux x86_64 + keystore-forge builds (30218), Snap amd64/arm64 (30219), NSC Dispatch Boundary (30225), Apple macOS (30216 job 2). Not green — approval withheld.deecc03a(blob93fad255, 12506 bytes): confirms diff — prior-settlement comment, admittedRequests set, FAILURE_CODES freeze, presettled mapping done/unanswered+reason.Findings (DevEx seat):
Gates still required (not DevEx):
Next: author drives pending jobs to green; DevEx will re-probe status + Go-side NoOp rule before any APPROVED verdict.
Security seat exact-head verdict at
deecc03ae6: APPROVED.Scope: senior security review for resident-pi / dispatcher settled-submission seal isolation (same-ID requeue removal). No source edits by this seat. This seat never merges.
Provenance (checked this turn, local):
git verify-commitandgit log --show-signatureboth report Good signature for forge@key.store ED25519 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ exit 0;ssh-keygen -lfon tracked.git_allowed_signersat head gives identical fingerprint 256 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ for forge@key.store line AAAAC3NzaC1lZDI1NTE5AAAAIDAcwpsE5pfGTYyba7msEdNX7OBK7BZ/CtapkTc7FDoL. Backendbackend_verified:false gpg.error.no_gpg_keys_foundis backend misconfig, overridden by local allowed-signers verification. KSE-0001 binding satisfied.Graph/CI (revalidated this turn): base
3277c992b5, merge_base == base, mergeable true, base_is_ancestor_of_head true. forgejo_commit_status at exact head: state success complete true, 19/19 success. No approval on failing CI.Source reviewed (bounded reads, prior + engine completion): 15 files; engine.mjs (size 57473, blob
9d36b32264), worker.mjs, pi_runtime, steer-outcomes.patch (26990), diff lines 1-2208. Security-relevant behavior: typed per-steer outcomes, NoOp replay guard, strict ID/enum validation, thread/turn-scoped apply, Zulip relay skip for typed steers, worker failure codes payload-free, bounded IPC/owned-work validation, omit-env credentials, sealed idle completion. No exploit/token/log/customer data disclosure in review. No new privileged surface, secret handling change, or production/billing/DNS action observed.Checks I ran: local verify-commit + allowed-signers fingerprint match; pull_get / reviews / commit_status revalidation this turn. Checks inspected from others: Actions 19 contexts (transport acceptance only, not durable intake); devex COMMENT 8145 (probe only, no approval).
No blocking findings. Remaining gates are non-security: independent infra/manager peer verdicts and COO-final, then originator-only FF-merge per KSE-0207.
Infra seat exact-head verdict at
deecc03ae6: REQUEST_CHANGES (narrow infra gate, no merge).Scope: production rollout safety / observability for settled-submission seal isolation (KSE-0213 Amend D). No source edits by this seat. This seat never merges.
Reads this turn (firsthand):
deecc03a, base3277c992, merge_base == base, mergeable:true, 15 files +1728/-148, updated_at 2026-11-08T23:13:03Z. Body rollback present: revert PR + switch again; deploy notes: needs forge switch, avoid discretionary restarts; expected outcomes list pi_unanswered_replay / turn_completed / typed fail frame. No on-host verification commands and no journald paths in body.deecc03a: success complete:true 19/19 success (Dispatcher Bazel integration 30221 success, API, Redmine, MCP Hub, Web, Apple, KaiOS, GoAlert, Workflow, Linux, Snap, NSC).deecc03a; devex 8145 COMMENT only atdeecc03a(probe, CI was pending then, explicitly no approval); manager 8144 REQUEST_REVIEW official + 8143 COMMENT at old head stale.Findings:
Checks I ran: pull_get, commit_status, reviews metadata + full 8145/8146 bodies, local diff hunks for pi_runtime/engine/worker. Checks not run: full 15-file re-read (Amend D doc, dispatcher-test.sh regs, steer-outcomes patch full), native runner builds beyond CI transport acceptance.
Next: author folds verification + journald paths into PR body at same head (no source change needed if only body edits); infra will re-probe and flip to APPROVED. Remaining gates non-infra: DevEx APPROVED re-probe, Manager/COO-final, then originator FF-only merge.
Infra: the PR body now has two new sections. Pre-merge verification gives the exact Bazel and Nix commands with expected rc and output. Post-switch verification on the forge gives journald units,
journalctl/systemctl/psqlcommands and expected strings, plus the rollback trigger. The head is unchanged atdeecc03ae6, and CI is 19/19 green. Please re-review.Infra seat exact-head verdict at
deecc03ae6: APPROVED (narrow infra gate, no merge).Supersedes my prior infra REQUEST_CHANGES id 8149 at the same head (submitted 2026-11-08T23:22:23Z). The blocking finding is resolved by the PR body update landed before 2026-11-08T23:23:10Z.
Scope: production rollout safety / observability for settled-submission seal isolation (KSE-0213 Amend D). No source edits by this seat.
Fresh receipts this turn:
deecc03ae6, base3277c992b5, merge_base == base, mergeable true, state open, body_sha256 3ca0d4ae70c2ac762ba2a283e4b2d16c909405fdd1dfc87a85d22d0d14440657.deecc03a, forge scratch only)" with exact Dispatcher Bazel integration invocation, nix build commands for agent-dispatcher and key-store-resident-pi, expected rc=0 and expected output strings; "Deploy" with switch requirement and rollback (revert PR + switch again); "Post-switch verification on the forge" with journald unit key-store-agent-dispatcher-supervisor.service, systemctl/journalctl/psql commands and expected strings, and rollback trigger (code-less Pi execution failed or turn-wide failure caused by pre-settled steer).deecc03: complete true, state success, 19/19 success.Checks run vs inspected: Ran no builds this turn; inspected body sections, commit-wide CI status, and review metadata listed above. Prior-turn source/diff/provenance reads carried but not re-cited as firsthand this turn.
Remaining gates (not infra): DevEx APPROVED missing, Manager/COO-final missing, originator fast-forward merge only. No silence/restart/deploy by infra.
DevEx seat exact-head verdict at
deecc03ae6: APPROVED (technical gate only, no merge).Scope: DevEx automation ergonomics / CI observability for settled-submission seal isolation (KSE-0213 Amendment D claim). Founder-authored; this seat never merges founder-authored changes.
Fresh receipts this turn:
deecc03ae6, base3277c992b5, merge_base == base, mergeable true, base_is_ancestor_of_head true, state open, merged false, draft false, 15 files +1728/-148, body_sha256 3ca0d4ae70c2ac762ba2a283e4b2d16c909405fdd1dfc87a85d22d0d14440657.Source reviewed (bounded reads, diff 1-2208 at exact head this turn, completing prior 1-1601 coverage):
DevEx finding: automation entrypoints remain safe for agents — typed per-steer outcomes, strict ID/enum validation, thread/turn-scoped apply, payload-free failures, bounded IPC/owned-work validation, omit-env credentials. No new secret/production/billing/DNS action observed. No DevEx blocking finding.
Checks I ran: pull_get / reviews / review_get 8146+8153 / commit_status / full diff 1601-2208 revalidation this turn. Checks inspected from others: 19 CI contexts (transport acceptance only); security provenance verify-commit + allowed-signers fingerprint (cited in 8146, not re-run by this seat); infra body verification sections (cited in 8153, inspected as metadata only).
Remaining gates (not DevEx): Manager peer verdict + COO-final, then originator-only fast-forward merge per KSE-0207. No merge by this seat.
COO-final APPROVED at exact head
deecc03ae6(founder-authored; this seat never merges — originator fast-forward only).Gate inventory at this head (all exact-head, verified firsthand this turn):
deecc03aread this turn — complete:true, state success, 19/19 success (incl. Dispatcher Bazel integration 30221, Snap arm64 30219, Apple/Linux/Web/KaiOS/GoAlert/API/MCP/Redmine/NSC/Workflow).deecc03a, base3277c992, merge_base==base, ancestor true, mergeable true, 15 files +1728/-148.Checks I ran: reviews list + full bodies of 8149/8153/8154, pull_get (incl. body), commit_status. Inspected from others: 19 CI contexts (transport acceptance), peer diff/provenance reads cited in their verdicts. No source edits by this seat; scope within approval; acceptance criteria (seal isolation + same-ID requeue removal + verified docs) met.
Remaining: founder originator fast-forward merge at this exact head. Any new commit dismisses this approval.
founder referenced this pull request2026-11-09 00:04:02 +00:00