The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 09:30 UTC
fix(acp): cancelled plan steps no longer keep the plan running (#25564)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
MarcoDotIO committed
Oct 31, 2026 at 22:32 UTC
5ff1482765d37eb45d6b563bce9df24a5b5fbe97
4 files changed
+50
-14
apps/server/scripts/acp-mock-agent.ts
+12
@@ -1104,6 +1104,18 @@ const program = Effect.gen(function* () {
1104
entries: [{ content: "Ship B", priority: "high", status: "in_progress" }],
1105
},
1106
},
1107
+ {
1108
+ sessionUpdate: "plan_update",
1109
+ plan: {
1110
+ type: "items",
1111
+ planId: "plan-c",
1112
+ entries: [
1113
+ { content: "Write the fix", priority: "high", status: "completed" },
1114
+ { content: "Try another approach", priority: "low", status: "cancelled" },
1115
+ { content: "Add a test", priority: "medium", status: "completed" },
1116
+ ],
1117
+ },
1118
+ },
1119
{ sessionUpdate: "plan_removed", planId: "plan-a" },
1120
{
1121
sessionUpdate: "terminal_update",
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+13
@@ -3046,6 +3046,19 @@ describe("AcpAdapterV2", () => {
3046
assert.equal(planA[1]?.status, "superseded");
3047
assert.isDefined(planB);
3048
assert.notEqual(planA[0]?.id, planB?.id);
3049
+ const planC = plans.find(
3050
+ (plan) =>
3051
+ plan.kind === "todo_list" && plan.steps.some((step) => step.text === "Write the fix"),
3052
+ );
3053
+ assert.ok(planC?.kind === "todo_list");
3054
+ assert.deepEqual(
3055
+ planC.steps.map((step) => ({ id: step.id, text: step.text, status: step.status })),
3056
+ [
3057
+ { id: "acp-step-1", text: "Write the fix", status: "completed" },
3058
+ { id: "acp-step-3", text: "Add a test", status: "completed" },
3059
+ ],
3060
+ );
3061
+ assert.equal(planC.status, "completed");
3062
3063
const items = events.flatMap((event) =>
3064
event.type === "turn_item.updated" ? [event.turnItem] : [],
packages/provider-acp/src/server/adapter.ts
+19
-12
@@ -4033,20 +4033,27 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
4033
if (planState.latest === null) return;
4034
plan = { ...planState.latest, status: "superseded" };
4035
} else if (update.kind === "items") {
4036
- const steps: ReadonlyArray<OrchestrationV2PlanStep> = update.plan.map(
4037
- (step, index) => ({
4038
- id: `acp-step-${index + 1}`,
4039
- text: nonEmptyText(step.step, `Step ${index + 1}`),
4040
- status:
4041
- step.status === "inProgress"
4042
- ? "running"
4043
- : step.status === "completed"
4044
- ? "completed"
4045
- : "pending",
4046
- }),
4036
+ // A cancelled entry is not outstanding work, and plan steps have no
4037
+ // cancelled status, so drop it rather than show it as pending.
4038
+ const steps: ReadonlyArray<OrchestrationV2PlanStep> = update.plan.flatMap(
4039
+ (step, index) =>
4040
+ step.status === "cancelled"
4041
+ ? []
4042
+ : [
4043
+ {
4044
+ id: `acp-step-${index + 1}`,
4045
+ text: nonEmptyText(step.step, `Step ${index + 1}`),
4046
+ status:
4047
+ step.status === "inProgress"
4048
+ ? "running"
4049
+ : step.status === "completed"
4050
+ ? "completed"
4051
+ : "pending",
4052
+ },
4053
+ ],
4054
);
4055
const completed =
4049
- steps.length > 0 && steps.every((step) => step.status === "completed");
4056
+ update.plan.length > 0 && steps.every((step) => step.status === "completed");
4057
plan = {
4058
...base,
4059
status: completed ? "completed" : "active",
packages/provider-acp/src/server/runtimeModel.ts
+6
-2
@@ -220,7 +220,7 @@ export type AcpPlanUpdate =
220
readonly explanation?: string | null;
221
readonly plan: ReadonlyArray<{
222
readonly step: string;
223
- readonly status: "pending" | "inProgress" | "completed";
223
+ readonly status: "pending" | "inProgress" | "completed" | "cancelled";
224
}>;
225
}
226
| { readonly nativePlanId: string; readonly kind: "markdown"; readonly markdown: string }
@@ -493,10 +493,14 @@ export function parseSessionModeState(
493
};
494
}
495
496
-function normalizePlanStepStatus(raw: unknown): "pending" | "inProgress" | "completed" {
496
+function normalizePlanStepStatus(
497
+ raw: unknown,
498
+): "pending" | "inProgress" | "completed" | "cancelled" {
499
switch (raw) {
500
case "completed":
501
return "completed";
502
+ case "cancelled":
503
+ return "cancelled";
504
case "in_progress":
505
case "inProgress":
506
return "inProgress";