Repository navigation
perf(gateway): skip discarded sidebar send diagnostics - #184837
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR skips send-disabled diagnostics that sidebar and dashboard session rows already discard. Example: A sidebar request returns 100 session rows.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR makes a focused, owner-directed performance improvement absent from current main, with no actionable correctness or security findings. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway session presenter combines resident session facts with current recipient policy and emits mode-specific rows for lists and events. flowchart LR
A[Session list request] --> B[Resident session projection]
B --> C[Current visibility filtering]
C --> D[Recipient row presentation]
D --> E[Mode field allowlist]
E --> F[Serialized session rows]
Technical reviewBest possible solution: Keep the mode check in the existing presenter while preserving current disclosure checks and detailed-row send restrictions. Do we have a high-confidence way to reproduce the issue? Current main computes the diagnostic before applying summary-mode allowlists that remove it; the PR also reports an intended baseline regression failure, but this review ran no target code. Is this the best way to solve the issue? The patch removes unnecessary work at its existing owner, explicitly clears reused diagnostic state for summary modes, and preserves the original detailed-mode expression without adding machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 99f7a303e3ff. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +4, Tests +57. Total +61 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 26, 2026, 1:34 PM ET / 17:34 UTC. |
What Problem This Solves
Sidebar and dashboard session lists derive a per-row send-disabled diagnostic, then discard it through their wire-field allowlists. This repeats even when the presented row is otherwise reusable.
User Impact
Less allocation and CPU for warm session lists. Emitted fields and current visibility/sharing outcomes are preserved. Full and compact rows still show current send restrictions; mutation authorization is unchanged.
Why This Change Was Made
Skip the discarded diagnostic at the existing presentation owner. No cache, configuration, schema, or additional owner is introduced. Production delta: +4 lines (14 added, 10 removed); the mode branch preserves the full/compact diagnostic contract while avoiding its work for summary modes. Test delta: +57 lines. Simplification pass retained only that branch and its regression.
Evidence
Acceptance declared before candidate measurements: the existing owner workload with 1,000 persisted synthetic sessions, 100-row pages, 66 in-process recipients across two identities, and 3,000 measured reads per arm. Five alternating pairs for untraced timing and five separate sampled-allocation pairs; 15,000 reads / 1.5 million presented rows per side in each mode. A consistent allocation/CPU improvement with unchanged behavior qualifies; A/A controls are required before attributing any adverse tail/GC result.
Means across the five pairs:
Owner latency has 3,000 samples per arm/pair; event-loop samples range from 1,269–1,928. These are local owner measurements, not WebSocket/server-handler or model-turn throughput. The lane's duplicate-work fast path applies: no whole-Gateway stress campaign or production load was run. RSS/retained heap and promotion were not measured; this adds no retained state. No adverse conclusion is drawn from short GC/tail windows, and no A/A rejection gate was invoked.
Untraced per-pair context and reproducible workload
Per-kind GC totals across timing pairs: base: minor 552 collections / 112.38 ms; major 2 / 11.67 ms; fix: minor 334 collections / 83.35 ms; major 0 / 0.00 ms. Major counts are below the 50-collection gate; no separate major-GC claim. CPU fell in every timing pair, and allocation fell in every allocation pair. Base timing CPU ranged 0.4560–0.6361 ms/read; candidate 0.4121–0.5245 ms/read. The initial diagnostic profile is not included in the comparison. Two local controller errors interrupted one allocation pair and an initial timing attempt; incomplete pairs were not counted and were replaced. No completed pair or pause was trimmed.
Both revisions used the same owner substitution mechanism in the existing committed harness, to avoid comparing different TypeScript transforms:
Release barriers after both processes finish preparation, alternating AB/BA. Allocation runs additionally use
--no-turbo-inlining --allocationsand include objects collected by minor/major GC. The replacement fifth allocation pair used fresh fixtures and one repeat. Node v26.12.1 on macOS. The script checks stable expanded rows for each recipient after every measured window.The new regression fails on base
c00af62f03e6ab9929234a998693f53341a4e126: two unwanted diagnostic authorizations for the first two-row sidebar read. It passes with the fix, interleaves sidebar/compact/dashboard/full modes and owner/guest viewers, preserves detailed send restrictions, excludes drafts from guest reads, and proves role revocation still hides rows.src/gateway/session-row-presentation.test.tsandsrc/gateway/session-row-event-parity.test.ts, 11 tests passed; 61.51 s wrapper wall time including compilation (new regression 1.827 s). The default Bun runner crashed at startup with SIGTRAP; the supportedOPENCLAW_VITEST_RUNTIME=noderoute passed. No Bun workaround was added.git diff --checkpassed. Broad proof: CI run 40367542700 passed on exact head20b93d9c0285ab43c68b52600a68372d97de02b6, including production/test typechecks, lint, selected tests, builds, and boundary checks. The post-rebase event-parity rerun also passed (49.13 s wrapper wall time).The pre-push rebase preserved the measured production owner byte-for-byte. Ready for maintainer review; intentionally not self-merged.