fix(workspaces): point the repository-mismatch repair at the recorded URL and set the notice's next action

Changing the project's repository URL to the folder's origin does not repair a
workspace that recorded a third URL: the check still needs the origin or the
project URL to equal the recorded one. The text now says to restore the recorded
URL in the project or the folder's origin, or to save the work and choose
another workspace.

The workspace-validation notice seed now sets nextAction from the same text, so
its next-action row no longer falls back to a bare Retry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
scotttongandClaude Opus 5.5 committed 2026-11-25 11:39:33 -08:00
1 parent e9c95475e9
commit 4a2be2d116
2 files changed
+20 -10

No files matched your search

@@ -10,11 +10,17 @@ describe("workspace validation recovery text", () => {
it("explains a repository address mismatch and says Retry alone will not fix it", () => {
const payload = { reason: "persisted_workspace_source_conflict", reasonCode: "source_repository_mismatch" };
const text = workspaceValidationNextAction(payload);
expect(text).toContain("repository URL");
expect(text).toContain("git origin");
expect(text).toContain("Retrying without that change fails the same way");
// Repair restores the RECORDED URL: changing the project URL to the
// folder's origin would leave the recorded URL unmatched.
expect(text).toContain("Set the project's repository URL back to the URL this workspace recorded");
expect(text).toContain("make the folder's git origin (`git remote get-url origin`) equal to it");
expect(text).toContain("save any work in this workspace first");
expect(text).toContain("Retrying without one of these changes fails the same way");
expect(text).not.toContain("Press Retry to start it again.");
expect(buildWorkspaceValidationRecoveryNoticeSeed(payload).body).toBe(text);
// The notice's next-action row must not fall back to a bare "Press Retry".
expect(buildWorkspaceValidationRecoveryNoticeSeed(payload)).toMatchObject({
body: text, nextAction: text, title: "Workspace validation failed", tone: "danger",
});
});
it("explains any other unverifiable original repository instead of the generic text", () => {
@@ -36,6 +42,6 @@ describe("workspace validation recovery text", () => {
it("falls back to the generic text when the reason is unknown or missing", () => {
expect(workspaceValidationNextAction(null)).toBe(GENERIC);
expect(workspaceValidationNextAction({ reason: "configured_workspace_unavailable" })).toBe(GENERIC);
expect(buildWorkspaceValidationRecoveryNoticeSeed().body).toBe(GENERIC);
expect(buildWorkspaceValidationRecoveryNoticeSeed()).toMatchObject({ body: GENERIC, nextAction: GENERIC });
});
});
@@ -136,10 +136,12 @@ export function workspaceValidationNextAction(payload: Record<string, unknown> |
}
if (reason === "persisted_workspace_source_conflict") {
if (readNonEmptyStringField(payload, "reasonCode") === "source_repository_mismatch") {
return "The agent did not start: this task's workspace records a repository URL that does not match the git origin "
+ "of the project's folder, so Paperclip could not confirm it is the same repository. Make the repository URL in "
+ "the project's workspace settings match the folder's git origin (`git remote get-url origin`), then press Retry. "
+ "Retrying without that change fails the same way.";
return "The agent did not start: this task's workspace recorded a repository URL that no longer matches the "
+ "project's repository URL or the git origin of the project's folder, so Paperclip could not confirm it is "
+ "the same repository. Set the project's repository URL back to the URL this workspace recorded, or make the "
+ "folder's git origin (`git remote get-url origin`) equal to it, then press Retry. To use a different "
+ "repository instead, save any work in this workspace first, then choose another workspace for the task. "
+ "Retrying without one of these changes fails the same way.";
}
return "The agent did not start: this task's workspace's original repository could not be found or verified. "
+ "Check the project's workspace folder and repository URL in the project settings, then press Retry.";
@@ -150,8 +152,10 @@ export function workspaceValidationNextAction(payload: Record<string, unknown> |
export function buildWorkspaceValidationRecoveryNoticeSeed(
payload?: Record<string, unknown> | null,
): StrandedRecoveryNoticeSeed {
const nextAction = workspaceValidationNextAction(payload);
return {
body: workspaceValidationNextAction(payload),
body: nextAction,
nextAction,
title: "Workspace validation failed",
tone: "danger",
};