Repository navigation
fix(agent): apply toModelOutput to late background tool results - #174
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
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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:03
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
A
lifecycle: 'background'tool whose work outlivesgraceMsis delivered to the model as atool_task_resultuser message. That envelope embedded the rawexecuteresult, so atoModelOutputmapper that hides fields was bypassed on this path (both in-run delivery influshAsyncToolDeliveriesand the envelope persisted after the run indropSettledTasks).Both paths now go through a new
lateTaskForModel(task)before building the envelope:The persisted
pendingAsyncToolsterminal status follows the delivered status.tool.resultevents andPostToolUsehooks still receive the raw result, as on the in-round path.The
jsonbranch is checked at runtime, so this works onmain(whereToModelOutputResultonly declarescontent) and with #173, which addsjsonto the type and handles it on the other result paths. This PR covers the late-background path that #173 leaves out of scope. It merges cleanly with #171, #172 and #173; with #173 merged in, both test files pass.Not covered here: deferred tasks completed through
resumeToolResultsbuild their envelope inbuildResumeEnvelopeand also do not calltoModelOutput.Tests
tests/unit/to-model-output-late-background.test.ts(fails onmain, passes here): content mapper with schema-parsed input, json mapper, unknown mapper type, throwing mapper, raw-argument fallback on parse failure, and the envelope persisted after anonRunEnd: 'cancel'run. Full unit suite, typecheck and lint pass.