Repository navigation
fix(server): a project's worktree layout commands run only for requests that may run commands #41986
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
fix(server): a project's worktree layout commands run only for requests that may run commands #41986
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,7 +131,7 @@ export interface ThreadLaunchInput { | |
|
|
||
| type PreparationInput = Pick< | ||
| ThreadLaunchInput, | ||
| "commandId" | "projectId" | "workspaceStrategy" | "initialMessage" | ||
| "commandId" | "projectId" | "workspaceStrategy" | "initialMessage" | "linkOrigin" | ||
| > & { | ||
| readonly reusedWorktree?: { readonly baseRef: string }; | ||
| }; | ||
|
|
@@ -853,6 +853,7 @@ const make = Effect.gen(function* () { | |
| projectStart: { refName: startRef, baseRefName }, | ||
| baseBranch: input.workspaceStrategy.baseRef, | ||
| startFromOrigin: input.workspaceStrategy.startFromOrigin === true, | ||
| projectCommands: TaskFolders.linkRunsProjectCommands(input.linkOrigin), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Derive the preparation origin from the committed thread, not from the request. The initial launch passes the request's Suggested fix
|
||
| projectProgress: progress, | ||
| onClaimed: (taskFolder, claimedBranch) => | ||
| Effect.sync(() => { | ||
|
|
@@ -1177,6 +1178,7 @@ const make = Effect.gen(function* () { | |
| root: removedTaskFolder, | ||
| force: true, | ||
| forget: true, | ||
| projectCommands: TaskFolders.linkRunsProjectCommands(input.linkOrigin), | ||
| deleteBranch: removedBranch ?? undefined, | ||
| }) | ||
| .pipe( | ||
|
|
@@ -1705,6 +1707,7 @@ const make = Effect.gen(function* () { | |
| commandId: input.commandId, | ||
| projectId: thread.projectId, | ||
| workspaceStrategy: reuse?.strategy ?? workspacePreparation, | ||
| ...(thread.linkOrigin === undefined ? {} : { linkOrigin: thread.linkOrigin }), | ||
| ...(reuse === null ? {} : { reusedWorktree: reuse.reusedWorktree }), | ||
| ...(message === undefined | ||
| ? {} | ||
|
|
||
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.
Check the layout permission before the remote base fetch.
When
startFromOriginis true for a repository project, a failedfetchWorktreeBaseCommitreturns its error beforetaskFolders.createreceivesprojectCommands. For a thread whose link does not allow layout commands, the caller gets the fetch failure instead of the layout-permission refusal. The handoff still fails and no layout command runs, but the reason is wrong.Refuse the request for the layout-permission reason before the remote fetch runs, so the refusal does not depend on remote state.