Skip to content

Add environment-first new task flow on mobile#4447

Open
colonelpanic8 wants to merge 4 commits into
pingdotgg:mainfrom
colonelpanic8:feat/mobile-environment-first-new-thread
Open

Add environment-first new task flow on mobile#4447
colonelpanic8 wants to merge 4 commits into
pingdotgg:mainfrom
colonelpanic8:feat/mobile-environment-first-new-thread

Conversation

@colonelpanic8

@colonelpanic8 colonelpanic8 commented Jul 24, 2026

Copy link
Copy Markdown

What Changed

  • Split the mobile new-task picker into environment and project stages.
  • Scope logical project grouping to the selected environment so a newer project on another machine cannot replace the intended target.
  • Preserve incoming-share continuation and add project flows across the new navigation stage.
  • Add focused picker tests for environment scoping, project counts, and empty environments.

Why

This brings the mobile new-task flow in line with #4426: users explicitly choose where a task will run before choosing the project.

UI Changes

All shots: Android emulator (Pixel 6, API 35), light theme, same device and seeded environments for every image.

Environment-first new task flow (new behavior)

Step 1 — choose the environment:

Choose an environment

Step 2 — choose a project, scoped to that environment:

Choose a project

Empty-state call to action when the selected environment is not ready

Same state in both images: an environment was already chosen from step 1, and its project list has not arrived yet.

Before — the picker offered "Add environment", pushing the user toward creating another connection instead of working with the one they had just selected:

Before: Add environment call to action while the selected environment is still connecting

After — no call to action while the selected environment is loading or unavailable; the back chevron to the environment picker is still the escape hatch:

After: no call to action while the selected environment is still connecting

Verification

  • vp test run apps/mobile/src/features/threads/newTaskPicker.test.ts (2 tests)
  • vp run --filter @t3tools/mobile typecheck
  • vp run lint:mobile (native linters unavailable on Linux; generated native projects skipped)
  • vp check (zero errors; existing web warnings only)
  • vp run typecheck
  • Android emulator: verified environment → scoped project navigation across two connected environments, plus back navigation between stages.
  • Android emulator (Pixel 6, API 35, Expo dev client from this branch): re-verified the environment → scoped project navigation and captured the before/after empty-state call to action above.

Note

Medium Risk
Changes core navigation and deep-link paths for new tasks and share continuation; logic is covered by unit tests but multi-environment UX regressions are possible.

Overview
Mobile new-task creation is now environment → project → draft, instead of picking a project across all environments in one list.

The NewTask sheet route opens a new Choose environment screen that lists only environments with at least one logical project (with counts). Project selection moves to NewTaskProject with a required environmentId (deep link: new/projects/:environmentId).

Project lists are scoped to the chosen environment via shared newTaskPicker helpers, so duplicate repos on different machines no longer collapse into a single misleading choice.

Empty states and CTAs are environment-aware: the project step uses per-environment shell/connection state (useEnvironmentShellState), surfaces shell sync failures instead of spinning forever, and drops “Add environment” while a specific environment is selected, loading, or unavailable.

Incoming share and add project flows pass environmentId through navigation; draft fallback returns to NewTaskProject when the initial project is missing. Reserved share destinations still auto-skip to draft.

Reviewed by Cursor Bugbot for commit 7013878. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add environment-first new task flow on mobile

  • Introduces a new environment picker screen (NewTaskEnvironmentRouteScreen) as the first step when creating a task, listing only environments that have projects, with project counts.
  • Scopes the project picker (NewTaskRouteScreen) to the selected environment, with environment-aware empty states and header subtitles.
  • Adds utility functions in newTaskPicker.ts to build environment/project list items and derive empty states and CTAs based on shell status.
  • Incoming shares that have a reserved destination project auto-navigate past the environment picker directly to drafting.
  • Behavioral Change: the NewTask route now renders the environment picker; project selection moves to a new NewTaskProject sub-route with an environmentId param, which affects deep-link patterns.

Macroscope summarized 7013878.

@coderabbitai

coderabbitai Bot commented Jul 24, 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: 709e2fca-7573-4c2e-9d35-2639fbb91b9f

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Jul 24, 2026
@colonelpanic8
colonelpanic8 force-pushed the feat/mobile-environment-first-new-thread branch from 2d96724 to 355a74a Compare July 24, 2026 11:27
Comment thread apps/mobile/src/features/threads/NewTaskRouteScreen.tsx Outdated
Comment thread apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
Comment thread apps/mobile/src/features/threads/NewTaskRouteScreen.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found. New feature introducing an environment-first task creation flow on mobile with new screens, navigation changes, and business logic. Multiple unresolved comments identify potential bugs in loading states and navigation stack handling.

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

@colonelpanic8
colonelpanic8 force-pushed the feat/mobile-environment-first-new-thread branch from 355a74a to 06d4dbd Compare July 24, 2026 17:00
Comment thread apps/mobile/src/Stack.tsx
Comment thread apps/mobile/src/features/threads/newTaskPicker.ts
Comment thread apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
@colonelpanic8
colonelpanic8 force-pushed the feat/mobile-environment-first-new-thread branch from 61fee70 to 0bad292 Compare July 25, 2026 02:19
};
}

return {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium threads/newTaskPicker.ts:155

deriveNewTaskPickerEmptyState shows "No projects found" while projects are still loading. When an environment is already connected and its first shell snapshot is synchronizing, hasLoadedShellSnapshot is false but hasConnectingEnvironment is also false, so none of the earlier branches match and the function falls through to the "No projects found" fallback. The picker presents an empty catalog and offers "Add new project" until the snapshot arrives.

The same fallback is reached when all connections stay healthy but the shell subscription fails before producing any snapshot. catalogState.shellSnapshotError is never checked, so users are told the catalog is genuinely empty instead of seeing the load failure.

Consider checking hasPendingShellSnapshot to show a loading state, and checking shellSnapshotError before falling through to "No projects found".

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/mobile/src/features/threads/newTaskPicker.ts around line 155:

`deriveNewTaskPickerEmptyState` shows "No projects found" while projects are still loading. When an environment is already connected and its first shell snapshot is synchronizing, `hasLoadedShellSnapshot` is `false` but `hasConnectingEnvironment` is also `false`, so none of the earlier branches match and the function falls through to the "No projects found" fallback. The picker presents an empty catalog and offers "Add new project" until the snapshot arrives.

The same fallback is reached when all connections stay healthy but the shell subscription fails before producing any snapshot. `catalogState.shellSnapshotError` is never checked, so users are told the catalog is genuinely empty instead of seeing the load failure.

Consider checking `hasPendingShellSnapshot` to show a loading state, and checking `shellSnapshotError` before falling through to "No projects found".

environmentId,
incomingShareId: props.incomingShareId,
})
: StackActions.replace("NewTask", { incomingShareId: props.incomingShareId }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Draft fallback duplicates project screen

Medium Severity

When the draft screen falls back to NewTaskProject, StackActions.replace can leave a duplicate NewTaskProject route on the stack if one already existed. This causes back navigation to return to a stale project picker instead of the environment stage.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0bad292. Configure here.

Add new project
</Text>
</Pressable>
)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading empty state still shows CTAs

Medium Severity

The new environment empty state shows "Add environment" or "Add new project" buttons while emptyState.loading is true. This contradicts the loading messages and could prompt users to add items prematurely.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0bad292. Configure here.

colonelpanic8 and others added 4 commits July 24, 2026 20:54
An environment connection can stay `connected` while its shell
subscription fails, which left the project picker rendering a spinner
and "Loading projects" with no way to learn why projects never arrive.
Report the shell error before falling through to the loading state, and
keep cached snapshots on the existing empty-catalog message.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…icked

The project picker showed the "Add environment" call to action whenever
the chosen environment was not connected with a shell snapshot, so a
still-loading or unreachable environment pushed users toward creating a
new connection instead of working with the one they just selected.
Derive the empty state action explicitly: no action while loading or
while the selected environment is unavailable, "Add environment" only
when no environment is selected, and "Add new project" once the
selected environment is ready.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@colonelpanic8
colonelpanic8 force-pushed the feat/mobile-environment-first-new-thread branch from 0bad292 to 7013878 Compare July 25, 2026 03:54

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

There are 3 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7013878. Configure here.

title: "No projects found",
detail: "The connected environment did not report any projects.",
loading: false,
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Premature empty environment state

Medium Severity

deriveNewTaskPickerEmptyState only treats connection-phase connecting as loading. Once an environment is connected but its shell is still synchronizing (or failed) with no snapshot, it falls through to “No projects found”. The new environment picker then also always shows an Add CTA, so users can be pushed to add a project while projects are still loading.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7013878. Configure here.

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

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant