Skip to content

improve(ui): defer unused Access preference requests - #188546

Closed
steipete wants to merge 2 commits into
mainfrom
solid2/w-chat-access-demand-1030
Closed

steipete wants to merge 2 commits into
mainfrom
solid2/w-chat-access-demand-1030

Conversation

@steipete

@steipete steipete commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Chat loads remembered Access preferences when a session opens or switches, even while the Access controls are closed.

User Impact

Chat avoids that unused preference work until the controls are opened. While the remembered choice loads, only Access is disabled; effort and speed stay usable.

Why This Change Was Made

The visible Access subtree now requests and reads its preference. The existing preference owner still handles identity changes, stale results, field merging, and write authority. No route or lazy boundary changes.

Evidence

Reviewed comparison: 05c217914f11b987eb7b96da52a86618e1127e12 → 5ca510182998a15fe28c9a833a66634092fa892b.

Check Result
UI typecheck Passed before and after merging the current base.
Composer-control tests 17 distinct cases passed across retained runs. The first run passed 16 and exposed a missing boot ID in the new test fixture; the fixture was corrected and that one case passed on its single rerun.
Connection-lifecycle tests 26 passed, including identity replacement during an outstanding preference read.
Effort-picker browser tests 8 passed in Chromium, including lazy preparation, loading isolation, and remembered selection. WebKit remains for CI.
Source review Independent scoped review found no actionable P0–P2 finding; root review also checked the unchanged callback-forwarding components.
Production build / strict assets Passed on the exact candidate; both the absolute budget check and comparison with the frozen exact-base bundle passed, with no budget update.
Completed performance trial 240 captures; 20 per role/cell, both orders and A/A; independent numerical verification: 1,346 rows, zero mismatches. Limited structural-work acceptance; tails and missingness disclosed below.
Production Knip Same findings on base and candidate: isSameReplyToolAuthorityConversation, dispatchGatewayLifecycleMethod, prepareTtsRequest, SessionFilePreviewResource, SessionHtmlPreviewResource, and SessionHtmlPreviewPlan. No UI finding or new ignore.
PR CI (ci:full) Requested on this ready PR.

The 51 distinct passing cases above are evidence from the retained pre-integration runs plus the fixture-only rerun, not a claim that all three files were rerun together on the final head.

Asset sizes

Surface Base gzip Candidate gzip Requests, base → candidate
Startup JS 88,902 B 88,816 B 3 → 3
Startup CSS 33,548 B 33,548 B 1 → 1
Chat JS 1,273,929 B 1,273,447 B 20 → 20
Chat CSS 127,450 B 127,450 B 3 → 3

These small compressed-size changes are not timing evidence. Raw startup JS is unchanged at 278,314 B; raw Chat JS grows by 392 B. Each frozen bundle retains its native build identity.

Visual proof

Synthetic fixture, 1280×900, light theme. The opaque box redacts a feature label; the rest of each captured frame is unchanged. Both sides retain the remembered choice and usable effort controls.

Before, preference load held:

Before: preference load held

After, preference load held:

After: Access disabled during preference load

Before, remembered choice loaded:

Before: remembered choice

After, remembered choice loaded:

After: remembered choice

Full timing, CPU, work counts, and limitations

Accepted as a focused reduction in unnecessary preference work, with the limitations below explicitly retained. This is not a claim of a ≥5% readiness or CPU win, or an all-metrics pass of the broader readiness audit.

The completed trial contains 240 captures: 20 observations per base, A/A control, and candidate in each of four cells. Two planned batches each contain five forward and five reverse triplets. Both orders and all finite tails remain in the report; no historical or cross-candidate pooling. The independent numerical verifier checked 1,346 metric rows with zero mismatches. All bundles retained their native build identities; the warm seed used snapshot projection 13 and database 8.

Headless Chromium ran against the synthetic Gateway on the same shared Mac, at localhost and a simulated 100 ms RTT. Recorded one-minute host load ranged 14.73–61.34. The A/A control shows substantial wall-time variation, so affected script/task CPU over all 20 observations and structural counts govern this limited acceptance. Table values are arithmetic median / nearest-rank p95. The percentage column is the within-triplet paired median change / distribution p95 change against the base; it is not the ratio of table medians.

Work removed while Access remains closed

Measured interval Base / A/A RPCs Candidate RPCs Base / A/A response bytes Candidate response bytes
Full captured cold scenario, either network profile (median) 73 71 513,986 511,485
Full captured warm scenario, either network profile (median) 49 47 562,241 559,740
Settled session switch, either network profile (every run) 20 18 122,582 120,081

The switch removes 2 RPCs (10%) and 2,501 response bytes (2.04%) in every observation. The omitted work is the preference read and first-use migration write. This relocates preference work to visible Access demand; it does not eliminate the eventual cost if Access is opened. The fixture lacks new-session.migration.v1, so the measured two-request saving is specific to that first-use profile. This trial does not establish the magnitude for already-migrated profiles, real Gateway/provider latency, or a weighted production workload.

Readiness and session switch

Cell / metric Base ms, median / p95 A/A ms, median / p95 Candidate ms, median / p95 Candidate vs base, paired median / p95
Cold / local — first contentful paint 42.00 / 104.00 40.00 / 60.00 42.00 / 52.00 -3.85% / -50.00%
Cold / local — composer enabled 257.95 / 1,080.20 259.80 / 385.60 260.15 / 900.80 +3.57% / -16.61%
Cold / local — first transcript readiness 271.20 / 1,080.20 259.85 / 385.60 261.15 / 1,090.30 -4.51% / +0.94%
Cold / 100 ms RTT — first contentful paint 146.00 / 164.00 146.00 / 160.00 144.00 / 168.00 +0.00% / +2.44%
Cold / 100 ms RTT — composer enabled 1,444.00 / 1,645.60 1,447.95 / 1,564.20 1,445.55 / 1,588.80 -0.20% / -3.45%
Cold / 100 ms RTT — first transcript readiness 1,444.10 / 1,645.70 1,448.00 / 1,564.30 1,445.65 / 1,687.70 -0.20% / +2.55%
Warm / local — transcript paint 340.00 / 416.00 340.00 / 384.00 354.00 / 388.00 +1.83% / -6.73%
Warm / local — composer ready 158.70 / 216.60 160.10 / 176.90 153.00 / 173.50 -3.09% / -19.90%
Warm / local — settled session switch 1,407.45 / 1,446.50 1,404.60 / 1,442.10 1,407.20 / 1,460.50 -0.48% / +0.97%
Warm / 100 ms RTT — transcript paint 1,462.00 / 1,488.00 1,460.00 / 1,492.00 1,454.00 / 1,496.00 -0.41% / +0.54%
Warm / 100 ms RTT — composer ready 1,341.35 / 1,358.80 1,337.70 / 1,355.00 1,335.35 / 1,367.90 +0.12% / +0.67%
Warm / 100 ms RTT — settled session switch 1,785.95 / 1,806.30 1,777.60 / 1,813.00 1,786.55 / 1,819.90 +0.33% / +0.75%

Script and task CPU

Cell / metric Base ms, median / p95 A/A ms, median / p95 Candidate ms, median / p95 Candidate vs base, paired median / p95
Cold / local — script CPU 576.23 / 657.75 586.25 / 661.92 574.75 / 665.00 +0.94% / +1.10%
Cold / local — task CPU 1,069.07 / 1,300.76 1,063.89 / 1,250.39 1,067.33 / 1,283.49 -2.08% / -1.33%
Cold / 100 ms RTT — script CPU 701.61 / 757.16 702.24 / 766.76 701.59 / 779.49 +1.27% / +2.95%
Cold / 100 ms RTT — task CPU 1,367.17 / 1,531.77 1,362.04 / 1,533.65 1,362.45 / 1,570.87 +1.02% / +2.55%
Warm / local — switch script CPU 252.90 / 275.05 242.72 / 277.98 244.16 / 259.75 -2.43% / -5.57%
Warm / local — switch task CPU 546.71 / 598.97 546.59 / 588.01 547.19 / 576.66 -1.24% / -3.73%
Warm / local — stream script CPU 1,195.15 / 1,252.21 1,201.82 / 1,254.79 1,196.76 / 1,264.42 -0.03% / +0.98%
Warm / local — stream task CPU 3,944.48 / 4,089.16 3,954.10 / 4,124.86 3,947.80 / 4,137.57 +0.12% / +1.18%
Warm / 100 ms RTT — switch script CPU 264.57 / 295.34 262.28 / 279.01 261.97 / 284.26 -2.61% / -3.75%
Warm / 100 ms RTT — switch task CPU 617.24 / 663.01 632.49 / 663.48 621.24 / 655.83 -1.58% / -1.08%
Warm / 100 ms RTT — stream script CPU 1,258.82 / 1,347.96 1,309.83 / 1,350.12 1,291.88 / 1,336.69 +1.58% / -0.84%
Warm / 100 ms RTT — stream task CPU 4,121.58 / 4,398.97 4,314.62 / 4,385.40 4,172.96 / 4,352.24 +1.36% / -1.06%

The smaller full-cohort switch result supersedes the stronger partial ten-observation result. Against the A/A control, switch script CPU paired medians change −0.82% locally / −0.34% at 100 ms RTT; switch task CPU changes +1.14% / −0.97%. There is no demonstrated ≥5% CPU gain. Cold and streaming CPU are near flat on this host, and no affected aggregate script/task CPU cell establishes a regression beyond the pinned 20% limit.

Typing, tails, and missing observations

Cell / metric Base ms, median / p95 A/A ms, median / p95 Candidate ms, median / p95 Candidate vs base, paired median / p95
Warm / local — per-run typing-to-frame p95 20.35 / 26.39 19.84 / 24.58 20.48 / 25.19 +2.98% / -4.55%
Warm / 100 ms RTT — per-run typing-to-frame p95 20.35 / 25.18 20.16 / 23.82 19.50 / 26.63 -3.67% / +5.76%

All 120 warm captures delivered 645 deltas, retained the exact 43-character draft, and recorded 43 sent and 43 observed inputs, one pane render, no duplicate row keys, and zero final distance from the transcript tail. The native sender runs until stream completion; 43 is the observed count in this cohort, not a fixed-work contract. Streaming CPU includes that typing work, and streaming elapsed time also joins the sender's pending sleep. No pooled per-keystroke or normalized-work claim is made.

The following adverse observations remain part of the accepted limitation, rather than being called clean:

  • Cold localhost Sessions readiness p95 is 147.90 → 190.40 ms (+28.74%); Cron readiness p95 is 170.90 → 236.10 ms (+38.15%).
  • Cold 100 ms RTT Cron script CPU p95 is 80.74 → 103.21 ms (+27.82%; +22.37% against A/A). Its paired median is +1.34%, and the second-batch paired median is −1.26%. This candidate changes no Cron rendering or request path; the tail is retained as an unresolved observation on that separate surface, not evidence that Cron improved.
  • Warm 100 ms RTT typing-to-frame p95 is 25.18 → 26.63 ms (+5.76%; +11.80% against A/A). Estimated dropped-frame p95 is 434 → 463 (+6.68%). The same cell's A/A input-delay paired median/p95 changes +16.81%/+17.23%, so wall/frame results remain qualified by host noise; affected streaming script/task CPU stays near flat.
  • Cold localhost composer p95 is lower than the base but +133.61% against A/A; cold transcript readiness p95 is +0.94% against base and +182.75% against A/A. At 100 ms RTT, cold transcript readiness p95 is +2.55% against base and +7.89% against A/A. These are not blanket tail passes.

For localhost warm reload, cached-only transcript visibility is not observed in any role (20/20 missing per role); cached and retained-at-catchup rows are zero. Composer readiness, cache reads, and later transcript paint do not substitute for that missing outcome. At 100 ms RTT, cached-only transcript visibility is observed: base/A/A/candidate median is 1,422.25/1,421.00/1,417.00 ms, and the candidate p95 changes +0.20% against base. Snapshot seed metadata matches across roles but does not prove byte-identical storage between invocations.

Optional disclosures also include unavailable session-switch CLS, unavailable localhost warm anchor shift, absent raw frame-sample counts, and fractional timer deadlines. Per-delta text visibility is intentionally disabled in this untraced mode, so no per-delta paint-latency claim is made. All 16 part validations completed with 15 samples and only these optional disclosures; failed or missing observations were not replaced with zero.

This limited acceptance rests on the deterministic request reduction and the affected CPU/behavior evidence. The named tails and missing cached-only visibility remain unresolved for the broader readiness audit.

Size and Solid ownership

Nine changed files: six production and three tests. Physical LOC (including comments and blank lines): production 2,513 → 2,552 (+39); tests 2,019 → 2,226 (+207); total 4,532 → 4,778 (+246). The added production code scopes the preference read to visible demand, refreshes an already-demanded owner after identity changes, and preserves early-write preparation.

The textual Solid checklist census across the six production files is createMemo 10 → 11 and onSettled 0 → 1. Rendering controllers, effects, render effects, untrack, direct listeners, DOM queries, hand-built class strings, flush, owner APIs, createRoot, signals, and component cleanup hooks remain 0 → 0. The new memo derives the owner's preference snapshot; the settled callback requests preparation from that same owner.

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

clawsweeper Bot commented Oct 30, 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 30, 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-30T17:10:03.823551Z 5ca5101 PR opened
ℹ️ 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.

@steipete
steipete enabled auto-merge (squash) October 30, 2026 17:19
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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 Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR defers remembered Access preference requests until the Access controls appear and disables only Access while loading.

Example: Open Access with a remembered daybreak_red choice while the preference response is delayed.

  • Before: Access remains interactive before the remembered choice arrives.
  • After: Access waits for preferences, then restores Red; effort and speed remain usable.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused change with inspected UI evidence, distinct regression coverage, and no identified correctness defect.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after browser screenshots exercise the production Control UI against a synthetic Gateway, showing Access disabled during a held preference load and Red retained afterward; reported request counts support deferred work, while live Gateway latency and broad readiness improvements remain outside the claim.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Opening or switching chats performs preference work for controls the user may never open.
Reason: The maintainer-authored direction removes deterministic unused work, retains existing owners, and explicitly limits performance claims to the demonstrated structural reduction.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR removes unnecessary preference work while preserving the existing selection owner; no introduced defect was found.

Priority: P2
Reviewed head: 5ca510182998a15fe28c9a833a66634092fa892b

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied evidence does not show the new regression cases failing on the base.
Agent review details

How this fits together

The Control UI presents session settings through the existing DraftPreferenceState owner, which loads authenticated preferences, merges writes, and rejects stale identity results.

flowchart TD
  A[Effort menu opens] --> B[Visible Access controls]
  B --> C[DraftPreferenceState]
  D[Gateway identity updates] --> C
  C --> E[User preference RPCs]
  E --> F[Remembered choice and loading state]
  F --> B
Loading

Technical review

Best possible solution:

Keep preference loading at visible Access demand while retaining the existing identity, persistence, and mutation owners.

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

Current-main source directly shows preference synchronization during composer preparation while Access is closed; no target code was executed during this review.

Is this the best way to solve the issue?

The patch follows the smallest complete approach: remove eager preparation, observe preferences inside the existing lazy subtree, and refresh the same owner after identity changes.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Eager Access preference preparation and remembered selection changes intended behavior with a stated reason (3e1eff7: Remember the last permitted Access choice per authenticated user and agent across chats.)
  • Native toggle activation during streamed updates keeps the original intent (1f26ff4: Equality-filtered checked and disabled projections prevent unchanged snapshots from resetting native checkbox activation.)
  • Preference merging and lifecycle ownership keeps the original intent (bcafd72: Serialize preference writes, preserve concurrent fields, and fence delayed operations to their originating connection and scope.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned production change: The introduced diff removes eager synchronization from composer rendering, reads preferences inside the visible Access subtree, and preserves equality-filtered toggle bindings. (ui/src/pages/chat/components/chat-access-program-control.tsx:49, 5ca510182998)
  • Current main still performs eager work: Current main calls accessPreferences.synchronize during composer-control preparation, independently of whether Access is open. (ui/src/pages/chat/chat-pane-session-controls.ts:159, 8163a1d77101)
  • Existing lifecycle and persistence owner retained: Preparation delegates to existing synchronization; demanded owners refresh on identity changes, and early writes prepare preferences before entering the existing merge and connection-ownership checks. (ui/src/pages/new-session/draft-preference-state.ts:98, 5ca510182998)
  • Inspected visual and structural evidence: All four downloaded screenshots were inspected: the candidate disables Access during loading and retains Red afterward. The complete PR body reports two fewer RPCs per settled switch for its unmigrated synthetic profile, explicitly accepts limited structural-work improvement, and disclaims a substantial CPU or readiness gain. Its body SHA-256 matches a3a15bf5f522b9f53cd32fcccfada56e4097e2d89ef556cc4c299f8c0f994d39. (5ca510182998)
  • Feature history: fix(ui): preserve Daybreak choices across chats #185039 established remembered Access choices and the eager read; fix(ui): preserve Daybreak toggle activation during streamed updates #186357 added memoization to preserve native toggle activation during streamed updates. This PR preserves both behavioral contracts. (ui/src/pages/chat/chat-pane-session-controls.ts:158, 3e1eff7f703c)
  • Required CI remains unresolved: The reviewed head is mergeable but blocked, with failures in check-test-types-core-3, checks-ui-e2e (2/7), and checks-ui-e2e-real-gateway (1/2). Available annotations identify a phone composer geometry mismatch and a quiet-automation timestamp mismatch, but establish no causal link to this diff. Job-log retrieval redirected to a storage host blocked by the review environment, preventing further attribution. (5ca510182998)

PR surface

Source +39, Tests +207. Total +246 across 9 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 6 120 81 +39
Tests 3 209 2 +207
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 329 83 +246

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +120/-81 lines; tests +209/-2 lines The net production growth supports deferred preparation and lifecycle refresh; the tests cover lazy reads, early-write merging, identity replacement, and independent control readiness.

Labels

Label changes:

  • add P2: A focused efficiency improvement removes unnecessary authenticated preference requests without changing available capabilities.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: A focused efficiency improvement removes unnecessary authenticated preference requests without changing available capabilities.
  • 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.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

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 30, 2026, 1:26 PM ET / 17:26 UTC.

@steipete

Copy link
Copy Markdown
Contributor Author

Closing this candidate after reviewing the complete 240-capture trial (20 observations per base, A/A control, and candidate in each cold/warm × localhost/100 ms RTT cell). The full cohort supersedes the earlier partial result: it does not demonstrate a reliable ≥5% CPU or user-facing readiness improvement.

Session-switch script CPU changes −2.43% locally / −2.61% at 100 ms RTT against the base, but only −0.82% / −0.34% against A/A. The deterministic 20 → 18 RPC reduction is real, but this fixture includes a first-use preference migration; the patch moves that work to opening Access rather than eliminating its eventual cost. Retained adverse tails include localhost Sessions/Cron readiness p95 (+28.74%/+38.15%) and 100 ms RTT Cron script CPU p95 (+27.82%, +22.37% against A/A). Their cause remains unresolved; these measurements do not support blanket acceptance.

The 15 relevant owner/test inputs are unchanged from the measured base through current main source checks. Keeping the simpler eager owner is the better tradeoff without a demonstrated readiness benefit. Auto-merge was already confirmed cancelled; this closure does not re-arm it. No new runtime measurements or production changes were made for this disposition.

@steipete steipete closed this Oct 30, 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. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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