Repository navigation
perf(codex): reduce allocations while reading app-server output - #174468
Merged
steipete merged 1 commit intoOct 16, 2026
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
October 16, 2026 17:12
Contributor
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
steipete
deleted the
steipete/perf-micro-codex-stdio-transport-main-20260919
branch
October 16, 2026 17:24
vincentkoc
added a commit
that referenced
this pull request
Oct 16, 2026
…158510 * commit 'cff3c307ba6d0ce273abcdaf5cade848d9746d30': feat(decisions): preserve native catalog capabilities and accounting (#157492) fix(ui): avoid reactive read warnings in picker scrolling (#174436) refactor(test): remove unused Nextcloud fixture signing (#174470) refactor(browser): share managed tab eviction fixtures (#174474) fix(update): preserve Windows inspection path identities (#174471) perf: reduce large-session compaction and indexing allocations (#174433) perf(codex): reduce allocations while reading app-server output (#174468) fix(gateway): skip startup publication checks without a target (#174453) refactor: deslop agent harnesses, channel plugins and packages (wave-6 bundle A) (#173531) perf(state): reduce shared SQLite worker heap retention (#174420) refactor: remove routine channel callsite diagnostics (#174402)
vincentkoc
added a commit
that referenced
this pull request
Oct 16, 2026
…esafe-decision-native * commit 'cff3c307ba6d0ce273abcdaf5cade848d9746d30': feat(decisions): preserve native catalog capabilities and accounting (#157492) fix(ui): avoid reactive read warnings in picker scrolling (#174436) refactor(test): remove unused Nextcloud fixture signing (#174470) refactor(browser): share managed tab eviction fixtures (#174474) fix(update): preserve Windows inspection path identities (#174471) perf: reduce large-session compaction and indexing allocations (#174433) perf(codex): reduce allocations while reading app-server output (#174468) fix(gateway): skip startup publication checks without a target (#174453) refactor: deslop agent harnesses, channel plugins and packages (wave-6 bundle A) (#173531) perf(state): reduce shared SQLite worker heap retention (#174420) refactor: remove routine channel callsite diagnostics (#174402) # Conflicts: # src/agents/decision-inference.integration.test.ts
vincentkoc
added a commit
that referenced
this pull request
Oct 16, 2026
…/decision-tool-v2-proof-20261016 * commit 'cff3c307ba6d0ce273abcdaf5cade848d9746d30': feat(decisions): preserve native catalog capabilities and accounting (#157492) fix(ui): avoid reactive read warnings in picker scrolling (#174436) refactor(test): remove unused Nextcloud fixture signing (#174470) refactor(browser): share managed tab eviction fixtures (#174474) fix(update): preserve Windows inspection path identities (#174471) perf: reduce large-session compaction and indexing allocations (#174433) perf(codex): reduce allocations while reading app-server output (#174468) fix(gateway): skip startup publication checks without a target (#174453) refactor: deslop agent harnesses, channel plugins and packages (wave-6 bundle A) (#173531) perf(state): reduce shared SQLite worker heap retention (#174420) refactor: remove routine channel callsite diagnostics (#174402) # Conflicts: # docs/plugins/sdk-overview/capabilities.md
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Reading Codex app-server stdout allocates a buffer view and a fresh fragment array for every frame, even when its consumer finishes synchronously.
User Impact
Less temporary allocation while streaming Codex output. No wire-protocol or user-visible behavior changes; frame ordering, UTF-8 handling, EOF delivery, close cleanup, and asynchronous decode backpressure remain unchanged.
Why This Change Was Made
Reuse the reader-owned fragment array and retain the unread chunk only when asynchronous decoding actually pauses delivery. This removes work from the existing framing owner rather than adding another decoder or worker.
The profile that motivated investigation attributed app-server launch and process-inspection helpers to the transport bundle: all sampled stacks for that bundle ended in native process spawning, not JSON parsing. Current code already frames bytes without repeated concatenation and delegates large catalog responses to its existing worker. This PR makes the smaller measured allocation improvement; it does not claim to eliminate the reported transport-bundle CPU share.
Evidence
Median over five paired runs on the final source:
CPU is neutral within observed run-to-run noise; the allocation reduction is consistent across all five runs. This is a net deletion/simplification with no measured regression.
Measurement: Linux, Node 26.8.1, fake child process writing 128 MiB per run through a real stdout pipe in 16 KiB writes. Five alternating before/after runs per scenario. Streaming uses UTF-8 message deltas; mixed traffic adds 100-row catalog pages and large full-history responses. The consumer uses the production framing and envelope routing functions, parses synthetic messages, and verifies frame counts, byte totals, and content checksums. Catalog delivery returns a resolved promise to exercise pause/resume ordering; these numbers isolate framing/decoding and do not measure the production catalog worker or Gateway end to end. CPU uses
process.threadCpuUsage()without allocation sampling; allocations use separate V8 heap-sampling runs including collected objects at an 8 KiB interval. The unused outbound logging import is stubbed; no inbound transport logic is replaced.Focused proof:
node scripts/run-vitest.mjs extensions/codex/src/app-server/client-message-decoder.test.ts extensions/codex/src/app-server/client-catalog-worker.test.ts --maxWorkers=1— 27 passed, 2 files; wrapper wall time 125.41 s (compilation dominates; individual tests 4–286 ms). The initial invocation was aborted by source-snapshot verification after the final edit; the unchanged final source passed on the next invocation.OPENCLAW_OXLINT_SKIP_PREPARE=1 node scripts/run-oxlint.mjs --tsconfig extensions/codex/tsconfig.json extensions/codex/src/app-server/client-message-frames.ts, changed-fileoxfmt --check, andgit diff --checkpassed. The initial lint invocation's broad SDK artifact preparation was stopped to respect the local compute limit; the supported skip-preparation route ran the same file-scoped lint. Independent autoreview is clean through P2.Simplification pass: production +5/-6 lines (net -1), test delta 0. Existing behavioral coverage is reused; no new module, export, dependency, cache, configuration, or schema. No Testbox/Crabbox lease allocated. Broad build/typecheck/lint/test gates are delegated to PR CI.