Skip to content

Guard workflow results against Promise clone failures - #21

Merged
Michaelliv merged 1 commit into
mainfrom
investigate-issue-12-promise-clone
May 31, 2026
Merged

Michaelliv merged 1 commit into
mainfrom
investigate-issue-12-promise-clone

Conversation

@Michaelliv

Copy link
Copy Markdown
Owner

Summary

  • wait for started workflow subagents to settle before returning from the runtime
  • reject non-structured-cloneable workflow results with a targeted forgot-to-await error
  • validate runtime phase titles and agent prompt/options before they enter progress snapshots

Fixes #12

Verification

  • npm test
  • reproduced return { leaked: agent(...) } locally; now reports a workflow error instead of crashing Pi

@Michaelliv
Michaelliv merged commit 1c61834 into main May 31, 2026
1 check passed
HangxiangMa pushed a commit to HangxiangMa/pi-dynamic-workflows that referenced this pull request Sep 7, 2026
…n/s (Michaelliv#20) (Michaelliv#21)

Add a 'detailed' mode to the live 'Workflows running' panel alongside the
existing compact one-liner. Detailed mode renders per-phase progress (marker +
done/total + error count + token subtotal) and per-agent rows ([id] + status
icon + label + tokens + model), capped at progressPanelMaxAgents per phase with
a '... N earlier agents' overflow line, plus a run header with aggregate tokens,
cost, and a live tok/s rate. Compact mode is byte-for-byte unchanged.

New settings in ~/.pi/workflows/settings.json: progressPanelMode
('compact'|'detailed') and progressPanelMaxAgents (1-1000, default 8), live-read
each render (1s TTL) so toggles apply without a restart. New commands
/workflows-progress <compact|detailed|status> and /workflows-progress-max <N>.

token/s is summed from per-agent agent.tokens, NOT snapshot.tokenUsage.total:
real-pi testing showed the run-level aggregate is only finalized at run-end and
reads 0 for the entire live run, while per-agent tokens update on each agent
completion. Reuses statusIcon/shorten (display.ts) and shortModel (workflow-ui.ts)
via new exports; no duplication.

Tests: 16 new unit tests (settings normalize/clamp, token-rate math incl.
ramp/stall, detailed layout, per-phase overflow, mode selection, commands).
Verified end-to-end with a real deepseek-v4-flash run (live header: '31.7K tok
- 4434 tok/s').
jarjee pushed a commit to jarjee/pi-dynamic-workflows that referenced this pull request Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Error: #<Promise> could not be cloned.

1 participant