Skip to content

adoption_status truth: Codex-exact hooks.json parse, hook trust and RTK inline detection; pinned-version verdict (G9, G13) - #368

Merged
seathatflowsinourveins merged 2 commits into
mainfrom
claude/adoption-status-truth-20260926
Sep 26, 2026
Merged

seathatflowsinourveins merged 2 commits into
mainfrom
claude/adoption-status-truth-20260926

Conversation

@seathatflowsinourveins

Copy link
Copy Markdown
Collaborator

Summary

scripts/adoption_status.py --client-wiring now reports what this host's Codex actually does, so complete is false when Codex would run no ai-memory hook or its model never sees RTK's instructions (audit gaps G9 and G13).

  • RTK instructions. rtk_instructions is true only when RTK.md's text is inline in the instructions file Codex loads: AGENTS.override.md when it has text by Rust's str::trim, otherwise AGENTS.md. A bare @RTK.md pointer now counts as false, because Codex passes that file to the model unchanged and expands no @path reference.
  • Hook trust, compared as Codex compares it. A new codex.ai_memory_hook_events_trusted counts the ai-memory hooks Codex will run: enabled, and whose recorded trusted_hash equals the hook's current hash computed as Codex computes it. complete requires this count to equal the configured count.
  • hooks.json parsed as Codex parses it. The parse follows Codex's serde_json::from_str::<HooksFile> at rust-v0.157.1. A file Codex rejects makes both Codex counts null. Rejected shapes include repeated known fields, NaN, lone surrogates where serde parses text, and numbers a timeout cannot hold. Shapes Codex accepts, such as repeated unknown keys, still count. Matchers are decided only inside the regex subset that Python's re and Rust's regex-syntax 0.8.8 parse alike; anything else is null.
  • Pinned-version truth. Each profile gets a matched/mismatched/unchecked summary, and the report gets a top-level pinned_versions_match, false on any mismatch. Status and exit code are unchanged, as the flag's help text promises.
  • G13. The manifests/stack.json claude-code pin moves from 2.1.278 to 2.1.281, the floor both platform pins set, with a freshness note. The saturation audit carries the same version, the claude-code upstream snapshot record is refreshed, and the landscape winner pin stays 2.1.278. render.py panel 10 now cites the G1 cause. Panel 19's "undercount" label was wrong and now says increase() overcounts while sessions overlap.
  • Worktree capture marker. A tracked .worktreeinclude names only .ai-memory.toml, and a new recipe section explains enrolling a worktree for ai-memory capture. Enrolling also lets the worktree's sessions consume a pending handoff, so review and blind lanes stay unenrolled.
  • This host (read-only, no Codex started in the repair rounds). 7 of 7 ai-memory hooks are trusted, matching Codex 0.157.1's own hooks/list taken at 16:03Z. complete is false only because rtk_instructions is false: the RTK text is not yet inlined here. At build time, the checker on origin/main reported rtk_instructions true and complete true for the same host.

Lane: lane:shared. This PR changes what manifests/stack.json says: the claude-code version and its freshness text. manifests/evidence.json changes only by registration: 43 new files and 10 re-hashed, with no receipts[] change.

Lane consolidation: on 2026-09-26 the user shut down the other lane sessions and assigned this work to the workstation coordinator ("no other peers live, i shut them with the token save repos install into our native workflow and github workflow , harness update and sota foundation of our session as main task"); this quote stands in for the trading lane's ack.

What changed

  • scripts/adoption_status.py:
    • RTK inline detection, with the override file chosen by Rust trim
    • the Codex-exact hooks.json parse and matcher subset
    • hook-trust counting with ai_memory_hook_events_trusted
    • the per-profile pinned_versions_summary and top-level pinned_versions_match
  • tests/test_adoption_status.py: tests for each rule, written failing-first. RetainedEvidenceTests checks that every file the evidence README links is registered and not ignored.
  • manifests/stack.json: claude-code 2.1.278 → 2.1.281, with its freshness note.
  • blueprints/token-native-focus/saturation-audit.json: the same claude-code version (a test couples the two).
  • catalogs/landscape/upstream-snapshot.json: the claude-code record, refreshed from gh api. Latest stable is v2.1.283, so the record is marked "newer release, review pending". claude-code joins the review queue, and the queue text says "five" because main removed codex from it.
  • docs/token-efficiency-stack.md:
    • the client_wiring checks and the host coverage rule, with trusted hooks and inline RTK
    • how to make rtk_instructions true: inline RTK.md's text in the file Codex reads, then confirm with codex debug prompt-input
    • the pinned-version summary
    • the 10 profile plus 6 optional tool mapping
  • adoption/README.md: step 3 describes the new --client-wiring fields, with the marker.
  • recipes/README.md: new section "Worktrees and the capture marker", covering:
    • enrollment through .worktreeinclude and Worktrunk's wt step copy-ignored --require-include
    • --check-capture run with the hook's own --data-dir, expecting allowlist mode, marker_present and admits_capture
    • the handoff caveat
  • observability/native-data/render.py: text-only changes to panels 10 and 19.
  • .gitignore: ignores /.ai-memory.toml, and adds a scoped !evidence/artifacts/adoption-status-truth-20260926/*.jsonl exception.
  • .worktreeinclude (new): names only .ai-memory.toml.
  • manifests/evidence.json: registration only, following the hot-file protocol in the last commit.
  • evidence/artifacts/adoption-status-truth-20260926/ (43 new files, sanitized and hash-registered):
    • Codex oracles for parse (64 shapes), matchers (126) and trust (12 hooks under 6 state variants), and the six known answers
    • red/green checker test runs and the host trust read-back
    • the G1 Prometheus/Loki observation
    • the host scripts (apply.sh, rollback.sh, prove.sh/prove.py) as reviewed and as repaired, with captured fixture apply/rollback runs
    • the builder's prove.sh runs
    • review-2/: the second review's as-reviewed copies, harnesses and before/after runs

Verification

These are the final acceptance commands at head d5a7d5ae (repair round 2), run with the CI venv's Python 3.13.15:

$ python scripts/validate.py                    # exit 0: passed (6960 hashed files, 159 receipts)
$ python scripts/evidence_manifest.py --check   # exit 0: passed (6960 files)
$ python scripts/component_matrix.py --check    # exit 0: checked (32 rows)
$ python scripts/new_host_grand_list.py --check # exit 0: passed (32 layers, 66 winners)
$ python scripts/build_ecosystem.py --check     # exit 0: passed
$ python -m unittest <31 coupled modules>       # exit 0: 1807 tests OK, 21 skipped (210.8 s)
$ python -m unittest discover -s tests -q       # exit 0: Ran 6250 tests, OK (skipped=661), 601.7 s
  • The 31 coupled modules. They are every test module that references adoption_status, .gitignore, evidence.json or the evidence directory, among them test_adoption_status, test_adoption_docs_consistency, test_release_pin_contents, test_landscape, test_validate, test_evidence_manifest, test_host_receipts and test_component_matrix. They ran on the staged tree just before the last edit, which only quieted ShellCheck in review-2/fixture_guard_check.sh; that script's outputs were re-produced byte-identically. The full suite ran on d5a7d5ae itself. No gitleaks-lock rerun was needed; test_pre_commit_gate alone gave 3 tests OK.
  • Skip count. Round 1's full run skipped 642. The 31 coupled modules skip 21 at both b1df549f and d5a7d5ae, so the +19 comes from modules this change does not touch (host state at run time).
  • Round 1 at b1df549f. Same five script checks, exit 0 each. 16 coupled modules: 820 tests OK, 20 skipped. Full suite: 6249 tests OK, 642 skipped, 708.6 s.
  • Harnesses (local_integration).
    • fixture_guard_check: 3 unmet before, 0 after.
    • review2_harness: 6 unmet before, 0 of 9 after.
    • host_scripts_fixture on the repaired apply.sh/rollback.sh: 0 of 16 unmet; the reviewed scripts had 11 of 16.
    • Round 1's prove_harness on the new prove.py: 0 unmet.
    • ShellCheck 0.11.0 is clean on both shell scripts.
  • Codex oracles (Codex 0.157.1's own hooks/list in throwaway homes).
    • Parse: 64 shapes, 0 disagreements.
    • Matchers: 126 tried, 78 decided, 0 disagreements.
    • Trust: 12 hooks under 6 state variants, 0 disagreements; every checker hash equals Codex's currentHash.
    • The reworked codex_known_answers.py reproduced codex-known-answers.json byte-identically.
  • Evidence classes.
    • local_integration against the native binary: the oracle verdicts.
    • synthetic: the unit tests and stub harnesses.
    • Read-only local observation: the host trust read-back and the G1 Prometheus/Loki observation.
    • Not run: apply.sh --apply or rollback.sh --apply on this host, and any upstream test suite.

Reviews

Adversarial review (Claude Opus) of the build: 10 defects. All fixed in repair round 1 (b1df549f); none rejected.

# Finding Outcome
1 Checker parsed hooks.json more loosely than Codex; a duplicate-key file gave complete: true while Codex ran no hook; a lone surrogate crashed the CLI Fixed: Codex's serde_json::from_str::<HooksFile> modelled; both counts null for a rejected file; 5 checker tests red then green; parse oracle 64 shapes, 0 disagreements
2 apply.sh step A acted on a moving target and moved the checkout under live sessions Fixed: --apply needs the dry run's full 40-hex --target and refuses --fetch; live sessions found via /proc/*/cwd block it unless --allow-live-sessions; content and tool checks run before step A; same guard in rollback.sh; fixture 11 of 16 unmet before, 0 after
3 Enrolling a worktree also lets its sessions consume the pending ai-memory handoff Fixed by documentation (ai-memory 2.4.1 hook.rs) in apply.sh, the recipe and .worktreeinclude; review and blind lanes stay unenrolled; --enroll-worktree DIR stays the explicit per-lane opt-in
4 None of the evidence was retained in the repo Fixed: sanitized, registered evidence/artifacts/adoption-status-truth-20260926/; the G1 observation was re-taken (342M vs 6.2M, 55.2x, 112 series instance="unscoped", 4,504 resets/h) because the builder's figures had no retained output
5 "changed after" markers named the wrong release Fixed: v2026.09.26.2 for this change; the probe-fix sentence keeps v2026.09.26
6 apply.sh step B never checked its stated result Fixed: jq -e on allowlist mode, marker_present and admits_capture; on failure the copied marker is removed
7 Capture check omitted the hook's --data-dir (the denylist default admits everything) Fixed: --data-dir is read from the installed ai-memory hook commands, and allowlist mode plus marker_present are required
8 codex_matcher_loads accepted matchers Codex rejects Fixed: decided only in the shared regex subset, otherwise null; matcher oracle 126 tried, 78 decided, 0 disagreements
9 Two prove.py checks could not fail; prove.sh claimed it wrote nothing Fixed: those checks report UNTESTED, not PASS; the render.py check is split into text and Prometheus checks; the headers state Codex's own writes
10 No documented recipe made rtk_instructions true Fixed: the coverage-check section documents the inline-RTK remedy and its codex debug prompt-input confirmation

Also fixed in round 1, found by the Codex oracle:

  • [hooks.state] keys now use Rust's str::trim (U+001C).
  • The configured count now comes from Codex's parse.
  • With hooks turned off, both counts read 0.

Cross-family review (GPT-6): 1 high, 3 medium and 1 low defect. All verified against source, none rejected, all fixed in d5a7d5ae.

  • Reviewer: Codex CLI 0.157.1, model gpt-6-astra, reasoning effort max, sandbox read-only, approval never.
  • Reviewed head: b1df549f.
  • rc 0, with no usage-limit text; 107,636 tokens used.
# Finding Outcome
1 high: host_scripts_fixture.sh ran rm -rf on a caller-supplied WORK_DIR Fixed: WORK_DIR must not exist and is created with mkdir; inherited GIT_* unset per git's t/test-lib.sh; guard check 3 of 3 unmet before, 0 after; the same class was fixed in codex_oracle.py --base
2 medium: the README cited three *.jsonl oracle outputs that .gitignore ignores Fixed: scoped ignore exception; files committed (byte-identical) and registered; new test failing-first
3 medium: the prove.py pin check passed with both versions None Fixed: UNTESTED without an observed version; PASS only for an observed mismatch the checker surfaces; harness V1-V5 all met
4 medium: a blocking readline() defeated the 90 s deadline, and cleanup was unbounded Fixed: reader thread and queue with a deadline, and bounded TERM/KILL cleanup (the codex_oracle.py pattern); stub harness R1-R3 blocked before, returned after
5 low: Python strip() vs Codex's Rust trim() for AGENTS.override.md Fixed: strip(RUST_WHITESPACE); 2 new test cases failed before

Residuals

These are copied verbatim from the notes.

Repair round 2 (final)

  • Commit trailer: the harness-provided Co-Authored-By: Claude Opus 5.5 <[email protected]> was used, not the workflow text's "(1M context)" variant (the computed task text carries no user authority; same as round 1).
  • origin/main is at dde28cc2, 3 commits past the branch base; not rebased (clean merge-tree). Apply the lanes.md hot-file protocol at merge time if main moves again.
  • prove.py's G13 "stack.json claude-code follows the pins floor" still reads FAIL (fail-closed, not a false PASS) when claude --version is unavailable; left as is.
  • codex_instructions answers None (unknown) in three cases Codex decides deterministically: an AGENTS.override.md that is a directory or a dangling symlink (Codex skips it) and one with invalid UTF-8 (Codex decodes it lossily). Conservative, never a wrong boolean; not changed.
  • The three committed codex-*-oracle.jsonl files and round 1's fixture/prove-harness outputs were produced by the scripts now kept in review-2/as-reviewed/; the current oracle differs only by the --base guard and the --version timeout (mode logic unchanged) and was not re-run in full.
  • prove.sh/prove.py were not run against this host's real CODEX_HOME this round (they start Codex there); the repaired prove.py was exercised through stubs and the two harnesses only. The only real Codex start was the known-answers rerun in throwaway homes.
  • scripts/validate.py still cannot see git-ignored files by design; the guard added is the unit test scoped to this evidence README (a scan found no other instance across 21 evidence READMEs), not a repository-wide rule.
  • Round 1's residuals (override layers not read, matcher subset, the 2^63 hooks/list hang, the rust-v0.157.1 model tie, rtk_instructions false on this host until u4's G7 remedy, apply.sh --apply refusing while sessions live in the checkout) are unchanged.
  • The advisor was rate-limited this round; no second-opinion pass on the plan.

Repair round 1

  • --dangerously-bypass-hook-trust, SessionFlags -c overrides, hooks defined in config.toml or a project layer, and profiles are not read (the documented "command-line overrides can override the user scope" limit).
  • A matcher outside the shared regex subset (47 of the 126 tried) leaves the trusted count null; a skipped value nested deeper than Python's recursion limit or an integer over 4,300 digits reads as a rejected file although Codex could accept it (both only make complete false).
  • Codex 0.157.1 stops answering hooks/list when a hashed hook's timeout or kept context limit exceeds 2^63-1 (its unreachable! on the TOML conversion); worth an upstream report, not filed.
  • The model is tied to rust-v0.157.1 (serde_json 1.0.149 with arbitrary_precision, regex-syntax 0.8.8): re-run codex_oracle.py (parse, matchers, trust) when the Codex pin moves.
  • Codex was not started against this host's real CODEX_HOME in this round (its app-server writes runtime DBs and runs a plugin sync there); the live hooks/list observation is the builder's (16:03Z), still covering the unchanged hook files.
  • rtk_instructions stays false on this host until u4's G7 inline remedy is applied; u4 also corrects the recipes line that says a 0.49.0 Codex home "keeps its instructions" (left to u4 to avoid conflicting edits).
  • apply.sh --apply on this host will refuse while any session (this coordinator included) has its cwd in ~/code/native-agent-stack, until the operator closes them or passes --allow-live-sessions.
  • Commit trailer: the harness-provided Co-Authored-By: Claude Opus 5.5 <[email protected]> was used, not the workflow text's "(1M context)" variant.

Build report

  • RTK. rtk 0.50.0's init -g --codex writes only an @RTK.md pointer, on the assumption (its issue Bound the harness audit and move it to claude-code-action v1.0.247 #892) that Codex expands it; Codex does not. This is worth reporting upstream; I have not filed it. Until u4's G7 fix lands, complete stays false on this host.
  • Hash copy. The trust hashing is tied to Codex 0.155.1–0.157.1; rerun codex_trust_fixture.py when the Codex pin moves. Trust for Context Mode's bundled plugin hooks isn't checked by the file-based checker; Codex's own hooks/list shows all 6 trusted.
  • Separate decisions: pins for the six optional tools, if you want a presence and version check over the full 16-tool set; raising the claude-code floor to 2.1.283; moving the landscape winner pin.
  • Not handled by u5: the R2 Codex hygiene items and the Repomix false-pass correction to "All 16 tools worked".
  • Side effect: my first prove.sh run against the primary checkout refreshed tests/__pycache__/__init__.cpython-313.pyc there (an ignored bytecode cache). prove.sh now sets PYTHONDONTWRITEBYTECODE=1.

SOTA sources

🤖 Generated with Claude Code

Scout and others added 2 commits September 26, 2026 14:12
…atchers; RTK inline; pinned-version verdict (G9, G13)

scripts/adoption_status.py --client-wiring now reports what Codex actually runs:
- rtk_instructions is true only when RTK.md's text is inline in the AGENTS file
  Codex loads (Codex expands no @RTK.md reference).
- ai_memory_hook_events_trusted counts ai-memory hooks that are enabled and whose
  [hooks.state] trusted_hash equals the hook's current hash, as Codex's
  hook_trust_status compares them (keys trimmed as Rust's str::trim does).
- hooks.json is read as Codex's serde_json parse reads it: a repeated known field,
  NaN, a lone surrogate where text is parsed, a number a field cannot hold, nesting
  past the recursion limit or a hook Codex cannot hash all make Codex load no hook,
  and both Codex counts are then null. The reviewed checker counted such files as
  wired (complete: true) and crashed on a lone surrogate.
- A matcher is decided only inside a regex subset Python's re and Rust's regex
  parse alike; otherwise the trusted count is null.
- --pinned-versions adds each profile's pinned_versions_summary and a top-level
  pinned_versions_match.

Codex 0.157.1's own app-server hooks/list agreed with the checker on 64 hooks.json
shapes, 126 matchers and 12 trust states in throwaway homes; the checker tests fail
on the reviewed code (54 failures, 1 crash) and pass now. On this host the repaired
checker reads 7 of 7 ai-memory hooks trusted, as Codex's own hooks/list did.

G13: manifests/stack.json claude-code follows the 2.1.281 pins floor (with the
saturation audit and the refreshed landscape snapshot record); a tracked
.worktreeinclude names only the ignored .ai-memory.toml, and recipes/README.md says
what enrolling a worktree does (capture, and a SessionStart handoff fetch that
consumes the pending handoff), how to check it against the installed hook's
--data-dir, and to keep independent-review and blind lanes unenrolled; render.py's
G1 text names the cause (all token series instance="unscoped"; increase() read 55x
Loki's output tokens over one hour). The 14 profile ids and the 16 tools of the E2E
receipt are reconciled in the docs and a test.

Evidence: evidence/artifacts/adoption-status-truth-20260926 (local integration:
Codex oracle runs, red/green test runs, host trust read-back without starting
Codex, the G1 Prometheus/Loki observation, and the u5 host scripts as reviewed and
as repaired with fixture runs of both). Docs changed after v2026.09.26.2 say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ir dirs; oracle outputs committed; bounded app-server reads; pin check untested without evidence; Rust-trim override rule

Resolves the GPT-6 cross-family review of b1df549 (1 high, 3 medium, 1 low; all held):

- high: host_scripts_fixture.sh no longer runs rm -rf on the WORK_DIR it is given: the path
  must not exist and the fixture creates it. Git in the fixture sees only that sandbox
  (inherited GIT_* unset, GIT_CONFIG_NOSYSTEM, GIT_ATTR_NOSYSTEM, GIT_CEILING_DIRECTORIES, as
  git's t/test-lib.sh v2.43.0 arranges). The reviewed fixture deleted an existing directory's
  file, rewrote a caller's GIT_CONFIG_GLOBAL file and made six commits in a caller's GIT_DIR
  repository; the repaired one does none of these and still meets 16 of 16 expectations on
  the repaired apply.sh/rollback.sh. Same class: codex_oracle.py --base must be new or empty.
- medium: the three Codex oracle *.jsonl outputs matched .gitignore's *.jsonl and were missing
  from every clone; a scoped .gitignore exception and registration commit them, and
  RetainedEvidenceTests checks that every file the evidence README links is registered and
  not ignored (red on exactly those three).
- medium: prove.py's pin check passed with no --version observation; it now reads UNTESTED
  when a version is unavailable or nothing differs from its pin, FAIL on any contradiction,
  and PASS only for an observed mismatch the checker surfaces at the top.
- medium: prove.py's blocking readline defeated its 90 s deadline and its cleanup waited
  without bound after SIGTERM; it now reads through a thread and queue with a deadline and
  ends the app-server with bounded waits (15 s, TERM 3 s, KILL 10 s). codex_known_answers.py
  asks through codex_oracle.hooks_list; rerun against Codex 0.157.1 in throwaway homes, its
  output is byte-identical to codex-known-answers.json.
- low: codex_instructions decides a blank AGENTS.override.md with Rust's str::trim set
  (codex-home/src/instructions/mod.rs at rust-v0.157.1): U+001C..U+001F are text to Codex.

Evidence (local_integration): evidence/artifacts/adoption-status-truth-20260926/review-2/
(as-reviewed copies, fixture_guard_check.sh, review2_harness.py, before/after runs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@seathatflowsinourveins seathatflowsinourveins added the lane:shared Touches files owned by both lanes; needs both lanes' acknowledgement label Sep 26, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@seathatflowsinourveins
seathatflowsinourveins merged commit 015c470 into main Sep 26, 2026
25 checks passed
@seathatflowsinourveins
seathatflowsinourveins deleted the claude/adoption-status-truth-20260926 branch September 26, 2026 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lane:shared Touches files owned by both lanes; needs both lanes' acknowledgement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants