From debe64ee3bbb362ee8b2c3031ac8bc2f24bda814 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Thu, 15 Oct 2026 03:03:07 +0800 Subject: [PATCH] docs: review unattended drafts and design cycle skip flag Co-Authored-By: Codex --- docs/skip-cycle-rebalance-design.md | 138 ++++++++++++++++++++++ docs/unattended-followup-pr-review.md | 49 ++++++++ docs/unattended-owner-update-inventory.md | 60 ++++++++++ 3 files changed, 247 insertions(+) create mode 100644 docs/skip-cycle-rebalance-design.md create mode 100644 docs/unattended-followup-pr-review.md create mode 100644 docs/unattended-owner-update-inventory.md diff --git a/docs/skip-cycle-rebalance-design.md b/docs/skip-cycle-rebalance-design.md new file mode 100644 index 00000000..26a3040e --- /dev/null +++ b/docs/skip-cycle-rebalance-design.md @@ -0,0 +1,138 @@ +# Skip one rebalance cycle (design only) + +Status: draft design, no runtime binding. This PR must remain draft and must not +be merged as part of this follow-up. It adds no executable trading code, +configuration, identity, credential, permission, endpoint, or deployment. + +## Purpose and current source evidence + +A verified severe reviewer consensus may request that one identified rebalance +cycle submit **zero new orders**, including buys, sells, options, hedges and cash +sweeps. It cannot authorize orders, liquidate a portfolio, cancel existing orders, +change targets, resume trading, or clear another block. Already outstanding orders +can still fill; skipping a cycle is not a claim that broker positions are frozen. + +There is no verified cycle-pause interface today. The following existing code +locations define where a future implementation would consume the flag: + +- QPK `common/feature_snapshot_runtime.py:evaluate_feature_snapshot_strategy` + already returns a fail-closed strategy result before strategy evaluation when + snapshot admission fails. Add the cycle-denial decision beside this existing + pre-trade guard, before generating actionable rebalance targets. +- InteractiveBrokersPlatform `application/execution_service.py:execute_rebalance` + already checks live risk authority and wraps every submission in + `submit_claimed_order`, which requires an execution claim. The same denial must + be enforced before any plan executes and again in that existing final submission + guard, before calling its delegate. Broker adapters need equivalent enforcement + before adoption; one IBKR example does not prove fleet coverage. +- QPK `execution_kernel/guards.py` contains pure deny/allow decisions. Current IBKR + `consult_t1_live_submit` is **shadow-only** and explicitly ignores its result. + Adding a shadow denial there alone would not pause anything. Do not change + shadow behavior or present it as a functioning pause interface. + +Source anchors: QPK main `ec26c1e94c8e06d758520711eba6b7d4603597ee`; IBKR main +`1bbf9ddbecddeef4f680f4bc5259bf5902e1b5dd`, read from GitHub during this review. +These are source observations, not production image or runtime acceptance. + +## Flag and ownership + +Use a caller-owned record `skip_cycle_rebalance.v1`, keyed by the **existing +durable cycle identity**. The runtime, not model text, constructs its scope: + +```json +{ + "schema": "skip_cycle_rebalance.v1", + "cycle_id": "", + "runtime_target": "", + "account_scope_sha256": "", + "strategy_release": "", + "snapshot_sha256": "", + "skip": true, + "reason": "missing_stale_inputs", + "review_material_sha256": "", + "review_receipt_ids": ["", ""], + "recorded_at": "" +} +``` + +The example is a contract, not a flag written to any runtime. Identifiers are +opaque metadata; secrets and raw account numbers never enter this record. +Allowed reasons are `data_integrity`, `risk_limit`, `missing_stale_inputs`. +Reject extra fields, duplicate JSON keys, incorrect types, missing scope, and any +`skip` value other than literal `true`. There is no `skip=false`, delete, reset, +resume, order or configuration operation exposed to the review writer. + +The existing review consumer validates complete, distinct admitted reviewer roles, +current frozen material and receipts before setting a flag. All required roles +must flag the same severe category. Unverified Dot identity, a configured profile +name, missing secrets, or an advisory opinion alone cannot become authority to +write a runtime flag. If the admitted review channel is unavailable, the pre-trade +guard denies with `cycle_review_unavailable`; it does not invent a successful +consensus. No new IAM or secret access is proposed. + +The future producer can only append an immutable skip record for the current +scope to an **already authorized durable store**. A repeated identical write is +idempotent; conflicting records deny and require investigation. Existing request +IDs with unknown outcomes are reconciled read-only, never replaced. If there is +no suitable existing store and producer identity, implementation/adoption stays +blocked. This design does not authorize creating either. + +## Guard behavior + +An admitted reader returns either a validated current-cycle skip, an authoritative +complete `absent` result for that exact key, or `unavailable`. File-not-found, +truncated listings, permission errors, timeouts and unknown writes must not be +silently interpreted as authoritative absence. + +| Observed input | Guard result | Effect | +| --- | --- | --- | +| Valid skip matching every current scope field | deny `cycle_rebalance_skipped` | No new order of any side or instrument | +| Invalid, conflicting, unreadable or unresolved current lookup | deny `cycle_skip_state_unavailable` | No new order; operational alert | +| Admitted review channel unavailable | deny `cycle_review_unavailable` | No new order; operational alert | +| Authoritative absence for current key | keep original guard result | Adds no trading authority | +| Valid older-cycle record plus authoritative current absence | keep original guard result | Previous record cannot enable or disable another cycle | +| Existing guard already denies | preserve denial | Flag processing cannot change deny to allow | + +Conceptually the existing guard computes: + +```text +denied = original_guard_denied OR current_cycle_skip OR skip_read_unavailable + OR admitted_cycle_review_unavailable +``` + +On denial, return the existing blocked/no-op execution result with +`orders_submitted=[]` and the explicit reason. Do not emulate holding by setting +targets to zero or cash: existing execution logic could turn that into sells. +Do not return a buy-only prohibition: it could still permit sells. Read-only +observation and original pending-order reconciliation may continue. + +Keep the skip latched for all retries of the same durable cycle. A process restart, +new invocation UUID, changed timestamp or timeout must not produce a replacement +cycle that avoids it. A flag's age never clears it for that cycle. A genuinely new +cycle uses a new existing durable identity and must satisfy every original gate; +this is not automatic approval or an auto-resume command. `RECONCILE_ONLY`, unknown +submission, risk limits, live-enable, release admission and all existing claims +remain independently binding. + +Before adoption, prove that flag publication and the final submission guard use +the existing cycle/claim serialization boundary: either the skip is committed +before cycle admission, or the final submission read observes it before delegate +execution. A separate best-effort read with a check-to-submit race is insufficient. +Late flags cannot undo earlier orders; report the actual submission state and +deny subsequent submissions. If existing storage/claims cannot provide this +ordering, keep adoption blocked instead of claiming a verified pause interface. + +## Required offline and adoption evidence + +Implementation tests must inject fake stores and broker delegates, and assert zero +delegate calls for valid skip, malformed state, read failure, stale current +receipt, disagreement, duplicate roles, unknown writer outcome and existing +denial. Cover sell, buy, cash sweep and option paths; retries/restarts must stay +denied. Prove a different cycle cannot inherit or bypass a skip, and unchanged +absence never changes the original decision. Cover a flag appearing between +planning and submission through the existing serialized claim boundary. + +This documentation-only draft does not run those tests or claim implementation. +Future binding requires the approved store/identity, all broker path coverage, +the concurrency proof and a separately authorized adoption. Until then severe +consensus keeps reporting `pause_not_available` and notifying the owner honestly. diff --git a/docs/unattended-followup-pr-review.md b/docs/unattended-followup-pr-review.md new file mode 100644 index 00000000..c5cd5056 --- /dev/null +++ b/docs/unattended-followup-pr-review.md @@ -0,0 +1,49 @@ +# Unattended draft review — 2026-10-15 + +Local self-review of exact GitHub PR diffs and current check results. This is not +an independent model review, production acceptance, or a grant verification. +No merge qualifies under the owner's requested conditions; all six stay draft. +Any future eligible merge must re-read all checks at the exact final head and use +`gh pr merge --squash --match-head-commit ` without `--admin`. A skipped gate +is not evidence that the gate passed. + +| PR | Reviewed head | Observed checks | One-line disposition | +| --- | --- | --- | --- | +| QPK #672 | `0c727102b57074fab889fd156efedf2ba340f8af` | CI test success | Keep draft: deeper Dot routing/admission is unverified and the monitor executes a mutable feature-branch reference. | +| ARC #116 | `47539f27728ebd6eb8d40d8d1e3989797067a1f7` | CI test success | Keep draft: stacked on #115 and explicitly depends on unresolved issue #104 caller identity/model/material/routing admission. | +| US #601 | `295df4da6bef3e4e8ff22e95fb980a2d01035dce` | Four CI checks success; behind main | Keep draft: unadopted QPK runtime and mutable monitor reference; no verified deeper Dot route. | +| CN #330 | `6b4f0efc6c341b786a6e37a18e54171e0979c3c9` | CI test and actionlint success | Keep draft: unadopted QPK runtime and mutable monitor reference; no verified deeper Dot route. | +| HK #249 | `6c2b0b20c3ef234363e91b19279a323592a0be40` | CI success; Evidence Gate skipped | Keep draft: QPK/runtime/routing dependencies remain and the Evidence Gate has not passed. | +| Crypto #270 | `a8a413d08263fbe1d787e0d429daf6004fd0ab78` | CI test/actionlint success; Evidence Gate skipped | Keep draft: QPK/runtime/routing dependencies remain and the Evidence Gate has not passed. | + +The diff review found no added trading, IAM or secret-access permission in these +six changes. GitHub issue writes are review-record/notification permissions; +existing OIDC permissions are retained, not new grants. This satisfies only part +of the requested merge conditions, and does not excuse runtime dependencies. + +QPK `DotReview` selects a configured verifier or first reviewer and accepts only +agent mode before submission; its completed receipt checks request, task, owner +and provider. It cannot prove beforehand that the profile is an admitted Dot +route. Its monitor checks out `feat/advisory-review-closed-loop`. Consumer health +workflows call that same mutable branch. Consumers retain existing approved-wheel +digests, so enabling a new environment flag does not prove the installed runtime +contains the new disposition code. Do not change pins or READY variables here. + +ARC #104 is an **issue**, not a PR. It remains open with unfilled acceptance items +for the caller, actual effective route, model/material authority and live receipt +verification. ARC #116 changes shipped `config/repair.json` to enable the loop +for an opt-in backend and suppresses some unconfirmed notices; without verified +adoption its new behavior must not be treated as operational recovery. + +Additional concrete QPK monitor limitation: `check_lane` reads only completed +runs; a permanently queued/running review can be omitted. It also uses the latest +manual or PR run as the age anchor for a scheduled lane. Such runs can mask a +missing natural scheduled review. The independent monthly dead-man follow-up +uses expected schedule slots and detects stalled cycles without any model route. + +Validation in this follow-up: QPK's review-loop/disposition/task/drift/summary +tests passed (43); ARC unittest suite passed (95). Tests use fakes. The reviewed +GitHub checks were read separately. Missing API secret availability and actual +Dot caller admission were not tested or modified. No ready conversion, merge, +production run, deployment, server access, trading operation or permission +change was performed. diff --git a/docs/unattended-owner-update-inventory.md b/docs/unattended-owner-update-inventory.md new file mode 100644 index 00000000..8cabf203 --- /dev/null +++ b/docs/unattended-owner-update-inventory.md @@ -0,0 +1,60 @@ +# AI scenario disposition inventory — owner update 2026-10-15 + +Source: owner-provided ~/codex-jobs/scenarios/final.txt, refreshed for completed monthly_audit, harden and arc_migrate jobs on 2026-10-15. + +Classification is operational, not a claim that merged source has been deployed or exercised. No scenario has current evidence of the complete unattended pattern in production. Owner update: Gemini free-tier CAPTCHA solving with local OCR fallback is allowed. Counts: 0 operationally verified unattended-closed-loop, 26 unattended-capable groups needing loop/adoption, 6 human-only groups. These are capability classifications, not proof of current login, billing, secret availability or runtime acceptance. Groups preserve the original 32-row inventory; some groups contain multiple repositories. + +| ID | Scenario | Classification | Concrete change or retained boundary | +| --- | --- | --- | --- | +| 1 | Gateway dispatch infrastructure | needs loop | Require consumer-owned review disposition and liveness; the gateway itself must not close consumer issues. | +| 2 | Gateway short structured API tasks | needs loop | Validate frozen outputs and caps; add outcome artifacts and failed/skipped-task monitoring before unattended use. | +| 3 | Daily briefing and QPK research summaries | needs loop | Review factual summaries against frozen facts; archive/close passes, one Dot escalation for flags; record summary unavailability for the independent monitor. QPK draft adds the review hook. | +| 4 | Daily briefing dual review | needs loop | Feed all three role outcomes to disposition; retain strict quorum and existing admission; independent briefing dead-man. | +| 5 | Health-cycle diagnosis | needs loop | Preserve failure fingerprint deduplication; add one deeper Dot confirmation and notify only confirmed problems; monitor diagnostic job liveness. | +| 6 | 12345 short complaint rewriting | needs loop | Keep deterministic fact preservation and length checks; archive validation outcomes; review factual flags and monitor rewrite failure without automating identity verification. | +| 7 | 12345 synthetic assistant verification | needs loop | Close successful synthetic verification records; preserve one original task on timeout; alert after N failed/skipped verification jobs. | +| 8 | Portal image CAPTCHA | unattended-capable; needs loop | Gemini free tier, then bounded local OCR; validate answer and actual portal acceptance, archive credential-free outcome, stop unresolved attempts, and independently alert failures/missing runs. SMS OTP, QR approval and real-person verification remain owner-controlled. See the Pigbibi five-repository proposal. | +| 9 | Medical local SSO/OCR collection | human-only by design | Human-only: protected local session and owner-controlled collection; no unattended login. | +| 10 | Recruitment report rewriting | needs loop | Validate rewritten facts against original evidence; archive passes, confirm factual flags through Dot; retain disabled state until separately admitted. | +| 11 | Recruitment frozen lead audit | needs loop | Replace server CLI with existing-grant frozen-material tasks; add strict evidence review/disposition and independent liveness. No server path restoration. | +| 12 | Ctrip compliance evidence review | needs loop | Retain collection coverage/evidence gates; add frozen dual review/disposition once admitted. Login/CAPTCHA/needs_review remain operational states, never legal findings. | +| 13 | PhotoStory multi-stage review | needs loop | Retire server CLI under a separate cutover; attach per-batch verdicts, one deeper Dot review for flags, and processor/review dead-man. Publication remains separately authorized. | +| 14 | Actions failure diagnosis | needs loop | Stack on arc_migrate #115; add issue-only verdict disposition, one deeper task, and diagnostic liveness. Preserve #104 identity blocker and no auto-repair. | +| 15 | HomeNetwork router/server repair | human-only by design | Human-only: retain hard-disabled privileged AI repair from #39; deterministic checks remain. | +| 16 | Telegram owner Mac engineering session | human-only by design | Human-only: interactive owner-controlled engineering; no autonomous review-triggered code/configuration repair. | +| 17 | Telegram remote server agent mode | human-only by design | Human-only: never operate servers through an unattended AI agent; retain disabled/unapproved boundary. | +| 18 | Telegram speech transcription | needs loop | Add deterministic duration/output/cost validation and liveness; factual transcript corrections require bounded review, no server actions. | +| 19 | QPK frozen engineering-material review | needs loop | Use shared issue-only disposition, archive verdicts and monitor failures/skips; retain merge/deployment authority restrictions. QPK draft. | +| 20 | US/CN/HK/Crypto drift review | needs loop | Use shared disposition without altering drift or trading outcomes; one Dot escalation; severe consensus reports missing cycle-pause binding. QPK and consumer drafts. | +| 21 | US/CN/HK/Crypto Evidence Gate | needs loop | Opt into shared disposition and companion issues, archive verdicts and monitor gate liveness; never close a PR or bypass deterministic evidence/READY checks. Consumer drafts preserve harden role fixes. | +| 22 | Research promotion-cycle findings and summaries | needs loop | Review frozen summaries, withhold unverified summaries, archive results; retain human adoption gates. QPK draft covers summaries, not automatic research/code generation. | +| 23 | SOXL code-generation research | human-only by design | Human-only: owner-controlled one-off engineering; do not restore autonomous model code edits. | +| 24 | SOXL fixed-parameter learning review | needs loop | Attach frozen-request verdict records, one deeper confirmation and task liveness; preserve manual trigger and grant blocker. | +| 25 | Global ETF deep source review | needs loop | Add strict source-evidence verdicts and one deeper task; retain current grant/READY block and bounded task limits. | +| 26 | CN ETF request advice | needs loop | Archive frozen-request review outcomes, one deeper Dot confirmation and liveness; retain missing CN admission as a blocker. | +| 27 | Strategy plugin evidence cross-check | needs loop | Migrate V1 facts-only calls to admitted V2; archive verification, confirm flags and monitor failed/skipped checks. Never change plugin signals or trading settings. | +| 28 | Crypto monthly dual-API audit | needs loop | Source loop merged in CryptoLivePoolPipelines #208. Runtime remains blocked on existing API secret availability and monthly-workload Dot admission; no cycle-bound pause API exists. | +| 29 | Deleted Crypto automatic optimization repair | human-only by design | Human-only: remain deleted; autonomous AI code/configuration repair is forbidden by the current pattern. | +| 30 | HK/US monthly snapshot audit | needs loop | Connect frozen published snapshots to admitted independent reviews, companion issue disposition, one deeper Dot review and monthly dead-man; no snapshot/configuration mutation. | +| 31 | Monthly shadow signal review | needs loop | Review frozen source material through existing admitted tasks, archive/close passes, confirm flags; retain manual/blocked state until grants exist. | +| 32 | Six-repository engineering PR review | needs loop | Replace retired failing scripts with admitted frozen-diff review and companion issue disposition/dead-man; never auto-merge or change code based on findings. | + +Conflicts: harden finished before consumer edits; HK/Crypto role/READY fixes were independently merged as #248/#268; the new drafts now include the resulting main commits. arc_migrate finished before ARC edits; the ARC draft is stacked on #115. No in-flight job worktree was edited. + +Owner decisions/adoption gaps: make existing API secrets available if desired; authorize no new grants in this task; establish admissible monthly/ARC routes through separate approved work; select existing cycle-pause bindings if available; adopt reviewed wheels/references; retain the six genuinely human-controlled groups and non-CAPTCHA identity checks; image CAPTCHA alone is no longer a human-only reason. No live trading, server, IAM, secret-value or force-push operations were performed. + +## Reclassification of the seven previously human-only groups + +| ID | Updated classification | Reason | +| --- | --- | --- | +| 8 | Unattended-capable image-CAPTCHA loop | Owner permits Gemini free tier with OCR fallback. Other identity factors are separate boundaries. | +| 9 | Human-controlled local medical SSO/OCR | Protected Mac session, identity approval and uncertain medical/payment fields remain; CAPTCHA permission does not authorize these operations. | +| 15 | Human-controlled privileged router/server repair | Server/privileged repair is outside the authorized unattended review loop. | +| 16 | Human-controlled Mac engineering session | Interactive engineering remains owner-directed. | +| 17 | Human-controlled remote server agent | Unattended server operation remains forbidden. | +| 23 | Human-controlled SOXL code generation | CAPTCHA was not the reason; autonomous code adoption is not authorized. | +| 29 | Deleted automatic optimization repair stays deleted | CAPTCHA was not the reason; no restoration of autonomous repair. | + +Group 8 covers 12345HotlineBots, MedicalClaimAssistant, RecruitmentComplianceWatch, FranchiseLeadWorkflows and TelecomMonthlyClaim. The five-repository closed-loop proposal is in the 12345HotlineBots draft, `docs/captcha-unattended-closed-loop.md`. It proposes image-only processing, existing free-tier credentials, local OCR, deterministic format checks, portal/session readback, archive/close on validated success and independent operational dead-man alerts. It never restores legacy server/CLI routes or enables business workflows. + +The six original draft reviews and exact heads are recorded in `unattended-followup-pr-review.md`; all remain draft. The separate `skip-cycle-rebalance-design.md` defines a design-only, monotonic deny flag for existing pre-trade/final submission guards. No executable pause binding is claimed.