Repository navigation
fix(llm): resend capped replies; repair the NIM endpoint test - #624
Conversation
A generation that runs away until max_tokens (finish_reason `length`) usually finishes when the identical request is sent again, yet every call failed on the first cut-off: an episode inside /memory/add was lost, a background extraction reran whole. OpenAIProvider now treats `length` as a resendable attempt, counted by a new `truncated_reply_retries` (default 1, in [llm], [llm.<task>] and [multimodal]) apart from `invalid_reply_retries`. A retry never raises max_tokens (llm-contract 3.1); `content_filter` is still not resent. The llm_attempt_failed log reports `retries_left` for the failure's budget in place of `attempts`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test still called resolve_llm_config, which per-task resolution replaced, so the file failed at collection. It now resolves every task the way the bootstrap does and checks each one reaches NIM's base URL, key and model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It had landed under [profile], past [llm.<task>], as a sub-heading of the wrong section; it describes an [llm] endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gloryfromca
left a comment
There was a problem hiding this comment.
No blockers; this can merge as far as I am concerned.
Reviewed the full diff and surrounding LLM provider/configuration code, callers and task-resolution path, branch history, backward-compatible defaults, test intent (including checking that coverage was strengthened rather than weakened), and the repository rules in CLAUDE.md / .claude/rules including architecture constraints. The capped-reply and invalid-reply budgets remain independently bounded, content_filter remains non-resendable, and the unchanged request preserves the configured output cap.
Verification: all project lint gates passed; the targeted LLM/decider suite passed (132 tests). The full unit run reached completion with 4,171 passed, 4 skipped, and 10 pre-existing NLTK tokenizer setup failures because this fresh worktree initially lacked the data installed by make install-deps; after installing the declared punkt_tab and stopwords data, that entire tokenizer file passed (13 tests).
Summary
Resend an LLM reply cut off at the output cap. A generation that runs away until
max_tokens(finish_reasonlength) usually finishes when the identical request is sent again, yet every call failed on the first cut-off: an episode extracted inside/memory/addwas lost for good, and a background extraction reran whole.OpenAIProvider-- EverOS's implementation of the everalgoLLMClientcontract, which leaves truncation handling to the implementation (llm-contract.md§3.5) -- now treatslengthas a resendable attempt with a budget of its own:truncated_reply_retries(default1) in[llm], settable per task in[llm.<task>]and in[multimodal]. It applies to every task; no task has a default of its own.invalid_reply_retries, so a runaway generation cannot use up the resend an unparsable reply needs, nor the other way round.max_tokens(§3.1): a reply that is long by nature reaches the cap again and still fails withcut_short.content_filter, refusals and empty replies still fail at once.Repair the NVIDIA NIM endpoint test (#596). It still called
resolve_llm_config, which per-task resolution (#595) replaced, sotests/unit/test_component/test_llm/test_nvidia_endpoint.pyfailed at collection andmake testonmainstopped there. It now resolves every task the way the bootstrap does and checks each reaches NIM's base URL, key and model. The#### NVIDIA NIMsection ofdocs/configuration.mdhad landed under[profile]; it moves back under[llm], unchanged.Area
Verification
Hermetic environment (
EVEROS_ROOTin a temp dir, provider keys blank,PYTHON_DOTENV_DISABLED=1):LoCoMo on this branch (3 full runs, per-task models with
deepseek/deepseek-v4.1-flash-1017for episode and summary; the benchmark config settruncated_reply_retries = 6): 12 replies were cut off at the cap and all 12 completed on the first resend, so the default of1would have recovered every one. No episode was lost; all 1540 questions were searched, answered and judged in every run. In an earlier run of the same model without the resend, cut-offs lost 5 of 685 episodes (0.7%).Checklist
main..envfiles, dependency folders, or generated output.Notes for Reviewers
mainfails at collection, so this branch could not show a greenmake teston its own. It is two separate commits.llm_multirounddecider (its own[decider] retriesmultiply with it).llm_attempt_failedreportsretries_left(of the failure's budget;0= giving up) in place ofattempts.LLMCallError(reason="cut_short")keeps its meaning for callers:content_filter, orlengthon every attempt the budget allowed.By submitting this pull request, I agree that my contribution is licensed under
the Apache License 2.0.
🤖 Generated with Claude Code