Skip to content

fix(android): the sidebar opens threads while New thread is open - #21004

Closed
PixPMusic wants to merge 1 commit into
pingdotgg:mainfrom
PixPMusic:pixpmusic/android-new-thread-sidebar-select
Closed

PixPMusic wants to merge 1 commit into
pingdotgg:mainfrom
PixPMusic:pixpmusic/android-new-thread-sidebar-select

Conversation

@PixPMusic

@PixPMusic PixPMusic commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On an unfolded Android foldable, tapping a thread in the sidebar does nothing while the New thread flow (Choose project or the draft) is open. The rail's Chats/PRs tabs have the same problem: the list switches but the detail pane stays on New thread. Dev builds log The action 'RESET' … was not handled by any navigator.

The sidebar and rail live in the root stack's layout and reset the workspace with navigation.dispatch((state) => CommonActions.reset(…)). From there, a state-callback dispatch goes to the focused navigator. With New thread open, that is the nested NewTaskSheet stack, whose routes are NewTask, NewTaskDraft, and so on. The reset to [Home, Thread] doesn't fit that stack, so it is dropped.

Fix

resetAndroidWorkspace walks up to the root navigator and dispatches the reset with target set to the root state's key. useAndroidWorkspaceSelection (sidebar threads, PR list and PR thread links) and the rail's tab selection use it. Screens on the root stack already dispatched to the root; addressing it by key doesn't change their behavior.

Why this qualifies as a small focused fix

It's one defect, a reset addressed to whichever navigator happens to have focus, fixed at the two places that dispatch it from the root layout. Phone layouts don't show the sidebar or rail next to New thread, so only split view changes.

Verification

On the Android 15 Pixel 9 Pro Fold emulator (unfolded, split view), against an isolated server with the showcase Moonbase fixtures:

  • New thread → Choose project → tap a sidebar thread: before, nothing happens and RESET is unhandled; after, the thread opens.
  • New thread → React → type an unsent draft → tap a sidebar thread: before, the draft stays; after, the thread opens and the draft is kept under Unsent.
  • New thread open → tap PRs on the rail: before, the list switches but the detail stays on Choose project (RESET unhandled); after, the PR detail placeholder shows. Tapping Chats returns to Threads.
  • Ordinary sidebar selection with a thread already open still switches threads.
  • On a physical Pixel 10 Pro Fold (unfolded) running a dev client of main, tapping a sidebar thread with New thread open logged the same unhandled RESET; with this branch loaded, the thread opens.
  • vp run typecheck in apps/mobile passes; vp lint and vp fmt on the changed files are clean.

Before / After

Same emulator, state, and steps: open New thread, pick React, then tap two sidebar threads.

Before After
Before: after tapping a sidebar thread the New thread draft stays open and the dev toast reports an unhandled RESET After: tapping a sidebar thread opens it while the unsent draft stays in the list
before video after video

Model: Claude Opus 5.5 | Harness: Claude Code in T3 Code

The sidebar and navigation rail reset the workspace stack with a
state-callback dispatch from the root layout. That dispatch goes to the
focused navigator, so with the New thread flow open the reset reached
its nested stack, which has no Home or Thread route, and was dropped.
Address the root stack by its key instead.
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Oct 17, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at aff98d6

Macroscope's review found this PR approvable — This is a narrowly scoped Android navigation bug fix that changes reset targeting only when a nested New thread flow has focus, while preserving the existing workspace route calculation. No product defaults, static-analysis suppressions, sensitive packages, schema changes, or deployment behavior are involved.

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

@coderabbitai

coderabbitai Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 481c3cf9-5ae2-4b28-8d39-d9d0a1df7e09
📥 Commits

Reviewing files that changed from the base of the PR and between 13aa882 and aff98d6.

📒 Files selected for processing: 2
  • apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx
  • apps/mobile/src/features/workspace/useAndroidWorkspaceSelection.ts

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

📝 Walkthrough

Android workspace tab selection and the workspace selection hook now use a shared helper to reset navigation. The helper targets the reset at the root navigator’s state key when that state exists.

Changes: Android workspace reset

Layer / File(s) Summary
Root-targeted reset helper
apps/mobile/src/features/workspace/useAndroidWorkspaceSelection.ts
Adds resetAndroidWorkspace, which walks to the root navigator and targets the reset action at its state key when the root has state.
Workspace selection reset callers
apps/mobile/src/features/workspace/AndroidWorkspaceNavigation.android.tsx, apps/mobile/src/features/workspace/useAndroidWorkspaceSelection.ts
Both tab-selection paths delegate reset actions to the helper and pass callbacks that build the workspace navigation state.

Priority: ➖ Normal

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

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to aff98

No actionable navigation risk remains; the change is ready to merge after normal checks.

Security architecture risk: 🔵 Low · up to aff98

The change is confined to Android navigation and preserves existing destinations and draft ownership. No security regression was established, but dismissal of nested flows during submission or branch preparation is not fully verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated change in authority is within the current application's navigator hierarchy: existing workspace selections can now reset the root and remove nested routes. The inspected helper does not itself grant service privileges or change resource identifiers.

Trust Boundaries and Controls

  • observed — The inspected request-review caller checks command permission, open PR state, capability, and viewer permission before invoking Android workspace selection. Moving reset targeting does not remove those caller checks; this observation does not establish authorization coverage for every destination.

Resilience and Maintainability Implications

  • observed — Draft screens register removal guards during submission, incoming-share transfer, and branch preparation. Whether ancestor-targeted resets honor those nested guards remains unverified. Draft persistence also uses a debounced serialized write with retry tracking; immediate process-interruption durability was not established.
Pre-merge checks: Passed 4
Check name Status Explanation
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.
Title check Passed The title clearly and concisely describes the Android sidebar behavior fixed by the pull request.
Description check Passed The description covers the problem, fix, focused scope justification, detailed verification results, before-and-after evidence, and agent attribution.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@t3dotgg

t3dotgg commented Oct 18, 2026

Copy link
Copy Markdown
Member

Note

🤖 Claude Opus 5.5 responding on behalf of Theo

Closing: #21071 shipped the same fix. resetAndroidWorkspace walks up to the root navigator and dispatches the reset with target set to the root key. That covers New thread and Settings.

#21071 also fixes one more case. When the caller is the navigation container, its getState() stays undefined until the first navigation action, so sidebar taps did nothing right after launch. Main now reads getRootState() for that case. #21071 also removed the rail this PR edits. Thanks for tracking this down.

@t3dotgg t3dotgg closed this Oct 18, 2026
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: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