Repository navigation
fix(agent): bind deferred task identity to tool schema and strip HITL outputs - #180
Open
alexb-openrouter wants to merge 4 commits into
Open
alexb-openrouter wants to merge 4 commits into
alexb-openrouter wants to merge 4 commits into
Conversation
Contributor
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
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
Fixes two tool-output / deferred-resolution bugs in
@openrouter/agent:Deferred task tool identity & schema binding (
resume-tool-results.ts,tool-executor.ts,model-result.ts,tool.ts)resumeToolResultsonly checkedtask.name !== request.expectToolName. A separate deferred tool instance with the same public name and a looseroutputSchemacould settle the original tool's pending task and bypass the owning tool'soutputSchema.computeToolFingerprint(tool)now computes a deterministic SHA-256 fingerprint over the client tool's name,inputSchema, andoutputSchema(including Zod v4 refinements, transforms,strict/passthroughcatchalls, and unrepresentable types) and persists it onPendingAsyncTool.toolFingerprint(additive within state version 1, JSON-serializable across processes).bindDeferredCompletionpassesexpectTool: toolValuetoresumeToolResults, which verifiestask.toolFingerprintbefore persisting for.resolve(),.fail(),.cancel(), andresumeToolResults({ tools }).HITL
outputSchemastripping (tool-executor.ts)invokeOnResponseReceivedandcomputeHitlItemOutputvalidated againsttool.function.outputSchemaviaz4.safeParsebut discardedvalidation.dataand forwarded the unstrippedhookResultor rawitem.output.validation.dataviatoFunctionCallOutputValue(validation.data)so extra fields stripped byoutputSchemaare never sent to the model (whilecomputeHitlItemOutputstill returnsnullwhen the serialized validated payload is already identical toitem.output).Testing
packages/agent/tests/unit/async-tool-deferred.test.tscovering same-name looser-schema rejection for.resolve()/.fail()/.cancel(), dropped.refine()rejection, directresumeToolResults({ tools })substitution rejection, and cross-process JSON round-trip resolution with an equivalent tool definition.packages/agent/tests/unit/hitl-tool.test.tscovering extra-field stripping withonResponseReceived, without a hook, and on content-array outputs.pnpm test(112 test files, 1299 tests),pnpm typecheck,pnpm lint,pnpm build, andpnpm verify:packages.