History

fix(web): stop marking mixed tool runs as failed (#7893)

Theo Browne committed 2 months agov0.0.34-nightly.20260822.1159

Commit ce912841 parent 11f05137 files · +230 −6Browse files

Showing the changes to apps/server/src (3 of 7 files). Show all

Unified · Split

3 files
  1. apps/server/src/orchestration/ActivityPayloadProjection.ts +8 −2
  2. apps/server/src/provider/Layers/CodexAdapter.test.ts +60 −0
  3. apps/server/src/provider/Layers/CodexAdapter.ts +3 −1
apps/server/src/orchestration/ActivityPayloadProjection.ts+8−2
@@ -342,11 +342,17 @@ export function projectActivityPayload( · 341 unmodified lines
342 return activity;342 return activity;
343 }343 }
344 344
345 const itemStatus = asRecord(data.item)?.status;
346 const projectedPayload =
347 payload.status === "completed" && (itemStatus === "failed" || itemStatus === "declined")
348 ? { ...payload, status: itemStatus }
349 : payload;
350
345 if (payload.itemType === "mcp_tool_call") {351 if (payload.itemType === "mcp_tool_call") {
346 return {352 return {
347 ...activity,353 ...activity,
348 payload: {354 payload: {
349 ...payload,355 ...projectedPayload,
350 data: projectMcpToolCallData(data),356 data: projectMcpToolCallData(data),
351 },357 },
352 };358 };
@@ -384,7 +390,7 @@ export function projectActivityPayload( · 31 unmodified lines
384 return {390 return {
385 ...activity,391 ...activity,
386 payload: {392 payload: {
387 ...payload,393 ...projectedPayload,
388 data: projectedData,394 data: projectedData,
389 },395 },
390 };396 };
apps/server/src/provider/Layers/CodexAdapter.test.ts+60−0
@@ -614,6 +614,66 @@ lifecycleLayer("CodexAdapterLive lifecycle", (it) => { · 613 unmodified lines
614 }),614 }),
615 );615 );
616 616
617 it.effect("preserves failed and declined outcomes on completed tool items", () =>
618 Effect.gen(function* () {
619 const { adapter, runtime } = yield* startLifecycleRuntime();
620 const items = [
621 {
622 type: "commandExecution",
623 id: "failed-command",
624 command: "vp test run",
625 commandActions: [],
626 cwd: "/tmp",
627 exitCode: 1,
628 status: "failed",
629 },
630 {
631 type: "mcpToolCall",
632 id: "failed-mcp",
633 server: "simulator",
634 tool: "build",
635 arguments: {},
636 error: { message: "Build failed" },
637 status: "failed",
638 },
639 {
640 type: "fileChange",
641 id: "declined-change",
642 changes: [],
643 status: "declined",
644 },
645 ] as const;
646
647 for (const item of items) {
648 const firstEventFiber = yield* Stream.runHead(adapter.streamEvents).pipe(Effect.forkChild);
649
650 yield* runtime.emit({
651 id: asEventId(`evt-${item.id}`),
652 kind: "notification",
653 provider: ProviderDriverKind.make("codex"),
654 createdAt: "2026-01-01T00:00:00.000Z",
655 method: "item/completed",
656 threadId: asThreadId("thread-1"),
657 turnId: asTurnId("turn-1"),
658 itemId: asItemId(item.id),
659 payload: {
660 completedAtMs: 1_778_000_000_000,
661 threadId: "thread-1",
662 turnId: "turn-1",
663 item,
664 },
665 });
666
667 const firstEvent = yield* Fiber.join(firstEventFiber);
668 NodeAssert.equal(firstEvent._tag, "Some");
669 if (firstEvent._tag !== "Some" || firstEvent.value.type !== "item.completed") {
670 return;
671 }
672 NodeAssert.equal(firstEvent.value.payload.status, item.status);
673 }
674 }),
675 );
676
617 it.effect("maps completed plan items to canonical proposed-plan completion events", () =>677 it.effect("maps completed plan items to canonical proposed-plan completion events", () =>
618 Effect.gen(function* () {678 Effect.gen(function* () {
619 const { adapter, runtime } = yield* startLifecycleRuntime();679 const { adapter, runtime } = yield* startLifecycleRuntime();
apps/server/src/provider/Layers/CodexAdapter.ts+3−1
@@ -480,7 +480,9 @@ function mapItemLifecycle( · 479 unmodified lines
480 lifecycle === "item.started"480 lifecycle === "item.started"
481 ? "inProgress"481 ? "inProgress"
482 : lifecycle === "item.completed"482 : lifecycle === "item.completed"
483 ? "completed"483 ? "status" in item && (item.status === "failed" || item.status === "declined")
484 ? item.status
485 : "completed"
484 : undefined;486 : undefined;
485 487
486 return {488 return {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t