Repository navigation
feat(fuse): add vendored FUSE-1 adapter and sizing isolation (SH-2 2/5) - #9
Conversation
Add VendoredFuseEvaluator, which re-verifies the vendored engine digests before each evaluate() call, plus FUSE input translation, NO-NEW-RISK clamping and per-tier sizing controls. Register fuse_adapter in the code manifest, hash explicit scheduler config paths by their relative path, and record the SH-2 entry gates. Part 2 of the SH-2 split of #7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b63a6e6ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Resolve o5_settled_cash before defaulting settled_cash to the bankroll, keep a missing V7 session_time as missing instead of asserting a regular session, and compile vendored source with dont_inherit=True so legitimately compiled __pycache__ bytecode verifies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d10093c34e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Default the canonical O5 session counters only when no alias carries evidence, forward H so O9 can match authorized H change descriptors, and stop substituting one_session_loss (a return fraction) for the cumulative dollar loss L when re-tiering explicit FUSE payloads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
Stage N has no broker evidence in any mode, so absent broker_* observations are substituted with modelled values and O3 is a model self-reconciliation, not reconciliation evidence. Comment only; no change to validated inputs or record hashes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9d93ba72f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Default session_order_count and session_turnover only when the key is omitted; an explicitly null counter is unknown evidence and is passed through as None so evaluate_O5() fails closed on turnover/order limits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b0e285a938
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Compare cached vendored bytecode by code-object equality instead of marshal encoding, which differs between py_compile and compile() on CPython 3.11/3.12, while still rejecting altered constants. Preserve an explicitly null settled_cash or o5_settled_cash as unknown evidence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9137a64ca5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review All 12 review threads on head 9137a64 have been addressed and resolved. Rounds 1–4 were fixed with regression tests. The O3 design limitation is tracked in #10. The round-5 P2s are tracked in #11 under the agreed split policy. This asks for a fresh review of the current head. Generated by Claude Code |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
AI Code Review (opencode /
|
Validate every market record (including optional SPX) for eligibility, calendar digest and effective session, apply corporate actions to V1 returns only when the ex-date is the decision session, pass explicit null policy hashes and heartbeats through uncoerced, leave absent settled cash unknown, pin the complete metadata digest set in code, and execute only verified engine source bytes via a dedicated finder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
Record heartbeat_source="adapter_self" when the adapter defaults the O7 heartbeat to as_of, and "caller" when session inputs supply it, so a self-attested heartbeat is never mistaken for liveness evidence. The ledger-supplied heartbeat follows in part 4 (#13). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
SH-2 decisions are end-of-day, so every trading day, half days included, maps to `open`; FuseControl's half_day_cutoff is a pre-trade rule. Pin that the 2026-11-27 14:30 ET half-day decision maps to open with O2 clear, and that late runs are the scheduler cutoff's job. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
Apply the feeder's exact rate freshness rule, reject records retrieved after the decision instant, reject the ineffective kill_switch_tripped flag, fail closed on conflicting corporate actions and on caller closes that disagree with the validated market close, and pass explicit nulls (broker, cash, exposures, tolerance, proposal) through as missing. Unknown tiers and missing high-water marks no longer fall back to balanced or bankroll defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
The close-mismatch guard must compare values, not the strict sizing parser (which rejects floats by design), so a float and a canonical decimal string for the same close are treated as equal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
Reject conflicting corporate actions before any successor state, never let current_index_closes override a validated record, propagate unknown held-position values into reconciliation and aggregates, reject kill_switch_tripped on the effective payload at the evaluator boundary, drop source records dated after the decision instant, and compare timestamps as aware instants rather than strings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
Drop source records dated after the decision instant at the evaluator boundary so nested fuse_inputs and direct payloads are covered, and pass an unknown ledger quantity as share_count None (0 only for an explicitly flat position) so O3/V2 cannot clear on an invented zero. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq
Handoff: SH-2 split status (the worker session stopped here)The SH-2 work in #7 is being split into five PRs against
Parts 3–5 each have the earlier parts merged into them (merge commits, no rebase). Part 5's tree is #7 plus the review fixes made in this PR. This PR at
|
AI assistance
Claude Code (cloud worker session) split this out of #7, then fixed review findings from Codex,
qsl-ai-reviewerand a local Codexgpt-6.2-astraadversarial review. Each fix has a regression test that fails before the fix.What changed
Part 2 of 5 in the split of #7. Part 1 (#8, vendored engine) has merged.
src/shadow/fuse_adapter.py(new):VendoredFuseEvaluatorverifies the 8 engine source digests, the framedengine_hash,spec_version, and the full metadata set. The metadata digests are pinned in code (PINNED_FUSE_METADATA_SHA256), includingprovenance.jsonandSH1-ACCEPTANCE.json.PYTHONPYCACHEPREFIXare never consulted.His forwarded for O9;one_session_lossis never used as cumulative loss.StubEvaluatorquarantined in production mode.src/shadow/sizing.py:NO-NEW-RISKclamp, per-fund and per-tier control scopes, strict decimal andq_prevalidation.src/shadow/manifest.py: registersfuse_adapter.py; explicit config paths are hashed by repo-relative path.docs/sh2-entry-gates.md: FUSE-1 entry-gate record and digest provenance.tests/test_fuse_adapter.py,tests/test_sizing.py. The 12 ledger-integration adapter tests land with the ledger in part 4.Documented Stage N semantics (comments in code):
last_heartbeatsupplied, the adapter's heartbeat is labelledheartbeat_source="adapter_self". The ledger supplies the previous committed record's timestamp in part 4: O7: ledger supplies last_heartbeat from previous committed record #13.open. FuseControl C-FUSE-GATE'shalf_day_cutoffis a pre-trade rule whereas_ofis an order instant. Late EOD runs are rejected by the scheduler's decision cutoff (late_after_decision_cutoff), not by O2.Follow-ups: #10 (O3), #11 (O5 whitelist aliases and counter coercion, plus the qsl LOW items), #12 (Astra P2 hardening), #13 (O7 ledger heartbeat).
Remaining parts: 3 calendar/feeder close isolation and
http_limits; 4 ledger/scheduler/replay integrity; 5 Cloud Run packaging and the acceptance pack.How verified
PYTHONPATH=src python3.12 -m unittest discover -s testson this head: 128 tests OK. The suite also passed on 3.11 and 3.13 earlier in this round.PYTHONPATH=src python3 -m shadow.sh2_acceptance:PASS_OFFLINE,demo_cases_passed=10/10.pyflakesreports nothing on the edited adapter and test files.Why
#7 (~24k lines) is too big for
qsl-ai-reviewerto cover fully. Splitting it out lets the adapter and the sizing logic get a full review.Risk
mode="shadow".productionstays locked:production_chain_locked: true,clk01_active: false,orders_placed: 0,kelly_applied: false,H = "0".🤖 Generated with Claude Code
https://claude.ai/code/session_011iHeYdGvqQh5k2bkN5Eiuq