Repository navigation
fix(axir): retry cut-off actor replies in the five generated languages - #912
Merged
Merged
Conversation
Port the TypeScript cut-off reply retry (#906) to Python, Java, Go, Rust and C++ through AxIR. A distiller or executor reply that is cut off at the output limit no longer ends the run: the same turn asks again, up to three more times, first unchanged and then with the TypeScript note after the action log. Any other failure, and a reply still cut off after every retry, is raised as before. A cut-off reply with no text used to fail in the ports as a missing field, which then surfaced as "Assistant content is required when no tool calls are provided". It now fails as TypeScript reports it, "Max tokens reached before completion", so the retry recognizes it. Nine conformance fixtures recorded from TypeScript cover both changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The five generated languages now retry a cut-off actor reply as TypeScript does, so the entry added with #906 is done. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Summary
Ports the cut-off reply retry from TypeScript (#906) to the five generated languages (Python, Java, Go, Rust, C++) through AxIR, and closes the backlog entry
axir-2026-11-17-retry-an-agent-actor-turn-after-a-cut-off-model-reply.A distiller or executor reply that is cut off at the output limit no longer ends the run. The same turn asks again, up to three more times: the first retry repeats the request unchanged, later ones add the TypeScript note after the action log. Any other failure, and a reply still cut off after every retry, is raised as before.
What changed
ir/axcore/agent.axir): two new ops at the end of the file,@agent_is_cut_off_reply_errorand@agent_actor_stage_forward. The distiller and executor actor loops call the model through the second one.forwardandstreamingForwardshare that loop, so both are covered. The limit (3) and the note text are the TypeScript ones.ir/axcore/gen.axir): a cut-off reply with no text used to be parsed as an answer with a missing field. The validation retry that followed then failed its own request check, so the run ended withGenerate failed: Assistant content is required when no tool calls are provided. TypeScript does not parse an empty answer and reportsMax tokens reached before completion. The ports now do the same (@parse_answer_outputs, a new op at the end of the file), so the retry recognizes the most common real case: a reply that spent its whole allowance on reasoning.agent-streaming-goldens.ts,axgen-streaming-goldens.ts). The agent extractor's scripted model learned two reply forms the port runners already had:{results: [...]}with its own finish reason, and{error: {type: 'plain', message}}.agent-forward-cut-off-reply-retriedagent-forward-cut-off-reply-noteagent-forward-cut-off-reply-exhaustedMax tokens reached before completionagent-forward-cut-off-reply-other-erroragent-forward-cut-off-reply-distilleragent-forward-cut-off-reply-with-contentagent-forward-cut-off-reply-function-argumentsInvalid function argumentsis retriedagent-streaming-forward-cut-off-reply-retriederrors-max-tokens-empty-content(axgen)How the ports report a cut-off reply
Checked by running the packages, not only by reading the IR:
Generate failed: Max tokens reached before completion. Unchanged.Invalid function arguments(one call). The ports never raise that: the generation answers the bad call with a tool error and asks the model again (Python and Go: three requests, run completes). That difference predates this PR and is not changed. The retry still recognizes the message, as TypeScript does, and a fixture pins it with a scripted failure.Generate failed: ...).Behaviour changes for port users
Generate failed: Max tokens reached before completioninstead ofGenerate failed: Assistant content is required when no tool calls are provided. It still fails after one request.Not included
actorMode: 'completion'stages are unchanged. TypeScript has no counterpart, so there is no reference behaviour to port.stop) is unchanged. Checked on the Python package: it still ends withAssistant content is required when no tool calls are provided, where TypeScript returns an empty output after one call. That difference predates this PR.Verification
Run locally on
0b7e5b844, which is this branch on top ofmainat5706a70d2(#910). The second commit only closes the backlog entry.npm run axir:verify:dev: exit 0. Python, Java, C++, Go and Rust each reportok conformance: shard 1/1: 2209 fixtures(2,200 before, plus the nine new ones).npm run axir:check-packages:AxIR committed packages are up to date.npm run axir:conformance:check:AxIR conformance fixtures and provider catalog are in sync.Re-recording after feat(agent): raise the default maxRuntimeChars from 3,000 to 12,000 #910 changed none of the new fixtures.npm run test --workspace=@ax-llm/ax: 277 files, 4,243 passed, 1 skipped; templates, index, type-check, type-tests, lint and format pass.npm run test:spelling: passes.npm run test:axir:go-fast:72 fast AxIR Go tests ... 0 failing.npm run test:axir:tools: 137 passed.npm run axir:gate:response-perturb:522 response mutations across 203 fixtures: every fixture has a model-dependent assertion on every target.npm run skills:check,axir:gate:prompt-sync,axir:gate:anti-facade,axir:gate:ledger,axir:backlog:validate,axir:backlog:check: pass.ir/conformance/axagent-real, 14 fixtures, built as CI's antidote job builds it): passes on Go, Java, C++ and Rust.Do the new fixtures have teeth?
Not verified locally:
quickjsmodule. CI runs it.npm run test:axiraggregate (the slow Go test suite) was not run; the fast subset and the five-language verification were.🤖 Generated with Claude Code