Skip to content

fix(runtime)!: recover durable summaries within caller limits - #296

Merged
lg2m merged 56 commits into
mainfrom
fix/eng-1029-ac3-durable-summary-spend
Oct 14, 2026
Merged

lg2m merged 56 commits into
mainfrom
fix/eng-1029-ac3-durable-summary-spend

Conversation

@lg2m

@lg2m lg2m commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Transient in-run summary failures previously failed the whole prompt. AC3 retries them under the existing recovery policy, preserves durable work, and pauses when recovery is exhausted. Summary attempts retain measured spend and enforce the caller’s remaining allowance.

Spec: autonomous-core AC3 · ENG-1029

Behavior

  • Persist measured summary subturns before further work; interrupted unknown spend stops bounded callers. Summary tool calls never execute.
  • Preserve the original cancellation, deadline, token and cost limits. Settle owned internal attempts once before publishing foreground completion receipts.
  • Keep foreground receipts within bounded row/byte snapshots, including after many internal attempts and a later queued cancellation.
  • Preserve foreground identity, delegated holds, drafts, structural deletion/refocus and authoritative prices through live events and quiet reconnect/replay.

Current-main integration

AC17 PR294 is merged on main 7de994b1. This head integrates that main, preserving schema45’s approval_delegated values and adding the validated owner index at schema46. Upgrade44/45, reopen, malformed-index refusal and rollback are covered. Older binaries reject upgraded stores. Protocol32 and descriptor13 remain unchanged.

Verification

Qualified source 12d2f0bf, with evidence recorded at e8c52db1:

  • Serial workspace tests: 2,309 passed / 0 failed / 14 ignored, excluding one nested embedding child invocation.
  • Workspace formatting, all-target/all-feature Clippy with -D warnings, and workspace build pass.
  • Focused migrations55, client38, TUI363 unit+6 integration and documentation consistency23 pass.
  • Independent focused main/schema/client integration review: Approve.
  • Existing AC3 long-run evidence includes2,000 turns /5,000 durable4KiB calls /99 compactions /0 duplicate effects. It is bounds evidence from an earlier source, not final-head outage or performance qualification.

Commands use env -u NO_COLOR; inherited NO_COLOR=1 conflicts with existing ANSI-expecting tests. No user configuration or test timeout was changed. Failed diagnostic logs are preserved.

Performance and remaining gates

Recorder PR297 supplies a common immutable benchmark fixture. Hosted diagnostic run38512527872 completed120 runs/360 rows against earlier sources; this does not qualify this newer integration’s latency. Final-head before/after measurement, quiet tails, H0 and whole-plan gates remain open without waivers.

Fresh idle bootstrap without retained foreground identity remains unidentifiable until run-body data loads. Rust consumers using explicit RunStats/SessionView literals must initialize the added fields. Architecture, protocol migration history, transcript design, guide and ledger are updated.

The opening Codex 👍 at 10f87482 applies to that earlier head. Request fresh review of this current integration. Remaining autonomous-core goal/guard/continuation/retention/hosting and paid evidence belong to their tracked slices; this PR does not claim the entire plan finished.

lg2m added 26 commits October 11, 2026 22:05
… when spent

AC3 (ADR-0048 § 2). The in-run compaction summarizer was a single-shot
provider turn: one 529 failed the whole prompt run with a /compact
diagnosis. It now runs under the same TurnRecoveryPolicy and
MAX_TURN_RETRIES allowance as a model turn. A transient fault settles
that compaction run failed and the loop re-issues the step after the
backoff, emitting TurnRetrying. When the allowance is spent the run
settles paused with every earlier turn durable. Rejected summaries
still fail closed.

Refs: ENG-1029
…d rejection

AC3 review follow-up. A compaction step that finishes while its prompt
run still holds the session no longer pings, counts as unread, raises an
error notice or clears live tool state in the client. Adds tests for a
cancel during the summarizer backoff and for a non-transient summarizer
error failing closed, and asserts the scripted faults were served.

Refs: ENG-1029
AC3 re-review: assert approvals survive a compaction step's finish and
the prompt run's own pause still notifies and clears live state; cover
a queued prompt cancelled behind the active run; document the summarizer
retry in the protocol guide.

Refs: ENG-1029
Adopt 01dd7b5, b1e4bff and 455d318 into the user-authorized dependent stack. Preserve consolidation and AC17 receipts. The original worktree and draft PR remain untouched; known spend and caller-limit repairs remain required before pushing ready.
AC3/ENG-1029 qualification: a caller with 500k tokens completes despite 600001 reported summary tokens. This public-API fixture fails behaviorally on the adopted retry source before the accounting repair.
AC3 first accounting repair: durable internal compaction spend also consumes the prompt caller limit without duplicating session accounting. Stop before another provider work request when that allowance is exhausted. Retry/subturn durability and qualification remain in flight.
AC3: admit each provider send from the remaining allowance, persist each completed summarizer turn before continuation, and preserve known receipts with unknown aggregate state across faults and cancellation. Caller and internal-store accounting retain separate ownership. Session-total and child-rollup qualification remains in flight.
Token/cost and unknown-usage subrequest cases pass; priced receipt test reproduces the omitted internal-compaction cost in the session total before the settlement repair.
AC3: retain exact-once accounting independently of prompt active-slot ownership.
AC3: a second child must inherit the remainder after the first child and its internal summarizers.
AC3: preserve exact ownership and fail-closed accounting without counting internal attempts as descendants.
AC3: reserve schema45 after a red full-history-scan regression; preserve independent unknown accounting.
AC3: migrate schema44 to45 atomically, validate index shape and preserve historical accounting.
AC3: qualify cancellation/deadline durable prefixes and reproduce post-settlement turn writes.
AC3: guard internal turn persistence in its worker job; document measured-prefix accounting and caller bounds.
AC3: two process kills preserve measured prefixes and unknown totals without provider or tool replay.
AC3: prove output-lane persistence precedes cancellation settlement and cost is charged once.
AC3: measured summary replay is scoped; prompt-first terminal recovery must notify only once.
AC3: notify once in either recovery order, including snapshot reconnection.

BREAKING CHANGE: RunStats adds owned_step. Explicit external struct literals must initialize it; Default-based construction and wire formats are unchanged.
AC3: preserve provider inputs across retries and original duration through backoff; distinguish lifecycle outcomes in design.
AC3: model schema16 before testing its exact auto-compaction ownership backfill.
Separate successful workspace and 2000-turn bounds proof from pending performance and live gates.

lg2m commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Latest head5dd3a15c fixes both new findings, plus the independently reproduced cold-eviction variant. Full workspace2,289 passed/0 failed/14 ignored, fmt/Clippy/build green. Please review the latest source. Performance description is corrected: prior recordings used materially different included fixtures; comparable replacement measurement remains pending in #297.

Base automatically changed from fix/eng-872-ac17-tolerant-arguments to main October 14, 2026 03:34

@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: 5dd3a15c3b

ℹ️ 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-tui/src/app.rs Resolved

lg2m commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Head eff40ce fixes the new delayed-receipt/eviction finding. The regression preserves drafts/focus and requests one missing terminal receipt only for a body made warm by replay. Serial workspace2,289 tests pass with all original timeouts, fmt/all-target/all-feature Clippy/build green; independent review approved. Please review the latest head.

@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: eff40ce15a

ℹ️ 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-client/src/state/reduce.rs Resolved
Comment thread crates/qq-client/src/state.rs Resolved

lg2m commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review
Latest61b75bcc fixes structural deletion replay and bounded foreground receipts; full serial workspace2,291 passed, fmt/Clippy/build green. Please review the latest head.

@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: 61b75bcc4b

ℹ️ 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 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review
AC3's declared implementation and acceptance checks are complete at10f87482: all reported regressions fixed, independent source review approved, full serial workspace2,292 passed/0failed/14ignored, fmt/Clippy/build green. Please make this a final review of concrete, reproducible correctness or safety regressions introduced by this diff. Resolved decisions are settled absent a new reproducing input; broader autonomous-core performance/goal/continuation work is tracked separately. If there are no blocking introduced regressions, approve and react 👍 to the opening PR description.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 10f8748222

ℹ️ 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 added 4 commits October 14, 2026 00:23
Merge main7de994b1 and preserve AC17, delegated holds, Herdr and AC3 receipt behavior. Test-first owned_compaction_index_upgrades_preserves_rows_and_reopens reproduces main45 failure; separate45→46 index migration preserves existing data and supports repeated reopen. Migration55, client38 and TUI363+6 pass; independent source review approved. Full workspace qualification follows before push.

lg2m commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review current head e8c52db against main7de994b1, focusing on concrete regressions introduced by this PR, especially preservation of main’s schema45 delegated holds and AC3’s separate schema46 migration. Previous resolved decisions are settled unless new reproduction evidence shows a remaining defect. Workspace2309 tests, formatting, Clippy and build pass; exact evidence and open performance gates are in the updated description. Please provide the final review outcome for this head, with the opening-description 👍 if approved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: e8c52db180

ℹ️ 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 merged commit 5500928 into main Oct 14, 2026
6 checks passed
@lg2m
lg2m deleted the fix/eng-1029-ac3-durable-summary-spend branch October 14, 2026 15:31
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