fix: use correct working directory for monorepo subpaths#19
Merged
Conversation
When a project has a subpath set (for monorepos), the agent's working directory was incorrectly set to the worktree root instead of the subdirectory within the worktree. Fixed in two places: - Backend (start_branch_session): Look up the project's subpath and join it to the worktree path before passing as working_dir - Frontend (BranchCard → SessionModal): Pass projectSubpath from ProjectSection through BranchCard so that resume_session also uses the correct subpath-adjusted working directory
Store working_dir on the Session model so that resume_session can read it from the database instead of receiving it from the frontend. This consolidates the subpath logic in one place (the backend) and removes the need for the frontend to compute effective working directories. Backend changes: - Add working_dir column to sessions table (schema version 1 → 2) - Add working_dir field to Session struct, accepted in new_running() - start_session and start_branch_session persist working_dir on create - resume_session reads working_dir from the session record Frontend changes: - Remove workingDir param from resumeSession() in commands.ts - Remove workingDir prop from SessionModal - Remove projectSubpath prop and effectiveWorkingDir from BranchCard - Remove projectSubpath pass-through from ProjectSection - Remove workingDir="/tmp" from SessionLauncher
The schema version bump (1 → 2) in the previous commit introduces a backwards-incompatible database change. Users whose database was created under v0.2 will be prompted to reset it. To give users a rollback path: - Tag v0.2 on main at the last commit before the schema break - Bump the app version to 0.3.0 so the compatibility dialog can say "v0.3 requires a database update — install v0.2 to go back"
loganj
added a commit
that referenced
this pull request
Feb 26, 2026
Refine selection and hover colors for consistency
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix the agent's working directory when a project has a subpath set (monorepos). Previously, the agent was launched in the worktree root instead of the correct subdirectory.
Changes
Fix subpath handling (28bec4d)
start_branch_session): Look up the project's subpath and join it to the worktree path before passing asworking_dirBranchCard → SessionModal): PassprojectSubpaththrough so thatresume_sessionalso uses the correct subpath-adjusted working directoryConsolidate working directory on the backend (bdd5a96)
working_dircolumn tosessionstable (schema version 1 → 2)working_diron session creation soresume_sessionreads it from the database instead of receiving it from the frontendworkingDirparam fromresumeSession(), removeprojectSubpathpass-through fromBranchCard/ProjectSectionVersion bump (7327c88)
Files changed
src-tauri/src/session_commands.rs— subpath join + working_dir plumbingsrc-tauri/src/store/models.rs— addworking_dirtoSessionsrc-tauri/src/store/sessions.rs— schema migration, persist/readworking_dirsrc-tauri/src/store/mod.rs— schema version bumpsrc-tauri/src/store/tests.rs— updated testssrc/lib/commands.ts— removeworkingDirfromresumeSessionsrc/lib/*.svelte— simplify component propspackage.json,Cargo.toml,tauri.conf.json— version 0.3.0.github/workflows/staged-ci.yml— CI adjustments