GeezerVison is showing github.com — fix(clients): keep a checkout terminal off the thread's worktree by saphid · Pull Request #16039 · pingdotgg/t3code
Conversation
saphid
commented
Oct 5, 2026
•
edited by juliusmarminge
Loading
Uh oh!
There was an error while loading. Please reload this page.
An existing checkout terminal could inherit its thread's later worktree association when reopened. Web and mobile now select the terminal's whole location first, preserving an explicit worktreePath: null; thread defaults apply only when no terminal location exists. Mobile also waits for terminal metadata before retaining its initial location, so metadata arriving after the thread cannot freeze the wrong fallback.
Pending launches retain their location. New and split terminals continue to use the thread default. No server or wire changes.
Maintainer continuation of @saphid's #16039, preserving the contributor commits and merging main normally. The implementation was independently rebuilt around source precedence, with distinct mobile state and shared-subscription regressions found during review.
Verification:
- Contribution tests: four cases replaced by four behavior regressions in three existing files, covering source precedence, mobile retention, and the real shared metadata subscription. Web/mobile suites run 148 → 147 cases, and the shared runtime suite grows 40 → 41; all seven relevant suites pass, 236/236. Negative controls fail for checkout-null fallback, selecting a mobile location before metadata arrives, and exposing the synthetic metadata seed. Shared metadata regression: fixed run · seed-exposing negative control.
- Web, mobile, and client-runtime typechecks pass. Scoped lint and formatting pass, with existing warnings.
- Three independent full-PR review rounds by Claude Opus 5.5 and GPT-6 Sol: round one identified mobile metadata ordering; round two found the shared stream exposed a synthetic empty list before the server snapshot. The fix skips that seed while preserving real empty snapshots and reconnect behavior. Round three found no code blockers in either full-PR review.
- Real isolated web app and PTY: created a checkout terminal, then associated its thread with a separate Git worktree. Compared exact pinned-main panel source against the rebuilt web source, with the same session metadata and viewport. Replayed
terminal.restart through the app command using the actual panel's rendered location, then printed the shell cwd and worktree environment. Main supplied the thread worktree; the fix preserved checkout identity. This was an API-level recovery replay, not a test of a UI restart control or natural server recovery. The panel source and post-snapshot behavior are unchanged by the later mobile and shared-readiness repairs. A fresh final-head app pass remained on its splash screen after restart; the new readiness and reconnect behavior is proven by the production-atom test, not an additional UI capture.
Before — checkout terminal incorrectly carries the thread worktree:

After — checkout terminal retains worktreePath: null:

Web recovery replay output and method.
Mobile location selection and retention were verified through focused logic and React state tests. Native attach/reopen and the loading/error UI were not exercised in an integrated app. macOS, Windows, iOS, Android, Electron desktop, and remote/relay/tunnel runtime behavior were not exercised on this headless Linux host. Current-head CI passes and Macroscope approved this exact head; there are no unresolved review threads. The first web run failed a syntax-highlighting wait in an unchanged WorkflowOpeningBlock test; the failed-job rerun passed.
Implementation: GPT-6.1 Sol / Codex. Tests: GPT-6 Astra / Codex. Adversarial reviews: Claude Opus 5.5 / Claude Code and GPT-6 Sol / Codex, orchestrated through T3 Code.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
macroscopeapp
Bot
commented
Oct 5, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Approved at ea3ecc3
Macroscope's review found this PR approvable — This is a focused terminal-location bug fix that preserves explicit checkout identity across web and mobile and avoids freezing a fallback before server metadata arrives. The accompanying regressions cover precedence, mobile retention, and real empty metadata snapshots without changing schemas or wire behavior.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Oct 5, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
985a3cc7-dd7e-4d4c-88aa-515558fee749
📥 Commits
-
Reviewing files that changed from the base of the PR and between 7812230 and c568d169dee2bb6b74bfffe640661e6278abca76.
📒 Files selected for processing (23)
-
apps/web/src/components/ChatView.tsx
apps/web/src/components/RightPanelTabs.browserProfile.test.tsx
apps/web/src/components/RightPanelTabs.terminal.test.tsx
apps/web/src/components/RightPanelTabs.test.tsx
apps/web/src/components/RightPanelTabs.tsx
apps/web/src/components/diffs/DiffFileLoadingBoundary.tsx
apps/web/src/components/diffs/DiffLoadingState.tsx
apps/web/src/components/preview/PreviewPanel.tsx
apps/web/src/components/pullRequest/PullRequestCodeTab.tsx
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
apps/web/src/panels/bundledPanels.test.tsx
apps/web/src/panels/bundledPanels.tsx
apps/web/src/panels/diff/DiffSidePanel.tsx
apps/web/src/panels/panelHost.ts
apps/web/src/panels/panelRegistry.test.tsx
apps/web/src/panels/panelRegistry.ts
apps/web/src/panels/preview/PreviewSidePanel.test.tsx
apps/web/src/panels/preview/PreviewSidePanel.tsx
apps/web/src/panels/terminal/PersistentThreadTerminalDrawer.tsx
apps/web/src/panels/terminal/TerminalSidePanel.attach.test.tsx
apps/web/src/panels/terminal/TerminalSidePanel.test.tsx
apps/web/src/panels/terminal/TerminalSidePanel.tsx
apps/web/src/routes/_chat.pull-requests.tsx
💤 Files with no reviewable changes (1)
-
- apps/web/src/components/preview/PreviewPanel.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
📝 Walkthrough
-
The change adds a typed registry for lazy-loaded side panels. ChatView hosts the Preview, Diff, and Terminal panels through shared context, and RightPanelTabs uses panel metadata and launcher configurations to display and open them.
Changes: Registered side panels
| Layer / File(s) |
Summary |
Panel registry and host contracts apps/web/src/panels/panelRegistry.ts, apps/web/src/panels/panelHost.ts, apps/web/src/panels/bundledPanels.tsx, apps/web/src/panels/*test.tsx |
Adds typed panel definitions, lazy loading, metadata lookup, and shared host context. Tests cover loading behavior, component identity, mounting, and panel-specific prop types. |
Preview and Diff panel bodies apps/web/src/panels/preview/*, apps/web/src/panels/diff/DiffSidePanel.tsx, apps/web/src/components/diffs/*, apps/web/src/components/pullRequest/PullRequestCodeTab.tsx, apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx, apps/web/src/components/preview/PreviewPanel.tsx |
Preview and Diff use the panel host for shared state. Diff loading components and imports move to DiffLoadingState; the previous PreviewPanel and DiffPanelShell implementations are removed. |
Terminal panel and drawer apps/web/src/panels/terminal/*, apps/web/src/components/ChatView.tsx |
Moves terminal panel and drawer behavior into panel modules. TerminalSidePanel resolves thread and launch context; the drawer manages terminal sessions and actions. Tests cover host updates, attachment, and launcher behavior. |
Right-panel launcher actions apps/web/src/components/RightPanelTabs.tsx, apps/web/src/components/RightPanelTabs*.test.tsx |
Builds panel launcher actions from registry metadata and availability. Tests cover action details, Browser profile selection, and Terminal availability and opening. |
ChatView panel hosting and wiring apps/web/src/components/ChatView.tsx, apps/web/src/routes/_chat.pull-requests.tsx |
ChatView provides shared host context and renders registered panels. Inline and sheet launchers receive panel configurations; the pull-request route marks Preview, Diff, and Terminal unavailable. |
Priority: ⬇️ Low
Estimated code review effort: 4 (Complex) | ~60 minutes
Change: Refactor
Sequence Diagram(s)
sequenceDiagram
participant ChatView
participant PanelHostContext
participant RegisteredSidePanel
participant PreviewSidePanel
ChatView->>PanelHostContext: Provides thread and panel state
ChatView->>RegisteredSidePanel: Renders selected panel with panel props
RegisteredSidePanel->>PreviewSidePanel: Loads selected Preview body
PreviewSidePanel->>PanelHostContext: Reads shared host state
Loading
Suggested reviewers: juliusmarminge
Merge Risk: ⚪ Minimal · up to c568d
-
This refactor moves the Preview, Diff, and Terminal panels into a shared registered-panel host. Launcher labels, shortcuts, and availability are unchanged. No concrete regression has been identified, and the change appears ready to merge after normal checks.
Security Architecture Review
-
Security architecture risk: 🔵 Low · up to c568d
The inspected paths preserve existing thread-scoped terminal inputs, annotation callbacks, and availability checks. No introduced security regression was established. Risk remains low rather than minimal because server authorization and some asynchronous recovery behavior remain unverified.
Retained concerns
No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The security-sensitive outcomes remain terminal operations in the selected environment/thread and mutations through the existing composer callbacks. The inspected client wiring does not establish wider exposure; maximum cross-user, environment, or credential exposure depends on server enforcement that was not verified.
Trust Boundaries and Controls
- observed — Shared context makes annotation and composer capabilities accessible to all hosted panel code, rather than only their former direct recipients. The current registry is fixed and bundled: Preview consumes annotation sending, Diff consumes composer/workspace values, and Terminal consumes thread identity and visibility. This is broader internal capability visibility, not evidence of an attacker-controlled extension boundary.
Resilience and Maintainability Implications
- observed — Session-exit handling uses a boolean-gated deferred callback without a captured identity generation. That implementation, and an unkeyed persistent terminal parent, were present at base. The inspection did not establish that hosted rendering introduces or worsens a stale-close failure.
Hardening Proposals
- proposed — As pre-existing lifecycle hardening, bind delayed terminal-exit callbacks to the initiating environment/thread/terminal generation and cancel pending callbacks during teardown. This proposal is not an introduced PR finding.
Pre-merge checks: 2 · 3
-
Failed checks: 3 warnings
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
 |
Docstring coverage is 31.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 45 functions across 22 files. |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
| Title check |
 |
The title describes a checkout terminal worktree fix, but the changes implement a right-panel panel registry and panel-host refactor. The title is unrelated to the primary changes. |
Rename the pull request to describe the panel-host refactor, such as "refactor(web): register right-panel terminal through panel host". |
| Description check |
 |
The description provides detailed verification, but it describes a checkout terminal worktree bug and mobile behavior that are not represented in the supplied changes. It also omits the required Probl… |
Rewrite the description to match the actual changes. Add the required Problem, Change, Scope and approval, and Verification sections. Document the panel-host migration, its scope and approval status, and focused verification results. |
Passed checks: 2 passed
-
| Check name |
Status |
Explanation |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Description check
-
Explanation
The description provides detailed verification, but it describes a checkout terminal worktree bug and mobile behavior that are not represented in the supplied changes. It also omits the required Problem, Change, and Scope and approval headings and does not explain the panel-host refactor.
Resolution
Rewrite the description to match the actual changes. Add the required Problem, Change, Scope and approval, and Verification sections. Document the panel-host migration, its scope and approval status, and focused verification results.
- Fix all pre-merge checks with AI
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Review requested
| Date (UTC) |
Reviewer |
Where |
| 2026-10-06 |
Maria |
Discord DM |
Logged so this PR shows when a maintainer was asked to review it.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Preview becomes the second panel on the side-panel registry that Diff
started. Each definition now also carries the panel's title, icon, launcher
letter, client support and unavailable copy, so the tabs, the empty
launcher and the add menu read one ordered list instead of three
hand-kept ones. Labels, letters, order and copy are unchanged.
Panel props are inferred from each lazily loaded body, and the caller is a
closed union, so another panel's props, unknown ids and widened ids do not
compile. ChatView lends the rendered panel a small host (thread, right
panel visibility, composer draft target, workspace mutation id and the
annotation send) instead of drilling the same props into each body; the
annotation send keeps the per-render closure it had before, and PreviewView
still drops a pick that settles after a thread switch.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
ChatView built a new PanelHost on every render, so every usePanelHost
consumer re-rendered even when no host field changed. Memoize it on its
fields and send annotations through onSendRef so the sender stays stable.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Plain server threads reuse one ChatView, so the memoized panel host's
sender could resolve to the next thread's composer when a pick settled
after a switch. The latest sender now carries its thread key, and each
host forwards only to a sender for its own thread.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
ChatView replaced the panel host's annotation sender while rendering. If
React threw that render away, an in-flight preview pick could still call
its onSend, for example one that edits a queued message instead of sending
a turn. Update the sender in a layout effect so only committed renders
lend it.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
PersistentThreadTerminalPanel, PersistentThreadTerminalDrawer, their two
reconciliation helpers and the terminal launch-context types now live in
apps/web/src/panels/terminal. The moved code is unchanged apart from the
added export keywords; ChatView imports them and its call sites, props,
memo boundaries and callbacks are untouched.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The right-panel terminal is now a registered side panel. Its body reads the
thread and visibility from the panel host and keybindings from the server
keybindings atom, then hands them to the unchanged memoized terminal, so
ChatView renders that leave its inputs alone still skip it. ChatView passes
only the terminal surface, launch context, focus request, callbacks and
shortcut labels. Launcher copy, letter, order and availability are
unchanged; the bottom drawer stays mounted by ChatView.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…tree
A terminal launch context with a null worktree path means the terminal was
launched on the local checkout. The right-panel terminal treated that null as
missing and fell back to the thread's worktree, so a thread that gained a
worktree after the launch gave the drawer a worktree path and runtime env that
did not match its cwd. Use the launch context whenever one exists, as the
persistent drawer already does.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…hread's worktree
A terminal summary's null worktree path means the server opened the terminal
on the project checkout. Without a launch context the right-panel terminal
treated that null as missing and fell back to the thread's worktree, so a
thread that gained a worktree later gave the drawer a checkout cwd with a
worktree path and runtime env. Fall back to the thread's worktree only when
there is neither a launch context nor a summary.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This PR now carries only the checkout-terminal worktree fix. The panel-host
layers it was stacked on (pingdotgg#15010, pingdotgg#16038 and the terminal panel move) wait on
Ideas discussion #14938; the fix does not need them.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s worktree
A null worktree path on a terminal launch context or server summary means
the terminal runs on the project checkout. The right-panel terminal read
both with `??`, so it treated that null as missing and fell back to the
thread's worktree. Once a thread gained a worktree (first worktree-mode
send, or switching the thread onto a worktree), a terminal still running on
the checkout got the worktree as its worktreePath and T3CODE_WORKTREE_PATH,
and the server tracked and re-spawned it with that mismatched context
whenever it reopened the session.
Use the launch context whenever there is one, then the summary, and fall
back to the thread's worktree only when neither exists, as the bottom
drawer already does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The mobile terminal screen resolves its location from the session summary,
where a null worktree path means the terminal runs on the project checkout.
resolveTerminalOpenLocation read that field with `??`, so once the thread
had a worktree it resolved a checkout terminal to the checkout cwd with the
thread's worktree as its worktreePath. Attaching to a running session
ignores the location, but when the server has to open a new session for it,
that session records the wrong worktree and takes its workspace lease on the
worktree instead of the checkout.
Use the session's location whenever there is a session, and fall back to the
thread's worktree only when there is none, matching the web fix.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
saphid
changed the title
refactor(web): open the right-panel terminal through the panel host
fix(clients): keep a checkout terminal off the thread's worktree
Oct 14, 2026
…inal off the thread's worktree
Preserve the scoped contribution against upstream 70d60e0.
Focused checks and read-only integration review recorded in the PR.
GPT-6.1 Sol (high), Codex harness through T3 Code.
This was referenced Oct 17, 2026
|
Taking over this one for batch worktree-git-05. I’ll resolve the main conflict, keep the authoritative checkout location intact on web and mobile, and verify the terminal behavior before publishing here without merging.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Labels
size:L
100-499 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|