镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

perf(web): load thread automations only when shown - #33797

Open
voltcrash wants to merge 1 commit into
pingdotgg:mainfrom
voltcrash:t3/lazy-thread-automations
Open

voltcrash wants to merge 1 commit into
pingdotgg:mainfrom
voltcrash:t3/lazy-thread-automations

Conversation

@voltcrash

Copy link
Copy Markdown
Contributor

Thread details statically import the automations panel, which pulls scheduled-task settings code into the thread route even when Automations is hidden, the details card is closed, or the thread is a draft. This focused performance fix defers that single panel behind its existing render condition. Its query and task controls are unchanged; Suspense preserves the existing empty loading state, and the existing render boundary provides a local error with Reload if chunk loading fails.

Production builds from upstream b48b8ea2 and this patch reduce the thread route's static JS closure by 102,959 raw bytes / 33,169 gzip bytes. ThreadAutomationsPanel, ScheduledTasksSettings, and settings layout leave the closure. Calendar remains eager through other paths. A visible full-density automations panel immediately loads the new chunk, so this is deferred transfer, not a claim that every session transfers less data. Build manifests, module list, and reproducible measurement.

Validation: both production builds succeeded; the existing automations permissions, details-card browser, and chunk-reload tests passed (3 files, 14 tests); vp run check:changed passed.

The primary agent checked the built web client against isolated synthetic state with Replay (dev): on a cold full-density thread with Automations hidden, the baseline requested the scheduled-task settings/layout chunks; this patch requested none of the panel/settings/layout chunks. Revealing Automations fetched all three and displayed a bound task. Resume, Pause, Run now (completed Replay turn), Edit, and Manage worked. An injected HTTP 503 for the panel chunk produced the local error/Reload state while chat and composer stayed usable; removing the failure and clicking Reload recovered. Runtime transcript · task controls recording.

Before: Automations hidden After: Automations hidden
Before, hidden automations After, hidden automations

Panel after reveal · Chunk failure fallback.

Limits: compact/essential/draft gates were inspected in source, not separately runtime-tested. Desktop shares this web UI but was not separately exercised; mobile has separate UI and is unchanged. Measurements/captures use b48b8ea2 and d98c7eda; the final rebase only added unrelated server-side Claude fixes and left this behavior diff unchanged.

This is submitted under CONTRIBUTING's very small focused obvious-fix exception: it removes one unnecessary eager dependency without adding a feature or changing product defaults. Related work: #18594 extracts schedule labels and defers the whole details card but does not split this panel; #16042 and #21779 cover other optional panels. This PR does not include those changes.

Reviewed with review-loop: 1 round with Claude Opus 5.5. Reviewer verdict: approved.

Created with GPT-6.1 Sol (extra-high reasoning) in Codex through T3 Code.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 10, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 5bed48e

Macroscope's review found this PR approvable — The automations panel now loads only when its existing visibility conditions are met, with a local error message and reload control if loading fails. Automation behavior, permissions, and product defaults remain unchanged.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

ThreadDetailsPanel now loads ThreadAutomationsPanel on demand. It renders no fallback while the panel loads. If rendering fails, it shows an alert and a Reload control that reloads the page. The existing visibility conditions remain unchanged.

Changes: Thread automations loading

Layer / File(s) Summary
Lazy loading and error handling
apps/web/src/components/chat/ThreadDetailsPanel.tsx
ThreadDetailsPanel dynamically imports ThreadAutomationsPanel and wraps it in suspense and error boundaries. Loading renders no fallback. Render errors show an alert and a Reload control.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related issues

  • pingdotgg/t3code#29304: The issue describes failures in chunks loaded after startup. This change adds a reload action for failures in the automations panel, but the available evidence does not show that it prevents the issue’s reload-loop behavior.

Suggested reviewers: t3dotgg, macroscopeapp

Merge Risk: Low · up to 5bed4

Automations could remain on the error screen after switching threads, but the inspected paths do not establish a recoverable case. This is a bounded risk for merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: defer loading the thread automations panel until it is shown.
Description check Passed The description explains the problem and change, gives the focused-scope rationale, and reports build, test, runtime, and UI verification results. It does not use the template’s section headings, but …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem and change, gives the focused-scope rationale, and reports build, test, runtime, and UI verification results. It does not use the template’s section headings, but it includes the required information and is mostly complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@coderabbitai coderabbitai 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.

Additional comments: 1

apps/web/src/components/chat/ThreadDetailsPanel.tsx-250-250: 1

250-250: Minor · Stability & Availability · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Reset the error boundary when the thread changes.

If the automations panel throws, RenderErrorBoundary keeps its failed state until its resetKeys change. Server-thread navigation reuses ChatView, so the next thread can show the error instead of its automations. Pass resetKeys={[props.environmentId, props.threadId]} to the boundary. (raw.githubusercontent.com)

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bcee0f5 and 5bed48e.

Files selected for processing: 1

  • apps/web/src/components/chat/ThreadDetailsPanel.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

This branch has not been deployed

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant