Keep agent-created follow-ups in run workspace

Reviewed and merged for PAP-10871/PAP-10873.\n\nVerification:\n- pnpm vitest run server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts\n- git diff --check origin/master...HEAD\n- GitHub PR checks green before merge
This commit is contained in:
Dotta
2026-06-10 21:20:51 -05:00
committed by GitHub
parent b8fb81dee9
commit 11a64819f9
2 changed files with 104 additions and 1 deletions
@@ -818,6 +818,67 @@ describe("agent issue mutation checkout ownership", () => {
expect(mockIssueService.update).not.toHaveBeenCalled();
});
it("defaults agent-created root follow-up issues to inherit the current run workspace", async () => {
const app = await createApp(
ownerActor(),
createRunContextDb({
issueId,
executionWorkspaceId: "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
}),
);
const res = await request(app)
.post(`/api/companies/${companyId}/issues`)
.send({
title: "Follow-up in same worktree",
projectId: "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
});
expect(res.status, JSON.stringify(res.body)).toBe(201);
expect(mockIssueService.create).toHaveBeenCalledWith(
companyId,
expect.objectContaining({
title: "Follow-up in same worktree",
inheritExecutionWorkspaceFromIssueId: issueId,
}),
);
});
it("preserves explicit workspace choices on agent-created root issues", async () => {
const app = await createApp(
ownerActor(),
createRunContextDb({
issueId,
executionWorkspaceId: "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
}),
);
const explicitExecutionWorkspaceId = "cccccccc-cccc-4ccc-8ccc-cccccccccccc";
const res = await request(app)
.post(`/api/companies/${companyId}/issues`)
.send({
title: "Explicit different workspace",
executionWorkspaceId: explicitExecutionWorkspaceId,
executionWorkspacePreference: "reuse_existing",
});
expect(res.status, JSON.stringify(res.body)).toBe(201);
expect(mockIssueService.create).toHaveBeenCalledWith(
companyId,
expect.objectContaining({
title: "Explicit different workspace",
executionWorkspaceId: explicitExecutionWorkspaceId,
executionWorkspacePreference: "reuse_existing",
}),
);
expect(mockIssueService.create).toHaveBeenCalledWith(
companyId,
expect.not.objectContaining({
inheritExecutionWorkspaceFromIssueId: issueId,
}),
);
});
it("allows board users to set explicit cheap issue assignee profile overrides", async () => {
const app = await createApp(boardActor());