Skip to content

perf(ui): defer New Session submission operations - #184591

Closed
steipete wants to merge 13 commits into
mainfrom
solid2/w-boot-new-commands
Closed

steipete wants to merge 13 commits into
mainfrom
solid2/w-boot-new-commands

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Chat's speculative New Session imports reach creation and placement operations even when the user only reads an existing conversation. This change gives those operations one deferred entry point, reached by New Session intent or placement recovery.

User Impact and Ownership

The New Session route and connected draft warm creation operations in parallel. The existing plain TypeScript submission owner retains synchronous rejection, draft custody, notification prompting, and mutation authority. The extracted module contains creation, initial-turn, and placement-completion operations. Before any post-import effect, the owner rechecks the current connection, client, recovery scope, request lifetime, and method access. Cancelling during code loading remains preparation cancellation rather than an uncertain write. Import failure preserves the draft and presents the error.

Placement startup shares the submission entry already needed on New Session, keeping the static request count unchanged. The pure placement-dispatch parameter helper has its own lightweight module so its callers do not import startup operations. There are no dependency changes or new state owners.

Measured Bundle Result

Exact baseline: 4d560fde03f9b17a68bdef08c7e819ab2aedfdcd. Exact candidate: da64e86eaf58a933995e7999a4046708d11621f9 (clean build, tree 0e70c1ab7b647afb0d6bffac11c5e1f586a9c7d9). Both sides have retained build receipts and strict reports.

These are emitted static route closures, not observed network traffic or V8 execution. All values are bytes; each route includes its startup closure.

Surface Base JS raw Head JS raw Raw change Base JS gzip Head JS gzip Gzip change JS requests
Startup 839,552 839,570 +18 270,699 271,103 +404 5 → 5
Chat 3,951,145 3,951,218 +73 1,233,238 1,233,777 +539 20 → 20
New Session 2,420,045 2,422,223 +2,178 749,810 750,781 +971 17 → 17

CSS is unchanged: startup 181,913 raw / 31,981 gzip B in 1 request; Chat 749,961 raw / 122,253 gzip B in 3 requests; New Session 528,923 raw / 87,150 gzip B in 3 requests.

The strict checker passes with zero warnings and zero violations. That pass does not establish a performance win: startup grows by 404 gzip B, Chat by 539 gzip B, and New Session by 971 gzip B, while the JS request counts remain 5/20/17. Runtime savings have not been measured, and this candidate has not demonstrated the lane's Chat boot reduction or its no-readiness-regression requirement. The increases remain an unresolved performance tradeoff pending runtime evidence; no budget acceptance or measured CPU benefit is claimed.

A separate emitted navigation-preload closure shows the intended narrower surface: New Session idle prewarm after Chat decreases from 299,932 → 282,815 raw JS B (−17,117) and 82,820 → 78,083 gzip JS B (−4,737), with 5 JS requests unchanged. The full navigation-preload closure decreases by 17,045 raw / 4,181 gzip JS B, with 18 JS requests unchanged. These manifest-derived closures differ from the static boot closures above; they establish a structural reduction in the New Session prewarm set, not a browser-observed download, CPU, or readiness improvement.

Evidence

Proof Result and scope
Exact-head build and strict performance check Passed for da64e86eaf58a933995e7999a4046708d11621f9; clean build receipt; zero warnings/violations. Static growth is disclosed above.
UI typecheck Latest single-entry run reported passed in the retained work record; command log has no diagnostics. No additional run performed for this draft.
New Session test-type leaf Reported passed in the retained work record.
Submission flow 28/28 passed on the prior 9930 contract version; retained fixed-flow log, 15.63 s. Subsequent 6061/da64 changes correct grouping and the shared entry; no claim that these tests reran on da64.
Deferred operations and notification focused tests 1/1 and 6/6 reported passed before the final contract corrections; retained as prior-correction evidence only.
Production Knip Exact-head production check passed with zero findings in 5m10.3s.
Independent review Initial extraction, completed expanded-context, grouping, and final single-entry reviews reported scoped-clean with no actionable P0–P2 findings. The final review covers the three-file entry/grouping delta. Reviews did not execute the project or establish emitted chunk behavior.
Runtime smoke and synthetic before/after capture Pending.
Observed network and V8 loaded/executed/unused bytes Pending.
Script/task CPU, long tasks, and Chat/New Session readiness Pending for localhost and the 100 ms RTT profile, with serial interleaved A/A/head samples.

The runtime comparison must reuse the exact retained builds, keep coverage/traces separate from timing, use synthetic data, and apply the campaign's timing acceptance rules. No prior-head runtime measurement is candidate evidence.

Change Size

Production: 10 changed files, 3,325 → 3,402 lines (+77). Tests: 2 changed files, 695 → 851 lines (+156). The additional code handles post-import authority and regression coverage without adding another state owner.

The census was captured from the frozen single-entry working files. Its stored head field predates the final commit; verification against the exact candidate matched all 12 file line counts and all three final-delta source hashes, and confirmed those are the only files changed since that stored head. The census is a source-count record, not a bundle or execution measurement. Its production pattern counts are unchanged at 2 classes and 2 subscriptions; dynamic imports move 2 → 3, runtime import declarations 83 → 82, and runtime reexports 0 → 4. The counted Solid reactive/lifecycle APIs, DOM listeners/queries, and JSX elements remain zero.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T01:42:50.572844Z 9223d99 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da64e86eaf

ℹ️ 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".

Comment thread ui/config/control-ui-chunking.ts Outdated
Comment on lines +236 to +237
// New Session intent and placement share these operations; idle Chat hints exclude them.
return "new-session-submission-runtime";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Demonstrate a performance gain before retaining the deferral

The commit's baseline comparison reports larger startup, Chat, and New Session static closures (+404, +539, and +971 gzip bytes), unchanged request counts, and no runtime measurements or accepted regression budget. The smaller idle-prewarm closure establishes a structural reduction, but does not establish improved browser download, execution, or readiness. AGENTS.md requires the performance workflow, which explicitly requires reverting changes without a measurable gain and obtaining owner acceptance for worsened metrics. Run the interleaved browser workload against the baseline and candidate and establish the benefit/no-readiness-regression result, or withdraw this regrouping until that evidence exists.

AGENTS.md reference: AGENTS.md:L68-L68

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR moves New Session creation and placement operations behind one deferred import while retaining the existing submission owner.

Example: A connected operator submits “Start this task” without a handshake recoveryScope.

  • Before: The permitted session creation proceeds without durable recovery metadata.
  • After: The new post-import comparison silently returns before session creation.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The ownership-preserving extraction is useful, but a concrete admission regression, affected failing tests, and absent final-effect authority evidence prevent a pass.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Reading an existing conversation speculatively loads New Session operations that the user has not requested.
Reason: The maintainer-authored direction targets unnecessary loading through existing owners; retaining this implementation still depends on satisfying the repository's performance acceptance rule.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 8 items remain

Keep this PR open for repair: the owner-approved deferral introduces silent rejection of supported submissions, and affected consumer tests need updates.

Priority: P2
Reviewed head: da64e86eaf58a933995e7999a4046708d11621f9

Before merge

  • Add real behavior proof - Authority-chain proof required: exercise the deferred submission owner through the production browser and Gateway, showing permitted creation and rejection before projects.add, sessions.create, or placement I/O when the account changes or permissions are revoked during loading; the supplied evidence contains mocked tests and static build measurements, with runtime smoke and browser measurements explicitly pending. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Preserve permitted creation when the handshake has no recovery scope (P1) - When hello.auth omits recoveryScope, GatewayBrowserClient uses an empty or derived string scope. Comparing the optional handshake field directly with input.recoveryScope therefore returns before sessions.create, even though ordinary local creation does not require durable recovery metadata. The draft remains with no error, so Send appears to do nothing. Exact-head CI exposes this in the pending-scope background-navigation case and the unscoped background case. Compare captured identity using the existing optional-scope contract while retaining rejection of actual owner changes.
  • Update submission consumers to await the new creation boundary (P2) - The added await makes creationComposer and sessions.create unavailable immediately after submit(), but affected tests still assume synchronous preparation. Exact-head CI fails creation-composer.test.ts when composer.setMessage reads undefined, palette-session-draft.test.ts when ownership changes before creation begins, and command-palette-mentions.test.ts when assertions run before the import settles. Update these consumers to wait for the actual composer or create admission before testing post-admission behavior, preserving the separate cancellation-before-import coverage.
  • Account for the emitted placement facade in the build contract (P2) - Grouping session-placement-startup.runtime.ts into new-session-submission-runtime emits an additional dynamic-entry facade. The unchanged control-ui-isolated-desktop-runtime.node.test.ts expects only the implementation chunk and its dependency, so checks-ui (3/3) fails at line 277 on the extra session-placement-startup.runtime asset. Update the build-contract expectation to include the requested facade while retaining its checks that placement stays out of Chat and remains unevaluated.
  • Resolve security review attention item - No concrete authorization bypass was found, but delayed mutation admission lacks final-effect proof for replaced or revoked authority.
  • Resolve merge risk - The author must establish that account replacement or permission revocation during deferred loading prevents the final creation, project, and placement RPCs.
  • Resolve merge risk - The author must eliminate the disclosed route-closure growth or obtain explicit owner acceptance of that tradeoff after establishing a measurable benefit.
  • Explain or restore the original intent of Synchronous submission admission and visible pending input - fae30c7: fix(ui): show new-session sends immediately under load #136069 preserved admission and access ordering while making submitted input visible immediately; the new import retains display custody but adds an unexplained rejection for absent recovery metadata.

Findings

  • [P1] Preserve permitted creation when the handshake has no recovery scope — ui/src/pages/new-session/draft-submission-flow.ts:489-493
  • [P2] Update submission consumers to await the new creation boundary — ui/src/pages/new-session/draft-submission-flow.ts:477-482
  • [P2] Account for the emitted placement facade in the build contract — ui/config/control-ui-chunking.ts:228-229

Provenance

  • Synchronous submission admission and visible pending input changes intended behavior without addressing why it exists (fae30c7: fix(ui): show new-session sends immediately under load #136069 preserved admission and access ordering while making submitted input visible immediately; the new import retains display custody but adds an unexplained rejection for absent recovery metadata.)

Tests

  • Missing end-to-end proof: Missing exact-head production-browser evidence covers cold submission, cancellation and import failure, allowed versus replaced/revoked principals at final RPCs, placement recovery, and matched Chat/New Session performance.
Agent review details

How this fits together

The Control UI submission owner accepts drafts, checks Gateway access, creates sessions, and hands accepted input to Chat or placement recovery.

flowchart LR
  A[New Session or command palette] --> B[Draft submission owner]
  B --> C[Deferred operations module]
  C --> D[Session creation capability]
  D --> E[Gateway]
  C --> F[Placement startup owner]
  F --> E
  D --> G[Chat handoff]
Loading

Technical review

Best possible solution:

Keep one deferred operations entry under the existing submission owner, preserve permitted unscoped creation, and retain the deferral only when its measured benefit justifies its cost.

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

Source inspection establishes the undefined-versus-string rejection, and exact-head CI exercises failing unscoped submission contracts; no product code or tests were run during this review.

Is this the best way to solve the issue?

The extraction preserves existing ownership and removes the replaced implementations, but its scope guard must preserve ordinary creation without recovery metadata and its performance benefit remains unestablished.

Full review comments:

  • [P1] Preserve permitted creation when the handshake has no recovery scope — ui/src/pages/new-session/draft-submission-flow.ts:489-493
    When hello.auth omits recoveryScope, GatewayBrowserClient uses an empty or derived string scope. Comparing the optional handshake field directly with input.recoveryScope therefore returns before sessions.create, even though ordinary local creation does not require durable recovery metadata. The draft remains with no error, so Send appears to do nothing. Exact-head CI exposes this in the pending-scope background-navigation case and the unscoped background case. Compare captured identity using the existing optional-scope contract while retaining rejection of actual owner changes.
    Confidence: 0.99
  • [P2] Update submission consumers to await the new creation boundary — ui/src/pages/new-session/draft-submission-flow.ts:477-482
    The added await makes creationComposer and sessions.create unavailable immediately after submit(), but affected tests still assume synchronous preparation. Exact-head CI fails creation-composer.test.ts when composer.setMessage reads undefined, palette-session-draft.test.ts when ownership changes before creation begins, and command-palette-mentions.test.ts when assertions run before the import settles. Update these consumers to wait for the actual composer or create admission before testing post-admission behavior, preserving the separate cancellation-before-import coverage.
    Confidence: 0.98
  • [P2] Account for the emitted placement facade in the build contract — ui/config/control-ui-chunking.ts:228-229
    Grouping session-placement-startup.runtime.ts into new-session-submission-runtime emits an additional dynamic-entry facade. The unchanged control-ui-isolated-desktop-runtime.node.test.ts expects only the implementation chunk and its dependency, so checks-ui (3/3) fails at line 277 on the extra session-placement-startup.runtime asset. Update the build-contract expectation to include the requested facade while retaining its checks that placement stays out of Chat and remains unevaluated.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Repair and validate the existing submission contract (recommended)
    The author should preserve unscoped creation, update affected consumer tests, and provide allowed-versus-revoked final-effect evidence before retaining the deferral.
  2. Withdraw the deferral if measurements show no benefit
    The author can remove the extraction and regrouping if the matched browser workload cannot justify their added cost.

Provenance checked

Testing

Proof path: unit tests only.

Security

Needs attention: No concrete authorization bypass was found, but delayed mutation admission lacks final-effect proof for replaced or revoked authority.

Evidence

What I checked:

PR surface

Source +77, Tests +156. Total +233 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 10 220 143 +77
Tests 2 156 0 +156
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 376 143 +233

Review metrics

Metric Value Why it matters
Production versus test LOC Production +220/-143; tests +156/-0 The production growth implements the deferred boundary and post-import checks; the new test covers distinct loading-failure, custody, cancellation, and authority cases.
Reported emitted gzip tradeoff Startup +404 B; Chat +539 B; New Session +971 B; idle New Session prewarm −4,737 B These exact-head structural measurements explain the tradeoff but do not establish browser execution or readiness improvement.

Labels

Label changes:

  • add P2: This is a bounded performance improvement with pre-merge correctness and validation repairs, rather than a demonstrated regression in a released runtime.
  • add merge-risk: 🚨 compatibility: The new scope comparison rejects previously permitted creation when handshake recovery metadata is absent.
  • add merge-risk: 🚨 security-boundary: Captured submission authority now crosses an additional awaited import, without final-effect proof for account replacement or revoked permissions.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: This is a bounded performance improvement with pre-merge correctness and validation repairs, rather than a demonstrated regression in a released runtime.
  • merge-risk: 🚨 compatibility: The new scope comparison rejects previously permitted creation when handshake recovery metadata is absent.
  • merge-risk: 🚨 security-boundary: Captured submission authority now crosses an additional awaited import, without final-effect proof for account replacement or revoked permissions.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 26, 2026, 8:16 AM ET / 12:16 UTC.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XL and removed size: L labels Oct 27, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Superseded by #186004, which contains the current reviewed head, complete cold-boot coverage rankings, timing evidence, and inspected screenshots. This older head is retired; its CI is not evidence for the replacement.

@steipete steipete closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui ci:full Keep ordinary native-locale CI selection on the next PR run. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant