Skip to content

fix: repair headless resume before model dispatch - #378

Merged
Brian Krabach (bkrabach) merged 1 commit into
mainfrom
fix/headless-resume-repair
Oct 21, 2026
Merged

Brian Krabach (bkrabach) merged 1 commit into
mainfrom
fix/headless-resume-repair

Conversation

@bkrabach

Copy link
Copy Markdown
Collaborator

Summary

  • Share the existing Foundation-backed pre-turn repair between interactive chat and headless execution.
  • Repair and checkpoint resumed history before execute_single dispatches to the model.
  • Exercise the actual headless execution boundary, not only extracted interactive helpers.

An ordinary user message inserted between an assistant tool call and its genuine result previously reached the provider unchanged through amplifier run --resume. Interactive chat already had a repair step, but headless execution skipped it.

Behavior and scope

The CLI still uses Foundation's existing diagnosis and repair algorithm. Observed tool results retain their original payloads and correlation IDs; only genuinely missing results receive unknown-outcome placeholders. Ambiguous associations remain unresolved.

Repair uses each host path's existing save callback, including its held root writer and metadata-preservation policy. Checkpoint failures now propagate before model dispatch in both paths. This is an intentional tightening of the interactive path, which previously swallowed save errors alongside diagnostic errors. Diagnosis and context-operation failures retain their existing best-effort behavior.

After a successful repair checkpoint, headless execution resets its save-attempt flag so a later failed or cancelled turn still saves new messages. It also rechecks handoff before dispatch.

No Core, Foundation, provider, SDK, dependency, lockfile, configuration-default, or repair-algorithm changes.

Verification

  • Measured baseline falsifier: the new actual-execute_single regression fails against unchanged main because history is still broken when dispatch starts.
  • Clean uv sync --locked --all-extras --dev environments: full suite 2,773 passed, 1 skipped, 13 integration deselected, 1 xfailed, each on Python 3.11.14, 3.12.13, and 3.13.11, using locked Core 1.6.1 and installed Foundation/context dependencies.
  • Separate POSIX integration selection: 13 passed.
  • Focused repair suite: 41 passed, including repaired memory and disk before dispatch, healthy no-op, partial parallel results, receipt/metadata preservation, backup persistence, refusing checkpoints, failed/cancelled-turn saves, JSON output, and handoff.
  • Installed-wheel DTU: 41 focused tests passed on Python 3.13.11, Core 2.0.2, Foundation a5f91fc, and Anthropic SDK 1.15.0. All 103 production Python files matched the candidate before and after execution.
  • Actual live CLI, configured/reported as anthropic/claude-sonnet-5-5: one genuine tool call; one injected saved-history ordering violation repaired by actual headless --resume; another fresh-process resume. All three commands succeeded. Primary history and backups retained the genuine receipt, original user-message order, and original payloads, allowing only context-owned sequence restamping.
  • Independent source review found no blockers. Default Ruff checks on changed Python files and formatting of the regression file passed. Existing unrelated production-format findings were left unchanged.

The live check injects saved ordering damage around a genuine tool result; it does not claim to reproduce a spontaneous interactive interruption race. CLI model labels are not vendor-side usage/cost or HTTP-retry telemetry. The separate preinstalled-provider wheel/cache startup corner case is not changed by this PR.

The disposable DTU was destroyed after evidence export, and its absence was independently confirmed. No normal user installation or settings were changed.

Generated with Amplifier

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@bkrabach
Brian Krabach (bkrabach) merged commit 8622557 into main Oct 21, 2026
9 checks passed
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.

2 participants