Skip to content

Emit hydrated spans for better trace inspection UX#5

Merged
adagradschool merged 1 commit into
masterfrom
feat/hydrated-spans
Mar 18, 2026
Merged

Emit hydrated spans for better trace inspection UX#5
adagradschool merged 1 commit into
masterfrom
feat/hydrated-spans

Conversation

@adagradschool
Copy link
Copy Markdown
Contributor

Summary

This updates the Claude trace plugin so Claude LLM spans contain the full prompt history for the model call instead of only the incremental delta since the previous call.

It also simplifies the hook lifecycle by making Stop synchronous and removing the extra Stop/SessionEnd coordination state.

What changed

  • parse_stop_transcript.py

    • rebuilds prompt history from the full transcript
    • still emits spans only for the latest turn
    • adds promptlayer.prompt_history_mode = "full_session"
    • dedupes duplicate user entries caused by queue/transcript overlap
  • Hook flow

    • makes Stop synchronous
    • removes async-era session state used to coordinate Stop and SessionEnd
    • keeps SessionEnd focused on final root-span emission and cleanup
  • Tests

    • adds a multi-turn full-history fixture
    • adds parser and OTLP assertions for full-session prompt emission
    • extends fixture replay coverage

Why

This makes Claude span data reflect the full model-call context, which improves trace inspection for multi-turn and tool-using sessions.

Verification

  • bash scripts/replay-fixtures.sh
  • source .env && uv run --script scripts/e2e_smoke.py

Copy link
Copy Markdown

@rite2hhh rite2hhh left a comment

Choose a reason for hiding this comment

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

LGTM

@adagradschool adagradschool merged commit 7dff044 into master Mar 18, 2026
2 checks passed
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.

2 participants