Skip to content

Propagate nested rollout trace lineage - #640

Merged
jdchawla29 merged 1 commit into
hud-evals:mainfrom
jdchawla29:codex/nested-trace-lineage
Sep 3, 2026
Merged

Propagate nested rollout trace lineage#640
jdchawla29 merged 1 commit into
hud-evals:mainfrom
jdchawla29:codex/nested-trace-lineage

Conversation

@jdchawla29

@jdchawla29 jdchawla29 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • keep telemetry context as simple trace-header storage
  • propagate the active trace across MCP and decode inbound MCP trace metadata at the MCP boundary
  • derive local and hosted rollout parentage when a rollout starts, keeping nested rollouts on distinct child traces
  • send child and parent headers through SDK gateway clients and Claude Code gateway requests, prevent equivalent-ID self-parenting across standard UUID forms, and omit invalid hosted parent IDs

Verification

  • UV_CACHE_DIR=/private/tmp/hud-python-uv-cache uv run --extra dev pytest -q hud/agents/tests/test_tool_agent.py hud/agents/tests/test_claude_sdk_agent.py hud/utils/tests/test_gateway.py hud/eval/tests/test_job.py hud/eval/tests/test_rollout.py hud/eval/tests/test_hosted.py hud/telemetry/tests/test_instrument.py hud/tests/test_trace.py hud/agents/tests/test_trace.py hud/eval/tests/test_file_tracking_observer.py (202 passed)
  • UV_CACHE_DIR=/private/tmp/hud-python-uv-cache uv run --extra dev --extra train ty check on changed source files
  • UV_CACHE_DIR=/private/tmp/hud-python-uv-cache uv run ruff format and ruff check on all changed files

Note

Medium Risk
Touches trace context, platform reporting, and gateway/MCP headers across eval and agents; behavior changes are mostly additive but affect how nested and hosted rollouts are attributed.

Overview
Adds parent–child trace lineage so nested rollouts and downstream calls stay linked in HUD telemetry and on the platform.

Context and propagation: set_trace_context now accepts an optional parent_trace_id and exposes Trace-Id plus X-HUD-Parent-Trace-Id via get_trace_headers(). The inference gateway and Claude SDK agent (gateway MCP headers, ANTHROPIC_CUSTOM_HEADERS, Windows remote env via base64 JSON) forward those headers. Outbound MCP tool calls attach hud/trace-id in request meta; get_mcp_trace_id() reads it (or trace-id HTTP header) on the server side.

Rollouts: Local rollout and hosted submit derive the parent from the ambient trace or inbound MCP context, bind the child trace with that parent, and report parent_trace_id on trace enter / rollout submit. Self-parenting is dropped when parent and child normalize to the same id; hosted submit also omits parents that fail canonical UUID formatting.

Other: normalize_trace_id prefers uuid.UUID parsing before the namespaced fallback.

Reviewed by Cursor Bugbot for commit f5e1592. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-03T03:45:09.721937Z f5e1592 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 713cc3d5d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hud/eval/run.py Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 713cc3d. Configure here.

Comment thread hud/capabilities/mcp.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7dbad18ab2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hud/eval/runtime/hosted.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: afa1c03fc5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hud/capabilities/mcp.py
Comment thread hud/eval/runtime/hosted.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29fdbfef41

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hud/eval/run.py Outdated
@jdchawla29
jdchawla29 force-pushed the codex/nested-trace-lineage branch 3 times, most recently from 599dd8a to 8414824 Compare September 3, 2026 02:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8414824bf5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hud/eval/runtime/hosted.py
@jdchawla29
jdchawla29 force-pushed the codex/nested-trace-lineage branch 2 times, most recently from 002fcc6 to fb52133 Compare September 3, 2026 03:29

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb52133449

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hud/agents/claude/sdk/agent.py
@jdchawla29
jdchawla29 force-pushed the codex/nested-trace-lineage branch from fb52133 to f5e1592 Compare September 3, 2026 03:40
@jdchawla29
jdchawla29 merged commit 0b63b4d into hud-evals:main Sep 3, 2026
5 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.

1 participant