Skip to content

feat(runtime)!: complete durable goal checks and driver bounds - #330

Merged
lg2m merged 87 commits into
mainfrom
feat/eng-1063-goal-completion
Oct 17, 2026
Merged

lg2m merged 87 commits into
mainfrom
feat/eng-1063-goal-completion

Conversation

@lg2m

@lg2m lg2m commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

QQ drives durable goals to verified completion with bounded paid-family accounting, exact check consent and recoverable interrupted-check holds. G2/G3 builds on merged #308/#309; G4 surfaces are in #331. Linear: ENG-1063 / ENG-1053. Spec: docs/plans/goals.md.

Behavior

  • Authorized native checks use no model run. A current pending check can verify the final charged work run; deadline, token, cost and unknown-accounting limits still apply. A model audit needs another available model run.
  • Check supervision observes exit before noisy pipe reads, confirms descendant teardown, and retains workspace exclusion until cleanup is confirmed. Missing workspaces settle as failed checks without poisoning the host.
  • Current managed ceilings and conservative request/routing bounds apply at execution start. Sponsored descendants share current paid-owner remainders. Interrupted started checks require exact acknowledgment; unstarted consent survives restart.
  • Final-slot work reserves a tool-free handoff. Revisions fence stale claims and check results.

Verification

cargo xtask check

Head 725dabe85508 vs origin/main; 0 changed file(s); scope: full workspace.

Gate Result Tests Time Command
fmt pass 1.5s cargo fmt --all -- --check
lint pass 2.0s cargo xtask lint
clippy pass 27.4s cargo clippy --color never --workspace --all-targets --all-features -- -D warnings
test pass 2709/2709 passed, 15 skipped 72.4s cargo nextest run --color never --profile default --workspace
doctest pass 2.9s cargo test --color never --workspace --doc
minimal-clippy pass 5.0s cargo clippy --color never -p qq-provider --no-default-features --features test-support --all-targets -- -D warnings
minimal-test pass 211/211 passed, 0 skipped 6.0s cargo nextest run --color never --profile default -p qq-provider --no-default-features --features test-support

All gates passed in 117.4s.

Real-binary smoke: 6/6 passed. Ordinary request recapture: 8/8 byte-identical to main 3e34eea2 across Responses, Chat, Anthropic and Google, initial/post-tool turns. Focused completion checks:29/29 pass. Independent source review approves the new fixes at b75b341; the added policy-pool correction is independently approved at8681c56d. Completion-check validation now awaits capacity under caller cancellation/deadline bounds; a red-before-green regression covers canceled waiters and permit recovery.

Test-first regressions reproduce final-run verification refusal, sustained descendant output starving exit, disappearing workspaces, portable group confirmation, routing token bounds, refreshed admission and sponsored approval expiry. Red-before-green logs remain private under /tmp/qq-goal-delivery-20261015/. Tests use command-local tmpfs fixtures on this I/O-loaded host; assertions and timeouts remain unchanged. Native macOS execution was unavailable locally.

Compatibility and qualification

Protocol33→34; schema55→58 (forward-only); descriptor15 unchanged. Upgrade clients/servers together and back up database/WAL/SHM before migration. Unix checks execute natively; other platforms fail closed. Current main auth/fixture fixes are preserved; removed PR319 provenance is absent.

G5 is qualified on final runtime e84e3552 in #332: the ninth subscription-only trial settles after 8,744.546 durable goal-event seconds, with four compactions, all 14 checklist identities retained and exact terminal usage reconciled. All 25 checked-in audit checks pass. Earlier trials remain historical; they do not supply final-runtime acceptance. Separate ENG-1058/resource/performance/H0 work remains unqualified. No paid API fallback. Do not merge this stack.

Current review repairs at725dabe8 move workspace opening into the bounded blocking preparation task, reset only a changed check’s failure streak, and mask diagnostics before persistence/provider context, conservatively omitting a clipped leading credential fragment. The focused completion suite passes31/31; independent source review approves. Real-binary smoke6/6 and ordinary-request byte parity8/8 pass on this head.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T11:11:33.653820Z 725dabe Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

lg2m added 28 commits October 15, 2026 23:26
ENG-1063 G2 closeout. Port test-first fd01818e onto current main; retain all current goal regressions.
ENG-1063 G2 closeout. Port 6cd1a811 without old merge history or historical ledgers. Preserve current sponsor deadlines, routing projection, output caps and cooperative preparation drain.
ENG-1063. Port e2d764ce; retain goal_review module.
G2: reserve input and current output/cost before dispatch, recheck absolute caller deadlines inside the store actor, and retain the initial durable-start refresh handshake. Qualify goal/prompt caller caps, count-based final responses, raised budgets and queued expiry.
G2: reject unknown capped spend before pending dispatch proof, reserve worst cached/tier rates, and verify exact input affordability and queued caller deadline controls.
G2: metered real compaction/continuation sends [1024,1024] despite a cumulative caller output cap below1000. Goal-less control retains existing byte-exact summary join assertions.
G2: admit every summary and continuation against current caller and goal remainders using committed helper identity. Preserve absolute deadlines, avoid disabled-path bridge allocation, and read settled durable accounting after interrupted admission. Metered real compaction and post-commit/pre-ack race regressions pass; independent review, goal/summary tests, workspace Clippy and build pass. Full G2 and autonomous-core remain incomplete.
ENG-1063. Port 5e29c757 while preserving all paid-ancestor deadline intersections, sponsor metadata and current output caps. Only a run own goal can classify its final slot.
G2.2: intersect caller limits at admission, tighten live final-slot meters without resetting spend, and refuse extra reserve turns after any consumed turn cap. Persist rejected handoff tool turns before exhaustion.
G3.1: preserve typed acquisition expiry and settle unstarted checks through the queued-run path. The calendar-expiry regression verifies timeout priority and durable queue cleanup.
G3: reuse durable prompt runs and zero-repair output contracts for independent one-turn verification. Fence results against current revision and exhaustion; cap audit attempts and withhold tools.
G3: hold a completed process before settlement, mutate its goal, and require original run diagnostics to survive snapshot and reopen.
G3: persist bounded check results on the original run even after goal edits, replacement or clear. Publish existing message events in the terminal transaction without adding check-only records to model context.
G3.4: extend the existing real-process acceptance with exact Once checked achievement after forty goal runs, preserving the deadline-only variant. Prove ForGoal three-strike blocking and exact terminal reopen evidence.
G3: hard-kill real runtimes at explicit phase barriers, preserve unstarted authority and exact row recovery, and pause started checks without repetition. Observe the orphan boundary with stable test-owned pidfds; decision15 remains open.

lg2m commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review current head e86fb41. All four prior findings have published fixes, targeted regressions and per-thread evidence. Final full workspace2704/2704+15intentional skips, minimal-provider211/211, doctests/Clippy and real-binary smoke6/6 pass. Final-head goal-less request parity is8/8 against current main3e34eea2. The PR description records compatibility and remaining qualification.

@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

if paid
&& metadata.goal.is_some()
&& let Some(limit) = metadata.limits.max_cost_usd_nanos

P1 Badge Reserve routing tokens before dispatch

When task routing is enabled and a goal has a small max_total_tokens remainder, this admission validates only the router's declared cost; TaskRouter exposes no token ceiling, so the up-to-64-KiB TypeSafe routing request can be dispatched and record usage beyond the goal limit before the later main-request meter stops. Extend routing admission with a conservative token/input reservation and refuse the routing request before dispatch when it exceeds the current goal remainder.

AGENTS.md reference: AGENTS.md:L92-L93

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

lg2m commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review published head4bc4f247ceea. Both inline findings are fixed with per-thread regression evidence and resolved. The summary-only routing-token finding is also fixed: router input/output bounds default unknown, and admission checks current caller plus paid-owner remainders, including pending spend, before the dispatch marker. TypeSafe leaves billed output unknown; finite output/total caps fail closed for paid multi-candidate routing. Final full2706/2706, minimal211/211, smoke6/6 and8/8 goal-less byte parity against current main pass. PR body includes final-head evidence and the disk-I/O timeout/reproduction/tmpfs rerun. No gates or assertions weakened; no macOS execution or final-head performance qualification claimed.

@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

qq/src/runtime.rs

Lines 2706 to 2708 in 4bc4f24

let permit = match Arc::clone(slots).try_acquire_owned() {
Ok(permit) => permit,
Err(_) => return Err(qq_core::GoalCheckPolicyError::Overloaded),

P1 Badge Wait for check-policy capacity instead of pausing valid goals

When four goal/check policy loads already hold this shared semaphore, a fifth validate_goal_check immediately returns Overloaded; in the checked-completion path, goal_check::execute turns every such policy error into Completion::Policy, and finish durably pauses the otherwise valid goal as needs_user: configuration. This can make concurrent autonomous goals require manual recovery solely because configuration reads briefly saturated the pool. Await the permit instead—the execution path already bounds that wait by the check deadline, and command-time validation has its existing 10-second timeout.

AGENTS.md reference: AGENTS.md:L92-L93

ℹ️ 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 crates/qq-core/src/sessions/goals.rs Resolved

lg2m commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the review-body policy-capacity finding (review5546040233) in 8681c56, published at 4c2578a. Completion-check validation now waits for the shared four-slot pool, matching goal-policy loading. Caller check deadline/cancellation and command timeout bound that wait. The regression reproduced immediate Overloaded while slots were held; afterward it verifies a canceled waiter, successful queued validation and all four permits returned. Three focused policy/managed-denial tests, full2707/2707 +15 deliberate skips, minimal211/211, smoke6/6 and ordinary request parity8/8 pass. Independent source review approved the change. No merge.

@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: 4c2578abcd

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

lg2m commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review published head 725dabe. The three latest findings have tested published fixes and per-thread evidence; all three threads are resolved. Final-head full workspace gates, real-binary smoke and8/8 ordinary-request byte parity pass, with independent source review approved. PR body carries current evidence. No merge requested.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 725dabe855

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

@lg2m
lg2m added this pull request to stack #342 October 16, 2026 16:27
@lg2m
lg2m merged commit 0df2241 into main Oct 17, 2026
8 checks passed
@lg2m
lg2m deleted the feat/eng-1063-goal-completion branch October 17, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant