ISSUE DESCRIPTION Deep-research / workflow subagent transcripts aren't discovered…
- User
ISSUE DESCRIPTION
Deep-research / workflow subagent transcripts aren't discovered (nested under subagents/workflows/)
What I was doing
Running Claude Code's
/deep-researcha few times, then looking for those sessions in agentsview. Each run fans out into ~100 subagents and leaves a large pile of per-agent transcripts on disk — exactly the kind of session history I'd want to browse and analyze in agentsview after the fact.What happened
None of the deep-research subagent transcripts show up in agentsview. The parent session imports fine; the ~100 subagents per run are invisible.
The cause is a path-depth assumption in discovery.
DiscoverClaudeSessionslooks for subagent transcripts exactly one level down:<project>/<session>/subagents/agent-<id>.jsonland in that loop it skips any directory entry:
// internal/parser/discovery.go ~L359 for _, sub := range subFiles { if sub.IsDir() { continue // ← never descends } name := sub.Name() if !strings.HasPrefix(name, "agent-") || !strings.HasSuffix(name, ".jsonl") { continue } ... }But deep-research (and Workflow-tool runs generally) write their subagent transcripts one level deeper, grouped by workflow id:
<project>/<session>/subagents/workflows/<wf_id>/agent-<id>.jsonlsubagents/here contains only theworkflows/directory, which the loop skips — so the entire tree underneath is never discovered. Each transcript carriesisSidechain: trueand an accompanyingagent-<id>.meta.jsonwhoseagentTypeisworkflow-subagent.Concretely, in one session three
/deep-researchruns produced 312agent-*.jsonlfiles undersubagents/workflows/, and zero directly undersubagents/. All 312 are currently dropped.Why it matters
Deep research is one of the highest-value things to capture: a single invocation can spawn a hundred subagents and burn a lot of tokens, and right now that whole tree is invisible in agentsview — no transcripts, no token/usage attribution, no way to review what the subagents actually did. As more people lean on workflow-style fan-out, this is a growing blind spot.
The fix looks small: walk
subagents/recursively (or specifically also descend intosubagents/workflows/<wf_id>/) instead of only reading its top level, and treatagent-*.jsonlfound anywhere beneath it the same way. The () is available alongside each transcript if the workflow grouping is worth surfacing in the UI. Assistant
Now let's modify the subagent discovery loop in
DiscoverClaudeProjectsto walk recursively.Assistant
Now let's add the
findAgentJSONLFileshelper function, and updateFindClaudeSourceFile's subagent lookup similarly.Assistant
Now add the
findFileByNamehelper function nearfindAgentJSONLFiles.Assistant
Good, Go 1.26 supports
filepath.SkipAll. Now let's build.Assistant
Build succeeded. Now let's write a quick reproduction/test script to verify the fix works for nested workflow subagents.
Assistant
Let's place the reproduction script inside the repo temporarily (in cmd/ or a scratch dir under the module) then remove it before submitting.
Assistant
Both the nested workflow subagent file and
FindClaudeSourceFilelookup now work correctly. Let's clean up the temp repro and run the existing test suite.Assistant
This test fails independently of my change (likely due to running as root, where permission-based read errors don't occur). Not related to my fix. Let's run the rest of the test suite excluding this pre-existing failure.
Assistant
All existing relevant tests pass. Let's also run the whole test suite excluding the known pre-existing failing test, to make sure nothing else broke.
Assistant
These failures are all pre-existing environment issues (missing
$HOME, running as root) unrelated to my change. Let's set$HOMEand re-run to confirm no other failures.Assistant
Good — with
$HOMEset, only the pre-existing root-related permission test failure remains (confirmed unrelated to my change, since it fails identically on the original unmodified code too, likely due to running tests as root where permission-based read errors don't trigger). Let's double checkgit difffor final review.Assistant
Now let's update this classification to handle nested workflow subagent paths.
Assistant
There's a duplicate closing brace at line 510. Let's fix that.
Assistant
Now missing blank line before Codex comment, but that's fine stylistically. Let's add a blank line for consistency.
Assistant
Good. Now let's build to confirm correctness.
Assistant
Now let's check whether this classification path (project extraction) is used elsewhere too — specifically, sync engine's per-agent project resolution for Claude subagents (deriving project name from parts, or similar logic that might assume depth==4).
Assistant
No existing helper. Let's add one and use it in both spots (line ~5551 fallback).
Assistant
Let's add a helper
claudeProjectForPathright afterfindContainingDir.Assistant
Now let's find the two
filepath.Base(filepath.Dir(path))fallback usages for AgentClaude and replace withclaudeProjectForPath.Assistant
Only the first one (line 5581,
parser.AgentClaudecase) needs updating; the second one at 5608 is forAgentIflow, unrelated.Assistant
Now let's build and run the full test suite for the sync package.
Assistant
All sync tests pass. Let's run the whole test suite once more to confirm.
Assistant
Only the pre-existing unrelated (root-permission) test failure remains, confirmed identical on the base commit. Now let's write a quick manual reproduction for the sync engine's
classifyOnePathto confirm workflow subagent detection via fsnotify-based sync too.Assistant
Let's write a small temporary test script (not part of the test suite) to validate
classifyOnePathhandles nested workflow paths correctly.Assistant
Good, this gives me the pattern. Let's write a temp test file (not committed) to verify manually.
Assistant
This confirms the fix works for the sync engine's live classification path too. Now clean up the temp test file.
Assistant
All good, only the known pre-existing failure remains. Let's do a final review of the full diff.
Assistant
No formatting issues. Let's run
go vetand full test suite once more for final sanity check.Assistant
Only the pre-existing environment-related test failure (root privileges bypassing permission checks) remains — confirmed unrelated to my change since it fails identically on the unmodified base commit.
Now let's go through the checklist explicitly.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.