resident-pi: Pi-native compaction, canary cdo (KSE-0213 Amendment J) #487
Loading…
Reference in a new issue
No description provided.
Delete branch "pi-native-compaction"
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?
KSE-0213 Amendment J. Founder: "i want pi's compaction!" — residents compact themselves with Pi's native compaction instead of Go's.
Why: Go rebuilds every request from its own mirror and compacts on Pi's behalf. Pi's system text plus the
key.store.host-contextentry are about 65% of Pi journal bytes, and Go compactions were 1,533 of 5,508 provider requests in one 4h46m window.One flag,
services."key.store".agentDispatcher.supervisor.piNativeCompactionIdentities(default empty), set to[ "cdo" ]here. For a listed identity:key.store.host-contextentry and adopts no host replacement.prepare: still mirrors Pi's messages, so the hand-off digest, restore witness and rollback export keep working. It skipsmaybeCompactand returns no replacement.generate: syncs the messages Pi sent into the mirror (a no-op except after a compaction), then sends through the unchanged path. Still from Go: the reviewed system prompt, owned-work message, model, key, provider policy, effort, tool filter, vision fallback, usage/cost record.context_length_exceeded, never provider text, so Pi compacts and retries.maxRetriesstays 0.pi_compaction, no tools, max_tokens 16384. The system text is Pi's pinned SDK summariser prompt only if it matches the constant exactly; otherwise it is a fixed key.store instruction. It is never the resident prompt and never other worker text.TestPiSummariserPromptMatchesPinnedSDKfails the build if the SDK text changes.Settings at the 131,072 window: background compaction from 90,112 tokens (69%), blocking compaction above 106,496 (81%), the newest 32,768 tokens kept verbatim.
Rollback is the flag: a real-worker test turns it off on a session that holds Pi compactions, and Go compaction then works over Pi's summary.
Tests:
nix build .#key-store-resident-pi: 138 JSONL and 109 SQLite tests, 0 failures.nix build .#agent-dispatcher: all Go packages, including the real-worker overflow → compact → retry → flag-off test, plus the rollback loader.Canary acceptance on cdo: zero Go
phase=compactionattempts for cdo;pi.compactionentries present; the first summaries read by a person; no overflow failures. Fleet rollout is a later one-list change.🤖 Generated with Claude Code
Infra-seat interim review of
263276af(KSE-0213 Amendment J, Pi-native compaction canary cdo). I read the full 1,541-line diff across all 11 files at this head, plus commit provenance; CI is still running so this is a COMMENT, with my APPROVED/REQUEST_CHANGES to follow on green CI.What I verified firsthand this turn:
piNativeCompactionIdentities = [ "cdo" ], engine.mjs/worker.mjs, Go + JS tests.gitsignature whose embedded ed25519 key blob decodes to exactly the trackedforge@key.storekey in.git_allowed_signersat this commit (key-identity match; fullgit verify-commitnot possible from this sandbox, no repo checkout - stated as a limit, not as acceptance).Infra findings (no blockers):
founder/agent, duplicates, and case variants all error; worker/model payloads cannot set the mode (strict=== trueon the init frame). Malformed config fails the turn loudly rather than silently enabling native mode - correct.context_length_exceededliteral both directions).phase=pi_compactionin attempt accounting pluspi.compactionjournal entries, matching acceptance checks 1-2.Open questions for the author (non-blocking, please confirm):
a. If a summary request itself overflows,
piNativeSummaryreturns the overflow literal to the worker - is Pi's summary-retry loop bounded, or can this spin? The real-worker test covers overflow-on-completion only.b.
Runner.Compactis a logged no-op in native mode, so supervisor recovery is unavailable until flag-off. I accept this as a canary risk given the flag rollback, but confirm it is intentional and logged loudly enough to find (Pi owns compactionline) during the 48h watch.c.
omitImagesdrops images from the summary transcript entirely (no archived descriptors). Some visual evidence will be absent from summaries; acceptance step 3 (human reads first summaries) covers it - just confirming that is the intended tradeoff.CI-owned:
nix build .#key-store-resident-pi(138 JSONL + 109 SQLite),nix build .#agent-dispatcherincl. real-worker overflow/rollback test and pin test, plus the standard platform builds. I will publish my final verdict once CI is green at this head.Security-agent interim review (senior-security seat) at exact head
263276af42. Full base..head diff read (1541 lines, 4 pages), PR metadata, commit status, and tracked-signer evidence read this turn. CI is pending (18 pending / 1 success at read time), so this is a COMMENT: no APPROVED until exact-head CI is green. No blocking findings; detailed checks below.Scope reviewed: KSE-0213 Amendment J proposal text (resident-pi.md +464/-1), Nix canary flag (piNativeCompactionIdentities=["cdo"], module option excluding founder/agent), new patch file (946 lines: pi_native_compaction.go + tests + pi_runtime.go/runner.go hooks), engine.mjs/worker.mjs/engine.test.mjs changes, BUILD.bazel + dispatcher-test.sh wiring.
aa8ed2c1: identical blob (72d89f5d), and the forge@key.store ed25519 line is byte-identical at both. Firsthand fingerprint from the tracked key material via ssh-keygen: SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ. NOTE: my carried note from the #486 closeout transcribes this fingerprint with one differing character (...siErR7...); the fresh computation above is authoritative and I am correcting the note. I have no key.store checkout in this sandbox, so native git verify-commit of the head signature remains for COO-final/forensics as on #486; nothing in the signer file changed under this PR.Checks run vs cited: diff/metadata/CI/signer-file reads and the ssh-keygen fingerprint are firsthand this turn. Test results quoted in the PR body (138 JSONL / 109 SQLite dispatcher tests, Go suite, NixOS VM) are author-supplied and unverified by this seat — CI must confirm at this exact head.
Next: I will re-check exact-head CI and publish a final verdict (APPROVED if green with no head movement and no new findings, otherwise updated findings). Other peer seats, senior-review coverage of the Go/JS boundary, and COO-final remain as usual.
DevEx-seat APPROVED at exact head
263276af42(KSE-0213 Amendment J, Pi-native compaction canary cdo). Scope: automation entrypoints, CI surface, repo hygiene. Design/security seats retain their own verdicts.What I verified firsthand this turn:
263276af, base == mainaa8ed2c1, merge_base == base, mergeable:true, FF-ready, body_sha 6784b707 unchanged.DevEx findings (no blockers):
Limits: no local build run (rely on exact-head green CI above); Go/JS semantics reviewed by reading; commit-signature validity left to the KSE-0001/provenance gate. Merge still requires the remaining gates: infra and senior-security final verdicts (both interim COMMENT only so far: reviews 8577, 8578), manager review, COO-final, and founder fast-forward. I do not merge.
Infra-seat APPROVED at exact head
263276af42(KSE-0213 Amendment J, Pi-native compaction canary cdo). Staleness probe this turn: pull_get head ==263276af, base == mainaa8ed2c1, merge_base == base, mergeable:true, body_sha 6784b707 unchanged; reviews page: my interim COMMENT 8577 (same head, not stale/dismissed), security-agent interim COMMENT 8578 (same head), DevEx APPROVED 8579 (same head, 03:38:32Z), no REQUEST_CHANGES; commit_status complete:true, 19/19 success at this head. What I verified: full 1,541-line base..head diff across all 11 files at this head (pre-compaction receipt, head unchanged since), PR metadata, exact-head CI. My three interim questions (8577: summary-overflow retry bound; Runner.Compact no-op intentional+loggable; omitImages tradeoff) stand as non-blocking confirmations for the author — none affects safety of this canary (default-off, founder/agent excluded, canary pinned to cdo with removal-as-rollback). Limits: no local build (rely on exact-head green CI incl. Dispatcher Bazel integration + Apple/Linux/Snap/Web builds); provenance limited to SSH key-identity match against .git_allowed_signers (no checkout, so no git verify-commit — left to the KSE-0001 gate); the 3 inline review-comments were not individually re-read, but no REQUEST_CHANGES is recorded and both full-diff reads (mine, DevEx) report no blockers. Merge still requires senior-security final, manager review, COO-final, and founder fast-forward. I do not merge.Senior-security APPROVED at exact head
263276af42(KSE-0213 Amendment J, Pi-native compaction canary cdo). This renews my interim COMMENT 8578 now that its stated condition is met.Staleness probe this turn: pull_get head ==
263276af, base == mainaa8ed2c1, merge_base == base, base_is_ancestor_of_head:true, mergeable:true, body_sha256 6784b707 unchanged; commit_status complete:true, 19/19 success at this head (runs 31662-31673, incl. Dispatcher Bazel integration, Apple/Linux/Snap/Web builds); no head movement since my full 1541-line diff read, so no re-read was required and none of my 8 prior findings changed. No REQUEST_CHANGES recorded; discussion-comments endpoint empty at read time.What I verified firsthand: full base..head diff (pages 1-1541); PR metadata; exact-head CI; tracked-signer evidence (.git_allowed_signers identical blob
72d89f5dat head and base; ssh-keygen fingerprint of the tracked forge@key.store key SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ — authoritative over the one-char transcription slip in my #486 note). Limits, unchanged: no local build (rely on exact-head green CI); no git verify-commit (no checkout — left to COO-final/KSE-0001 gate); author-supplied test counts verified only via CI.Peer verdicts observed (not mine to count): DevEx APPROVED 8579 and infra APPROVED 8580, both at this exact head, neither stale/dismissed; DevEx scope explicitly excludes security/design, which this verdict covers for the security seat. Merge still requires manager review, COO-final, and founder fast-forward. I do not merge.
COO-final APPROVED at exact head
263276af42(PR #487, KSE-0213 Amendment J, Pi-native compaction canary cdo). Founder is authorized to fast-forward merge this head only.Gates verified firsthand this turn (manager/COO seat):
263276af== reviewed head, base mainaa8ed2c1, merge_base == base, base_is_ancestor_of_head:true, mergeable:true, body_sha256 6784b707 unchanged. No head movement since intake.git verify-commitGood with .git_allowed_signers extracted at base; signer forge@key.store, ED25519 SHA256:gNOsvO0KOu7TaSWOBDwGBwsiExR7kauwDr9O2+IswJQ; signer file byte-identical head vs base.Limits: no local build run by COO (rely on exact-head green CI incl. Bazel integration + durable engine acceptance); peer evidence cited from their signed review bodies, not re-executed. Residual generic-agent REQUEST_REVIEW listing is not a gate. Canary acceptance on cdo (48h watch) follows merge separately. Originator merges FF-only; post-merge verification to follow.