Skip to content

fix: fit measured requests and finalize failed goals - #61

Merged
Brian Krabach (bkrabach) merged 1 commit into
mainfrom
fix/measured-fit-goal-cleanup
Sep 20, 2026
Merged

Brian Krabach (bkrabach) merged 1 commit into
mainfrom
fix/measured-fit-goal-cleanup

Conversation

@bkrabach

Copy link
Copy Markdown
Collaborator

What changed

This companion change builds on the optional fit_output negotiation added by the Context dependency (Context PR #44). It deep-clones the assembled request, preserves tools, options, retention, overlays, and tool choice, and tries a bounded output-cap ladder: at most six additional counts, with a 1,000-token floor. Severe sub-10k warnings are included before each candidate count. The accepted, newly counted request object is dispatched unchanged.

Goal-turn failures across initial, continuation, and escalation paths now clear the active goal, flush a deferred errored completion exactly once, emit terminal progress, avoid evaluator/judge/summary helpers, and re-raise the original turn error. Cooperative fitting cancellation follows the normal cancellation lifecycle; actual task cancellation still propagates.

Why

Some provider budgets fit when reducing the output reserve increases the provider-reported input allowance. This gives the loop a bounded, lossless negotiation path and ensures failed goal turns do not leave stale active state or pending error completion.

Verification

  • Local Loop: 419 passed
  • DTU Loop: 412 passed, 7 abstract Core contract skips; all candidate tests ran
  • Context dependency validation: 208 passed, 11 abstract Core contract skips, 1 existing xfail
  • 113 focused measured-fitting/goal checks passed (overlapping the full suites)
  • Four-way old/new interoperability, protected content, finalization, cooperative cancellation, and headless failure persistence were validated
  • Synthetic counters and SDKs were used for control-flow/composition tests; no live vendor calls

Fixture-only test correction

The existing hard-fit fixture changes from 40k to 70k supplementary Han characters to restore its intended over-budget precondition after the documented model input-ceiling correction. Assertions are unchanged, and the authentic baseline production passes the corrected fixture.

Non-goals and limits

No Core API, provider/default-meter change, byte-fallback deletion, retention weakening, automatic model change, or required-input protection relaxation is included. Output fitting cannot resolve an independent input ceiling or genuinely oversized required input, and adds at most six extra counts per fit.

The Context dependency is merged in microsoft/amplifier-module-context-simple#44.

Generated with Amplifier

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@bkrabach
Brian Krabach (bkrabach) merged commit 9e5d4ff into main Sep 20, 2026
5 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