Repository navigation
docs(plans): plan the autonomous, embeddable core (ENG-978) - #211
Conversation
Add a read-only source audit (core-autonomy-audit-2026-09-28) of what stops qq-core from running one task unattended for hours and from being embedded, and the plan that acts on it (autonomous-core.md, AC0-AC16, ledger). Three proposed ADRs: - ADR-0048: run bounds reset at their seams; ContinueRun and opt-in auto-continue of paused/interrupted runs, never re-executing a call without a recorded result. - ADR-0049: a durable run goal re-stated verbatim after every compaction, a completion audit, an always-on loop guard, continue-if-idle. - ADR-0050: a qq-harness composition crate out of src/, a tool-fetch feature, a CI-tested embedding example and public-surface hygiene. Consolidation: delete mid-run-compaction.md (design is ADR-0039; MRC-4/5 move to AC14 and Goal 5), move RR12's loop result to AC4, bring run-reliability status up to date (RR6-RR8.4 shipped; ResumeRun never built), mark F03 shipped, reserve ADR 0048-0050 (0047 held by #210). No code change.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8c2e15d45a
ℹ️ 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".
Continuation names its run, admits only the session's latest prompt run, and is race-safe through UNIQUE(continues_run_id). It carries exact limit remainders against the original deadline, sends a notice instead of the prompt a second time, and never auto-continues no_progress. The goal is bound to its run chain and activated at claim, and renders whole within 8 KiB. The completion audit gets its own allowance. The loop guard is progress-aware. update_goal is in every catalog, exposed per run, so plan identity is unchanged. qq-harness takes public inputs and is proven by an external smoke crate. Move PRs are ordered to build on their own. Protocol pairs land as single PRs. AC15 and AC16 scopes are corrected. The ADR-0039 edit becomes an appended clarification, and the RR8 remainder is listed as open.
… contract is checked Review (Codex, #212): only PROTOCOL_VERSION is checked across a connection; capabilities are advertised, and the descriptor and store schema are checked locally (plan identity, store open). The runbook said both sides check all of them. The table and text now say where each is checked. The policy itself is a durable choice a future maintainer could re-litigate, so it is recorded as ADR-0051 (0048-0050 are held by #211), indexed, and reserved in the root ledger. Refs: ENG-969
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b78f0ec0e4
ℹ️ 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".
…plan (ENG-978) Goal writes are checked against a rendered-size cap with bounds that provably fit. Continuation carries every cumulative RunLimits field and the remaining repair_turns. AC11 owns every fetch consumer. The loop guard rejects only after observed repeats and counts new reads as progress. The reservation rebase travels with the compaction request because the marker commits before the splice. Headless follows continuation chains. achieved_pending_audit is durable before publish. Load stages stay a closed enum. Also corrects the effect class name ReadOnly.
…us-core-plan # Conflicts: # docs/adr/README.md # docs/plans/README.md # docs/plans/progress/root.md
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6fafe68ee2
ℹ️ 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".
…lan (ENG-978) Correct the audit: in-run compaction shares and is refused at the 32-step compaction budget, and ADR-0048/AC2 stop charging it there. Also correct the audit's fsync-cost claims, since activity and chunk writes already share group commits. AC15 becomes measure-first and keeps ADR-0003's committed JSON. AC16 becomes a workspace retention gate and the single-session store bound becomes linear growth. AC12.1 leaves RuntimeBuildError in the binary until its catalog dependency moves. The goal PR owns the client reducer.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bbf70a4e69
ℹ️ 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".
…erating slice files (ENG-978) Loop guard: separate the seen set from the repeat counter so short cycles still pause. A steer no longer claims to resume a finished run. from_runtime takes an explicit workspace. RunPause becomes reason-tagged. qq-harness depends on qq-protocol. Owned paths become starting areas: each slice owns every consumer its type and wire changes force, gated by the workspace build, and new state must reach snapshots and reducer state in the same PR.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5caeb1b2e1
ℹ️ 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".
| - a **seen set** of every such triple observed in the current slice, | ||
| bounded at 4 096 hashes (16-byte hashes, 64 KiB), with eviction | ||
| counted as "seen". It is cleared only at a slice boundary or by a | ||
| *mutation event*: a successful call with effect class other than |
There was a problem hiding this comment.
Keep novelty history across slice boundaries
The revised A/B fix still cannot make the advertised no_progress pause fire: because the seen set is cleared at every slice boundary, the first A and B in each 256-call slice are novel again, so every slice contains novelty and the condition at lines 107–110 never accumulates two no-novelty slices. Fresh evidence beyond the prior alternating-loop comment is this explicit boundary reset in the revised design. Carry the bounded history across the no-progress window, or exclude boundary re-discovery from the slice accounting; otherwise an A/B loop can run indefinitely despite AC4's required fixture.
AGENTS.md reference: AGENTS.md:L81-L82
Useful? React with 👍 / 👎.
| - Continuations are ordinary runs: durable, observable, cancellable. A | ||
| cancel or new prompt from a client cancels the pending continuation. |
There was a problem hiding this comment.
Define cancellation of a scheduled continuation
During the cooldown, the named run is already settled as paused or interrupted, so the current CancelRun handler returns RunAlreadyFinished as soon as it sees the stored outcome (sessions/commands.rs:798–826) and never changes durable state. This promise therefore has no command transition that can cancel the pending schedule; a user can request cancellation and still have the successor start and execute tools. Extend CancelRun to atomically cancel the scheduled continuation with a truthful receipt/event, or add a dedicated command, and test its race with the timer.
AGENTS.md reference: AGENTS.md:L109-L110
Useful? React with 👍 / 👎.
| compaction must still shrink the context (ADR-0039's shrinkage check) | ||
| and is charged to the caller's token and cost limits like any turn. | ||
| That is the bound on how many can run. |
There was a problem hiding this comment.
Charge compaction usage to the caller's limits
The current in-run compactor stores usage and cost only on its internal compaction run, then returns InRunCompaction { summary } without accounting (sessions/in_run_compaction.rs:161–195), so the prompt run's BudgetMeter never sees that spend. Removing the 32-step cap therefore does not make token or cost limits the replacement bound claimed here, and AC5's predecessor-chain remainder can also omit every owned compaction row even after all RunLimits fields are enumerated. Require the compactor to return and charge its accounting, include that spend in continuation remainders, and test a low token/cost limit across compaction and continuation.
AGENTS.md reference: AGENTS.md:L149-L150
Useful? React with 👍 / 👎.
…ease (#212) * docs(release): adopt 0ver; contract bumps no longer force a MINOR release The product number orders releases and stays 0.MINOR.PATCH. PATCH is the normal step; MINOR is a deliberate milestone. Compatibility is carried by the contract versions, so the release PR must list every changed contract constant and the upgrade steps. * docs(release): record the 0ver decision as ADR-0051; state where each contract is checked Review (Codex, #212): only PROTOCOL_VERSION is checked across a connection; capabilities are advertised, and the descriptor and store schema are checked locally (plan identity, store open). The runbook said both sides check all of them. The table and text now say where each is checked. The policy itself is a durable choice a future maintainer could re-litigate, so it is recorded as ADR-0051 (0048-0050 are held by #211), indexed, and reserved in the root ledger. Refs: ENG-969 * docs(release): ship upgrade steps in the release body; ADR-0051 alternatives; client-side protocol check Review (Codex, #212): - ADR-0051 said the server refuses a mismatched peer. It does not: requests are bearer-authenticated only. The client compares ServerInfo before it attaches (local discovery, probe_health). Stated as such. - Upgrade steps lived only in the bump PR body, while the release workflow used --generate-notes alone. The release body is now the tagged CHANGELOG.md section (--notes-file, above generated notes), and the job fails if the section is missing. The runbook adds a hand-written Upgrading block to each such section; the changelog header says so. - ADR-0051 gains the template's Alternatives and Evidence sections. Refs: ENG-969 * docs(release): the runbook states the protocol guard as client-side Review (Codex, #212): the table and 0ver paragraph still said the protocol is checked "both sides" and "at every connection". Only the client compares the advertised version before it attaches; the server does not check callers. Aligned with ADR-0051. Refs: ENG-969
Spec
ENG-978. Research is in
docs/design/core-autonomy-audit-2026-09-28.mdand the plan isdocs/plans/autonomous-core.md. Docs only; no code change.What this proposes
Goal:
qq-coreruns one task unattended for 8+ hours to a typed outcome, with bounded memory, disk and fsyncs, and a third party can embed it in under 100 lines. Frontends (TUI, web, supervisors) are clients of that core and are out of scope beyond showing the new state.New findings, verified from source on
7885f2cruns.context_increment_bytescounts every streamed chunk and tool result over the whole run (sessions/claim.rs:947–966) and is zeroed only at run start. A long tool-heavy run (roughly 500–2 000 calls) failsPolicy: session context reached its 4 MiB limiteven though its live context was compacted. The 48-turn in-run compaction test adds about 105 KiB, so it never gets near the limit.lib.rs:1618) and one empty-output retry (lib.rs:1382) are also counted over the whole run.paused(about 2–3 min of outage) andinterrupted(any restart) never continue. The RR4 plan'sResumeRunand "retry to the deadline" were never built.lib.rs:1823), and an empty checkpoint reply fails the run (lib.rs:2633).executeis about 2 430 lines inside onestream!, with 63 mutable bindings whose reset scope is implicit. That is why 1 and 2 exist.ResolvedModel,RuntimeLoader,PlanCache, MCP bridge, headless driver) is about 12 k lines insrc/. The only embedding reference is a 150-line test.htmdbrings 22 packages that nothing else uses, forfetchonly. Store writes duplicate streamed text, and retention is unbounded (ADR-0038 is still Proposed).Proposed decisions
RunLimitsstay lifetime). The summarizer runs under turn recovery. AContinueRuncommand plus opt-inAutoContinue(cooldown for paused, startup for interrupted) continue a stopped run as a linked run. A call without a recorded result is never re-executed.RunGoal(objective plus a bounded checklist,update_goaltool) is re-stated verbatim after every compaction and continuation, and costs zero bytes when unused. A bounded completion audit. An always-on loop guard (3rd identical failing call or 5th identical call → rejection result; 2 idle slices →paused{no_progress}). Continue-if-idle.qq-harnesscomposition crate moved out ofsrc/in three mechanical PRs.qq-coregets a CI-testedexamples/embed.rs, a publicresolved_model, async compile, atool-fetchfeature, and public-surface hygiene (norusqlitetype in public signatures; product extensions off the core load request).Slices (AC0–AC16)
Order:
RunStateby reset scope, with zero test edits.PROTOCOL_VERSIONbumps.Plan acceptance is measured: a scripted 2 000-turn, 5 000-call soak with ≥ 20 compactions, 3 outages and 2 kills completes with zero
Policyfailures and no duplicated calls; RSS is flat; per-turn overhead is flat; the embedding example is under 100 lines; the minimal profile builds.Consolidation / stale-doc cleanup
docs/plans/mid-run-compaction.md. Its design is ADR-0039 (link updated to point at Git history). MRC-4 moves to AC14 and MRC-5 to Goal 5.run-reliability.md: the status block is brought current (RR6, RR7, RR7.1, RR4.1, RR8.1–RR8.4 shipped). The RR4 note now saysResumeRunwas not built, and RR12's loop item moves to AC4.plans/README.md: the stale priority 0 (RR1–RR4, all shipped) is replaced, and the F03 triage row is corrected.progress/root.md: F03 is marked shipped.Verification
cargo test --offline --bin qq docs_truth→ 5 passed.file:linecitation in the audit was re-checked against7885f2c. The reference-harness paths were checked under.source/at the revisions the audit records.Compatibility / performance
None: docs only. The ADRs are Proposed; each needs a lead decision and a second reviewer before its slices start.
Decisions needed
qq-harnessand whether the loop guard is on by default (AC4 gates that on T13 evidence).