Repository navigation
fix: Emit recall context using native hook contracts - #832
Draft
buildingjoshbetter wants to merge 11 commits into
Draft
buildingjoshbetter wants to merge 11 commits into
buildingjoshbetter wants to merge 11 commits into
Conversation
This was referenced Oct 11, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #763 (C07). Emit recall context using the contract selected by trusted installed host/event argv.
Changes
SessionStart/UserPromptSubmitadditionalContextsessionStartadditional_contextSessionStart/BeforeAgenthookSpecificOutput.hookEventNameandadditionalContextSessionStart/UserPromptSubmithookSpecificOutput.hookEventNameandadditionalContextInstalled argv supplies the trusted host and exact native event; stdin fields cannot select another serializer. Legacy Claude defaults and behavior are retained. C05's
--hostcontinues to select transcript admission/identity/background routing; Stop/Compact parse--eventbut use host for transcript admission.Emission succeeds only after stdout reports the full response write and flush completes. The SessionStart recall-injected marker follows that success and a nonempty recall portion. Partial/None/oversized writes, closed streams, write/flush errors and welcome/update-only output do not mark recall. That marker records emitted context, not native host acceptance or model-visible delivery.
Cursor
beforeSubmitPromptretains capture/per-exchange storage and skips recall lookup/emission because its documented response lacks the required context transport. Capture support does not imply per-prompt injection. Trusted Cursor conversation identity uses C05's shared normalization. Cursor registrations carry--host cursorand exactsessionStart,stop,beforeSubmitPromptorpreCompactevents with existing 10/5-second timeouts. Verified owned commands migrate; foreign hooks and meretruememorymentions remain preserved.Stack and scope
Proposed normal fast-forward refresh of existing draft #832 to C07 head
26afddf7332f1586768d1d787cfe1aad2c1278e1, destinationfix/native-hook-contracts-publish-v3. Previous published head:d60536f068d58c45bef19a05d8833a3a5d7b5299.Parent is draft #831 through
fix/transcript-allowlists-publish-v3, with expected refreshed dependency head003705e9e3f4cd38f7a3abf5c79607af2ba45e7e. The plan keeps the same existing PRs, titles and base branch chain.The delta against corrected C05 contains seven paths: four production files, two hook/adapter test files and the fixture-only #630 lifecycle correction. Compared with the previous published C07 head, only the inherited C05 ownership fixture and #630 fixture changed; all production and documentation bytes are identical. C10/#766 follows C07. Shared retrieval, budget and storage functions, formula constants, model/reranker identities, dimensions and limits remain unchanged. Product egress defaults remain held.
Controls and preserved failures
The reviewed independent source retained three original Cursor negatives: collapsed conversation state, missing SessionStart conversation marker and foreign command rewriting. Corrected source passed all 17 frozen independent controls. Those controls cover trusted argv despite forged stdin, exact JSON/event fields, six write/flush failure modes, marker ordering, Cursor capture without recall, transcript admission before reads and owned command recognition.
Twenty-one new synthetic test definitions contain 75 unittest assertion/fail call AST nodes and one Python
Assertstatement. Cursor fixtures retain 29 test definitions and all 69 PythonAssertstatements, with faithful Python/package-script command inputs. These are source inventories, not runtime assertion execution totals. The frozen protection inventory retains the executable ASTs of 23 named retrieval/budget/store functions: 10 SessionStart + 13 Prompt = 23. Formula constants are checked separately and unchanged. A separate source review passes 23 scope checks protecting unrelated source and prerequisite boundaries; 15 actual-serializer checks cover supported schemas, unsupported host/events and write/short-write/flush refusal.Original old-head Windows failures remain preserved. Draft #831 at
72b66c20d5e00c6935f9ae2264b27d019b335925failed four ownership-fixture subtests because unconditional POSIX single-quoted commands were supplied to the native Windows parser; production correctly rejected them. Log SHA256ac86315cb74ffde5db2086772a793f031b90d52d55cb2e05104facdd3477f8fbis preserved in.work/reports/transcript-hosted-failure-windows-114405870142-v1.log. The first fixture childb53c35d6b8bcdd705c5893d672976a65eb35cd0bpassed its simulated methods but omitted literal-semicolon Windows coverage; that gap and its receipt remain preserved. Child003705e9e3f4cd38f7a3abf5c79607af2ba45e7eexplicitly tests POSIX single-quoted and native Windows double-quoted literal semicolons on both simulated platform paths, retaining all 32 methods, 102 assertion/fail call AST nodes and foreign/shell negatives. Production ownership is unchanged.Draft #833's old Windows job separately failed seven manual-parity methods through unescaped native paths, JSON/TOML parsing and Hermes POSIX tokenization, plus the same four inherited C05 subtests. Its preserved log SHA256 is
6b6697440d6dc5e6360df7a0aaf31bcc384c3fe9f749d8b16e93f4f57a305c72, in.work/reports/manual-docs-hosted-failure-windows-114407979608-v1.log. C10's fixture-only encoding/tokenization/canonicalization correction retains eight method bodies and 58 assertion/fail call AST nodes. Narrow JSON-compatible double-quoted STRING decoding rejects duplicate keys, aliases, tabs, malformed/trailing input and non-string collections. Actual-source synthetic controls exercise POSIX and Windows path strings; they do not establish actual new Windows CI or native host acceptance.The preserved old #832 Ubuntu experimental failure used ordinary CPython 3.14.8; actual GIL state was not measured. Its #631 zero-vector rebuild hit the unchanged nonblocking model-publication busy fence with identity
(0, "model2vec", 256). The exact lock owner and historical cause remain unproven. Log SHA256b81ee74dfc997bc0e0824bb1ee09e8537c5bba02a2dc63a95888a1d26f83d3f3remains in.work/reports/native-hook-ft-hosted-failure-114406830194-v1.log; the historical filename is not evidence of a free-threaded runtime.Actual-source inspection identified a separate #630 fixture that opened its unique engine without teardown. C07's fixture-only correction captures that fixture's coordinator, checks its canonical database path against the unique fixture database, cancels and waits at most 10 seconds, surfaces failed completion, and always closes the fixture engine in a nested
finally. It covers open/test failures without changing the model fence, shared lock, registry, model identity, caller transaction semantics, GC or production code. Initial child67e73f3c7fe427b8b63fcfaa933fdcb339fcb2a2failed a foreign-database negative by cancelling/waiting on that coordinator; its commit/report remain preserved. Child26afddf7332f1586768d1d787cfe1aad2c1278e1refuses before foreign cancel/wait and still closes the fixture engine. Root confirmed 16 frozen lifecycle controls and 32 production guards passed. All three #630 method bodies/nine PythonAssertnodes and the entire #631 file (nine tests/28 PythonAssertnodes) remain unchanged; these are source inventories, not runtime assertion totals. Synthetic actual-function ownership witnesses demonstrate safe teardown and possible interference, without proving the historical hosted owner.The inherited #684 correction requires exact Engine/failed-handle proof, strict automatic-owner receipts, identity rechecks and one shared 10,000 ms budget. Current-owned writers refuse before opening; manual/receiptless, serving/already-admitted and replacement-handle cases retain refusal. Historical macOS and old #829 Windows owner identities remain unproven; duplicate hosted jobs passed. Separate synthetic verified-owner reproduction supports the narrow correction. Reconnect controls pass 26 methods and 42 independent probes. All 101 boundary methods and 550 unittest assertion/fail call AST nodes remain unchanged through fixture repairs; the memory-only run passes 101/101.
Original combined full
5cd23db000fd2a7c98e93395be33cf8638641db1failed ten MCP fixture tests: nine missing-timeNameErrortraces and one parallel-wait assertion cascade. Original source, container and full log remain preserved, log SHA2562a706b32240afa808f582e1751beeea1a24302f1a6f86f3eb3eddec5fa85befd. The inherited MCP-only fixture repair retains all 11 test methods and 52 unittest/Mock assertion/fail call AST nodes, binds actual source-derived collaborators and strict unexpected-wait/import guards, and passes 11 safe methods plus 35 independent controls. Production, GC, model and retrieval behavior are unchanged by that fixture repair.Source-only controls rejected queue v4's marker-insertion argv and publisher v5's incomplete exact-PR identity checks; the originals and failed controls remain preserved. Root uses reviewed queue v5, SHA256
cb9136cbe4cd3c2ca75c9c52e225c0ed2d71f5f08b711ae8ea6e885fe9d17824, and publisher v6, SHA256573d39c50d4258461fe6160f65ab5a66f9ffc5871425946e6970fdbad2277f8b. Root confirmed the publisher's 22 URL and 63 metadata negative controls passed. Those source controls are distinct from actual publication/readback. Plan v4 SHA25645dd32d3f099b6445c97054089b66382bec9866e90ae6b1c268516e94b39eb56and manifest v9 SHA2568419a390c620d0f9fc6159f48631d123448a80745b1f2baad9f36cead85d1a8bpin the refresh source chain.Exact-source validation
acc9e00a55cadb91f392ec2a172a2f1fa580c7497eadab0e30751d913a7ec9b092d2af719aee4039007eb8ace87896291dc85200acc9e00a55cadb91f392ec2a172a2f1fa580c749f5e0f116edaddb79ed96fe3dc3b28b56198af256aa92e1d1c2c91bcb2b03bbc526afddf7332f1586768d1d787cfe1aad2c1278e191bcb493697a732de9c58ed30ae2b87249464d2839ad32ca04ca777396cc8c22Both full gates exited 0 with 17 skips, three network deselections and 39 warnings, no timeout/OOM and matching actual source/build/log hashes. The focused selection contains 39 files, including #630 and #631. The exact C07 pytest elapsed time was 407.19 seconds; the table reports runner elapsed time.
The gates ran sequentially on synthetic data in offline installed-wheel images with eight CPUs, 16 GiB, read-only source/models/fixtures, enabled native SQLite flags and no GPU exposed. Installed-wheel images were built and identified; all-test installed import origin was not measured. No GC-disabling override was used; three selected regression assertions observed GC enabled at their checkpoints. Full-run runtime GC state was not recorded.
Exact publication source/build/run:
source-native-hook-contracts-publish-v7,build-native-hook-contracts-publish-v7,native-hook-contracts-publication-v3. Receipts:.work/reports/native-hook-contracts-publication-validation-v3.json,.work/reports/native-hook-contracts-publication-container-config-v3.jsonand.work/reports/build-native-hook-contracts-publish-v7-evidence-v1.json. Build-log SHA2566f4cfc86115d1037a0eebd437708ede770f1a7197722d4f62ffcc1b0ff1a2490. Combined/focused receipts are.work/reports/native-integrations-combined-full-validation-v4.jsonand.work/reports/native-integrations-focused-validation-v8.json, with container configs v4/v5 and combined-v8 build evidence.The complete five-gate set was independently accepted before body-file preparation. Those receipts validate exact sources; actual publication and remote readback remain separate root actions.
Remaining validation
Actual corrected-head Windows CI and fresh CPython 3.14 hosted CI remain unproven. The current root GPU images record Python 3.12.15; the old Python 3.14.8 experimental job's actual GIL and busy-fence owner were not measured. No matched-3.14 runtime success is claimed.
Configuration presence, registration, status output, serializer emission and written instructions do not establish native event execution, payload translation, transcript capture, host acceptance or model-visible recall. No native Codex, Cursor, Gemini, Kimi, Hermes or OpenClaw version was exercised by the manual parity controls. Kimi's newer home, Hermes translation under #765, and OpenClaw discovery/activation/runtime payloads/user/database propagation under #764 remain unverified. The adapter's OpenClaw staging divergence remains separate.
Historical macOS closed-handle and old #829 Windows I/O owner identities remain unproven; duplicate jobs passed and synthetic verified-owner controls support only the scoped inherited admission correction. The original 26.24 GB Mac memory fix and native host/model acceptance remain unproven. Complete-archive DeepSearch and durable source citations remain future work; #758/#759 product egress policy is held.
Validated private integration remains
3a9360b1ba6bf210a1b54e05287117923fbbaae5; adoption of the refreshed passing combination is separate. Draft only. No merge, release, refreshed private adoption or accepted issue closure is claimed.