Repository navigation
feat(runtime): record slice checkpoints as report turns; an empty one no longer fails the run (AP3a) - #237
Merged
Conversation
… no longer fails the run The 256-call slice checkpoint used to append its notice to the system prompt. That invalidated the provider's cached prefix twice per slice, and 23 of 25 observed checkpoint turns ignored it. An empty reply also failed the whole run. The checkpoint and continuation notices are now runtime messages at the end of the conversation, and the system prompt never changes at the seam. Each notice is persisted with the first turn whose request carried it, as model_turns.notice (store schema 40), and assembly replays it before that turn. Live and restart contexts are therefore byte-identical, which the reference oracle and a restart test check. An empty checkpoint is a missed report: the live context fills it with the placeholder assembly inserts, the slice resets, and the run continues. Steering that arrives at a text-only checkpoint is applied before the continuation. The checkpoint text now asks for a report (established with path:line, unknown, next action). Flips AC0.1's empty-checkpoint oracle. Migration tests assert STORE_SCHEMA_VERSION instead of a literal. AP3a of docs/plans/autonomous-core.md (ADR-0054 § 2). Linear: ENG-990
…low-up for report turns The in-run compaction splice removes every message before the first kept assistant turn, including the steering and the runtime notice in front of it. Replay dropped only turns through the cutoff, so it re-added both. The steering half predates this slice. Replay and the reference oracle now drop the first kept turn's notice and its steering. replay_drops_the_notice_and_steering_the_in_run_splice_removed failed on the old rule. Also: - a budget-final turn never gets the continuation notice; - an unmetered empty checkpoint is retried as a swallowed gateway failure (documented and tested); - the notice column's meaning (first attempt) is documented, and the runbook query judges each report by its last attempt, checked against a schema-40 store; - a misplaced doc comment is fixed. New tests: steering during a report, for text and empty reports; audit always audits only the final answer; a truncated report keeps one notice and replays identically; one static prefix across the seam. Linear: ENG-990
Second-review follow-up: - a budget-final turn after a report gets no continuation notice. The regression fails if the guard reverts; - the runbook query reads blocks from $.content when a turn carries a provider replay envelope; - end to end, a run compacts in-run three times after its slice report and a follow-up replays the live context. This fails on the pre-fix replay rule; - a faulted report is retried under one notice, and the stored rows replay in live order; - a Jev run cannot reach a slice report: its per-run review cap, now the named MAX_CHECKPOINT_REVIEWS_PER_RUN, is below the slice checkpoint, and a test fails if either moves. The cutoff unit drift found in review predates this slice and is filed as ENG-991, an AC2 input. Linear: ENG-990
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…cord the Bedrock check The plan and ADR-0054 described a 'turn kind' column; what shipped is model_turns.notice. The plan header still said AC0.1 was unpushed, and the runbook said schema 39 only. Records the live Bedrock Converse check: Llama and Mistral reject user text after tool results in any form (ENG-999). Linear: ENG-990
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slice AP3a of
autonomous-core.md(ADR-0054 § 2) · Linear ENG-990 · Base: #236 (AC0.1), on #235 → #233 → #232.What changes for users
The 256-call slice checkpoint, where a long run is asked to write down its progress, now works the way it was meant to:
provider returned an empty slice checkpointused to end a multi-hour run. An empty metered reply is now a missed report: the slice resets and the run continues. An empty reply with no usage after fresh tool results is still retried as a swallowed gateway failure, which is documented and tested.path:line), what is unknown, and the next action. This is the shape AP3b builds on.Design
runtime::TurnNotice { Report, Continuation }is carried onAssistantTurnCompleted. It is persisted asmodel_turns.notice(store schema 39 → 40, a nullable TEXT column) on the first turn row whose request carried it.CODECerror.EMPTY_TURN_PLACEHOLDER, which is exactly what assembly inserts, so live and replay match.architecture.md, and the progress-report query judges each report by its last attempt.Verification
Completed, and the live window is[report notice, placeholder, continuation notice];an_empty_checkpoint_is_a_missed_report_and_the_run_completes_with_its_billing: billed, replay identical, oracle agrees;an_empty_checkpoint_is_a_missed_report_and_the_run_continues.replay_drops_the_notice_and_steering_the_in_run_splice_removed.Prepared.static_prefixare equal across the seam.alwaysaudits only the final answer). A Jev run cannot reach a checkpoint: a test pinsMAX_CHECKPOINT_REVIEWS_PER_RUNbelow the slice size.version_thirty_nine_gains_the_turn_notice_as_null_and_rejects_a_bad_shape: old rows replay unchanged, a bad column shape is refused, and an unknown value isCODEC. Migration tests now assertSTORE_SCHEMA_VERSIONinstead of 27"39"literals.cargo test --workspace: 2029 passed, twice. Soak--ignored: 5 passed. Clippy (--all-targets --all-features -D warnings) and fmt are clean. Docs-truth passes with the guide's "store schema 40".context_assemblyassemble medians: 51.6 / 52.7 / 55.9 µs before, 51.0 / 52.9 / 55.2 µs after;turn_overhead: 15.0–15.6 ms before, 15.4–16.4 ms after, with overlapping ranges.Review
There were two independent read-only reviews. The first requested changes: one blocking item (the in-run splice versus replay), four should-fixes, and five test gaps. All are fixed. The second approved and asked for S1–S3 in this PR, which are done. Its S4, the in-run cutoff unit drift that predates this slice, is filed as ENG-991 and recorded as an AC2 input.
Compatibility