Skip to content

Track app-server start in ChatGPT telemetry#24142

Open
aibrahim-oai wants to merge 8 commits into
mainfrom
aibrahim/telemetry-app-server-start
Open

Track app-server start in ChatGPT telemetry#24142
aibrahim-oai wants to merge 8 commits into
mainfrom
aibrahim/telemetry-app-server-start

Conversation

@aibrahim-oai
Copy link
Copy Markdown
Collaborator

@aibrahim-oai aibrahim-oai commented May 22, 2026

Why

We want ChatGPT telemetry to receive app-server startup timing as its own signal instead of folding it into thread or turn telemetry. Keeping startup separate makes the later turn timing breakdown cleaner and gives us a direct measure of process start-to-ready latency.

What changed

  • add a dedicated codex_app_server_started analytics event and reducer/client plumbing in codex-rs/analytics
  • measure startup duration and completion time in codex-rs/app-server/src/lib.rs
  • add serialization and reducer coverage for the new event

Verification

  • cargo check -p codex-analytics -p codex-app-server -p codex-core
  • just fix -p codex-analytics -p codex-core

@aibrahim-oai
Copy link
Copy Markdown
Collaborator Author

aibrahim-oai commented May 22, 2026

aibrahim-oai added a commit that referenced this pull request May 22, 2026
aibrahim-oai added a commit that referenced this pull request May 22, 2026
aibrahim-oai added a commit that referenced this pull request May 22, 2026
aibrahim-oai added a commit that referenced this pull request May 22, 2026
@aibrahim-oai aibrahim-oai force-pushed the aibrahim/telemetry-app-server-start branch from 03394d3 to 3ed1c71 Compare May 22, 2026 23:05
aibrahim-oai added a commit that referenced this pull request May 22, 2026
aibrahim-oai added a commit that referenced this pull request May 22, 2026
Copy link
Copy Markdown
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

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ed1c71cec

ℹ️ 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 codex-rs/app-server/src/lib.rs Outdated
info!("processor task exited (channel closed)");
}
});
analytics_events_client.track_app_server_started(app_server_start_timer);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Delay startup event until remote control is connected

When the app server is launched as remote-control-only (for example --listen off --remote-control), this records codex_app_server_started immediately after spawning the processor, but start_remote_control only returns a JoinHandle while its initial status is still Connecting and the spawned RemoteControlWebsocket::run performs the actual backend connection afterward (app-server-transport/src/transport/remote_control/mod.rs:168-198). That makes the new startup telemetry undercount start-to-ready latency precisely for the remote-control path, because the event can be sent before the app server is reachable from ChatGPT.

Useful? React with 👍 / 👎.

@aibrahim-oai aibrahim-oai force-pushed the aibrahim/telemetry-app-server-start branch from be12003 to ee60c49 Compare May 22, 2026 23:55
Copy link
Copy Markdown
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

Here are some automated review suggestions for this pull request.

Reviewed commit: ee60c494da

ℹ️ 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 on lines +1072 to +1073
analytics_events_client
.track_app_server_started(app_server_start_timer, remote_control_enabled);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Update analytics tests for the startup event

In the app-server v2 analytics tests I checked (thread_start.rs, thread_fork.rs, and thread_resume.rs), wait_for_analytics_payload returns the first /codex/analytics-events/events POST and then looks for codex_thread_initialized. This new unconditional startup POST is emitted before any thread start/resume/fork request, so those tests now see only codex_app_server_started in the first payload and fail instead of reaching the thread event; update the tests/helpers to wait for the specific event type, as wait_for_analytics_event already does.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
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

Here are some automated review suggestions for this pull request.

Reviewed commit: 50056e7f1d

ℹ️ 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 on lines +1072 to +1073
analytics_events_client
.track_app_server_started(app_server_start_timer, remote_control_enabled);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Update plugin analytics tests for startup event

With this unconditional startup event, app-server tests that enable analytics now receive codex_app_server_started as the first /codex/analytics-events/events POST before any later plugin action. Fresh evidence in the current tree is that the thread analytics tests were updated to wait for a specific event, but plugin_install.rs's wait_for_plugin_analytics_payload and plugin_uninstall.rs still read the first analytics POST and assert it is codex_plugin_installed/codex_plugin_uninstalled, so those CI tests will fail when the startup payload arrives first.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
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

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fdc8e8124

ℹ️ 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 on lines +1072 to +1073
analytics_events_client
.track_app_server_started(app_server_start_timer, remote_control_enabled);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Emit startup telemetry for in-process app-server starts

This call only runs in run_main_with_transport_options, but the main TUI and exec paths start the app server through InProcessAppServerClient (tui/src/lib.rs and exec/src/lib.rs), which reaches in_process::start_uninitialized and creates an analytics_events_client without ever calling track_app_server_started. In those in-process launches the new codex_app_server_started event is never emitted, so the startup telemetry misses a primary production app-server path rather than tracking all app-server starts.

Useful? React with 👍 / 👎.

const ANALYTICS_EVENTS_TIMEOUT: Duration = Duration::from_secs(10);
const ANALYTICS_EVENT_DEDUPE_MAX_KEYS: usize = 4096;

#[derive(Clone, Copy, Debug)]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

would be preferable to keep the boundary clean and avoid defining this in the analytics crate and using it in app-server, can we move this timing code into app-server?

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