Skip to content

fix(mobile): hide worktrees outside git repos - #8289

Closed
jesse-merhi wants to merge 1 commit into
pingdotgg:mainfrom
jesse-merhi:t3code/prevent-nonrepo-worktrees
Closed

jesse-merhi wants to merge 1 commit into
pingdotgg:mainfrom
jesse-merhi:t3code/prevent-nonrepo-worktrees

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Aug 26, 2026 •

Copy link
Copy Markdown

The mobile new-task composer offered worktree and branch controls for folders that were not Git repositories. This PR uses the existing VCS status stream and hides those controls when the selected folder is not a Git repository.

Confirmed non-Git folders are normalized to the current checkout with no branch or worktree metadata.

Change breakdown

Part Files +LOC -LOC
Mobile implementation 3 +57 -22
Focused tests 1 +12 -0
Total 4 +69 -22

Proof

Matched iPhone 17 Pro simulator captures use the same non-Git project, backend, light theme, and viewport.

Before: direct base After: PR
Before: a non-Git folder incorrectly shows New worktree and Choose branch After: the same non-Git folder has no worktree or branch controls

How to verify

  1. Add a project whose root is a normal folder without a .git directory.
  2. Open the mobile new-task composer for that project.
  3. Confirm that worktree and branch controls are absent and the task uses the current checkout.
  4. Open a Git project and confirm the existing checkout, worktree, and branch controls still appear.

Implementation note

This reuses the existing status subscription. It adds no RPCs, contracts, server routes, or compatibility machinery.

Built with gpt-5.6-sol in T3 Code via the Codex harness.


Note

Low Risk
Scoped mobile new-task UI and workspace resolution only; no server or auth changes, with a unit test for the mode guard.

Overview
The mobile new-task composer no longer shows worktree or branch controls when the selected project folder is not a Git repository. Detection reuses the existing vcsEnvironment.status subscription; isGitRepo is exposed on the new-task flow (defaulting to Git while status loads to avoid a flash).

resolveNewTaskWorkspaceMode forces local when isRepo is false, and branch/worktree draft fields are cleared on submit, queue, and workspace changes so non-Git tasks always start as current checkout with no branch or worktree metadata.

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

Note

Hide workspace controls in NewTaskDraftScreen for non-Git repos

  • Adds resolveNewTaskWorkspaceMode to force workspace mode to local when the selected project is not a Git repository
  • NewTaskFlowProvider fetches VCS status, clears branch and worktree selections for non-Git projects, and omits them from queued messages
  • NewTaskDraftScreen only renders workspace controls when isGitRepo is true
  • Risk: NewTaskFlowProvider defaults isGitRepo to true while the VCS status query loads, potentially flashing Git-only UI before it resolves

Macroscope summarized 851bf24.

@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

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: c0770976-d121-44a3-8a72-e6e688136c00

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

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:M 30-99 changed lines (additions + deletions). labels Aug 26, 2026
Comment thread apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). size:XL 500-999 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). size:L 100-499 changed lines (additions + deletions). labels Aug 26, 2026
let gitRepoStatus = taskFlow.isGitStatusKnown ? taskFlow.isGitRepo : null;
if (taskEnvironmentConnected && selectedProject.workspaceRoot !== "" && detectionRequired) {
taskFlow.setSubmitting(true);
const detection = await requestRepositoryDetection(selectedProject);

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.

🟠 High threads/NewTaskDraftScreen.tsx:710

Two rapid Start presses both pass the initial taskFlow.submitting check before requestRepositoryDetection resolves, then both continue into createProjectThread, creating duplicate threads/turns from one draft. Add a synchronous in-flight ref (or equivalent lock) that is set before the await and cleared on every terminal path.

🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/mobile/src/features/threads/NewTaskDraftScreen.tsx around line 710:

Two rapid Start presses both pass the initial `taskFlow.submitting` check before `requestRepositoryDetection` resolves, then both continue into `createProjectThread`, creating duplicate threads/turns from one draft. Add a synchronous in-flight ref (or equivalent lock) that is set before the await and cleared on every terminal path.

Comment thread apps/mobile/src/features/threads/NewTaskDraftScreen.tsx Outdated
Comment thread apps/mobile/src/features/threads/new-task-flow-provider.tsx Outdated
@jesse-merhi
jesse-merhi force-pushed the t3code/prevent-nonrepo-worktrees branch from 045222c to 432f7e8 Compare August 27, 2026 03:22
@github-actions github-actions Bot added size:M 30-99 changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Aug 27, 2026
@jesse-merhi jesse-merhi changed the title fix(mobile): hide worktree mode outside git repos fix(mobile): hide worktrees outside git repos Aug 27, 2026
@jesse-merhi
jesse-merhi force-pushed the t3code/prevent-nonrepo-worktrees branch from 432f7e8 to 851bf24 Compare August 27, 2026 04:27
@jesse-merhi
jesse-merhi marked this pull request as ready for review August 27, 2026 04:33
Copilot AI lite review requested due to automatic review settings August 27, 2026 04:33

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@macroscopeapp

macroscopeapp Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Would Approve

Macroscope's review found this PR approvable — This is a focused mobile bug fix that reuses existing VCS status data to hide Git-only workspace controls and normalize non-repository tasks without schema or server changes. A separate unresolved High-severity finding flags duplicate submissions from rapid Start presses, representing an independent correctness risk that must be addressed.

Not approved because:

  • 1 blocking correctness issue found at or above your repo's Minimum Blocking Severity

Adjust the Minimum Blocking Severity for this repo — including turning it Off — in Settings. You can add or adjust custom eligibility rules. Learn more.

@t3dotgg

t3dotgg commented Aug 28, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-5.6 Sol responding on behalf of Theo

We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.

We selected #7927 for non-Git mobile task creation. It falls back to the current checkout in the send path and rechecks queued tasks, while this branch forces local mode and hides the worktree controls. Hiding the full control is not in #7927, so we are keeping that presentation choice as reference rather than claiming that it landed.

If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.

@t3dotgg t3dotgg closed this Aug 28, 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:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants