Skip to content

Commit 7c4ed89

Browse files
rubenfiszelclaude
andcommitted
fix(linear): don't treat a linked github issue as a PR
`findLinkedGitHubPr` accepted any attachment with `sourceType: "github"` as a PR. Linear's "GitHub Issues" sync tags the source issue with that same sourceType (URL `.../issues/N`, no branch metadata), so the oneshot seed classified it as a linked PR, set `source: "github-integration"`, and fell back to `issue.branchName` in `mode: "existing"`. That branch was never created, so `createWorktree` threw `Branch not found` and every GIT-team oneshot was dropped. Only trust the explicit PR source types; for the generic `github` type require a `/pull/` URL. GitHub-issue attachments now fall through to `source: "none"` → `mode: "new"`, so webmux creates the branch fresh like any other issue. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 632caae commit 7c4ed89

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

backend/src/__tests__/linear-service.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,21 @@ describe("findLinkedGitHubPr", () => {
461461
expect(result?.url).toBe("https://github.com/org/repo/pull/42");
462462
expect(result?.state).toBe("unknown");
463463
});
464+
465+
it("ignores a linked github issue tagged sourceType 'github' (not a PR)", () => {
466+
// Linear's "GitHub Issues" sync attaches the source issue with
467+
// sourceType "github" and an /issues/ URL. It must not be treated as a PR,
468+
// else the oneshot seed resolves to a never-created branch.
469+
const result = findLinkedGitHubPr({
470+
attachments: [
471+
attachment({
472+
id: "1", url: "https://github.com/org/repo/issues/10105", title: "#10105 bug",
473+
createdAt: "2026-05-01", sourceType: "github",
474+
}),
475+
],
476+
});
477+
expect(result).toBeNull();
478+
});
464479
});
465480

466481
describe("buildLinearPickupMarkdown", () => {

backend/src/services/linear-service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,9 +842,13 @@ export function findLinkedGitHubPr(
842842
issue: { attachments: LinearAttachment[] },
843843
): LinkedGitHubPr | null {
844844
const githubAttachments = issue.attachments.filter((a) => {
845-
if (a.sourceType === "github" || a.sourceType === "githubPR" || a.sourceType === "github_pull_request") {
845+
if (a.sourceType === "githubPR" || a.sourceType === "github_pull_request") {
846846
return true;
847847
}
848+
// `sourceType: "github"` covers both linked PRs and linked issues, so it is
849+
// not enough on its own — a synced GitHub *issue* (Linear's "GitHub Issues"
850+
// team) would otherwise be treated as a PR, and the oneshot seed resolves to
851+
// a branch that was never created ("Branch not found"). Only /pull/ URLs are PRs.
848852
return /github\.com\/.+\/pull\/\d+/i.test(a.url);
849853
});
850854
if (githubAttachments.length === 0) return null;

0 commit comments

Comments
 (0)