Skip to content

Child agent sessions produce isolated traces — no linkage to parent trace #8

Closed

Description

@x-xiang

Problem

When a parent agent spawns child agents (sub-agents), each child session creates an independent
trace with its own traceId. There is no way to view the full parent → child orchestration as a
single connected trace in Langfuse.

Expected Behavior

Child agent sessions should be linked to the parent session's trace, so the entire multi-agent call
chain is visible as one trace in the Langfuse UI.

Current Behavior

A multi-agent workflow (e.g., 1 parent + 3 child agents) produces 4 completely disconnected traces.
There is no correlation between them — the parent trace has no reference to child traces, and vice
versa.

Environment

  • OpenCode: 1.15.5
  • Plugin: 0.1.0
  • Langfuse: Self-hosted

Activity

  1. bezbac commented on Jul 17, 2026

    @bezbac
    Member

    Hi @x-xiang, thanks for the report! I already noticed this and am planning to spend some time next week updating the behavior here, along with making a few more general improvements.

  2. x-xiang commented on Jul 17, 2026

    @x-xiang
    Author

    Hi @x-xiang, thanks for the report! I already noticed this and am planning to spend some time next week updating the behavior here, along with making a few more general improvements.

    Thanks for the quick response! Glad to hear it's already on your radar. Looking forward to the update — happy to help test when it's ready.

  3. bezbac commented on Aug 7, 2026

    @bezbac
    Member

    Hi @x-xiang, just wanted to share an update here. I released v0.2.0, but it doesn’t yet include fixes for sub-agent tracing. I hope to find some time in the coming weeks to give it another go :)

  4. x-xiang commented on Aug 7, 2026

    @x-xiang
    Author

    Thanks for the update, and no rush at all — really appreciate you keeping the issue posted.
    I’d be happy to help test it whenever you get a chance to revisit it.

  5. idityaGE commented on Aug 9, 2026

    @idityaGE
    Contributor

    Hi @bezbac, I worked on a fix for this issue and manually verified it against the Langfuse UI.

    Proposed fix branch:
    https://github.com/idityaGE/opencode-observability-plugin/tree/fix-child-session-parenting

    Compare:
    main...idityaGE:opencode-observability-plugin:fix-child-session-parenting

    I tried to open a PR, but GitHub returned:

    idityaGE does not have the correct permissions to execute CreatePullRequest

    Could you please enable/allow PRs from my fork, or let me know the preferred way to contribute this change?

    Summary of the fix:

    • Tracks OpenCode session.created / session.updated parent session IDs.
    • Parents child session opencode.turn spans under the active parent trace when available.
    • Makes session.idle finalize only that session so child sessions do not clear parent trace state.
    • Adds an integration regression test for parent-child session trace linkage.

    Validation:

    • npx pnpm run format
    • npx pnpm run build
    • npx pnpm run test:integration with 14 passing tests

    Before:
    Image

    After:
    Image

  6. self-assigned this
    on Aug 17, 2026
  7. bezbac commented on Aug 18, 2026

    @bezbac
    Member

    Hi @idityaGE, I took the required steps to open up the plugin to external contributions. Could you open a PR, sounds like you're changes would be helpful!

  8. idityaGE commented on Aug 18, 2026

    @idityaGE
    Contributor

    Hi @idityaGE, I took the required steps to open up the plugin to external contributions. Could you open a PR, sounds like you're changes would be helpful!

    PR#27

  9. bezbac commented on Aug 20, 2026

    @bezbac
    Member

    This was released as part of v0.3.0.

    You might need to update your OpenCode config to explicitly reference this version if you’ve already used a prior version.

    "plugin": [
      "@langfuse/opencode-observability-plugin@0.3.0",
    ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions