Repository navigation
fix(agent): apply toModelOutput to deferred results delivered by resumeToolResults - #176
Open
alexb-openrouter wants to merge 1 commit into
Open
alexb-openrouter wants to merge 1 commit into
alexb-openrouter wants to merge 1 commit into
Conversation
Contributor
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
alexb-openrouter
marked this pull request as ready for review
November 30, 2026 16:28
Contributor
This branch has not been 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.
Summary
resumeToolResults(and a deferred tool's.resolve(), which calls it) put the raw validatedoutputinto thetool_task_resultenvelope. It never called the tool'stoModelOutput, so a mapper that hides fields was bypassed and the raw result reached the model.Now
buildResumeEnvelopemaps a successful output through the new shared helpermapTaskResultForModel(src/lib/task-result-for-model.ts):inputSchema. The input comes from the matchingfunction_callitem in persisted history ({}if that item is gone). If schema parsing fails, the mapper gets the raw arguments, the same ascomputeToolOutputForModel.contentandjsonmapper values both go intoresult.failedwith the error message. The raw result is never sent.toolsis omitted, there is no mapper to apply (the call is already documented as unvalidated).The helper works the same way as
lateTaskForModelin #174 (late background results), so #174 can call it too. #173 widensToModelOutputResultwithjson. The helper readsmapped.typeas a string, so it works with or without #173. This PR does not touchmodel-result.ts, so it does not conflict with #171–#175.Tests
tests/unit/to-model-output-resume.test.tscovers:.resolve()withrun, checking the next model request)failedfailedFive of these failed on
main. All unit tests, typecheck and biome pass.