Skip to content

feat(app-server-test-client): support tracing#13286

Merged
owenlin0 merged 1 commit intomainfrom
owen/app_server_test_client_supports_tracing
Mar 3, 2026
Merged

feat(app-server-test-client): support tracing#13286
owenlin0 merged 1 commit intomainfrom
owen/app_server_test_client_supports_tracing

Conversation

@owenlin0
Copy link
Collaborator

@owenlin0 owenlin0 commented Mar 2, 2026

Summary

This adds tracing support to the app-server-test-client so requests it sends to app-server carry W3C trace context, and each run prints an easy-to-follow trace link at the end. Depends on #13285

Example:

$ cargo run -p codex-app-server-test-client -- \
  --codex-bin target/debug/codex \
  send-message-v2 "hello"
  
// truncated for brevity...
< {
<   "method": "turn/completed",
<   "params": {
<     "threadId": "019cb0f6-412e-7b43-a031-72461a990bea",
<     "turn": {
<       "error": null,
<       "id": "019cb0f6-4151-7ab0-af08-7f18a16612d6",
<       "items": [],
<       "status": "completed"
<     }
<   }
< }

< turn/completed notification: Completed

[Datadog trace]
go/trace/eaa4e7d57f804ca89017e62ce9f88de8

[codex app-server exited: exit status: 0]

What changed

  • Attach traceparent metadata to outgoing JSON-RPC requests from the test client
  • Generate a trace ID and root span ID per client session
  • Print a Datadog trace summary at the end of each run so it’s easier to jump from a local repro to tracing
  • Wrap the main command flows so the trace summary still gets printed after the request lifecycle completes
  • Improve spawned app-server shutdown behavior by waiting briefly for a clean exit before killing the process (otherwise the trace gets dropped)

Why

The test client is useful for reproducing app-server behavior locally, but it was hard to connect a local run to backend traces. With this change, local debugging gets a lot easier: you can run the client, reproduce the issue, and immediately inspect the corresponding trace.

@owenlin0 owenlin0 force-pushed the owen/app_server_test_client_supports_tracing branch from 2e56493 to 04ad015 Compare March 2, 2026 23:37
@owenlin0 owenlin0 marked this pull request as ready for review March 2, 2026 23:57
@owenlin0 owenlin0 force-pushed the owen/app_server_test_client_supports_tracing branch from 04ad015 to 5f1a7a5 Compare March 3, 2026 00:34
@owenlin0 owenlin0 force-pushed the owen/app_server_test_client_supports_tracing branch from 5f1a7a5 to 4d7d376 Compare March 3, 2026 00:41
@owenlin0
Copy link
Collaborator Author

owenlin0 commented Mar 3, 2026

@codex review

@owenlin0 owenlin0 requested review from celia-oai and jif-oai March 3, 2026 00:45
Copy link
Contributor

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

Choose a reason for hiding this comment

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

💡 Codex Review

let mut client = CodexClient::connect(endpoint, config_overrides)?;
let initialize = client.initialize()?;
println!("< initialize response: {initialize:?}");
let resume_response = client.thread_resume(ThreadResumeParams {
thread_id,
..Default::default()
})?;
println!("< thread/resume response: {resume_response:?}");
println!("< streaming notifications until process is terminated");
client.stream_notifications_forever()

P2 Badge Route streaming commands through trace-summary wrapper

The commit message says each run should print a Datadog trace link, but thread_resume_follow (and similarly watch) still instantiate CodexClient directly and return stream_notifications_forever() without calling print_trace_summary(). If these commands end due disconnect/error, no trace URL is emitted.

ℹ️ 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".

@owenlin0 owenlin0 requested a review from pakrym-oai March 3, 2026 00:46
@owenlin0 owenlin0 merged commit 9965bf3 into main Mar 3, 2026
31 checks passed
@owenlin0 owenlin0 deleted the owen/app_server_test_client_supports_tracing branch March 3, 2026 01:24
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants