Skip to content

Conversation

@kunal70006
Copy link

@kunal70006 kunal70006 commented Jan 30, 2026

Summary

  • Adds task-to-delegate-redirect hook to intercept native task tool calls
  • Redirects to delegate_task for agents with known issues (metis, oracle, momus, atlas)
  • Preserves original task arguments while adding required delegate_task parameters

Problem

The native OpenCode task tool returns empty responses (only session_id metadata) for certain agents due to token refresh issues. delegate_task works correctly for the same agents.

Diagnostic evidence from issue #1281:

Agent mcp_task mcp_delegate_task
metis Empty response Full response
oracle Empty response Full response
explore Works Works
librarian Works Works

Fixes #1281

Changes

  • src/hooks/task-to-delegate-redirect/index.ts - New hook implementation
  • src/hooks/index.ts - Export new hook
  • src/index.ts - Import, instantiate, and wire up hook

Implementation Details

  • Hook is conditionally enabled via isHookEnabled("task-to-delegate-redirect")
  • Only affects problematic agents (metis, momus, oracle, atlas)
  • Non-breaking: explore/librarian and other agents pass through unchanged
  • Follows existing hook patterns (like delegate-task-retry)

Testing

  • Verified hook pattern matches existing hooks
  • Hook runs BEFORE the existing if (input.tool === "task") block to ensure redirect happens first

Summary 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.

  • Bug Fixes
    • Added task-to-delegate-redirect hook to map task → delegate_task on tool.execute.before for affected agents.
    • Preserves task args and sets delegate_task fields (description, prompt, session_id, run_in_background=false, load_skills=[]).
    • Gated by isHookEnabled("task-to-delegate-redirect") and runs before the task handler; other agents are unchanged.

Written for commit 825e6c2. Summary will update on new commits.

Addresses issue where native OpenCode task tool returns empty responses
for certain agents (metis, oracle, momus, atlas) due to token refresh issues.

The hook intercepts task calls for these agents and transforms them to use
delegate_task which has more robust error handling.

Fixes code-yeongyu#1281
@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2026

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@kunal70006
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Jan 30, 2026
@code-yeongyu code-yeongyu reopened this Jan 30, 2026
@code-yeongyu
Copy link
Owner

Closing this PR - the root cause has been identified and fixed upstream.

Root Cause: OpenCode bugs (not oh-my-opencode)

  • Issue #11289 (empty response bug in prompt_async) - Fixed on 2026-01-30
  • Native task tool only extracts text type parts, ignoring reasoning type

Resolution: Update to latest OpenCode version

Note: oh-my-opencode's delegate_task already extracts both text + reasoning parts, so the current approach of directing agents to use delegate_task is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: mcp_task tool returns empty responses while mcp_delegate_task works correctly

2 participants