Skip to content

perf(codex): suppress unused app-server notifications - #151998

Merged
steipete merged 1 commit into
mainfrom
steipete/perf-codex-notification-optout-20260918
Sep 18, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/perf-codex-notification-optout-20260918

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Reduces main-thread CPU spent decoding Codex app-server notifications that OpenClaw does not use during concurrent turns.

User Impact

No intended change to chat output, tools, approvals, compaction, native subagents, or session discovery. New app-server connections request fewer notifications. Existing connections pick up the policy when recreated; no configuration or state migration is required.

Why This Change Was Made

Three supplied five-second production CPU profiles put app-server JSON.parse at 16–19% of main-thread busy time (403–583 ms per window), with roughly another 5% in line/string decoding. The client requested experimental APIs but subscribed to unused notifications, including a cumulative diff after each file change.

The initialize handshake now opts out of 37 exact methods from one plugin-owned policy: 34 notifications without an incoming consumer or turn-progress role, cumulative turn diffs, and two retired events. Retained file-change items carry the individual changes. The projector uses the same policy to recognize these events if a server still sends them.

The consumer audit includes client cleanup, native subagents, approval correlation, client runtime, compaction, ephemeral turns, native tool lifecycle, assistant projection, the turn router, and catalog observers. Some apparent projector no-ops are real progress consumers: MCP progress, streamed patch updates, reasoning section markers, and model metadata remain enabled. Terminal interaction also preserves nativeExecutionObserved cleanup evidence. Turn/item lifecycle, usage, raw response, warning, approval, and catalog events remain enabled.

The harness guide documents this policy. The regression guard rejects opted-out method literals in production consumers, with one precise exception for an outgoing process/exited event on the separate exec-server protocol.

Evidence

  • Initialize regression failed against the original client because optOutNotificationMethods was absent, then passed with the change. Focused client, consumer-guard, decoder, and projector coverage: 427 tests across 24 files passed.
  • Validation passed: extension production and test tsgo lanes, targeted type-aware lint, oxfmt, and whitespace checks. The test typecheck initially caught an ambiguous filesystem filename type; explicit UTF-8 encoding fixed it, and both the guard and test typecheck passed afterward.
  • Independent Codex autoreview: scoped-clean through P2, with no actionable findings.
  • Ready-for-review CI exposed a line-growth gate in the oversized client module. The unchanged initialization payload now lives in a dedicated sibling module. The line-growth gate, 66 focused tests across 3 files, extension production typecheck, targeted lint, formatting, and whitespace checks passed. A fresh independent P2 review of the extraction found no actionable issues.
  • Native contract proof used the bundled Codex 0.154.0 binary, isolated temporary homes/workspaces, and a synthetic loopback model endpoint with no account credentials. It accepted an unknown capability field and suppressed exact requested names. Both variants completed the same 12 native file patches with raw events enabled, matching OpenClaw's thread-start setting.
Synthetic native workload Baseline Opt-outs
Stdout messages 129 103
Stdout bytes 2,557,065 508,393
Median decoder CPU per transcript 3.037 ms 0.664 ms

The unchanged decoder replayed each captured transcript 200 times per sample, with two warm-up passes and seven alternating measured samples using process CPU time. This workload used 80.1% fewer wire bytes and 78.1% less decoder CPU, leaving 21.9% of decode work. These are synthetic measurements, not a production speedup claim.

Residual work includes required item/raw-response payloads and RPC responses. No pre-parse sniff is added: a method alone cannot discard a partially consumed notification, and raw-newline continuation recovery makes a line-only shortcut unsafe without another structural parser. Worker-thread decoding remains a follow-up if post-deployment profiles justify it. No live Gateway was changed; a new production profile remains the validation gap.

Codex source contract and compatibility citations

Personally inspected the sibling source and the minimum supported release. The current source commit is publicly resolvable.

@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: S maintainer Maintainer-authored PR labels Sep 18, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 2:00 PM ET / 18:00 UTC (Revision 3).

ClawSweeper review

What this changes

The Codex plugin requests suppression of 37 unused app-server notifications, shares that policy with event projection, and adds documentation and regression coverage.

Merge readiness

⛔ Blocked before merge - 1 item remains

The prior line-growth finding is resolved, and no actionable correctness or security findings remain. The optimization remains absent from the reviewed main revision; the related earlier PR closed without merging.

Priority: P2
Reviewed head: 5630a223e53a953e37c531c35418c70d1ae6953d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with useful native proof, preserved consumer contracts, and the previous finding addressed.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied real Codex 0.154.0 workload exercises the negotiated notification filter and replays captured traffic through the unchanged decoder, completing the same 12 patches with fewer bytes and lower decoder CPU.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied real Codex 0.154.0 workload exercises the negotiated notification filter and replays captured traffic through the unchanged decoder, completing the same 12 patches with fewer bytes and lower decoder CPU.
Evidence reviewed 10 items Current main still lacks negotiation: The reviewed main initialization requests experimental APIs and MCP extensions but does not send optOutNotificationMethods. The branch adds that negotiation through the existing connection owner.
Previous finding resolved: The current client delegates payload construction to client-initialize.ts while retaining version validation and initialization ordering. The introduced diff shrinks client.ts by 16 lines. The captured PR body reports the line ratchet and 66 focused tests passed after extraction; this read-only review did not execute tests.
Retained progress and cleanup: Turn-correlated notifications renew progress, so payload no-ops are not automatically expendable. The policy retains MCP progress, patch updates, reasoning markers, model metadata, terminal interaction, canonical item lifecycle, and catalog events.
Findings None None.
Security None None.

How this fits together

The Codex plugin connects OpenClaw agent turns to Codex app-server. Incoming notifications feed chat output, progress tracking, process cleanup, and session discovery.

flowchart LR
  A[Plugin notification policy] --> B[Connection initialization]
  B --> C[Codex app-server]
  C --> D{Notification requested?}
  D -->|Suppressed| E[No transport payload]
  D -->|Retained| F[OpenClaw decoder]
  F --> G[Chat, progress, and session consumers]
Loading

Before merge

  • Resolve merge risk (P1) - The reported performance improvement comes from a synthetic native workload; production-wide CPU savings remain unmeasured.
Agent review details

Security

None.

PR surface

Source +55, Tests +87, Docs +11. Total +153 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 78 23 +55
Tests 2 87 0 +87
Docs 1 11 0 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 176 23 +153

Review metrics

Metric Value Why it matters
Notification negotiation 37 exact methods suppressed per new connection The change reduces incoming traffic without adding a user setting or raising the supported server-version floor.

Root-cause cluster

Relationship: canonical
Canonical: #151998
Summary: This remains the active proposal for notification suppression; the overlapping earlier proposal closed without merging.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep notification selection in the Codex plugin's connection handshake, preserving events needed for progress, cleanup, approvals, and transcript projection.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep notification selection in the Codex plugin's connection handshake, preserving events needed for progress, cleanup, approvals, and transcript projection.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a correctness bug: this is a performance optimization, with supplied native before/after measurements and source-confirmed unnecessary subscriptions.

Is this the best way to solve the issue?

Yes. Using the existing server-side filtering capability avoids unnecessary transport and parsing work without introducing another decoder or changing retained event handling.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b40b81637df7.

Labels

Label justifications:

  • P2: This is a bounded runtime performance improvement supported by native workload measurements.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied real Codex 0.154.0 workload exercises the negotiated notification filter and replays captured traffic through the unchanged decoder, completing the same 12 patches with fewer bytes and lower decoder CPU.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied real Codex 0.154.0 workload exercises the negotiated notification filter and replays captured traffic through the unchanged decoder, completing the same 12 patches with fewer bytes and lower decoder CPU.

Evidence

What I checked:

  • Current main still lacks negotiation: The reviewed main initialization requests experimental APIs and MCP extensions but does not send optOutNotificationMethods. The branch adds that negotiation through the existing connection owner. (extensions/codex/src/app-server/client.ts:339, b40b81637df7)
  • Previous finding resolved: The current client delegates payload construction to client-initialize.ts while retaining version validation and initialization ordering. The introduced diff shrinks client.ts by 16 lines. The captured PR body reports the line ratchet and 66 focused tests passed after extraction; this read-only review did not execute tests. (extensions/codex/src/app-server/client.ts:339, 5630a223e53a)
  • Retained progress and cleanup: Turn-correlated notifications renew progress, so payload no-ops are not automatically expendable. The policy retains MCP progress, patch updates, reasoning markers, model metadata, terminal interaction, canonical item lifecycle, and catalog events. (extensions/codex/src/app-server/run-attempt-notification-controller.ts:114, 5630a223e53a)
  • Affirmative dependency boundary: The new initialization payload directly negotiates Codex's optOutNotificationMethods protocol capability, making direct Codex source inspection applicable. (extensions/codex/src/app-server/client-initialize.ts:14, 5630a223e53a)
  • Personally inspected dependency transport: The sibling checkout's upstream cache remote identifies openai/codex. At its inspected revision, initialize records a per-connection exclusion set and transport filters exact AppServerNotification names before queueing; responses and server requests do not match this filter. (codex-rs/app-server/src/transport.rs:101, 6b9826e3aa83)
  • Minimum-version compatibility: The cited minimum supported release already defines the optional exclusion list without deny_unknown_fields. Separate inspection confirmed canonical compaction items replace thread/compacted and legacy file-change output is no longer emitted. (codex-rs/app-server-protocol/src/protocol/v1.rs:43, 758ef40f50c1)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-18T17:31:54.702Z sha e24be0bb7989d47aaadbb88d50db895cec80a806 :: blocked before merge. :: none
  • reviewed 2026-09-18T17:43:29.508Z sha e24be0bb7989d47aaadbb88d50db895cec80a806 :: needs changes before merge. :: [P3] Keep the client within its inherited line budget

@steipete
steipete marked this pull request as ready for review September 18, 2026 17:36
Negotiate 37 unused notifications out of each app-server connection while retaining progress, cleanup, transcript, approval, and catalog consumers. Guard the initialize payload and future consumer overlap; document the handshake policy.
@steipete
steipete force-pushed the steipete/perf-codex-notification-optout-20260918 branch from e24be0b to 5630a22 Compare September 18, 2026 17:53
@steipete
steipete merged commit d091c27 into main Sep 18, 2026
106 checks passed
@steipete
steipete deleted the steipete/perf-codex-notification-optout-20260918 branch September 18, 2026 18:39
steipete added a commit that referenced this pull request Sep 19, 2026
Parse and project native catalog pages in one client-owned worker while preserving transport order, bounded display previews, cancellation routing, and joined worker shutdown. Keep complete native control metadata for canonical forks and direct-input checks.

Publish affirmative ephemeral metadata before settling native requests, so helper shutdown cannot lose catalog exclusion while a passive worker refresh is pending. The existing catalog index owns deletion, stale-read fencing, and persistence.

Synchronize worker-backed fixtures without changing deadlines or weakening assertions, and register the standalone synthetic benchmark. Main-baseline comparisons reproduced the PR regressions before repair. Focused worker, catalog, guarded-request, canonical-fork, and SQLite-restart proof plus changed checks passed; independent Codex review is scoped-clean through P2. Exact-head CI is required before landing.

Related: #152035, #151998, #152257.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
Negotiate 37 unused notifications out of each app-server connection while retaining progress, cleanup, transcript, approval, and catalog consumers. Guard the initialize payload and future consumer overlap; document the handshake policy.
steipete added a commit that referenced this pull request Sep 19, 2026
Parse and project native catalog pages in one client-owned worker while preserving transport order, bounded display previews, cancellation routing, and joined worker shutdown. Keep complete native control metadata for canonical forks and direct-input checks.

Publish affirmative ephemeral metadata before settling native requests, so helper shutdown cannot lose catalog exclusion while a passive worker refresh is pending. The existing catalog index owns deletion, stale-read fencing, and persistence.

Synchronize worker-backed fixtures without changing deadlines or weakening assertions, and register the standalone synthetic benchmark. Main-baseline comparisons reproduced the PR regressions before repair. Focused worker, catalog, guarded-request, canonical-fork, and SQLite-restart proof plus changed checks passed; independent Codex review is scoped-clean through P2. Exact-head CI is required before landing.

Related: #152035, #151998, #152257.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 20, 2026
Parse and project native catalog pages in one client-owned worker while preserving transport order, bounded display previews, cancellation routing, and joined worker shutdown. Keep complete native control metadata for canonical forks and direct-input checks.

Publish affirmative ephemeral metadata before settling native requests, so helper shutdown cannot lose catalog exclusion while a passive worker refresh is pending. The existing catalog index owns deletion, stale-read fencing, and persistence.

Synchronize worker-backed fixtures without changing deadlines or weakening assertions, and register the standalone synthetic benchmark. Main-baseline comparisons reproduced the PR regressions before repair. Focused worker, catalog, guarded-request, canonical-fork, and SQLite-restart proof plus changed checks passed; independent Codex review is scoped-clean through P2. Exact-head CI is required before landing.

Related: openclaw#152035, openclaw#151998, openclaw#152257.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: codex maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant