Skip to content

feat: add oh-my-pi adapter for the shared host interface - #561

Merged
abogartz merged 28 commits into
abogartz:mainfrom
WhollyMindless:refactor/554-host-contract
Nov 29, 2026
Merged

abogartz merged 28 commits into
abogartz:mainfrom
WhollyMindless:refactor/554-host-contract

Conversation

@WhollyMindless

@WhollyMindless WhollyMindless commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

This adds an installable oh-my-pi 19.2.1 adapter for the shared memory engine. With the same store and project identity, OpenCode and oh-my-pi can recall and select each other's eligible memories; explicitly global memories remain eligible across projects.

Related: #554, #571 and #578. The interface/reference harness (#560) and OpenCode adapter (#564) have merged. This branch includes main 052ca880. Upstream Pi remains a separate adapter in #570.

Supported behavior

  • All fourteen memory tools retain shared validation, ownership, write gates and project/global selection.
  • Automatic system context, tool-result pulls and independent outgoing-result observations use the shared lifecycle. Failed shell results retain gate evidence but do not receive pulls.
  • Turn-end capture uses the host's model/credential resolver with a scrubbed user-message prompt and no ambient tools. Compaction capture mines the original snapshot only after successful compaction.
  • Native /repo-init and /memory-report, JSON settings, usage snapshots, package discovery and the ./oh-my-pi export are included. Native /memory remains reserved.
  • Each adapter owns its implementation helpers. Shared dependencies are the host contract and memory engine, with an import-boundary test and common behavioral conformance suite.

Capture completion (#578)

The shared runtime and this adapter no longer race cleanup against 1,000 ms or 500 ms timers. A capture request owns its deadline (captureRequestTimeoutMs, default 60,000 ms) and abort signal. Cleanup joins admitted passes, local writes and terminal evidence; late answers after cancellation cannot write. Started model passes report completion, timeout, cancellation or failure explicitly, and queue drops are attributed.

Normal interactive/RPC capture remains background work. On oh-my-pi exit, an unanswered request is cancelled with host_shutdown; an answered pass finishes its local writes.

Print/JSON invocation admission is constrained by the installed host's verified shutdown grant. With the default request deadline, capture is refused before a provider call with insufficient_host_grant. A deliberately shorter configured deadline may fit. Setup probes the actual SDK dispatcher and uses its verified exported budget, rather than pinning two seconds. If verification fails, the adapter disables capture with a content-free warning and unverified_host_lifetime evidence while retaining all memory tools, commands, recall and injection. The shared host contract still rejects unverified lifetime declarations. This adds about two seconds once per capture-enabled process. This verifies the capture-lifetime declaration, not every capability.

Validation

Windows, Bun 1.4.4, pinned oh-my-pi 19.2.1:

  • Current feat: add oh-my-pi adapter for the shared host interface #561 unit suite: 2,082 passed, 34 skipped, zero failures.
  • oh-my-pi SDK/CLI suite: 39 scenarios passed across the full run and corrected false-grant fixture rerun.
  • Root and both adapter SDK typechecks, lint/formatting and comment policy pass.
  • Native tests cover slow responses during a retained session, shutdown cancellation with an observed HTTP abort, request timeout, insufficient print-mode admission, and a deliberately false SDK grant that disables capture while preserving native command dispatch. Unit regressions cover missing/mismatched grants, changed verified allowances, operational writes/recall/injection and opaque-error safety. Packed CLI installation tests cover default refusal and a configured capture followed by restart/recall.
  • Existing provider-error tests retain opaque-key protection. Compaction, lifecycle, command dispatch, configured failed-shell pulls, usage and cross-harness sharing remain covered.
  • Restoring a numeric cleanup race fails the named cleanup-contract test; held-provider tests also check row and receipt outcomes.
  • Real OpenCode capture checks: four pass; the Windows standalone persistence assertion fails on both this implementation and unchanged pre-fix ec07ba3 under OpenCode 2.4.2. Cooperative-server capture passes. The existing upstream shutdown issue is anomalyco/opencode#66868; the failing assertion is retained.

Native integration uses scripted local providers, not live credentials. New-head CI and maintainer re-review remain required.

Install instructions and acceptance scope distinguish controlled and native coverage.

Limits

Forced termination can interrupt writes and receipts. OpenCode's pinned SDK drops the abort signal; the runtime rejects late answers but cannot promise remote cancellation there. Live provider billing/authentication, later provider/context transformations, interactive rendering and compaction paths bypassing the tested hooks remain outside the acceptance claim. Usage describes retained session history, not a billing ledger.

This is not an npm release or a stable external adapter SDK. External packaging/versioning/trust and broader single-shot policy (#571) remain separate decisions.

@WhollyMindless
WhollyMindless force-pushed the refactor/554-host-contract branch from 8f7da81 to 5f56288 Compare November 27, 2026 21:21
@WhollyMindless WhollyMindless changed the title refactor: extract host contract and programmable test harness feat: add oh-my-pi adapter for the shared host interface Nov 27, 2026
@WhollyMindless
WhollyMindless marked this pull request as ready for review November 28, 2026 03:20
@WhollyMindless
WhollyMindless marked this pull request as draft November 28, 2026 06:34
@WhollyMindless
WhollyMindless marked this pull request as ready for review November 28, 2026 16:47

@ocsi-reviewer ocsi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes — one blocker under the binding design statement (new teardown constant), everything else non-blocking. Full first-pass review at 2c6f776, base 052ca88, seat: macOS, bun 1.4.4, real hosts omp 19.2.1 and opencode v2.3.0.

The blocker — clause 8 (amendment of the binding design statement on #554)

src/adapters/oh-my-pi/extension.ts:103 — if (!config.capture) await capture.settle(500); on session_shutdown, with settle() (src/adapters/oh-my-pi/capture.ts:119-136) a Promise.race against setTimeout(resolve, timeoutMs) that returns without awaiting, cancelling, or reporting the in-flight pass. integration/oh-my-pi/capture-shutdown-runner.ts then pins the abandonment: assert.ok(duration < 1900) and zero rows for the unanswered scenario. Clause 8: no teardown duration as a constant in core or an adapter; completion is an event; the only bound belongs to the model request; a host's cap is declared data, verified at install time. This diff adds a numeric bound on the cleanup path, guesses the host's patience (measured grant: 2000 ms; measured pass cost on this machine: a mining request accepted by a real provider that never lands before exit), and its own suite asserts the loss is correct behavior. Disclosed in the body — disclosure does not satisfy the clause. HostCapabilities.shutdown has no field in which to declare a handler budget, so the declaration obligation has nowhere to live yet — that is #578's scope.

Unblock condition: land the #578 shape here — cleanup awaits the tracked pass, the request owns its abort (it already receives controller.signal; no request-level timeout exists today), an abandoned pass emits a terminal evidence line with a reason, and capture-shutdown asserts outcomes rather than a <1900 ms window. The concurrent #570 review (ocsi-reviewer[bot], 22:39:54Z — arrived during this review) reached the same blocker on the same lines independently.

Note for the family: core's own DRAIN_LIMIT_MS = 1000 (src/capture/runtime.ts) is on main, not introduced here; #578 names both.

OpenCode must not regress — no regression

Measured on this machine, same conditions, base and head:

Suite origin/main 052ca88 head 2c6f776 brief baseline
bun test ./test/ 2040 run, 2017 pass, 23 skip, 0 fail 2098 run, 2075 pass, 23 skip, 0 fail 2099 / 23 skip
bun run test:simulator (not separately run) 68 pass, 0 fail 59 / 0
bun run test:e2e (real opencode v2.3.0) (not re-run at base) 62 pass, 0 fail, 701 assertions 62 / 0 / 701
bun run typecheck — pass pass
bun run lint / lint:comments — pass / pass pass
bun run test:oh-my-pi n/a 36 pass, 0 fail, 348 expects (143 s) 36 scenarios

The brief's baseline of 2099 unit tests did not reproduce here: my origin/main run measures 2040 (182 files). Head−base = +58 tests, +9 files — strictly additive; the discrepancy is in the baseline record, not in this diff. Zero failures anywhere at base or head, so no isolation re-runs were needed (that guard mattered only for mutant runs, below). test:simulator 59→68: the +9 are test/runtime/oh-my-pi-runtime-contract.test.ts — the nine shared scenarios driven through native callbacks; OpenCode's own contract test runs unchanged (shared runtime-contract.ts untouched; promptDelivery: "combined" predates this PR).

Deleted/weakened tests: case-title set diffed between origin/main and head across test/ — zero titles removed or renamed (1630 distinct title strings at base, +37 at head; no test( → test.skip( transitions). The only modified test file is import-boundary.test.ts, additions only.

Shared e2e helpers (harness.ts, fake-model.ts) cannot weaken the OpenCode gate: every new behavior is opt-in — startFake() default sets FAKE_REQUIRE_USER_MESSAGE=0, delayMs/reasoningTokens fire only for steps that carry them (no such steps exist in main-authored scenarios), idleTimeout: 60 raises a server cleanup bound that no OpenCode assertion depends on; with no new fields the emitted SSE is exactly sse([first, final]) as before. Confirmed behaviorally: the gate runs the identical 62/701-assertion pass.

Delivered bytes for OpenCode — identical

Same dumper, both trees, one shared store/fixture (tool registrations through the real OpenCode driver; timestamps normalized): all fourteen tool schemas match name, byte count, and sha256 — e.g. memory_remember bytes=2011 sha=8b2cc08f54635693, memory_update bytes=1849 sha=c5d6dd1da0316086, memory_merge_review bytes=1796 sha=f3d0eba6893abf74, memory_status bytes=629 sha=552a646d29b6caa4 (full table measured, all 14 equal). Injected system channel 511 bytes sha=76663a77ae22beb7, pull channel 515 bytes sha=82a362aafc6b794c — byte-identical base vs head. src/ outside src/adapters/oh-my-pi/ is untouched by this diff, which is consistent. No silent byte change.

Contract coverage — MemoryHost (src/host/runtime.ts)

Defined 5/6 — installCommands is absent (commands are registered inline after setupMemory via pi.registerCommand, which works but skips the "completed before tool registration" ordering the slot exists to give). Exercised in a real session: 5/5 defined members — harness (per-harness status file store/status/oh-my-pi_<sid>.json written), capabilities, tools (14 registered, executed), lifecycle, capture (auto_capture_start evidence + provider request observed). Sub-surfaces: LifecycleHandlers exercised 7/8 — error() never called anywhere in the adapter while the OpenCode adapter routes rejected handler work to it (filed #589); MemoryCaptureHost 5/5 (subscribedEvents, labels, turnEndEvents, readTranscript, generateText, defaultModel); capability declarations complete and honest against the measured host (compaction: "split", forcedExit: "no-cleanup" — both reproduced below).

Real-host evidence on omp 19.2.1

Isolation used for everything real: OPENCODE_MEMORY_DIR under scratch (never ~/.config/opencode/memory), project dir …/561-r/omp/proj (git repo, origin https://github.com/review-scratch/proj561.git, scope hash 372754b1154b), PI_CODING_AGENT_DIR/PI_CONFIG_DIR under scratch, own models.json (evo provider via the documented shape), key read from ~/.config/opencode/opencode.jsonc, never printed. One documented leak of host behavior: omp appends one debug line to ~/.omp/logs/ regardless of the agent-dir env (verified: 190-byte PI_PROXY unset line, content inspected; snapshot-hash check shows nothing else in ~/.omp touched by this review; ~/.pi untouched — pi was never run).

  • 14 tools register and execute — partial at CLI (model called memory_remember, memory_evidence, memory_recall, read in real turns; count pinned by contract, not counted in a CLI request log — the CLI's catalog cache resolved the provider outside my logging proxy, so tools-array bytes at CLI level are uncovered; the integration delivery-runner asserts delivered bytes through the real SDK): different.
  • turn writes a memory a second session reads — observed. omp -p remembered (gate blocked once for a missing embedded reference, promoted after embedding the verified notes.md quote — same engine gate as OpenCode), fresh second session recalled it verbatim.
  • injection reaches the system channel — observed at the shared-engine byte dump above and asserted against delivered bytes by delivery-runner (delivered.includes(FACT/PULL_HEADER)); real CLI request capture uncovered (see tools).
  • /repo-init, /memory-report, /memory — different: real SDK dispatcher covers them (workflows integration green here; body's native-dispatcher claim incl. /memory reserved); print mode (omp -p "/memory-report") does not dispatch slash commands (host-side), and interactive terminal rendering stays unverified per the body's own limits.
  • compaction capture fires — observed via capture-boundaries.test.ts compact/compact-override (real SDK; proven load-bearing by mutant M3) plus anchor/bookkeeping in compaction-runner (t2_compaction==1, summarizer requests clean of the mining prompt). Real CLI interactive compaction uncovered; snapcompact/native paths out of scope per the body.
  • failure shapes — provider never answers: observed (integration unanswered: exit 0, zero rows — but that is the pinned-abandonment of the blocker). Host exits mid-capture: observed at CLI — print-mode exit left auto_capture_start in evidence with the mining request accepted by the real provider and no row and no abandon-reason (silent, as disclosed for #571). Forced exit: observed — SIGKILL at t+6 s: no rows lost, loadAll() clean (4 rows), no cleanup claimed, matches declared forcedExit: "no-cleanup".

Cross-harness sharing — passes both directions

Real binaries, shared OPENCODE_MEMORY_DIR: OpenCode (opencode run --standalone, v2.3.0, plugin from this head) wrote scope=crossharness repo=372754b1154b; oh-my-pi recalled it verbatim (learning/crossharness … Written from the OpenCode side.). Reverse: omp wrote … Written from the oh-my-pi side.; OpenCode recalled it verbatim. Negative control from an unrelated repo folder (different origin) against the same store: No memories found on both harnesses. Concurrency: simultaneous omp+opencode writes to one store — both rows landed, store loads clean.

Mutations (5)

Mutant Result
M1 session_shutdown handler dropped killed — unit (6 fails, shutdown/lifecycle/usage pins)
M2 publish() resolves success without enqueuing killed — unit (8 fails)
M3 session_before_compact not registered survived unit (2098/0) and compaction.test.ts (5/5); killed only by capture-boundaries.test.ts (2 fails) — pinned, but by an adjacent suite
M4 delivered description: tool.description → tool.name survivor — full unit 2098/0 and full integration 36/36 (filed #588)
M5 settle() returns immediately with work in flight survived unit; killed by capture-shutdown answered — by the very assertion that encodes the 500 ms window

Duplication (#561 vs #570)

At this head only the oh-my-pi copy exists — src/adapters/pi/ does not exist on main, so byte-identical duplication is latent, not introduced here. Verified against #570's head ec07ba3: completion-error.ts/transcript.ts are already byte-identical to this PR's oh-my-pi files, and at that head all five (completion-error, config, delivery, transcript, usage) are identical between pi/ and oh-my-pi/ while capture.ts differs. #570 edits this PR's files (generalizing memoryOptions with a host parameter, renaming content types) and copies the results — landing #561 alone pre-accepts nothing about #570's choices. The cost of the resulting copies, stated plainly: one shared store, two divergent byte-identical-but-independent shaping layers — a transcript-scrubbing or usage-accounting fix landed in one adapter silently changes what the other harness sends and records against the same rows and the same status.json, with no import and no test to force the second copy. src/adapters/AGENTS.md mandates the duplication, and #579/#580 show the seam enforcing it is porous; the extraction path (published, versioned shared module) remains the settled direction from #554 discussion.

Non-blocking findings and dispositions

  1. Silent capture drop when the queue is full (capture.ts:151 — resolves success at 64 pending) — covered by the deferred abandonment-accounting work the body itself defers; named, not re-ticketed.
  2. Tool-description bytes at the omp surface unpinned (M4) — filed #588.
  3. handlers.error() parity (#570 routes failures, this adapter never does) — filed #589.
  4. Shipped prose claims: extension.ts agent_end comment "Native handlers have a 30-second budget" contradicts the measured 2000 ms enforcement this same file relies on; README.oh-my-pi.md ships "under consideration in PR #561", false at merge — filed #590.
  5. Bare-specifier bypass now reaches the new ./oh-my-pi export, and @oh-my-pi/* sit in root devDependencies: already filed as #579/#580; no new finding.
  6. Compaction pre-capture pinned only by an adjacent suite (M3) — acceptable coverage; noted so a future refactor of capture-boundaries knows it carries the load.

State/surface matrix (cells: observed command or uncovered)

Event delivered bytes recall/output status/report evidence/rows counters
fresh store uncovered at CLI; empty-state contract covered uncovered observed: status/oh-my-pi_<sid>.json created on first run observed: store tree created same file
the write itself OpenCode dump 14/14 identical; omp delivery-runner asserts FACT in delivered text observed verbatim CLI recall (both directions) observed write_promoted observed row bytes incl. repo=372754b1154b observed gate_injected/write_promoted
second harness same store OpenCode recalled omp row verbatim observed both directions per-harness files coexist observed interleaved evidence concurrency run: both rows, loadAll clean
provider never answers uncovered at CLI n/a uncovered observed via integration unanswered (0 rows) — pinned abandonment, see blocker auto_capture_start with no terminal row (silent)
forced exit mid-work n/a prior rows recall after kill store loads clean after SIGKILL no new lines; matches declared no-cleanup uncovered
restart second CLI session identical tool behavior observed status file per session evidence appends across sessions uncovered
compaction anchor in summarizer requests asserted; summarizer clean of mining prompt uncovered uncovered t2_compaction==1 capture-boundaries compact/compact-override
handler cap exceeded design keeps handler sub-2 s (capture not awaited) — observed in behavior n/a uncovered auto_capture_start, no row, no reason (print mode) host timeout message itself uncovered

Rescan and record

External-input scan at start: PR #561 had zero comments/reviews/inline remarks; head 2c6f776. Acceptance rescan before this review posted: no new comments on #554/#561/#571/#578/#579/#580; #561 head unmoved; CI 7/7 pass at this head. One outside item landed mid-window: #570's CHANGES_REQUESTED review (22:39:54Z) naming the same teardown blocker — it corroborates rather than changes this verdict; anything arriving after this rescan is the late window. Blind pass was sealed before opening the body (checksum kept): predicted defects were (1) bounded-shutdown abandonment pinned as correct — confirmed, and the body discloses the behavior but not that its own suite pins it; (2) the seam's bare-specifier hole widened by the new export — confirmed, already #579. One theory difference worth the author's eye: the body still frames review around unmerged intermediate branches (#560 → #564, "GitHub's default diff includes unmerged dependencies"), but the actual diff against origin/main touches no src/host or shared engine file at all — the framing is stale and undersells that this PR is purely additive.

What remains unverified (stated plainly)

Real CLI request-byte capture of the tools array and system-channel injection (host catalog cache routed around the logging proxy); interactive-terminal behavior of slash commands; the credential-scrub claim itself (pinned by the suite's synthetic-key test, not re-measured); omp plugin uninstall round-trip; provider billing of aborted streams (body names it out); relocated-checkout sharing (body names it out). None of these block; each is named so the next seat does not rediscover it.

@WhollyMindless

Copy link
Copy Markdown
Contributor Author

Note

🤖 GPT-6 responding on behalf of WhollyMindless

The teardown blocker is addressed in 8d83b28d using the #578 shape. Core's 1,000 ms drain and the adapter's settle(500) race are gone. Requests own their deadline and abort signal; cleanup joins passes, local writes and terminal evidence. Queue drops now report an attributed reason.

oh-my-pi keeps normal interactive/RPC background capture. Exit cancels unanswered requests with host_shutdown, while answered passes finish saving. Print/JSON admission requires a request deadline that fits the verified host grant; the default is refused before any provider request. Installation probes the real SDK dispatcher (about two seconds once per process), and a falsified grant fails before registration.

Verification: 39 native oh-my-pi scenarios pass, including observed HTTP abort, request timeout, default print refusal, configured print capture and false-grant rejection. The combined downstream unit suite passes 2,093 tests with 34 platform skips. Root/both SDK typechecks, lint/formatting and comment policy pass. Restoring a numeric cleanup race fails the named cleanup-contract test.

The real OpenCode cooperative-server capture passes. Its standalone Windows persistence check fails identically on unchanged ec07ba3 and this implementation under OpenCode 2.4.2; the assertion remains enabled and anomalyco/opencode#66868 remains relevant. The PR body now states the current behavior and limitations. Please re-review the blocker; new-head CI is pending.

@ocsi-reviewer ocsi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delta review: capture-completion fix (8d83b28, pi half 96a6cac)

Adversarial delta review against the clause-8 amendment. READ-ONLY: run in scratch worktrees under a temp dir; the live checkout was confirmed clean at 052ca88 on main before and after. Heads unchanged during the review (561 8d83b28, 570 96a6cac, no new comments after the head-update note).

Verdict: request changes. The OpenCode blast radius is sound — no regression, no delivered-byte movement, the teardown fix is fail-before tested, and no forbidden teardown constant remains on the cleanup path. One blocker is specific to the new oh-my-pi adapter: install-time grant verification hard-fails the entire adapter and silences all memory (not just capture) when the host's declared grant drifts from the value pinned in the adapter, with no degraded capture-disabled fallback. Everything else is approve-quality; details below.

Clause 8 — sentence by sentence

  1. "No duration constant on a cleanup path in core or an adapter." — MET. DRAIN_LIMIT_MS is absent from src at both heads; the settle(500) race is gone. The only remaining timers are the request deadline (src/capture/request.ts, owned by the request, explicitly allowed) and the install-time contract probe watchdog in src/adapters/oh-my-pi/lifetime.ts (max(10_000, declared*2)) — the latter is on the install-diagnostic path, not the cleanup path, and does not govern whether a pass's work survives. A structural AST test (test/host/capture-cleanup-contract.test.ts) fails any setTimeout/Promise.race/settle(duration) in the five cleanup files. My M_F (reintroduce a 1000 ms drain race) is killed by that named test.
  2. "Completion awaited as an event." — MET. Core teardown is drainInFlight = await Promise.allSettled([...inFlight]) (src/runtime/capture.ts:217); runPass is registered via track() (:1147), so dispose joins the live pass. oh-my-pi/pi session_shutdown awaits completion; no Promise.race on teardown.
  3. "The only bound belongs to the model request with its own abort." — MET. createCaptureRequest owns a timeout and an AbortController, forwards the signal to the host, and rejects the store on late answer. The real-host runners observe the abort reaching the provider socket. M_A (remove the timer + cancellation wiring) makes the request-lifecycle deadline/abort tests unable to pass.
  4. "A host's cap is declared data, verified at install." — MET in mechanism, DEFECT in failure mode. The grant is declared (shutdownGrantMs: 2_000) and verified against the installed SDK dispatcher: verifyOhMyPiLifetime drives a real ExtensionRunner with a never-resolving session_shutdown handler and requires the observed handler timed out after Nms to equal the declared value. config.captureLifetime makes it overridable. The defect is what happens on verification failure — see the blocker.
  5. "If the grant cannot fit the work, do not start it and report." — MET. runPass compares the per-pass remaining grant to the request deadline and the verified grant, and refuses with auto_capture_refused reason=insufficient_host_grant before any read or generation. Confirmed on the real host: the short-grant scenario reports insufficient_host_grant with 0 model calls.

Regression table (this machine, same harness both heads)

Check main 052ca88 head 8d83b28
unit bun test ./test/ 2017 pass / 0 fail / 23 skip 2087 pass / 0 fail / 23 skip (+70)
test:simulator 59 pass / 0 fail 68 pass / 0 fail
test:e2e (real opencode v2.3.0) 62 pass / 0 fail / 701 expect 62 pass / 0 fail / 701 expect
typecheck 0 0
lint (biome lint+format) 0 0
lint:comments clean (0 added) clean (105 added)
test:oh-my-pi (real omp 19.2.1) n/a (new) 39 pass / 0 fail / 363 expect

Reconciling counts: the author's note reports "2,093 tests / 34 skips"; on this machine I get 2,087 / 23. The absolute delta is platform-conditional skips, not a code difference — what matters is the internally-consistent same-machine gap (+70 unit tests, 0 failures going main→head) and e2e matching the brief exactly (62/0/701). No OpenCode regression.

Delivered-bytes table (real captured requests, sha + byte count)

Captured from real opencode run turns against the scripted provider at both heads, twice each.

Surface value main vs head
Full tools array (26 = 14 memory + 12 host: edit, execute, glob, grep, question, read, shell, skill, subagent, webfetch, websearch, write) 12645 bytes, sha 085dce0c… identical, all four runs
Plugin-injected system block (deterministic harness, seeded store) 604 bytes, sha 6a4a2e31…; 14 memory schemas 6221 bytes sha 60b684b3… identical
Real-request system channel (whole channel, incl. opencode base prompt) 8722 bytes constant length identical; sha drifts between two runs of the same head (session nonce), so no commit-attributable change
Pull channel (memory_recall schema + output) recall schema unchanged the fix touches no recall/read/inject path

Nothing moved on the delivered surface is attributable to this change. The diff confirms it: no edits to src/inject, src/tools, src/adapters/opencode, src/status/payload.ts, or src/core. The only status change (report.ts/metrics.ts) alters the memory_status capture-health line, not a tool schema.

Shutdown-runner assertions, before → after

Both runners dropped the duration < 1900 cap and the unanswered ? [] : [fact] abandonment pin.

  • oh-my-pi (integration/oh-my-pi/capture-shutdown-runner.ts) now asserts, per scenario, a terminal evidence line with the expected reason and a provider-socket abort observation: answered (provider sleeps 3400 ms) → rows=[fact], reason=completed; request-timeout (captureRequestTimeoutMs:500) → rows=[], reason=request_timeout, abort observed; unanswered → reason=host_shutdown, abort observed; short-grant → rows=[], modelCalls=0, reason=insufficient_host_grant; false-grant → install rejects with /does not honor its exported shutdown grant/.
  • pi (integration/pi/capture-shutdown-runner.ts) asserts answered saves [fact] with reason=completed, and unanswered (captureRequestTimeoutMs:1000) → rows=[], reason=request_timeout, abort observed, plus an auto_capture_finish receipt before disposal returns.

A better implementation is not failed by these assertions (a 3400 ms answer that lands is what they now require). The one assertion that pins a specific failure mode is false-grant: it requires install to reject, so it would fail a graceful-degrade implementation. That is exactly the design question in the blocker.

Fail-before coverage for the fix

Each fix component has a test that fails without it:

  • event-completion teardown: capture-dispose-drain.test.ts (M_E → 6 fails, incl. "a pass that already holds its answer is drained, not abandoned" and "cleanup awaits a slow unanswered capture beyond both former teardown bounds").
  • no numeric cleanup bound: capture-cleanup-contract.test.ts (M_F → fails by name/line).
  • request owns timeout+abort: request-lifecycle.test.ts (M_A → cannot pass).
  • install grant verification: capture-lifetime.test.ts + real false-grant scenario (M_B → fails).
  • queue-overflow report: oh-my-pi-capture.test.ts ("queue overflow is reported…", M_C → fails).

Install-verification failure mode — the blocker

verifyCaptureLifetime runs first inside setupMemory (src/runtime/setup.ts:52), which is inside the adapter's try (src/adapters/oh-my-pi/extension.ts:117); a throw is re-thrown (:384). So a verification failure rejects the whole adapter factory before any memory tool or command registers — I reproduced this end-to-end with stub SDK modules:

SDK module result
omits SESSION_SHUTDOWN_HANDLER_TIMEOUT_MS THREW: oh-my-pi does not expose a valid shutdown grant
renames the export same throw
declares 2000, dispatcher honors 50 THREW: oh-my-pi dispatcher does not honor its exported shutdown grant
declares 2000, dispatcher never honors THREW: Host shutdown contract probe did not finish (watchdog)
real oh-my-pi 19.2.1 RESOLVED {shutdownGrantMs:2000} (matches declared)
factory load, verify reports 50 rejects; registerTool called = false, registerCommand called = false
factory load, verify reports 2000 (control) loads; tools + commands registered

The host survives — session.ts collects the extension error into extensionsResult.errors — so this does not crash oh-my-pi. But it silences memory for every user on such a host: no degraded capture-disabled mode, no memory tool to report it. The coupling is sharp because ohMyPiCaptureLifetime.shutdownGrantMs is hardcoded 2000 while the declaration is supposed to be the host's exported value; a legitimate host retune of that budget (e.g. 2000→2500) makes the observed timeout differ from the pinned 2000 and silences memory until the plugin ships an update. The only mitigation is the user setting autoCapture:false (which skips the lifetime and keeps the memory tools), but autoCapture is on by default, so default users are the ones affected.

Recommendation: on verification failure, disable capture and report, keep the memory tools registered (matching the adapter's own no_capabilities degrade in runtime/capture.ts), rather than failing the whole load; and treat the SDK's exported/observed grant as the source of truth instead of pinning 2000 and hard-failing on any delta. This is why I request changes even though the OpenCode side is clean.

Real-host timings (oh-my-pi 19.2.1, isolated store)

bun run integration/oh-my-pi/_runscenario.ts <scenario> (scratch wrapper around the shipped runner; store + evidence dumped):

  • answered — exit 0, wall 8137 ms, row written context/batch: "The nightly archive job keeps fourteen days of tarballs." tags=auto-capture, terminal auto_capture_finish reason=completed. A provider answering at 3400 ms — slower than every prior bound — now lands.
  • request-timeout (captureRequestTimeoutMs:500) — exit 0, rows=[], terminal auto_capture_refused reason=request_timeout + auto_capture_finish reason=request_timeout. The run terminates on the request's own bound; not silent.
  • short-grant (default config) — exit 0, wall 3791 ms, rows=[], refused reason=insufficient_host_grant, 0 model calls: the run does not start work that cannot fit the 2000 ms grant, and reports why.

Mutation table

# Mutation Result Killer
M_A drop abort/timeout wiring in capture/request.ts killed request-lifecycle.test.ts (deadline/abort tests cannot pass; bun hung)
M_B remove the grant mismatch throw in host/capture-lifetime.ts killed capture-lifetime.test.ts "installation rejects a false host shutdown grant…"
M_C remove queue_full report in oh-my-pi capture.ts killed oh-my-pi-capture.test.ts "queue overflow is reported…"
M_E make core drainInFlight return immediately (abandon) killed (6) capture-dispose-drain.test.ts
M_F reintroduce a 1000 ms drain race in core killed capture-cleanup-contract.test.ts (named)
M_D oh-my-pi settle() resolve immediately survived unit + real-omp none
M_G pi session_shutdown skip await capture.settle() survived real-Pi integration none

M_D and M_G survive because the adapter-layer settle() is defense-in-depth: the load-bearing join is the shared core drainInFlight, which runtime.dispose() awaits and which M_E proves is tested. So the surviving mutants are not silent data-loss — but it does mean the adapter settle() await is neither independently verified nor independently necessary given the current ordering. Worth either dropping as redundant or covering with a scenario where the core drain does not also fire.

State / surface matrix

Scenario Observation Command
fresh store row written, reason=completed …_runscenario.ts answered
provider never answers rows=[], reason=request_timeout/host_shutdown, abort observed at provider …_runscenario.ts request-timeout; pi unanswered
provider slow-but-answers row saved at 3400 ms …_runscenario.ts answered
grant smaller than work reason=insufficient_host_grant, 0 model calls …_runscenario.ts short-grant
host omits grant verify throws → adapter load rejects before tools stub driver
host renames grant same throw stub driver
host honors ≠ declared "does not honor" throw stub + false-grant
concurrent second harness, same store covered by integration/oh-my-pi/shared-store.test.ts (in the 39-pass run) bun run test:oh-my-pi
existing store, capture into non-empty covered by unit/e2e seeded-store suites bun run test
forced SIGKILL mid-model-call uncovered — no test kills mid-pass and asserts store integrity —
restart uncovered in my runs (append-only + lock is the design safety, not observed here) —

Ticket status vs their own acceptance criteria

  • #578 — genuinely fixed. Both bounds gone + named-mutation guard; slow provider saves on a real host; never-answering terminates via the request's own timeout with an observed abort; install verification rejects a non-honored grant; short grant reports insufficient_host_grant. The settle()-redundancy is a nuance, not a missed criterion.
  • #583 — fixed, minor note. Every started pass leaves a terminal, reason-tagged line; the runners assert the receipt exists per scenario. Minor: the request_timeout path writes two terminal lines (refused + finish) rather than "exactly one"; not a silent loss, but slightly over the "exactly one" wording.
  • #584 — fixed at the evidence-log layer, incomplete at the status surface. Overflow now writes auto_capture_skipped reason=queue_full (the old silent Promise.resolve() is gone, M_C kills it). But queue_full is an auto_capture_skipped event, and metrics.ts' blocked counts only *refused/*blocked/*partial while report.ts' lastTerminal whitelist excludes skipped events — so saturation is distinguishable in the evidence log but not surfaced in the memory_status capture-health line. Worth adding to the status summary.

Unverified / caveats

  • No real OpenCode provider credentials were used; delivered-byte and real-request captures run against the repo's scripted fake model. The oh-my-pi/pi real-host runs use the repo's isolated agent dirs + local proxy, not your configured provider.
  • Forced mid-capture kill and restart-survival are uncovered above.
  • The provider's behavior for an aborted in-flight HTTP stream (billing/dup) is out of scope per #578.
  • Side-effect disclosed: running the real omp host appended small debug lines to ~/.omp/logs/ (e.g. one 201-byte file) despite isolated agent dirs, as expected for this host.

No merge, push, close, rename, or rebase performed. All scratch worktrees and the live-checkout state left as found.

@WhollyMindless

Copy link
Copy Markdown
Contributor Author

Note

🤖 gpt-6-astra responding on behalf of WhollyMindless

The startup blocker is addressed in 30d3605e, carried into #570 as 998f5fd4.

oh-my-pi now derives its allowance from the installed SDK's exported and observed grant. Verification failure disables capture and emits a static warning plus auto_capture_disabled reason=unverified_host_lifetime; all fourteen memory tools, native commands, recall and context injection remain available. Raw probe errors are not logged. The shared contract still rejects false declarations: the adapter instead offers no capture capability in this degraded mode.

Six new unit regressions cover a changed valid allowance, missing/mismatched/unobservable grants, probe exceptions, working writes/recall/injection/commands, no capture, and opaque-error privacy. The real SDK false-grant scenario now checks successful loading, native command dispatch and zero capture requests. Its injected 50 ms startup fault is reset before ordinary session disposal so it does not also truncate unrelated status writes.

Validation: #561 full unit suite 2,082 passed / 34 skipped / 0 failed; all 39 oh-my-pi native scenarios pass across the full run and corrected false-grant fixture rerun. On the combined #570 branch, 58 runtime/boundary/lifetime tests pass. Root and both SDK typechecks, lint/formatting and comment policy pass. New-head CI is pending.

The non-blocking observations about redundant adapter joins, duplicate timeout receipts and queue saturation in the status summary remain follow-ups; this delta addresses the startup blocker without changing request or teardown policy. Please re-review.

@ocsi-reviewer

ocsi-reviewer Bot commented Nov 29, 2026

Copy link
Copy Markdown

🤖 GPT-6 responding on behalf of ocsi-reviewer[bot]

Pointer, not a re-review: the single blocker in the newest review on this PR — install-time capture-lifetime verification hard-failing the adapter, so a host grant that drifts from the pinned declaration silences all memory instead of turning capture off — is the specific instance of a general gap now tracked as #591 (Adapter seam contract: declared degradation ladder and a doctor entry point).

Relevant because the general contract decides how this code should read once the immediate patch is in. This PR already ships the two pieces that contract needs for one seam: the declaration is data (shutdownGrantMs, with null meaning the host joins cooperative cleanup without a handler deadline) and it is verified against the live dispatcher rather than trusted. What #591 adds on top is that a failing seam resolves to a named, visible state — ok, degraded, unavailable — that never prevents tools, commands, recall or injection from installing, plus a deliberately-invoked doctor to run the slow probes the install path should not pay for.

So the request here stays narrow: on a verification mismatch, capture off with a legible reason and the memory tools intact. The shape of that fallback, whether it is copied per adapter or expressed once in the host interface, belongs to #591 rather than to this pull request. No action needed on this comment.

@ocsi-reviewer ocsi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: approve — the install-time capture-lifetime blocker is resolved at 7263375

The blocker was: install-time verification of the capture lifetime hard-failed the adapter, so a host whose shutdown grant drifted from the pinned declaration silenced all memory (14 tools + 2 commands) instead of turning capture off.

At this head that is fixed, and the fix is covered by tests that fail before it. A host whose grant cannot be verified now keeps every memory tool, both commands, recall and injection, and loses only capture — with a reason the operator can read twice (console at load, evidence line thereafter). No capture request starts while the contract is unverified, so nothing is saved and nothing is claimed.

I found no regression, no delivered-byte change, no remaining teardown constant that decides whether work survives. Two follow-up findings below are non-blocking. Everything I did not prove is listed under Not verified.

Reviewed head: 7263375 (confirmed still the PR head immediately before posting; no new commits landed after my checkout).


1. Regression table (my machine: bun 1.4.4, macOS, real opencode v2.3.0)

Gate main 052ca88 (measured here) head 7263375 Prior measurement Status
bun test ./test/ 2017 pass / 0 fail / 23 skip, 15 988 expects 2093 pass / 0 fail / 23 skip, 16 385 expects 2017 → 2087 matches; the +6 are exactly the new test/host/oh-my-pi-lifetime.test.ts
test:simulator (test/simulator + test/runtime) — 68 pass / 0 fail, 413 expects 68/0 matches
bun run test:e2e (real opencode v2.3.0) — 62 pass / 0 fail, 701 expects 62/0, 701 matches
bun run test:oh-my-pi script absent on main 39 pass / 0 fail, 363 expects 39/0/363 matches
bun run typecheck — clean (exit 0) clean matches
bun run lint (biome + format:check) — exit 0; 911 pre-existing biome warnings, format clean clean matches
bun run lint:comments — clean (109 added comment lines) clean matches

Environment note, so nobody chases it: test:oh-my-pi starts with bun x tsc -p integration/oh-my-pi/tsconfig.json, and integration/oh-my-pi has its own package.json + bun.lock. A fresh worktree that has only had a root bun install fails that step with TS2307/TS7006 against @oh-my-pi/pi-coding-agent. After bun install in integration/oh-my-pi, both typecheck and the gate are clean. Nothing here is a pull-request defect.

Worth a separate ticket: the five jobs in .github/workflows/ci.yml (lint, test, test-windows, smoke, smoke-stable) do not include test:oh-my-pi, so the real-SDK scenarios below run only on developer machines.

2. Delivered bytes

Path proof first, which is the strong part: across 052ca88..7263375 no file under src/inject, src/tools, src/core or src/adapters/opencode changed. The only core-side files in the diff are src/runtime/capture.ts, src/runtime/setup.ts, src/capture/request.ts, src/host/capture*.ts and src/status/*.

Real captured request at this head (one scripted turn, isolated guest with an empty then seeded store, plugin loaded from the checkout):

Quantity Value at 7263375
tools array 26 = 14 memory + 12 host
memory tools consolidate, decay, evidence, export, forget, import, init, list, merge_review, recall, remember, status, undo, update
host tools edit, execute, glob, grep, question, read, shell, skill, subagent, webfetch, websearch, write
JSON.stringify(tools) 28 910 B · sha256 937892fc08ac · sha1 c28256162d24
same, keys canonicalised 28 910 B · sha256 d54937ad7bba
tool names only, sorted 286 B · sha256 5e4d37bf2fa8
static plugin system block, as delivered 266 B · sha256 ebb49101863c (## Persistent memory (opencode-self-improvement) + its three sentences; 267 B / 32050438f6f2 including the leading newline the plugin pushes)
frontier block with one open row 222 B · sha256 11d3de2772f9
whole system message of the agent request 9 215 B · sha256 29f41c3cc200

I could not reproduce 085dce0c… or 6a4a2e31… from any of these normalisations, so I cannot compare digests with the earlier measurement — I have no base-side capture taken with the same script either. What I can state: the byte-producing code was not touched by this diff, and the delivered shape at this head is the documented 14 + 12 tools with the unchanged static plugin block.

3. Fail-before on the degradation path (30d3605/7263375)

Baseline for test/host/oh-my-pi-lifetime.test.ts at head: 6 pass / 0 fail / 31 expects. Each mutant applied to a clean worktree, then reverted.

Mutant Result Failing test Right reason?
(a) remove the try/catch so verification throws again fails both … keeps tools, commands, recall and injection without capture Yes — the extension factory itself rejects (Installed host does not match the declared capture shutdown grant, and the probe-failure error), i.e. the original silencing returns
(b) keep the catch, leave options.autoCapture untouched fails both degradation tests Partly. It trips expect(handlers.has("session_before_compact")).toBe(false) (the compaction capture hook stays armed), not a blocked capture attempt — the fixture's ctx has no modelRegistry, so bindCompletion returns early and expect(bindings).toBe(0) cannot observe an attempt. Correct signal, indirect route
(c) swallow without the console.warn fails both degradation tests Yes — Expected to include: "auto-capture disabled" / Received: "[]". Evidence line still lands, so the warning has its own assertion
(d) degrade but skip tool registration fails both degradation tests Yes — expect(tools.size).toBe(14) receives 0

Two mutants that survive the whole 2 093-test unit suite, stated so the redundancy is on the record rather than assumed away:

Mutant Result
(e) drop the stub, capture: capture.host always survives unit
(f) never set captureUnavailable (real capture host stays registered, autoCapture still forced off) survives unit

That is defence-in-depth: with options.autoCapture === false the adapter never builds a binding and never registers the compaction hook, so the subscribedEvents: [] stub cannot be shown to be load-bearing by any test. Keeping both is reasonable; only one is attributed.

Optional test strengthening (non-blocking): give the degraded fixture a modelRegistry so expect(bindings).toBe(0) asserts "no capture attempt" directly instead of leaning on the compaction-hook assertion.

4. Real-host degradation evidence

This is the PR's own real-SDK scenario, which I ran and watched pass under bun run test:oh-my-pi (39/0/363) against the pinned @oh-my-pi/pi-coding-agent 19.2.1 in integration/oh-my-pi:

bun install                       # root
cd integration/oh-my-pi && bun install
cd ../.. && bun run test:oh-my-pi
  • default capture respects real SDK shutdown: false-grant — testSetSessionShutdownHandlerTimeoutMs(50) makes the running dispatcher contradict the exported SESSION_SHUTDOWN_HANDLER_TIMEOUT_MS (2000 declared, 50 observed). The runner then asserts, against a live session: repo-init and memory-report both resolve from extensionRunner.getCommand, a full model turn runs, /memory-report produces its custom message, modelCalls === 0 ("unverified capture must never call the provider"), evidence contains auto_capture_disabled reason=unverified_host_lifetime, and no auto_capture_start exists.
  • default capture respects real SDK shutdown: answered — the inverse: real SDK, verification passes, a provider response delayed 3.4 s still lands its row (rows.map(content) === [fact], row tagged auto-capture), terminal reason completed.
  • short-grant covers the print/JSON grant rule below; unanswered and request-timeout cover host_shutdown and request_timeout.

The same three failure shapes are pinned at the adapter seam by test/host/oh-my-pi-lifetime.test.ts: missing export (constant absent), changed dispatcher (2000 declared / 50 observed), unobservable timeout, plus a positive the installed dispatcher's verified grant survives a host retune case (2500 declared and observed → grant 2500, no adapter change needed).

I did not run the installed omp CLI binary itself, and I did not patch a live SDK module to rename the export. See Not verified.

5. Print/JSON interaction — unchanged and safe

With lifetime verification failed, lifetime is undefined, options.autoCapture is false, and the capture host is { subscribedEvents: [] }. In agent_end the binding is only built when options.autoCapture !== false, so print mode builds none: no publish, no provider call, no captured promise to join. The refusal path (insufficient_host_grant, zero model calls) belongs to a verified grant whose request deadline does not fit it — src/runtime/capture.ts:244 — and stays intact: short-grant asserts exactly one model call for verified scenarios and zero for false-grant/short-grant. The degraded run does not exit zero claiming a save; it starts no capture at all, so there is nothing to claim. It also does not write an insufficient_host_grant receipt, which is correct — nothing was refused, capture was off.

6. Finding: the degraded state is invisible in memory_status, and the line blames the user

Proven at head, isolated store, degraded adapter, then the real memory_status tool:

AUTO-CAPTURE — is it off, misconfigured, armed, or alive?
  auto-capture: off (autoCapture: false)

The user never set autoCapture: false. The adapter forced it, so recordStartup derives capture=off and captureLines() prints the config-blaming sentence. grep the evidence file and the truth is there, two lines apart:

ev=auto_capture_disabled ts=… reason=unverified_host_lifetime harness=oh-my-pi
ev=plugin_load ts=… version=0.38.2 capture=off capture_on_compact=true capabilities=[] subscribed=[] …

So the reason survives in the store, and the distinguishing heartbeat fields (capabilities=[] subscribed=[] versus a normal off instance's populated ones) are already recorded — the report just never reads them. Once the console line from load has scrolled past, a user asking "is capture running, and why not?" gets a wrong answer. This is a real gap, not a polish item.

Where the line belongs, matching the existing vocabulary (invalid_model, no_capabilities, switch_mismatch):

  • src/status/metrics.ts — add the state to CaptureHealthState and CAPTURE_STATES (next to no_capabilities at 163-164 / 228-229), e.g. unverified_lifetime;
  • src/runtime/startup.ts — the heartbeat already sees wantCapture === false together with an empty capability set, so it can name the degraded case instead of plain off (or take the reason the adapter passes);
  • src/status/report.ts — one case in captureLines(), same shape as no_capabilities: auto-capture: unverified_lifetime — the installed host's shutdown grant could not be verified, so auto-capture is disabled; tools, recall and injection remain available.

Keep the evidence token unverified_host_lifetime exactly as this patch ships it; only the heartbeat state and the report line are new. This is the shape #591 tracks generally (declared degradation ladder + doctor). This patch is consistent with it — it declares the ladder in README.oh-my-pi.md and docs/reference/oh-my-pi.md and emits a reason-coded line — so no framework is asked for here; the missing piece is one state token and one report line.

7. Finding: queue_full still never surfaces

Verified at head. src/adapters/oh-my-pi/capture.ts:183 emits auto_capture_skipped reason=queue_full when the bounded queue (64) overflows. The reason whitelist in src/status/metrics.ts:288-293 — completed, request_timeout, host_cancelled, host_shutdown, capture_threw, insufficient_host_grant — gates auto_capture_finish/auto_capture_refused into lastTerminal, and queue_full is absent; a queue-full drop only advances lastSkipped through the generic auto_capture_* tail, which never names the reason. So a queue-overflow drop is still a silent success in memory_status.

Consequence for the queue-overflow ticket: closeable only partially. The oh-my-pi adapter now bounds the queue and emits a reason-coded receipt, which is the durability half; the surfacing half (queue_full in the whitelist, so an overflow drop appears as a terminal reason) is still open, and it is the same one-line class of change as §6.

8. Clause 8, sentence by sentence, at 7263375

Clause Grade Basis
(i) no duration constant on any cleanup path MET Nothing in the two new commits adds one. The only literals left on a teardown-adjacent path are the drain-queue bound (64, a count, not a duration) and the install-time probe watchdog Math.max(10_000, declared * 2) in src/adapters/oh-my-pi/lifetime.ts — unchanged by this patch, run before any session work exists, and it decides only whether capture is armed, never whether a capture survives. Under the stated bar it is not a teardown constant that decides whether work survives; I record it here rather than pretend I did not see it.
(ii) completion awaited as an event MET Unchanged: the queue drains on done resolvers and the compaction set on tracked promises; the probe handler resolves on a promise, not a sleep.
(iii) the only bound belongs to the model request, with its own abort MET Unchanged; cancellation aborts the request and print mode joins admitted work.
(iv) a host's handler cap is declared data verified rather than hardcoded MET at this head — upgraded from MET-in-mechanism/defect-in-handling The shutdownGrantMs: 2_000 literal is gone from lifetime.ts; the exported ohMyPiCaptureLifetime() now reads SESSION_SHUTDOWN_HANDLER_TIMEOUT_MS from the installed SDK and probe-verifies the running dispatcher's observed handler timed out after Nms against it, returning the observed value. A host retune therefore needs no adapter change — pinned by the installed dispatcher's verified grant survives a host retune (2500/2500) and by the real-SDK false-grant scenario, where the retuned dispatcher (50) refuses to authorize capture instead of silently mis-sizing a deadline. The old defect was that this verified value was compared against a pinned constant and the mismatch killed the adapter at install; that handling is what this patch replaces with degradation, so the mechanism and the handling are now both correct.
(v) if the grant cannot fit the work, do not start it and report MET insufficient_host_grant with zero provider calls, plus auto_capture_disabled reason=unverified_host_lifetime and a content-free warning when the grant itself cannot be established.

9. Mutations aimed at the fix itself

Mutant Unit suite (2 093 tests) Integration re-run Assessment
(M_D) oh-my-pi settle() resolves immediately passes — survives not re-run at this head see below
(M_G) session_shutdown does not await settle() (void capture.settle()) passes — survives not re-run at this head see below

Both still survive the unit suite, matching the earlier finding. I did not re-run the ~5-minute real-SDK suite against them at this head, so I am not claiming survival against the whole tree. My reading supports the earlier conclusion rather than adding to it: the print/JSON branch awaits settle() as a courtesy join in front of runtime.dispose(), while the receipts and the drain that decide whether a write lands live in core and are covered there — so the adapter-side await is redundant with the tested core drain, and deleting it is not a proven risk. I would not block on closing this mutation, and I would not describe it as a hole in this patch either; this patch does not introduce it.

10. Carry-forward

  • queue_full — see §7: partially closeable.
  • Restart survival of a captured row — still uncovered here. The answered scenario shows a 3.4 s-delayed response landing its row in-process (I watched that scenario pass; I did not independently quote the row), and nothing in what I ran restarts the host between the write and the read.
  • Forced kill mid-model-call (SIGKILL, not a cooperative session_shutdown) — not covered by anything I ran. The documented host_shutdown path is cooperative; a hard kill is still an unmeasured claim.
  • #591 — this patch is consistent with its declared-degradation-ladder shape; §6 names the one state token and one report line that would make this instance actually observable.

Not verified

  1. No live omp CLI process run. Real-host degradation evidence comes from the PR's real-SDK scenarios under bun plus the adapter-seam fixtures; I did not install the adapter into an isolated agent dir and drive the shipped binary.
  2. The "export renamed" variant specifically: proven only as "export absent" (the same code path, since the adapter reads one named export and requires a safe positive integer). A rename that leaves a same-named export with a wrong type is covered by the same Number.isSafeInteger guard but not exercised separately.
  3. Base-vs-head digest equality of the tools array and plugin block. My normalisations do not reproduce the earlier shas and I have no base capture with the same script; byte stability rests on the untouched-file proof plus the head-side capture in §2.
  4. M_D and M_G against the real-SDK integration suite at this head (unit only).
  5. Forced kill mid-model-call; restart survival of a captured row.
  6. memory_status for the degraded state on the opencode harness — the §6 proof is the oh-my-pi instance; the report code is shared, so the same off (autoCapture: false) line applies, but I only observed the oh-my-pi one.

@abogartz
abogartz merged commit 82dfb0a into abogartz:main Nov 29, 2026
7 checks passed
@abogartz-opencode-self-improvement

Copy link
Copy Markdown

🎉 This PR is included in version 0.39.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants