Skip to content

[Bug]: Mobile New thread from filtered sidebar still starts in open detail thread's project (currentProject overrides filteredProject) #38499

Open

Description

@momominibot

Before submitting

  • I searched existing issues (#29034, #30095, #25622) and verified this specific case is still reproducible on main.
  • I included source-level diagnosis and steps to reproduce.

Area

apps/mobile

Summary

When a thread from Project A is mounted in the detail route (currentRoute?.name === "Thread") and the user filters the thread list / sidebar to Project B and taps New thread, handleStartNewTask + newTaskDestination still prioritize currentProject (Project A) ahead of filteredProject (Project B), starting the new thread in Project A instead of the explicitly filtered Project B.

Steps to reproduce

  1. Connect the mobile app to an environment with at least two projects: project-a and project-b (with Settings -> General -> Use last project enabled, the default).
  2. Open an existing thread in project-a so Thread (project-a) is the active detail route in workspaceRoutesOf(state.routes).
  3. In split view (usesSplitView) or overlay sidebar (variant === "medium" / Android sidebar rail), open the Threads sidebar, select project-b in the project filter chip (selectedProjectKey), and tap New thread (WorkspaceToolbar / AndroidWorkspaceSidebar -> startNewTask).

Expected behavior

Because the user explicitly filtered the thread list to project-b and initiated New thread while the filtered sidebar is visible (or when an explicit single-project filter is active), the new thread opens in project-b (filteredProject), matching the intent of #29034.

Actual behavior

newTaskDestination resolves currentProject (project-a) ahead of filteredProject (project-b), so the composer and resulting creationSource: "mobile" thread start in project-a instead of project-b. If the user pastes a prompt and taps Send without noticing the composer header still says project-a, the run executes in the wrong repository.

Source-level diagnosis (main)

  1. In apps/mobile/src/features/layout/AdaptiveWorkspaceLayout.tsx (handleStartNewTask, lines 593-648), currentRoute is read from workspaceRoutesOf(state?.routes.slice(0, state.index + 1) ?? []).workspace.at(-1) regardless of whether the sidebar/list pane is currently visible or focused, and regardless of whether a single-project filter (filteredScope) is active:
    newTaskDestination({
      projects,
      requestId: uuidv4(),
      useLastProject: saved?.useLastProjectForNewThreads,
      currentProject: environmentId && projectId ? { environmentId, projectId } : undefined,
      filteredProject: filteredScope
        ? newTaskFilteredProject(
            filteredScope,
            listEnvironmentId,
            connectedEnvironmentIds,
            saved?.lastThreadProject,
          )
        : undefined,
      lastProject: saved?.lastThreadProject,
    })
  2. In apps/mobile/src/features/threads/new-task-project-selection.ts (newTaskDestination, lines 185-208):
    const project =
      options.useLastProject === false
        ? undefined
        : (find(options.currentProject) ??
          find(options.filteredProject) ??
          (last?.archivedAt == null ? last : undefined));
    #29034 placed filteredProject ahead of lastProject, which fixed compact single-column navigation after popping back to Home, but whenever Thread (project-a) remains on workspaceRoutes (split layout, overlay sidebar, or sidebar toolbar New thread), find(options.currentProject) wins first and overrides filteredProject.

Suggested fix

  • When starting a new thread from the sidebar/list toolbar (or when the overlay sidebar is open, or whenever an explicit single-project filter filteredProject is active and differs from currentProject), prefer filteredProject over currentProject — or omit currentProject when startNewTask is invoked from the sidebar/list chrome rather than ThreadHeader's onCompose.

Environment

  • Server: T3 Code 0.1.10 (darwin arm64)
  • Client: T3 Code Mobile (creationSource: "mobile")

Activity

  1. juliusmarminge commented on Nov 19, 2026

    @juliusmarminge
    Member

    A fix for this was proposed in #39001, but when the reported steps were run in the real app the problem did not appear.

    What was run on a6d2bed55b, the commit before this change:

    On each commit, confirmed Settings > General > Use last project enabled; opened Alpha thread; selected Bravo in the project filter without closing Alpha detail; tapped the native New task control. Base opened an Alpha draft; head opened Bravo. Cleared the filter, reopened Alpha and repeated: both opened Alpha. Disabled Use last project, reopened Alpha, filtered to Bravo and repeated: both opened Choose project.

    How: Manual native verification on the same pooled iPad Pro 13-inch (M5), iOS 27.2, portrait split view, light theme, 1032x1376 logical viewport. Separate real server and Metro per commit, fresh isolated databases, synthetic Alpha and Bravo projects with completed replay threads seeded through API and CLI. Stills were visually inspected and each pair was pixel-identical more than 500 ms apart. Recordings were inspected using decoded contact sheets and end frames. Device released, servers stopped, disposable worktrees and scratch removed.

    Could you share the exact steps, what you see, and the version and platform you are on? The pull request is closed for now; the fix is picked up again once the problem can be shown.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs more infoInitial triage showed no bug. Awaiting more info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions