Repository navigation
perf(chat): reuse unchanged startup command catalogs - #175674
Conversation
Reuse the prepared command revision and retain receipt-matched catalogs in warm chat snapshots. Keep cold loads, catalog invalidation, and slash-command picker behavior intact without changing boot sequencing.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR retains slash-command catalogs in chat snapshots and omits unchanged catalogs from warm startup responses. Example: Reload a conversation with the same 150-command catalog.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR provides a useful startup optimization and resolves the prior worker-policy finding; no actionable introduced defect was confirmed. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway prepares agent command catalogs, chat.startup returns their receipts, and the Control UI reconstructs omitted catalogs from account-scoped transcript snapshots before publishing metadata. flowchart LR
A[Prepared command owner] --> B[Chat startup handler]
C[Retained chat snapshot] --> D[Startup request receipts]
D --> B
B --> E[Response reconstruction]
C --> E
E --> F[Shared metadata store]
F --> G[Slash command picker]
Technical reviewBest possible solution: Retain the existing command revision and snapshot owners while keeping session worker policy independently refreshed. Do we have a high-confidence way to reproduce the issue? Current-main source retransmits startup commands despite matching other receipts, and the supplied handler regression exercises that path; no target code was executed during this read-only review. Is this the best way to solve the issue? Reusing the prepared content revision and reconstructing omissions against the request's captured payload is a focused solution that preserves invalidation and worker-policy lifetimes. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 25acc454deb2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +186, Tests +158, Docs +4, Other +2. Total +350 across 20 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 HistoryReview history (1 earlier review cycle)
Reviewed October 17, 2026, 12:54 PM ET / 16:54 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed the worker-policy finding in daad82c. The prepared command revision now travels separately as The added regression connects the real Gateway metadata runtime to the UI metadata store. It reproduced retention of the old required-worker profile before the fix and passes afterward. A raw IndexedDB snapshot from before command receipts also restores unchanged. The optional cache fields require no schema/version migration; a full application upgrade was not run. Independent review is clean through P2. Final paired byte measurements are 57,888 → 517 B (−57,371 B, 99.1%); updated proof is in the PR body. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: daad82c9cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| commands: response.metadata | ||
| ? response.metadata.commands | ||
| : previousHistoryState?.commands, |
There was a problem hiding this comment.
Keep large command catalogs from evicting transcript snapshots
When a valid command catalog exceeds the 12 MiB per-snapshot limit, retaining it inside every ChatSessionSnapshot makes boundChatSessionSnapshot() exhaust all messages and return null, after which cacheChatSessionSnapshot() deletes the entire memory and IndexedDB entry. This is reachable within the command schema limits—for example, command arguments may each contain up to 50 choices with 200-character values and labels—and such a catalog can still fit within the 25 MiB Gateway frame limit. Before this change the same transcript remained available for warm/offline loading, so the catalog should be stored separately, deduplicated, or omitted when it cannot fit rather than evicting the transcript.
Useful? React with 👍 / 👎.
|
Merged as 8f255dc using the authorized inherited-failure exception on exact head daad82c. CI run 39050396537 completed. Its only root failures were Independent autoreview and final ClawSweeper review have no actionable findings. The earlier worker-policy finding is fixed and covered by a failing-before/passing-after production-owner regression. The 150-command fixture measures 57,888 → 517 B across four concurrent swapped-core pairs. This is response-byte proof, not end-to-end reload latency. Focused proof totals 178 passing tests, including legacy IndexedDB restoration; no full application upgrade was run. |
* perf(chat): reuse unchanged startup command catalogs Reuse the prepared command revision and retain receipt-matched catalogs in warm chat snapshots. Keep cold loads, catalog invalidation, and slash-command picker behavior intact without changing boot sequencing. * test(chat): expect the startup command revision * test(chat): include command revision in prepared metadata fixture * fix(chat): keep command receipts separate from worker policy
What Problem This Solves
Warm chat reloads retransmit the entire slash-command catalog even when transcript, pending-input, and session metadata receipts already match.
User Impact
Warm reloads retain their slash-command picker without downloading an unchanged catalog. Cold clients, missing cached commands, and changed catalogs receive the full list. Boot sequencing and command execution are unchanged.
Why This Change Was Made
Reuse the existing prepared command owner's content revision in
stateRevision.commands, including its existing config/plugin/skill invalidation. Keep startup metadata revisionless: command receipts do not govern the lifetime of session worker policy. Retain commands beside the existing account-scoped chat snapshot and reconstruct receipt-matched omissions before publishing through the shared metadata store. The picker consumes that store without an additional commands.list read. No new cache owner, configuration option, database schema migration, or timer.Evidence
A synthetic 150-command skill/plugin catalog and 820-message history reproduce the defect through the production
chat.startuphandler. The regression fails on the original handler because all 150 commands are retransmitted; the patched handler omits them and delivers replacements after a skill generation changes.Four concurrent paired serialization replays of those captured handler responses ran on the Linux measurement host under the exclusive sandbox lock, swapping CPU halves 96–111 and 112–127 each pair. Every pair: 57,888 B → 517 B, paired difference −57,371 B (99.1% smaller). Start skew was at most 1 ms. CPU busy context across the measured halves was 1.03%, 11.15%, 12.46%, and 9.24%; dirty pages stayed under 14 MB. These are response-byte measurements, not end-to-end reload latency measurements. The sandbox was removed afterward.
Focused UI proof covers retained/changed/empty command catalogs, replacement sessions, a newer sibling cache arriving during a request, missing retained commands, and command parsing after picker refresh without
commands.list. IndexedDB round-trip preserves the catalog and revision, including the existing privacy projection.Production source delta is +28 authored lines plus +160 generated validator lines. The new wire receipt and retained payload require that growth; the existing revision owner and snapshot lifecycle are reused. No speculative cache, duplicate recomputation, or parallel execution path was added.
Focused checks: 49 Gateway handler/runtime/worker-policy tests pass (36.42 s combined file wall time); 71 UI metadata-store, worker-policy, and IndexedDB tests pass (2.63 s); 27 warm-startup tests pass (2.89 s); the focused Gateway integration case passes (15.54 s). Earlier unchanged-input proof also covers 18 picker tests and 12 native-session metadata tests. Total focused proof: 178 passing tests. Changed-file formatting, syntax lint, and
git diff --checkpass. PR CI owns broad validation, including typecheck and type-aware lint.CI found a hand-built prepared-metadata fixture missing its required revision; the fixture is corrected. ClawSweeper then identified a real interaction: publishing a command revision in shared startup metadata could retain stale required-worker policy on an unchanged compact refresh. The new regression connects the real Gateway metadata runtime to the real UI metadata store, reproduces the stale profile before the fix, and passes after moving the command receipt outside shared metadata. This preserves the deliberate revisionless-startup behavior from #175317, including its original Gateway integration assertion. Raw pre-command-receipt IndexedDB snapshots also restore unchanged; this is additive optional cache data, with no database version or schema migration. A full application upgrade was not run.
Independent autoreview is clean through P2, including the worker-policy correction and legacy-snapshot proof. Release-note context: warm chat reloads no longer retransmit unchanged slash-command catalogs, while changed skill/plugin/config catalogs still refresh.
This is a transport/persistence change with no visual changes. Broad gates run in PR CI; no Testbox lease was used.
Inherited CI failures
Final-head CI run 39050396537 tests merge
92ae8141c9dfb42bc1c03a9d31f905a67c224176, whose parents are baseline62cb03ac7a95f4b9cb435f8efc57f4034ba2649band PR headdaad82c9ccc5f80bbfe42e3364a5af85d368b0b4. Three jobs report defects in tests added by the baseline's snapshot-admission change:check-lint-core-2(job): the new temporary-open-failure test declareswriterinside the suite's existingwriterscope. Focusedeslint/no-shadowon the unchanged baseline file reproduces this error at line 626.checks-ui (1/3)(job): the new missing-store test raisesReferenceError: CHAT_SNAPSHOT_DB_NAME is not defined. Running only that test from the unchanged baseline file reproduces the same failure at line 639 (2.27 s file wall time). CI's other 7,064 tests in this shard pass.check-test-types-core-3(job): the same baseline test usesCHAT_SNAPSHOT_DB_NAME,CHAT_SNAPSHOT_METADATA_STORE_NAME, andSIDEBAR_SNAPSHOT_STORE_NAMEdespite importing them asDB,METADATA, andSIDEBAR.The failing test bodies are unchanged by this PR. Baseline reproduction used a temporary sibling copy of the exact baseline test file; the copy was removed afterward. The automated table labels these failures new relative to older scheduled-main run 39045247512; it did not compare scope or the newer exact main parent. The direct baseline reproductions above establish attribution. All other CI jobs completed successfully or were intentionally skipped. No CI reruns or branch updates were requested to chase green. Landing uses the authorized inherited-failure exception.