Skip to content

fix(workflow): fall back on malformed render details - #102

Merged
tt-a1i merged 1 commit into
mainfrom
codex/issue-101-workflow-render-fallback
Aug 24, 2026
Merged

fix(workflow): fall back on malformed render details#102
tt-a1i merged 1 commit into
mainfrom
codex/issue-101-workflow-render-fallback

Conversation

@tt-a1i

@tt-a1i tt-a1i commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • validate workflow tool-result details before entering the custom card renderer
  • fall back to Pi's plain text rendering for empty or structurally incomplete error details
  • keep malformed results out of the Workflow spinner lifecycle
  • add regression coverage for the exact parse-error crash path

Why

Pi represents some extension-tool execution failures with isError: true and details: {}. The Workflow renderer previously treated every truthy details value as WorkflowDetails, then called aggregateUsage(details.agents). A Workflow parse error therefore became an uncaught TypeError: agents is not iterable and terminated the TUI.

The fix checks the mandatory top-level Workflow render contract (runId, background, terminal/running status, finite startedAt, phases, and agents) before using the custom renderer. Invalid shapes preserve the original error text and do not start a spinner. Valid Workflow cards are unchanged.

Test plan

  • node --test --experimental-strip-types extensions/workflows/rendering.test.ts
  • bun run check
  • bun run test — 868 Node tests and 30 Vitest tests passed
  • git diff --check

Closes #101

Guard the Workflow custom renderer against generic Pi error details so parse failures remain visible as text instead of crashing the TUI. Add regression coverage for empty and incomplete details without spinner activity.\n\nCloses #101
@tt-a1i tt-a1i added the bug Something isn't working label Aug 24, 2026
@tt-a1i
tt-a1i merged commit fa034f8 into main Aug 24, 2026
2 checks passed
@tt-a1i
tt-a1i deleted the codex/issue-101-workflow-render-fallback branch August 24, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflow 解析错误的空 details 会触发 renderer 崩溃并退出 Pi

1 participant