Skip to content

fix(web): preserve closed plan panel state - #5536

Open
Zeko369 wants to merge 1 commit into
pingdotgg:mainfrom
Zeko369:t3code/preserve-closed-plan-state
Open

fix(web): preserve closed plan panel state#5536
Zeko369 wants to merge 1 commit into
pingdotgg:mainfrom
Zeko369:t3code/preserve-closed-plan-state

Conversation

@Zeko369

@Zeko369 Zeko369 commented Aug 6, 2026

Copy link
Copy Markdown

Problem

Reopening a thread could auto-open its Plan or Tasks panel even when the user had previously closed it. Existing steps loaded during thread restoration were treated like newly arrived plan updates, overriding the thread's persisted right-panel state.

This made returning to plan-bearing threads disruptive, especially while a turn was still running and continuing to publish task status updates.

Root cause

The auto-open effect only compared the active plan's turn with the latest turn. On navigation or hydration, the restored plan still belonged to that latest turn, so the effect could not distinguish an existing snapshot from a new update.

Fix

  • Track plan snapshots by their source activity ID.
  • Establish a restoration baseline after thread detail finishes loading.
  • Preserve an open right panel or a previously closed Plan surface when entering a thread.
  • Seed the existing per-thread dismissal tracker when restoring a closed Plan surface, so later updates from the same running turn do not reopen it.
  • Keep first visits eligible for automatic opening when the setting is enabled.
  • Keep carried-over tasks and manually dismissed turns closed.
  • Only consume the "Implement in a new thread" open intent once the target thread exists.

The same logic covers both Plan and Tasks because they share the plan right-panel surface.

Testing

  • pnpm exec vp test run apps/web/src/components/ChatView.logic.test.ts apps/web/src/session-logic.test.ts apps/web/src/rightPanelStore.test.ts — 142 tests passed
  • pnpm --filter @t3tools/web typecheck
  • Targeted vp lint for the five changed files
  • Targeted vp fmt --check for the five changed files
  • git diff --check origin/main...HEAD

Browser QA was not run. The behavior is covered by focused state-transition tests.

Reviewed with Claude Opus via claude -p.

Implemented with GPT-5.6 Codex via T3 Code.

Note

Preserve closed plan panel state across thread activation and restoration

  • Introduces resolvePlanSidebarAutoOpen, resolvePlanSidebarRestoration, and resolvePlanSidebarTurnKey utilities in ChatView.logic.ts to centralize plan sidebar open/close decisions.
  • The plan sidebar now tracks a per-thread activation baseline so it only auto-opens for plan updates that arrive after the thread is activated, not for pre-existing plans.
  • A previously closed panel on the plan surface is preserved on thread restoration; dismissal is seeded for that turn so the panel does not re-open.
  • ActivePlanState in session-logic.ts gains an updateId field, used to detect whether a plan update is new since the last observed baseline.
  • Behavioral Change: the sidebar now returns 'wait' during thread-detail loading, 'preserve' when restoring prior state, and 'none' in cases such as dismissed turns or stale plans, replacing the previous unconditional open behavior.

Macroscope summarized 87ead15.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a13d90ec-58ba-4cca-8864-c14e01b4bd21

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the size:L 100-499 changed lines (additions + deletions). label Aug 6, 2026
@Zeko369
Zeko369 marked this pull request as ready for review August 6, 2026 15:59
@Zeko369

Zeko369 commented Aug 6, 2026

Copy link
Copy Markdown
Author

If I delete tests it's an XS 😅

@macroscopeapp

macroscopeapp Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 87ead15

This is a well-structured UI bug fix that extracts sidebar auto-open logic into pure, testable functions with comprehensive unit tests. The change is self-contained to plan panel state management with no broader runtime or security implications.

You can customize Macroscope's approvability policy. Learn more.

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

Labels

size:L 100-499 changed lines (additions + deletions).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant