Skip to content

[Bug]: The mobile project picker can start a chat in an archived workspace #38983

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/mobile

Steps to reproduce

  1. Install the iOS app built from main and open it.
  2. Connect two environments, name them Mac and Server, and leave both connected.
  3. On Mac, put two folders on disk: a Git checkout of one repository, and a second folder that is a different project.
  4. On Server, put a second checkout of that same repository, with the same Git remote as the checkout on Mac.
  5. Tap New chat. On Choose project, tap Add project, choose Mac, tap Local folder, and add the shared checkout.
  6. Add the other folder on Mac the same way, and add Server's checkout of the shared repository the same way, choosing Server.
  7. Open Settings, tap General, and under Project grouping tap Keep separate.
  8. Open Settings, tap Projects, open the filter, and under environments turn off Server so only Mac remains.
  9. In that same filter, under projects, choose the shared repository.
  10. Under Organize, tap Archive project.
  11. Open the filter again, tap All connected environments, then open Settings, tap General, and under Project grouping tap Group by repository.
  12. On the thread list, tap Filter threads by project and choose the project that exists only on Mac.
  13. Tap New chat.
  14. On the new-thread screen, tap the project name in What should we build in.
  15. On Choose project, tap the shared repository, the row whose subtitle says 2 workspaces.
  16. Read the line under the project name that begins with on.

Expected behavior

That line says on Server, the machine whose copy of the repository is still open.

Actual behavior

That line says on Mac, the machine whose copy of the repository was archived.

Archived Mac checkout

Shared in the project picker

Environment on New thread

Impact

Minor bug or occasional failure. Mobile users with a partly archived repository group can start a chat in an archived checkout whenever the draft prefers that checkout's machine.

Version or commit

main at 8cf97b5f06. The cause is at apps/mobile/src/features/threads/new-task-project-selection.ts:26.

Environment

iPhone 18 Pro, iOS 27.0.

Logs or stack traces

expected 'archived-copy' to be 'open-copy'
Automated repro

Fails in 2 of 2 runs on main: apply the patch with git apply, then run the command.

diff --git a/apps/mobile/src/features/threads/new-task-project-selection.test.ts b/apps/mobile/src/features/threads/new-task-project-selection.test.ts
index 82533a3c91..25246fcd06 100644
--- a/apps/mobile/src/features/threads/new-task-project-selection.test.ts
+++ b/apps/mobile/src/features/threads/new-task-project-selection.test.ts
@@ -2,7 +2,7 @@ import { EnvironmentId, ProjectId } from "@t3tools/contracts";
 import { describe, expect, it } from "vite-plus/test";
 
 import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell";
-import type { HomeProjectScope } from "../home/homeThreadList";
+import { buildHomeProjectScopes, type HomeProjectScope } from "../home/homeThreadList";
 import {
   getProjectScopeSelectionTarget,
   isSameRepository,
@@ -60,6 +60,29 @@ function makeScope(projects: ReadonlyArray<EnvironmentProject>): HomeProjectScop
 }
 
 describe("getProjectScopeSelectionTarget", () => {
+  it("chooses an open copy of a repository over an archived copy on the preferred machine", () => {
+    const repo = { repositoryKey: "github.com/t3tools/t3code" };
+    const archived = {
+      ...makeProject("archived-copy", "mac", repo),
+      archivedAt: "2026-07-02T00:00:00.000Z",
+    };
+    const open = makeProject("open-copy", "server", repo);
+    const [scope] = buildHomeProjectScopes({
+      projects: [archived, open],
+      environmentId: null,
+      projectGroupingMode: "repository",
+    });
+    if (!scope || scope.archived) throw new Error("Expected a pickable repository group");
+
+    expect(
+      getProjectScopeSelectionTarget(
+        scope,
+        archived.environmentId,
+        new Set([archived.environmentId, open.environmentId]),
+      ).id,
+    ).toBe(open.id);
+  });
+
   it("prefers a connected copy of a project that spans environments", () => {
     const mac = makeProject("t3code", "mac");
     const server = makeProject("t3code", "server");
cd apps/mobile && pnpm exec vp test run src/features/threads/new-task-project-selection.test.ts

Workaround

No response

Activity

  1. added
    vouch:trusted
    on Nov 19, 2026
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

    vouch:trusted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions