Skip to content

exec-server: propagate notification trace context#31729

Draft
anp-oai wants to merge 4 commits into
codex/exec-server-async-span-coveragefrom
codex/exec-server-notification-trace-carrier
Draft

exec-server: propagate notification trace context#31729
anp-oai wants to merge 4 commits into
codex/exec-server-async-span-coveragefrom
codex/exec-server-notification-trace-carrier

Conversation

@anp-oai

@anp-oai anp-oai commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Why

Preserve distributed trace correlation across exec-server JSON-RPC notifications without adding per-chunk hot-path overhead.

What

  • Add an optional, lenient W3C trace carrier to notification envelopes.
  • Inject context into client notifications and bounded server lifecycle notifications, then parent server notification spans from inbound context.
  • Intentionally omit trace metadata from process output and nonterminal HTTP body deltas.

The wire change is additive and matches request envelopes. The internal 0.0.0 Rust notification struct gains a field.

Manual validation

  • just test -p codex-exec-server-protocol — 8 passed.
  • just test -p codex-exec-server — 308 passed, 2 skipped.

Stack

  1. #31687 — 1/5
  2. #31690 — 2/5
  3. #31707 — 3/5
  4. #31729 — this PR, 4/5
  5. #31730 — 5/5

anp-oai added 4 commits July 9, 2026 02:15
Align client and server spans with app-server's RPC attributes, centralize client span creation in call_inner so timed calls are traced, and serialize tracing tests that rebuild global callsite interest.
@@ -0,0 +1,60 @@
use codex_protocol::protocol::W3cTraceContext;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this test module is overkill, can you remove these tests please

}
}

fn set_notification_span_parent(

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

can we link the detached work without artificially mutating parentage? like a flow event?

#[test]
#[serial_test::serial(exec_server_tracing)]
fn notification_span_uses_inbound_trace_parent() {
let span_exporter = InMemorySpanExporter::default();

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

no need to test this, please remove this test

}
}

pub(crate) fn should_trace_server_notification(method: &str, params: &Value) -> bool {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

just trace them all until we have performance evidence otherwise, should the trace context be non-optional on the protocol struct?


#[tokio::test(flavor = "current_thread")]
#[serial_test::serial(exec_server_tracing)]
async fn notification_senders_propagate_current_trace_context() {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

remove this test please

@anp-oai anp-oai force-pushed the codex/exec-server-async-span-coverage branch 2 times, most recently from a88ece9 to 620b67a Compare July 9, 2026 06:33
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