Repository navigation
feat(git): allow custom worktree branch prefixes #6037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
filipgutica
wants to merge
4
commits into
pingdotgg:main
from
filipgutica:agent/configurable-worktree-branch-prefix
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1b82f26
feat(git): allow custom worktree branch prefixes
filipgutica 79e13a2
fix(git): address branch prefix review feedback
filipgutica a2f6acb
test(git): cover previous worktree prefixes
filipgutica cec345a
fix(git): address current branch prefix review feedback
filipgutica File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| import { describe, expect, it, vi } from "vite-plus/test"; | ||
|
|
||
| import { ProjectId, ProviderInstanceId } from "@t3tools/contracts"; | ||
|
|
||
| vi.mock("./uuid", () => ({ | ||
| randomHex: () => "deadbeef", | ||
| })); | ||
|
|
||
| import { | ||
| buildProjectThreadStartTurnInput, | ||
| type ProjectThreadStartTurnSpec, | ||
| } from "./projectThreadStartTurn"; | ||
|
|
||
| const makeSpec = ( | ||
| overrides: Partial<ProjectThreadStartTurnSpec> = {}, | ||
| ): ProjectThreadStartTurnSpec => ({ | ||
| projectId: ProjectId.make("project-1"), | ||
| projectCwd: "/workspace/project-1", | ||
| threadId: "thread-1", | ||
| commandId: "command-1", | ||
| messageId: "message-1", | ||
| createdAt: "2026-08-10T12:00:00.000Z", | ||
| text: "Build the mobile change", | ||
| attachments: [], | ||
| modelSelection: { | ||
| instanceId: ProviderInstanceId.make("codex"), | ||
| model: "gpt-5.4", | ||
| }, | ||
| runtimeMode: "approval-required", | ||
| interactionMode: "default", | ||
| workspaceMode: "worktree", | ||
| branch: "main", | ||
| worktreePath: null, | ||
| startFromOrigin: false, | ||
| ...overrides, | ||
| }); | ||
|
|
||
| describe("buildProjectThreadStartTurnInput", () => { | ||
| it("uses the configured prefix for a worktree bootstrap branch", () => { | ||
| const input = buildProjectThreadStartTurnInput( | ||
| makeSpec({ | ||
| worktreeBranchPrefix: "mobile-team", | ||
| }), | ||
| ); | ||
|
|
||
| expect(input.bootstrap.prepareWorktree?.branch).toBe("mobile-team/deadbeef"); | ||
| }); | ||
|
|
||
| it("falls back to the default prefix when the server configuration is unavailable", () => { | ||
| const input = buildProjectThreadStartTurnInput(makeSpec()); | ||
|
|
||
| expect(input.bootstrap.prepareWorktree?.branch).toBe("t3code/deadbeef"); | ||
| }); | ||
|
|
||
| it("omits worktree preparation for a local thread", () => { | ||
| const input = buildProjectThreadStartTurnInput( | ||
| makeSpec({ | ||
| workspaceMode: "local", | ||
| worktreePath: "/workspace/project-1", | ||
| }), | ||
| ); | ||
|
|
||
| expect(input.bootstrap.prepareWorktree).toBeUndefined(); | ||
| }); | ||
| }); |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Settings failure skips branch drift
Medium Severity
A failed
getSettingsread now returns fromfollowWorktreeBranchDriftbefore any checkout adoption. That path previously followed non-temporary branch changes without settings. Transient settings errors can leave thread branch metadata stale and orphan PR attribution, including when the checkout is a normal branch that does not need the prefix.Reviewed by Cursor Bugbot for commit cec345a. Configure here.