feat(torghut): add renewal bond profit escrow#5412
Conversation
|
Status as of 2026-05-07T10:43Z: mergeable with green CI; blocked only on the large-diff Codex review gate.
|
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…uant # Conflicts: # services/torghut/tests/test_trading_pipeline.py
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…uant # Conflicts: # services/torghut/app/trading/discovery/runtime_closure.py
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
docs/torghut/design-system/v6/137-torghut-renewal-bond-profit-escrow-and-evidence-carry-2026-05-07.mdand companiondocs/agents/designs/133-jangar-in-flight-stage-renewal-bonds-and-controller-ingestion-settlement-2026-05-07.mdwith a shadow-onlytorghut.renewal-bond-profit-escrow.v1receipt in/readyzand/trading/status.profit_window_idandevidence_escrow_idprojection, stale evidence expiry, evidence epochs, runtime-closure receipts, proof-lease projection, and shared simple-lane live-submission blocking.max_notionalat0.Related Issues
None. Requirement provenance came from the
torghut-quantimplementation mission, the NATS general-channel handoff for doc 64/doc 63 cutover criteria, and the current Torghut source-of-truth guide selecting the May 7 doc 137/doc 133 renewal-bond runtime objective as the active implementation handoff. After the finalorigin/mainmerge, the v6 index also lists newer follow-on docs 143/144 from main as next-work architecture; this PR does not claim to implement those later contracts.Testing
/tmp/codex-uv-bootstrap/bin/uv sync --frozen --extra dev/tmp/codex-uv-bootstrap/bin/uv run --frozen ruff format --check app/main.py app/models/__init__.py app/models/entities.py app/trading/discovery/runtime_closure.py app/trading/evidence_epochs.py app/trading/evidence_receipts.py app/trading/hypotheses.py app/trading/profit_leases.py app/trading/profit_windows.py app/trading/renewal_bond_profit_escrow.py app/trading/submission_council.py migrations/versions/0030_evidence_epochs.py tests/test_evidence_epochs.py tests/test_hypotheses.py tests/test_profit_leases.py tests/test_profit_windows.py tests/test_renewal_bond_profit_escrow.py tests/test_runtime_closure.py tests/test_submission_council.py tests/test_trading_api.py tests/test_trading_pipeline.py/tmp/codex-uv-bootstrap/bin/uv run --frozen ruff check app/main.py app/models/__init__.py app/models/entities.py app/trading/discovery/runtime_closure.py app/trading/evidence_epochs.py app/trading/evidence_receipts.py app/trading/hypotheses.py app/trading/profit_leases.py app/trading/profit_windows.py app/trading/renewal_bond_profit_escrow.py app/trading/submission_council.py migrations/versions/0030_evidence_epochs.py tests/test_evidence_epochs.py tests/test_hypotheses.py tests/test_profit_leases.py tests/test_profit_windows.py tests/test_renewal_bond_profit_escrow.py tests/test_runtime_closure.py tests/test_submission_council.py tests/test_trading_api.py tests/test_trading_pipeline.py/tmp/codex-uv-bootstrap/bin/uv run --frozen pytest tests/test_evidence_epochs.py tests/test_profit_leases.py tests/test_profit_windows.py tests/test_renewal_bond_profit_escrow.py tests/test_runtime_closure.py tests/test_submission_council.py tests/test_trading_api.py tests/test_trading_pipeline.py tests/test_hypotheses.py(250 passed, 1 warning)/tmp/codex-uv-bootstrap/bin/uv run --frozen pytest --cov --cov-branch --cov-report=term-missing --cov-report=xml(1965 passed, total coverage76.68%)/tmp/codex-uv-bootstrap/bin/uv run --frozen python scripts/check_diff_coverage.py --coverage-xml coverage.xml --threshold 90(91.89%changed-line coverage)/tmp/codex-uv-bootstrap/bin/uv run --frozen python scripts/check_migration_graph.py(ok=true, head0030_evidence_epochs)/tmp/codex-uv-bootstrap/bin/uv run --frozen ruff format --check app/trading/discovery/runtime_closure.py tests/test_runtime_closure.py scripts/run_whitepaper_autoresearch_profit_target.py tests/test_run_whitepaper_autoresearch_profit_target.pyafter the finalorigin/mainconflict resolution/tmp/codex-uv-bootstrap/bin/uv run --frozen ruff check app/trading/discovery/runtime_closure.py tests/test_runtime_closure.py scripts/run_whitepaper_autoresearch_profit_target.py tests/test_run_whitepaper_autoresearch_profit_target.pyafter the finalorigin/mainconflict resolution/tmp/codex-uv-bootstrap/bin/uv run --frozen pytest tests/test_runtime_closure.py tests/test_run_whitepaper_autoresearch_profit_target.py(48 passed, 1 warning) after the finalorigin/mainconflict resolution/tmp/codex-uv-bootstrap/bin/uv run --frozen pyright --project pyrightconfig.json(0 errors, 0 warnings, 0 informations)/tmp/codex-uv-bootstrap/bin/uv run --frozen pyright --project pyrightconfig.alpha.json(0 errors, 0 warnings, 0 informations)/tmp/codex-uv-bootstrap/bin/uv run --frozen pyright --project pyrightconfig.scripts.json(0 errors, 0 warnings, 0 informations)git diff --checktorghut-ci / Bytecode + pytest + coverageon head4a4e24db2(5m50s)torghut-ci / Pyrighton head4a4e24db2(1m0s)torghut-ci / Quality signals (complexity + security)on head4a4e24db2(20s)CI / check_changed_files,Semantic Commits / Lint commit messages, andSemantic Pull Request / Validate PR titleScreenshots (if applicable)
N/A. Backend runtime projection, API status payload, tests, and documentation changes only.
Breaking Changes
None. The proof lease, profit-window, evidence epoch, runtime-closure, and renewal-bond escrow payloads are additive and shadow-first; live capital defaults remain fail-closed.
Risk And Rollback
Risk: the new renewal-bond and profit-window projections are intentionally conservative. They can keep paper/live capital blocked while preserving stale-but-useful proof for zero-notional repair ranking, so rollout operators should treat new
repair_onlyand expired-escrow states as expected safety behavior rather than a live-order enablement.Rollback: revert this PR or roll back the Torghut image through the normal release PR/GitOps path. Downstream consumers can ignore
renewal_bond_profit_escrow,profit_window_contract, andprofit_lease_projectionwhile keeping the existinglive_submission_gateandTRADING_SIMPLE_SUBMIT_ENABLED=false; append-only evidence epoch and receipt rows should remain for audit continuity.Large-Diff Review Gate
This PR exceeds 1000 additions plus deletions (
5917additions,455deletions at current diff), so Codex review is required before merge under the repo execution contract. Current head is4a4e24db2c32c549efb999fd177dd8739172383e; the current-head Codex review request is #5412 (comment). The connector is still blocked by the account usage-limit response at #5412 (comment). Do not merge until a Codex review posts and any resulting threads are resolved, or a maintainer explicitly waives this large-diff gate.Checklist