fix: redirect native task tool to delegate_task for problematic agents #1282
+63
−0
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
task-to-delegate-redirecthook to intercept nativetasktool callsdelegate_taskfor agents with known issues (metis, oracle, momus, atlas)Problem
The native OpenCode
tasktool returns empty responses (only session_id metadata) for certain agents due to token refresh issues.delegate_taskworks correctly for the same agents.Diagnostic evidence from issue #1281:
Fixes #1281
Changes
src/hooks/task-to-delegate-redirect/index.ts- New hook implementationsrc/hooks/index.ts- Export new hooksrc/index.ts- Import, instantiate, and wire up hookImplementation Details
isHookEnabled("task-to-delegate-redirect")delegate-task-retry)Testing
if (input.tool === "task")block to ensure redirect happens firstSummary by cubic
Redirects native task tool calls to delegate_task for problematic agents to prevent empty responses. Adds a pre-execution hook for metis, momus, oracle, and atlas. Fixes #1281.
Written for commit 825e6c2. Summary will update on new commits.