fix(goal/recovery): boundedllm falls back to reasoning when content is empty / content 为空且 reasoning 有内容时以推理文本作为响应,避免 thinking 模型上 goal evaluator 空响应暂停 (#9678) - #9785
Open
myipanta wants to merge 1 commit into
Conversation
…s empty / content 为空且 reasoning 有内容时以推理文本作为响应,避免 thinking 模型上 goal evaluator 空响应暂停 (esengine#9678)
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
Fixes #9678. When the Goal evaluator (or recovery reviewer) runs on a thinking model as the fallback (
recovery_model → guardian_model → main model), the model streams its verdict intoreasoning_contentand finishes with an empty visible content block.boundedllm.Callonly collectedChunkTextand droppedChunkReasoning, so it returned an empty response and the goal fail-closed paused on every turn ("empty goal evaluator response"), even though output tokens were consumed.internal/boundedllm/bounded.go:Callnow also accumulatesChunkReasoninginto its own builder, bounded bymaxOutputBytesjust like text.goaleval,completioneval, recovery reviewer) extract a JSON verdict between the first and last{/}, so a verdict emitted at the end of the thinking stream parses directly.""(fail-closed upstream). Stream errors still surface instead of leaking the reasoning-before-error.This complements the main-loop fix #6617 (
reasoningOnlyFinishHonoured) on the bounded reviewer channel.Issues
Fixes #9678
Verification
internal/boundedllm/bounded_test.go:TestCallReturnsVisibleTextWhenPresent— reasoning never leaks into a present visible answer.TestCallFallsBackToReasoningWhenContentEmpty— reasoning-only stream returns the reasoning text.TestCallReturnsEmptyWhenNothingStreamed— truly empty stays empty (fail-closed).TestCallSurfacesStreamErrorWithoutReasoningFallback— an error after reasoning must surface, not return the thinking.go test ./internal/boundedllm/ ./internal/goaleval/ ./internal/completioneval/ ./internal/recovery/go test ./internal/control/go test ./internal/agent/go veton all affected packages;gofmtclean.Documentation impact
Documentation-impact: none - internal reviewer-channel fallback only; no user-facing config or docs/*.md change.
Cache impact
Cache-impact: none - bounded reviewer calls are isolated run-time requests (temperature 0, no tools/history), not part of the cache-stable system-prompt prefix or provider-visible tool schema.
scripts/check-cache-impact.shreports no cache-sensitive files changed.Cache-guard:
go test ./internal/boundedllm/(new reasoning-fallback suite) plus the goal-evaluator/recovery/completion suites that run the same channel.