Skip to content

fix: bind Binance execution authority to QPK 9618 - #148

Closed
Pigbibi wants to merge 2 commits into
mainfrom
codex/qsl-p3-binance-static1-qpk9618-combined-20260809-thread019fda1c
Closed

fix: bind Binance execution authority to QPK 9618#148
Pigbibi wants to merge 2 commits into
mainfrom
codex/qsl-p3-binance-static1-qpk9618-combined-20260809-thread019fda1c

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • fail closed Binance allocation, rotation, breaker, and BTC DCA execution unless typed scoped authority is explicitly approved and identity-consistent
  • propagate the existing decision/evidence through the order-client choke points and keep rejected, missing, stale, or mismatched authority at zero executable orders
  • atomically align pyproject.toml, qsl.toml, and uv.lock to QPK 9618b4bd8e179760ac174914713598762cab15d7
  • update offline replay assertions for the fail-closed no-order contract

Local acceptance

  • focused unittest: 18 passed
  • full unittest: 140 passed
  • QPK pin guard, qsl identity guard, uv lock --check: passed
  • dependency sync/check, Ruff, compile, package, exact scope10, diff and secret gates: passed
  • exact combined tree: 76a60f7b454d467fa68c0c4166530488b5e8528f

Boundary

  • no provider, credential, runtime endpoint, deploy, config-sync, broker, account, order, capital, paper, shadow, or live mutation
  • PR chore(deps): align QPK pin to b371322b948e #145 remains frozen and excluded
  • keep this PR open and unmerged; merge requires the separately authorized exact-head closure

Co-Authored-By: Codex <noreply@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7e551868b5

ℹ️ 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".

Comment thread application/execution_service.py Outdated
Comment thread decision_mapper.py
Comment thread decision_mapper.py Outdated
Comment thread application/cycle_service.py
Co-Authored-By: Codex <noreply@openai.com>

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 98a3697cd9

ℹ️ 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".

Comment on lines +92 to +93
if has_execution_authority(allocation.get("execution_decision")):
market_snapshot = capture_market_snapshot(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Recompute allocation after recapturing the market snapshot

Whenever execution authority is approved, this second capture replaces prices, balances, and u_total, but allocation, total_equity, and trend_val_equity still come from the first snapshot. If prices move while the two snapshots and strategy evaluation run—or the BNB top-up changes balances—the portfolio report, daily PnL, state rebasing, and circuit-breaker decision use the old valuation while subsequent execution uses the new market data. Recompute the allocation from the replacement snapshot, or isolate the fuel top-up without replacing the inputs used downstream.

Useful? React with 👍 / 👎.

Comment thread decision_mapper.py
Comment on lines +90 to +95
member["candidate_identity_sha256"]
== account["candidate_identity_sha256"]
== candidate_identity.candidate_sha256
and member["decision_digest_sha256"]
== account["decision_digest_sha256"]
== decision_digest

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require scoped approvals to reference the same portfolio snapshot

When MEMBER and ACCOUNT approvals were produced from different portfolio snapshots within the five-minute freshness window, this comparison still grants authority as long as the candidate and decision digests match. Because portfolio_snapshot_digest_sha256 is only shape-checked and never compared, approvals that were never jointly issued for one account state can be combined to authorize live orders; require the two scoped assessments to carry the same portfolio snapshot digest before accepting them.

Useful? React with 👍 / 👎.

Comment thread decision_mapper.py
Comment on lines +38 to +45
for field in (
"mandate_authority_receipt_sha256",
"candidate_identity_sha256",
"decision_digest_sha256",
"portfolio_snapshot_digest_sha256",
"assessment_sha256",
):
if not isinstance(value.get(field), str) or not _SHA256_PATTERN.fullmatch(value[field]):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Verify each serialized assessment digest before granting authority

When serialized assessment evidence is altered after QPK produced it, this check accepts any 64-character assessment_sha256 without verifying that it is the canonical digest of the assessment. For example, changing a rejected assessment's outcome to APPROVE and clearing reason_codes leaves its candidate and decision digests valid, so has_execution_authority can authorize live orders even though the supplied assessment hash no longer authenticates those fields. Recompute and compare the QPK assessment digest, or use QPK's typed assessment verifier, before trusting the evidence.

Useful? React with 👍 / 👎.

@Pigbibi

Pigbibi commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

Closing unmerged under the anti-review-loop boundary: this execution-authority safety slice consumed its one remediation batch, and the final exact head still has material snapshot, digest-binding, and assessment-integrity P1 blockers. Retain this branch and evidence; runtime authority remains MISSING/no_order. No replacement PR is created.

@Pigbibi Pigbibi closed this Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant