Skip to content
TheChatArchiveThe Chat Archive
Claudeclaude-sonnet-5· anthropicHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Deep-research / workflow subagent transcripts aren't discovered…

  1. User

    ISSUE DESCRIPTION

    Deep-research / workflow subagent transcripts aren't discovered (nested under subagents/workflows/)

    What I was doing

    Running Claude Code's /deep-research a 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. DiscoverClaudeSessions looks for subagent transcripts exactly one level down:

    <project>/<session>/subagents/agent-<id>.jsonl
    

    and 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>.jsonl
    

    subagents/ here contains only the workflows/ directory, which the loop skips — so the entire tree underneath is never discovered. Each transcript carries isSidechain: true and an accompanying agent-<id>.meta.json whose agentType is workflow-subagent.

    Concretely, in one session three /deep-research runs produced 312 agent-*.jsonl files under subagents/workflows/, and zero directly under subagents/. 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 into subagents/workflows/<wf_id>/) instead of only reading its top level, and treat agent-*.jsonl found anywhere beneath it the same way. The .meta.json (agentType: workflow-subagent) is available alongside each transcript if the workflow grouping is worth surfacing in the UI.

    Interface

    No new interfaces are introduced.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /agentsview, current file: none) bash-$

  2. Claude Assistant

    Now let's implement a recursive walk for the subagents directory using filepath.WalkDir instead of os.ReadDir.

  3. Claude Assistant

    Now replace the subagent scanning block with recursive walk using filepath.WalkDir.

  4. Claude Assistant

    Build succeeds. Now let's write a reproduction test script to verify discovery works with nested workflows directory.

  5. Claude Assistant

    Confirmed this failure pre-exists (likely because tests run as root, bypassing permission-based read errors) and is unrelated to our change. Now let's run only discovery tests to confirm they pass.

  6. Claude Assistant

    All discover tests pass. Now let's write a quick manual reproduction script for the nested workflows case to be thorough.

  7. Claude Assistant

    Let's put the repro under a temp file within the module instead.

  8. Claude Assistant

    The nested workflow subagent transcripts are now discovered correctly. Let's clean up temp files.

  9. Claude Assistant

    Now let's view the final diff to double check correctness and formatting.

  10. Claude Assistant

    This looks good. Let's run go vet and gofmt to ensure formatting is correct.

  11. Claude Assistant

    No formatting issues, no vet errors. Now let's run the full parser test suite once more (ignoring the pre-existing unrelated failure) plus build the whole project.

  12. Claude Assistant

    All other tests pass; only the pre-existing, unrelated TestParseCortexSession_SplitHistoryReadError failure remains (confirmed earlier to occur before our change too, likely due to running as root bypassing permission-based errors).

  13. Claude Assistant

    Checklist review:

    • Reproduced the reported error: Yes — I built a temp reproduction (/tmp/repro/.../subagents/workflows/wf-1/agent-*.jsonl) mirroring the issue's exact directory layout and confirmed with the pre-fix code (via git stash) that these files were not discovered.
    • Confirmed the fix resolves the error: Yes — after applying the fix, running the same reproduction script showed both agent-abc.jsonl and agent-def.jsonl nested under subagents/workflows/wf-1/ are now discovered correctly with the right Project/Agent fields, while the plain top-level session file is also still picked up.
    • Edge cases considered:
      • Subagents directory missing entirely → still gracefully skipped (os.Stat check retained).
      • Arbitrarily deep nesting (not just one extra level) is now handled generally via filepath.WalkDir, not hardcoded to subagents/workflows/<id>/, satisfying "walk recursively" per the issue's suggested fix.
      • Non-agent-*.jsonl files/directories at any depth are still ignored (e.g., .meta.json sidecar files, not-agent.jsonl).
      • Existing flat-layout subagent files (subagents/agent-*.jsonl) continue to work since WalkDir also visits the root of subagentsDir.
      • WalkDir callback errors are swallowed (return nil) so a transient permission error on one entry doesn't abort discovery of the rest of the tree, matching prior lenient behavior.
    • Ran existing tests: Yes — go test ./internal/parser/... and go test ./... were run. All discovery-related tests pass (TestDiscoverClaudeProjects including the Subagents and Basic cases, plus all other TestDiscover* tests across agents). The only failing test (TestParseCortexSession_SplitHistoryReadError) is unrelated to this change — verified it fails identically on the unmodified codebase (likely due to running as root, which bypasses the permission-based read error the test expects).

    The fix is minimal, general (uses recursive filepath.WalkDir rather than hardcoding the workflows/<id> path), and doesn't alter any test files. I'm confident this resolves the issue.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.