perf(server): stop tracing per-event live coalescer work #29758
main fromrefs/pull/29758/head·merged by maria-rcks View on GitHubProblem#
The local server trace (server.trace.ndjson, 10 rotated files of 10 MB plus the live one, with no sampling) keeps only about two hours of history during active use. Issue #28196 reports the same rotation. Per-event spans that finish in under a millisecond take up a large share of it.
On one install, ThreadLiveEventCoalescer.cancelWindow, flushPending and offerAll wrote about 9,100, 9,300 and 6,200 spans in a 112-minute window. That was 9.2 MB, or 8% of a 113 MB trace, with each span under 1 ms.
Change#
cancelWindow, flushPending and offerAll now use Effect.fnUntraced, with a one-line comment giving the reason. They run for every live thread event or batch. makeThreadLiveEventCoalescer keeps its span, which is written once per subscription when it starts. flushPending still runs uninterruptibly.
This follows #29640, which stopped tracing project enrichment cache reads for the same reason.
Scope and approval#
This is a focused performance fix for trace volume and part of #28196. It changes only span wrappers in one file. Nothing in the repo reads these span names.
Verification#
- Before the change, I confirmed on current
mainthat all three functions were wrapped in namedEffect.fnspans. - I searched for readers of the span names in tests, docs and span-name assertions, and found none.
vp test run apps/server/src/orchestration-v2/ThreadLiveEventCoalescer.test.ts: 12 of 12 pass.vp run check:changedpasses: format, lint, knip, typecheck and tests for the changed files.
The change adds no tests, because it doesn't alter behavior. That matches #29640.
Made with Claude Opus 5.5 through the Claude Code harness in T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
🟢 Approval recommended#
No active review issues are reported for the change to reduce routine server trace volume.
No open issues 🎉
What changed in this PR
Reduces routine server trace volume from live thread event processing, addressing part of #28196 and following the approach in #29640.
Changes:
- Switches
cancelWindow,flushPending, andofferAlltoEffect.fnUntraced. - Documents why these high-frequency operations omit spans.
- Retains the subscription creation span and uninterruptible flushing behavior.
Review effort: BalancedFile Description apps/server/src/orchestration-v2/ThreadLiveEventCoalescer.tsRemoves three per-event tracing wrappers without changing coalescing logic. - Switches
Approvability#
Verdict: Approved at
5f9fcffMacroscope's review found this PR approvable — Removes per-event tracing from three live-coalescer helpers to reduce trace noise and overhead. Event delivery, buffering safeguards, and product defaults remain unchanged; the impact is limited to fine-grained diagnostics.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 5b9731c
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
8c1cad15-7195-4316-a328-14004b432c32
Commits-
Reviewing files that changed from the base of the PR and between 5b9731cedc06f310c394f48e66d50a614397c0aa and 5f9fcff9f171cddd8056dc25654b9cd3b154b4fc.
Files selected for processing: 1-
apps/server/src/orchestration-v2/ThreadLiveEventCoalescer.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
-
Walkthrough
-
Three operations in
ThreadLiveEventCoalescernow useEffect.fnUntraced. A comment notes that frequently invoked operations should not emit sub-millisecond trace spans. The implementations remain unchanged.Changes: Coalescer tracing
Layer / File(s) Summary Switch coalescer operations to untraced functions
apps/server/src/orchestration-v2/ThreadLiveEventCoalescer.tscancelWindow,flushPending, andofferAllnow useEffect.fnUntraced. A comment oncancelWindownotes the tracing frequency concern. Their implementations remain unchanged.Estimated code review effort: 1 (Trivial) | ~5 minutes
Suggested reviewers:
juliusmarminge,maria-rcks
Merge Risk:
Minimal · up to5f9fc-
No actionable merge-blocking risk remains.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly and concisely describes the main change: removing per-event tracing from the server live coalescer. Description check The description includes Problem, Change, Scope and approval, and Verification sections. It explains the trace-volume issue, the implementation, the focused scope, related issues, and specific test re… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Description check
-
Explanation
The description includes Problem, Change, Scope and approval, and Verification sections. It explains the trace-volume issue, the implementation, the focused scope, related issues, and specific test results. It does not provide a direct issue link or approval comment, but the focused-fix rationale makes the description mostly complete.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
CodeRabbit Verify#
- Run CodeRabbit Verify to test the changes in this pull request.
-
onlydole(GitHub profile, opens in a new tab) closed this
onlydole(GitHub profile, opens in a new tab) reopened this
Note
Written by
gpt-6.1-solon behalf of MariaVerified in a real dev environment#
verified unchanged head
5f9fcff9f171cddd8056dc25654b9cd3b154b4fcon a linux boat vm. reproduced ongithub/main(61c3794c32) first in a separate worktree, stopped that dev server, then ran the exact pr head. installed each checkout withvp i. used repository playwright with/usr/bin/google-chrome, created a local git project through the app, and selected codexgpt-6.1-sol. no mocks, replay, fixtures, or seeded data.the same prompt ran
git status --shortand streamed 60 numbered sentences toCOALESCER_COMPLETE. main's isolated trace contained 31cancelWindow, 59flushPending, and 47offerAllspans, totaling 51,723 bytes. the pr emitted zero of all three, including the neighboring checks below. the subscription construction span remained (main: 3; pr: 7). these are observed trace counts, not a latency or long-term retention estimate.all 60 sentences in the provider's final response were present in the client. reload restored the completed history. reload during another running command restored its running state and stop control. clicking stop produced codex's
interruptedcompletion and the client's "stopped by user" state. a follow-up turn completed withAFTER_STOP_OK.blacksmith passed the 12 existing coalescer tests and
vp run check:changed HEAD^(format, lint, knip, graphql, affected typechecks, 13 tests). fetched the parent into the shallow worker before the latter check. applicable github ci checks are green. no source changes needed.



Not verified#
native ios/android and electron clients, macos/windows, relay/tunnel connections, other providers, multi-hour trace rotation, and saturation/error/overflow paths. this linux pass exercised the local web client and real codex app-server path.
maria-rcks merged this93b0db1
maria-rcks closed this
Sign in to join this conversation.
Codex Review Summary#
This comment shows the latest Codex review activity on this pull request.
5f9fcffℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.