Skip to content

feat(autoresearch): improve experimental task switching#3551

Open
MattPua wants to merge 4 commits into
mainfrom
posthog-code/autoresearch-task-switch-latency
Open

feat(autoresearch): improve experimental task switching#3551
MattPua wants to merge 4 commits into
mainfrom
posthog-code/autoresearch-task-switch-latency

Conversation

@MattPua

@MattPua MattPua commented Jul 17, 2026

Copy link
Copy Markdown
Member

Problem

Switching between tasks in the experimental thread view can block the UI for more than a second, especially for tasks with long histories.

Created with Autoresearch.

Changes

  • Preserve TaskDetail across route parameter changes instead of remounting the full tree.
  • Lazily mount inactive panel tabs, then retain them within the current task.
  • Scope mounted tabs, title editing, and session error state to the active task.
  • Add regression tests for task-scoped tab mounting and channel title editing.

Performance

Lower is better. Each point is the steady-state median task-switch latency measured during its autoresearch iteration.

xychart-beta
    title "Task switch latency by iteration"
    x-axis "Iteration" [1, 2, 3, 4, 5, 6]
    y-axis "Median latency (ms)" 0 --> 1600
    line [1552, 872, 598, 611, 716, 792]
Loading
Iteration Median Change
1 1552 ms Baseline benchmark
2 872 ms Preserve TaskDetail
3 598 ms Lazily mount inactive tabs
4 611 ms Activity cache experiment, reverted
5 716 ms Legacy renderer fallback, reverted
6 792 ms Restored proven path and added QA fixes

Why this is useful

  • The best measured iteration cuts median latency by 61% versus baseline.
  • The iteration history separates proven wins from reverted regressions.
  • Task-scoped state prevents the performance optimization from leaking tabs, title edits, or errors between tasks.
  • Profiling points to rendered thread length as the main cost in the tested tasks. Cloud versus local still needs a controlled comparison with matched history sizes and panel layouts.

How did you test this?

  • pnpm exec biome check on changed files.
  • 136 focused UI tests across 12 files.
  • Repository pre-commit hook, including full pnpm typecheck.
  • git diff --check.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

Generated-By: PostHog Code
Task-Id: 76febe11-f045-4047-bcdf-3a626a174ce8
@trunk-io

trunk-io Bot commented Jul 17, 2026

Copy link
Copy Markdown

✨ Submitted to Merge by @MattPua. It will be added to the merge queue once all branch protection rules pass, there are no merge conflicts with the target branch, and impacted targets for the current PR head commit have been uploaded. See more details here.

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

React Doctor found 4 issues in 2 files · 4 warnings.

4 warnings

src/features/panels/components/TabbedPanel.tsx

src/features/task-detail/components/TaskDetail.tsx

Reviewed by React Doctor for commit efc78d7.

Generated-By: PostHog Code
Task-Id: 76febe11-f045-4047-bcdf-3a626a174ce8
@MattPua
MattPua marked this pull request as ready for review July 17, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants