Skip to content

[codex-analytics] expose item timing through app server#20515

Draft
rhan-oai wants to merge 1 commit intorhan/core-item-timing-productionfrom
rhan/app-server-item-timing
Draft

[codex-analytics] expose item timing through app server#20515
rhan-oai wants to merge 1 commit intorhan/core-item-timing-productionfrom
rhan/app-server-item-timing

Conversation

@rhan-oai
Copy link
Copy Markdown
Collaborator

@rhan-oai rhan-oai commented Apr 30, 2026

Why

Once core emits native lifecycle timing, app-server clients need the same data on the public item notifications and reconstructed thread history. Keeping that wire/history layer separate makes the generated schema churn reviewable apart from producer code.

What changed

  • Exposes lifecycle timing on app-server ThreadItem values plus item/started and item/completed notifications.
  • Preserves timing through thread-history reconstruction and item builders.
  • Regenerates the app-server JSON schema and TypeScript fixtures for the new public fields.
  • Keeps exec/TUI consumers and fixtures compiling against the expanded public item shape.
  • Adds app-server coverage for dynamic tools, MCP calls, turn start notifications, and thread resume history.

Verification

  • cargo test -p codex-app-server-protocol
  • cargo test -p codex-exec --no-run
  • cargo test -p codex-tui --no-run

Stack created with Sapling. Best reviewed with ReviewStack.

@rhan-oai rhan-oai force-pushed the rhan/core-item-timing-production branch from 5c272b8 to c6e0ea5 Compare April 30, 2026 22:57
@rhan-oai rhan-oai requested a review from a team as a code owner April 30, 2026 22:57
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch from 65ef7bc to 84e66f0 Compare April 30, 2026 22:57
@rhan-oai rhan-oai marked this pull request as draft April 30, 2026 22:59
@rhan-oai rhan-oai force-pushed the rhan/core-item-timing-production branch from c6e0ea5 to 7a61984 Compare April 30, 2026 23:09
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch from 84e66f0 to 0cf1a11 Compare April 30, 2026 23:09
@rhan-oai rhan-oai force-pushed the rhan/core-item-timing-production branch from 7a61984 to 88c1fb0 Compare April 30, 2026 23:32
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch 2 times, most recently from e15f9f5 to e77df6b Compare May 1, 2026 00:17
rhan-oai added a commit that referenced this pull request May 1, 2026
## Why

Several analytics event families need the same per-thread attribution
state: the app-server client/runtime associated with a thread and, for
lifecycle-oriented events, the thread metadata captured during
initialization. Keeping connection ids and lifecycle metadata in
separate maps made each consumer rebuild the same thread context and
made subagent attribution harder to resolve consistently.

## What changed

- Replaces the separate thread connection and metadata maps with one
reducer-owned `threads` map.
- Routes guardian, compaction, turn-steer, and turn analytics through
shared thread-state lookups while preserving turn-origin attribution for
turn events and request-origin attribution for steer events.
- Lets newly observed spawned subagent threads inherit their parent
thread connection so later thread-scoped analytics can resolve through
the same state model.
- Adds regression coverage for standalone `SubAgentThreadStarted`
publication plus the `SubAgentSource::ThreadSpawn` parent fallback
through a thread-scoped consumer that depends on inherited connection
state.

## Verification

- `cargo test -p codex-analytics`

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/20300).
* #18748
* #18747
* #17090
* #17089
* #20239
* #20515
* #20514
* __->__ #20300
@rhan-oai rhan-oai force-pushed the rhan/core-item-timing-production branch 2 times, most recently from d55b667 to 42cdca0 Compare May 1, 2026 02:53
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch 3 times, most recently from 087ce59 to a862056 Compare May 1, 2026 04:49
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch from a862056 to 158fe58 Compare May 1, 2026 06:14
Bojun-Vvibe added a commit to Bojun-Vvibe/oss-contributions that referenced this pull request May 1, 2026
anomalyco/opencode#25109 (merge-as-is), #25029 (merge-after-nits), openai/codex#20515 + #20514 (merge-after-nits, stack pair).
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch from 158fe58 to 27e04d5 Compare May 1, 2026 15:28
@rhan-oai rhan-oai force-pushed the rhan/core-item-timing-production branch from 42cdca0 to d7b376e Compare May 1, 2026 16:57
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch from 27e04d5 to 0f46bf6 Compare May 1, 2026 16:57
@rhan-oai rhan-oai force-pushed the rhan/core-item-timing-production branch from d7b376e to be7c3a7 Compare May 1, 2026 17:31
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch from 0f46bf6 to 360adf3 Compare May 1, 2026 17:31
@rhan-oai rhan-oai force-pushed the rhan/core-item-timing-production branch from be7c3a7 to 0ecb14b Compare May 1, 2026 17:43
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch 2 times, most recently from 0df2bac to fc3e685 Compare May 1, 2026 17:51
@rhan-oai rhan-oai force-pushed the rhan/core-item-timing-production branch 2 times, most recently from 487af8f to 53976e4 Compare May 1, 2026 18:01
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch from fc3e685 to 71b5f1f Compare May 1, 2026 18:01
@rhan-oai rhan-oai force-pushed the rhan/core-item-timing-production branch from 53976e4 to 96a73c3 Compare May 1, 2026 18:31
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch from 71b5f1f to 81b61fb Compare May 1, 2026 18:31
@rhan-oai rhan-oai force-pushed the rhan/app-server-item-timing branch from 81b61fb to 35fc8b5 Compare May 1, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant