Skip to content

[codex-analytics] rework thread_source for thread analytics#20949

Merged
rhan-oai merged 1 commit into
mainfrom
rhan/thread-origin
May 6, 2026
Merged

[codex-analytics] rework thread_source for thread analytics#20949
rhan-oai merged 1 commit into
mainfrom
rhan/thread-origin

Conversation

@rhan-oai
Copy link
Copy Markdown
Collaborator

@rhan-oai rhan-oai commented May 4, 2026

Summary

  • make thread_source an explicit optional thread-level field on thread/start, thread/fork, and returned thread payloads
  • persist thread_source in rollout/session metadata so resumed live threads retain the original value
  • replace the old best-effort session_source -> thread_source mapping with an explicit caller-supplied analytics classification

Why

Before this change, analytics thread_source was populated by a best-effort mapping from session_source. session_source describes the runtime/client surface, not the actual thread-level origin, so that projection was not accurate enough to distinguish cases such as user, subagent, memory_consolidation, and future thread origins reliably.

Making thread_source explicit keeps one thread-level analytics field while letting callers provide the real classification directly instead of recovering it indirectly from session_source.

Impact

For new analytics events, thread_source now reflects the explicit thread-level classification supplied by the caller rather than an inferred value derived from session_source. Existing protocol fields remain optional; callers that omit threadSource now produce null instead of a best-effort inferred value.

Validation

  • just write-app-server-schema
  • cargo test -p codex-analytics -p codex-core -p codex-app-server-protocol --no-run
  • cargo test -p codex-app-server-protocol generated_ts_optional_nullable_fields_only_in_params
  • cargo test -p codex-analytics thread_initialized_event_serializes_expected_shape
  • cargo test -p codex-core resume_stopped_thread_from_rollout_preserves_thread_source

@rhan-oai rhan-oai force-pushed the rhan/thread-origin branch 3 times, most recently from 8ff56a5 to bc57b39 Compare May 4, 2026 16:47
@rhan-oai rhan-oai changed the title [codex] add thread_origin to thread analytics [codex-analytics] add thread_origin to thread analytics May 4, 2026
@rhan-oai rhan-oai force-pushed the rhan/thread-origin branch 6 times, most recently from be1be00 to 321a6cc Compare May 4, 2026 19:02
@rhan-oai rhan-oai changed the title [codex-analytics] add thread_origin to thread analytics [codex-analytics] add thread_creator to thread analytics May 4, 2026
@rhan-oai rhan-oai force-pushed the rhan/thread-origin branch 3 times, most recently from 40c394b to b13e5bc Compare May 4, 2026 19:54
@rhan-oai rhan-oai marked this pull request as ready for review May 4, 2026 21:10
@rhan-oai rhan-oai requested a review from a team as a code owner May 4, 2026 21:10
@rhan-oai rhan-oai force-pushed the rhan/thread-origin branch 3 times, most recently from 414156a to f4d5073 Compare May 4, 2026 22:49
@rhan-oai rhan-oai changed the title [codex-analytics] add thread_creator to thread analytics [codex-analytics] rework thread_source for thread analytics May 4, 2026
@rhan-oai rhan-oai force-pushed the rhan/thread-origin branch 9 times, most recently from 08ee4fa to a57b5d9 Compare May 5, 2026 00:35
@rhan-oai rhan-oai requested a review from owenlin0 May 5, 2026 01:07
@rhan-oai rhan-oai force-pushed the rhan/thread-origin branch 10 times, most recently from b79e86b to ec2466c Compare May 5, 2026 21:28
@rhan-oai rhan-oai force-pushed the rhan/thread-origin branch from 17fe52e to 7686157 Compare May 6, 2026 01:52
@rhan-oai rhan-oai enabled auto-merge (squash) May 6, 2026 02:07
@rhan-oai rhan-oai merged commit b3d4f1a into main May 6, 2026
26 checks passed
@rhan-oai rhan-oai deleted the rhan/thread-origin branch May 6, 2026 02:12
@github-actions github-actions Bot locked and limited conversation to collaborators May 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants