Repository navigation
feat: end research with complete_research when a finalizer writes the answer - #173
Merged
Merged
Conversation
… answer With a finalizer configured, research previously composed a full answer in finalize_answer arguments, which was always discarded at the handoff. Research is now offered complete_research instead. It takes no input, ends the loop, and hands off to the finalizer through the existing path. A stray finalize_answer call hands off the same way unless required visual work still withholds completion. Without a finalizer, research keeps finalize_answer.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
devhims
added a commit
that referenced
this pull request
Oct 9, 2026
Since #173, research with a configured finalizer ends by calling complete_research; finalize_answer is no longer offered. The context gathering tests still simulated finalize_answer and passed through an unknown-tool path. They now use complete_research, the production path.
This branch was successfully deployed
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.
Problem
With a finalizer configured (always, in production), research's
finalize_answernever saves its answer:phaseContext.finalizethrows the finalization handoff by design, and the finalizer writes the published answer. Research still had to compose the full answer as tool arguments first. Over the last 14 days, 127 of 250 completed runs paid for that discarded answer. In runf515c361it cost 1,332 output tokens and 7.7 s before the finalizer started.What changed
complete_researchinstead offinalize_answer. It takes no input, stops the loop, and hands off through the existing finalization path (agent_finalization_handoffwithreason: research_complete).inspect_videoandtopic_researchtell research to callcomplete_researchand not to write the answer. Without a finalizer, the prompts andfinalize_answerare unchanged.finalize_answercall (for example one copied from conversation history) hands off the same way, unless completion is currently withheld. Its answer is never used.Testing
npx tsc --noEmitnpx vitest run: 1599 passed. New: a single-video run where research callscomplete_research, the finalizer writes the answer, and research is never offeredfinalize_answer;complete_researchstays withheld until required visual work finishes.vitest.user-account.config.ts: 349 passed.vitest.auth.config.ts: 39 passed.AGENT_COMPLETION_LIVE=1 npx vitest run test/research-completion.live.test.tsagainst Fireworks GLM: research calledcomplete_researchon its first step, using 19 output tokens in 2.7 s, then the finalizer produced a validated answer.