-
-
Notifications
You must be signed in to change notification settings - Fork 871
Description
TaskOutput Cannot Retrieve claude-researcher and gemini-researcher Agent Results
Summary
When using the Research skill (/conduct-research) with parallel agents, the perplexity-researcher agent returns results successfully, but claude-researcher and gemini-researcher agents complete their work but cannot be retrieved via TaskOutput tool. The agents finish successfully and write complete transcripts to .jsonl files, but their task IDs become invalid before results can be collected.
Environment
- Claude Code Version: 2.1.15
- OS: macOS 26.2 (Build 25C56)
- Node: v22.15.1
- Bun: 1.2.21
- PAI: Custom installation with Research skill
Steps to Reproduce
-
Launch 3 parallel research agents using the Task tool (invoked via user prompt "do some quick research on ___"):
Task({ subagent_type: "perplexity-researcher", description: "Research query 1", prompt: "Research topic A..." }) Task({ subagent_type: "claude-researcher", description: "Research query 2", prompt: "Research topic B..." }) Task({ subagent_type: "gemini-researcher", description: "Research query 3", prompt: "Research topic C..." })
-
Agents launch and return agent IDs (e.g.,
a4f0876,a675f06) -
Attempt to retrieve results using TaskOutput:
TaskOutput({ task_id: "a4f0876", block: true, timeout: 120000 })
Expected Behavior
All three agents should:
- Complete their research
- Return results that can be retrieved via TaskOutput
- Provide consistent behavior across all agent types
Actual Behavior
perplexity-researcher: ✅ Works perfectly
- Returns full results in initial Task output
- Results available immediately
- No retrieval issues
claude-researcher: ❌ Retrieval fails
- Agent launches successfully (returns agent ID)
- Agent completes work (verified in transcript files)
- TaskOutput returns:
No task found with ID: a4f0876 - Full transcript exists at:
.claude/projects/[project-id]/subagents/agent-a4f0876.jsonl
gemini-researcher: ❌ Same issue as claude-researcher
- Agent launches successfully (returns agent ID)
- Agent completes work (verified in transcript files)
- TaskOutput returns:
No task found with ID: a675f06 - Full transcript exists at:
.claude/projects/[project-id]/subagents/agent-a675f06.jsonl
Evidence
Successful Agent Completion
Both claude and gemini agents complete successfully with comprehensive research results:
$ wc -l ~/.claude/projects/[project-id]/subagents/agent-a4f0876.jsonl
23 agent-a4f0876.jsonl
$ wc -l ~/.claude/projects/[project-id]/subagents/agent-a675f06.jsonl
26 agent-a675f06.jsonlAgent Output Verification
Reading the .jsonl transcript shows:
- Agents load context
- Execute WebSearch queries
- Generate formatted research reports
- Attempt voice notification
- Complete with SubagentStop event
Sample from claude-researcher transcript (line 17):
{
"message": {
"content": [{
"type": "text",
"text": "📅 2026-01-21\n\n**📋 SUMMARY:** Conducted focused research...\n\n**✅ RESULTS:**\n\n## Simon Sinek's Complete Bibliography\n..."
}]
}
}TaskOutput Error
TaskOutput(task_id: "a4f0876", block: true, timeout: 120000)
→ Error: No task found with ID: a4f0876
Root Cause Hypothesis
The agents complete so quickly (15-30 seconds) that by the time TaskOutput attempts retrieval, the tasks have been archived/cleaned up from the active task system. The transcript files persist, but the task IDs become invalid.
Possible issues:
- Task cleanup happens immediately after SubagentStop event
- TaskOutput looks in wrong location for completed subagent tasks
- Subagent task IDs use different namespace than expected
- Race condition between task completion and task registry cleanup
Impact
Current workaround: Use only perplexity-researcher agents, which return results synchronously in the initial Task output.
Impact on functionality:
- Research skill works but cannot leverage multi-source validation from all 3 agent types
- Must launch multiple perplexity agents instead of diverse agent types
- Loss of unique capabilities from claude-researcher (WebSearch with decomposition) and gemini-researcher (multi-perspective synthesis)
Workaround
Option 1: Use perplexity-researcher only
Launch multiple perplexity agents with different query angles:
Task({ subagent_type: "perplexity-researcher", prompt: "angle 1" })
Task({ subagent_type: "perplexity-researcher", prompt: "angle 2" })
Task({ subagent_type: "perplexity-researcher", prompt: "angle 3" })Option 2: Parse .jsonl files directly (hacky)
Could modify Research skill to read subagent transcript files directly:
jq -r 'select(.message.role == "assistant") | .message.content[]? | select(.type == "text") | .text' \
~/.claude/projects/[project-id]/subagents/agent-[ID].jsonlQuestions
- Is this a known issue with subagent task lifecycle management?
- Are other users experiencing similar problems with claude-researcher and gemini-researcher?
- Should TaskOutput be able to retrieve completed subagent results?
- Is there a different tool/approach for collecting subagent outputs?
- Should agents write to a shared output file that persists beyond task cleanup?
Additional Context
This issue was discovered while implementing the Research skill for parallel multi-source research. The pattern of "launch N agents, collect results" works perfectly for perplexity-researcher but fails for the other two agent types, despite all agents completing their work successfully.
The inconsistency suggests this may be an implementation difference between how perplexity-researcher returns results (synchronous in Task output) versus how claude-researcher and gemini-researcher are expected to return results (asynchronous via TaskOutput).
Test Case Files:
- Research subject: Alison Shapira (first test)
- Research subject: Simon Sinek (second test - reproduced same behavior)
- Agent transcript locations:
~/.claude/projects/-path/c2db0183-a081-40d5-bf62-36c6c694d01a/subagents/