Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Summary

Two issues addressed:

1. Trunk branch warning was confusing on local workspaces

Local runtime doesn't use trunk branch at all (it works directly in the project directory). The trunk branch selector was already hidden for local runtime, but the backend still required a trunk branch value - this led to confusing validation errors.

Fix: Made trunkBranch optional in the API. Backend now only validates trunk branch for worktree/SSH runtimes that actually need it.

2. Git repo requirement was unnecessary

Users should be able to add any directory as a project, even if it's not a git repository. Non-git directories are perfectly valid for local runtime which just runs Claude in the directory.

Fix:

  • Removed git repository validation from validateProjectPath
  • Added isGitRepository helper to check git status separately
  • listBranches returns empty array (not error) for non-git repos
  • Runtime selector disables worktree/SSH with tooltip "Requires git repository"
  • UI auto-selects local runtime for non-git directories

Changes

File Change
src/common/orpc/schemas/api.ts Make trunkBranch optional
src/common/orpc/schemas/message.ts recommendedTrunk nullable
src/node/utils/pathUtils.ts Remove git requirement, add isGitRepository helper
src/node/services/projectService.ts Return empty branches for non-git
src/node/services/workspaceService.ts Trunk branch validation only for worktree/SSH
src/browser/components/RuntimeIconSelector.tsx New disabledModes prop with tooltip
src/browser/components/ChatInput/CreationControls.tsx Force local runtime for non-git

Testing

  • Updated pathUtils.test.ts - validates non-git directories pass
  • Updated projectCreate.test.ts - validates non-git projects work with local runtime
  • All existing tests continue to pass

Generated with mux

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@ammar-agent ammar-agent force-pushed the git-warning-clarify-y7ee branch from b65aaa9 to e9b8042 Compare December 10, 2025 16:08
**Two issues addressed:**

1. **Trunk branch warning was confusing on local workspaces**
   - Local runtime doesn't use trunk branch at all
   - Now trunkBranch is optional in workspace.create API
   - Backend validates trunk branch only for worktree/SSH runtimes
   - UI hides trunk branch selector for local runtime (already was)

2. **Git repo requirement was unnecessary**
   - Projects can now be non-git directories
   - Non-git repos are restricted to local runtime only
   - listBranches returns empty array for non-git repos
   - Runtime selector disables worktree/SSH with tooltip 'Requires git repository'

**Changes:**
- src/common/orpc/schemas/api.ts: make trunkBranch optional
- src/common/orpc/schemas/message.ts: recommendedTrunk nullable
- src/node/utils/pathUtils.ts: validateProjectPath no longer requires .git, new isGitRepository helper
- src/node/services/projectService.ts: listBranches returns empty for non-git
- src/node/services/workspaceService.ts: trunk branch validation only for worktree/SSH
- src/browser/components/RuntimeIconSelector.tsx: new disabledModes prop with tooltip
- src/browser/components/ChatInput/CreationControls.tsx: force local runtime for non-git repos

_Generated with mux_
Fixes issue where git projects would incorrectly get local runtime selected
on first render because branches start as empty while listBranches is loading.

Added branchesLoaded flag to track when the API call completes, and only
force local runtime after branches have actually loaded (when branches is
still empty at that point, it's a genuine non-git directory).
@ammar-agent ammar-agent force-pushed the git-warning-clarify-y7ee branch 2 times, most recently from 6ce64d1 to ce398eb Compare December 10, 2025 16:29
- Local runtime: 'You are working in a directory' (no git mention)
- Worktree/SSH: 'You are in a git worktree' (git context)

This aligns the system prompt with the actual runtime environment.
@ammar-agent ammar-agent force-pushed the git-warning-clarify-y7ee branch from ce398eb to 5646bdf Compare December 10, 2025 16:33
@ammario ammario merged commit 81bd27c into main Dec 10, 2025
33 of 35 checks passed
@ammario ammario deleted the git-warning-clarify-y7ee branch December 10, 2025 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants