paired: repair safe owner workspace branch mismatches

This commit is contained in:
ejclaw
2026-04-11 08:45:47 +09:00
parent 2b8f55deb6
commit fe9d265c66
5 changed files with 269 additions and 5 deletions

View File

@@ -47,6 +47,7 @@ import {
transitionPairedTaskStatus,
} from './paired-execution-context-shared.js';
import {
isOwnerWorkspaceRepairNeededError,
markPairedTaskReviewReady,
prepareReviewerWorkspaceForExecution,
provisionOwnerWorkspaceForPairedTask,
@@ -273,7 +274,15 @@ export function preparePairedExecutionContext(args: {
}
// Use a stable per-channel worktree (not per-task) so the Claude SDK
// session persists across tasks. Different channels still get isolation.
workspace = provisionOwnerWorkspaceForPairedTask(latestTask.id);
try {
workspace = provisionOwnerWorkspaceForPairedTask(latestTask.id);
} catch (error) {
if (isOwnerWorkspaceRepairNeededError(error)) {
blockMessage = error.blockMessage || error.message;
} else {
throw error;
}
}
// Update source_ref from workspace HEAD so change detection compares
// against the correct repo. At task creation, source_ref is from the
// canonical workDir which may differ from the workspace clone.