Skip to content

perf(web): paint the new-thread page from cached state - #19862

Closed
maria-rcks wants to merge 21 commits into
t3/perf-wave5from
t3/perf-wave6
Closed

maria-rcks wants to merge 21 commits into
t3/perf-wave5from
t3/perf-wave6

Conversation

@maria-rcks

Copy link
Copy Markdown
Collaborator

stacked on #19014. this diff shows only this layer.

before and after: cached landing page and editable composer during startup

the landing page creates its draft from cached config and projects, so the composer can paint before live config and t3.json arrive. live workspace and model defaults reconcile afterward without replacing typed text or explicit choices. sending waits for authentication and workspace defaults; typing stays available, and pending defaults survive reload.

medians of five interleaved linux/chromium and electron/xvfb runs, 5e7366f → 067641925a, before merge-up:

time to editable composer before after
desktop warm launch 3,573 ms 1,735 ms
web cold navigation 1,631 ms 1,448 ms
web warm reload 721 ms 794 ms

the web ranges overlap; warm reload shows no measured win. the merged trimmed stack recheck against 5e7366f measured desktop warm launch at 3,134 → 1,644 ms; that comparison includes all layer trims. provider submission remains unverified.

model: claude-opus-5-5 coordinating gpt-6.1-sol subagents, harness: claude code in t3 code.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Oct 15, 2026
@juliusmarminge juliusmarminge added the macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews label Oct 15, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — This PR changes the existing new-thread startup flow and the timing of workspace/model defaults by introducing persisted pending state and asynchronous reconciliation. An unresolved high-severity finding also indicates that some drafts may remain stuck in “Preparing workspace,” so the behavior warrants human review.

Needs human approval because:

  • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity

No code changes detected at ae830d9. Prior analysis still applies.

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for ae830d9.

This comment will update automatically after the next completed run.

useEffect(() => {
if (draftId === null || !workspaceDefaultsPending || sessionConfig === null) return;
void completeDraftWorkspaceDefaults(draftId);
}, [draftId, environmentId, draftThread?.projectId, sessionConfig, workspaceDefaultsPending]);

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.

🟠 High components/ChatView.tsx:1876

A persisted draft can remain disabled as “Preparing workspace” indefinitely when sessionConfig arrives before its project snapshot: completeDraftWorkspaceDefaults returns while readProject(...) is null, and this effect does not rerun when shell hydration makes the project available because none of its dependencies change. Include project or shell readiness in the retry trigger so workspace defaults complete and sending is re-enabled.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/components/ChatView.tsx around line 1876:

A persisted draft can remain disabled as “Preparing workspace” indefinitely when `sessionConfig` arrives before its project snapshot: `completeDraftWorkspaceDefaults` returns while `readProject(...)` is `null`, and this effect does not rerun when shell hydration makes the project available because none of its dependencies change. Include project or shell readiness in the retry trigger so workspace defaults complete and sending is re-enabled.

@juliusmarminge juliusmarminge self-assigned this Oct 19, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Taking over this one. I’m keeping this focused on painting the landing draft from cached state, then reconciling workspace/model defaults before submission. I’ll rebuild this layer against current main, preserve author credit, and verify provider submission before publishing a focused replacement.

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks @maria-rcks — opening the landing draft from cached state is the right improvement, and your pending-defaults approach identified the important submission boundary.

I rebuilt this against current main as #21479, a single focused layer, because this PR depends on the older performance stack. You are credited in the body and as co-author.

I compared the complete original diff with the replacement. Cached landing painting, persisted pending defaults, deferred workspace/model reconciliation, and the submission guard are retained. The config-before-project stall is fixed with project-aware retry. Explicit workspace/model choices survive delayed reads; automatic branch discovery still applies defaults. Synchronous New Thread reuse clears an older pending phase. The broader bootstrap-gate change is intentionally left to #20183; no reconnect-read work from #11646 is included.

The replacement has 173 passing focused tests, scoped typecheck/lint, three independent review rounds (both final reviews clear), and Linux web before/after recordings plus actual provider submission proof in its body. Native clients and remote/tunnel connections were not exercised. CI and configured review follow-up continue on the replacement; nothing has been merged. Closing this original as superseded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Opt PRs made by unvouched contributors in for Macroscope review. Vouched contributors auto-reviews size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants