Handle merge conflicts as orchestration events
This commit is contained in:
@@ -333,7 +333,7 @@ function buildActorPrompt(input: ActorExecutionInput): string {
|
||||
},
|
||||
events: [
|
||||
{
|
||||
type: "requirements_defined | tasks_planned | code_committed | task_ready_for_review | task_blocked | validation_passed | validation_failed | branch_merged",
|
||||
type: "requirements_defined | tasks_planned | code_committed | task_ready_for_review | task_blocked | validation_passed | validation_failed | branch_merged | merge_conflict_detected | merge_conflict_resolved | merge_conflict_unresolved | merge_retry_started",
|
||||
payload: {
|
||||
summary: "optional",
|
||||
details: {},
|
||||
|
||||
@@ -117,6 +117,10 @@ const MANIFEST_EVENT_TRIGGERS = [
|
||||
"validation_passed",
|
||||
"validation_failed",
|
||||
"branch_merged",
|
||||
"merge_conflict_detected",
|
||||
"merge_conflict_resolved",
|
||||
"merge_conflict_unresolved",
|
||||
"merge_retry_started",
|
||||
];
|
||||
|
||||
const RUN_MANIFEST_EDITOR_VALUE = "__editor__";
|
||||
|
||||
@@ -413,12 +413,22 @@ export class UiRunService {
|
||||
.map((task) => task.worktreePath)
|
||||
.filter((path): path is string => typeof path === "string" && path.trim().length > 0);
|
||||
|
||||
await runtime.worktreeManager.closeSession({
|
||||
const outcome = await runtime.worktreeManager.closeSession({
|
||||
session,
|
||||
taskWorktreePaths,
|
||||
mergeBaseIntoProject: input.mergeToProject === true,
|
||||
});
|
||||
|
||||
if (outcome.kind === "fatal_error") {
|
||||
throw new Error(`Session close failed: ${outcome.error}`);
|
||||
}
|
||||
|
||||
if (outcome.kind === "conflict") {
|
||||
return runtime.sessionStore.updateSession(session.sessionId, {
|
||||
sessionStatus: "closed_with_conflicts",
|
||||
});
|
||||
}
|
||||
|
||||
return runtime.sessionStore.updateSession(session.sessionId, {
|
||||
sessionStatus: "closed",
|
||||
});
|
||||
@@ -448,7 +458,10 @@ export class UiRunService {
|
||||
if (input.sessionId?.trim() && !session) {
|
||||
throw new Error(`Session \"${sessionId}\" does not exist.`);
|
||||
}
|
||||
if (session && session.sessionStatus === "closed") {
|
||||
if (
|
||||
session &&
|
||||
(session.sessionStatus === "closed" || session.sessionStatus === "closed_with_conflicts")
|
||||
) {
|
||||
throw new Error(`Session \"${sessionId}\" is closed and cannot run new tasks.`);
|
||||
}
|
||||
const runId = randomUUID();
|
||||
|
||||
Reference in New Issue
Block a user