feat(workflows): add stage introspection and control actions - #1041
Conversation
Add workflow tool actions for listing stages, inspecting stage details, reading transcripts, sending stage messages or prompt responses, pausing runs, and reloading workflow resources in-process. Document the new workflow actions and cover transcript fallback ordering, prompt-answer payload handling, direct reload behavior, and schema validation with unit tests. Refs: #1023 Assistant-model: GPT-5.5
eb1f681 to
647691e
Compare
Code reviewSolid feature with good schema and test discipline. A few things worth tightening before merge. Bugs / dead code
Concurrency / correctness
Smaller things
Test coverage gaps
Nice things
Overall recommendation: address #1, #2, #3, and #4 before merging; the rest can be follow-ups. |
Assistant-model: GPT-5.5
Review —
|
Assistant-model: GPT-5.5
Review —
|
Assistant-model: GPT-5.5
Review —
|
Assistant-model: GPT-5.5
Code Review — PR #1041 (workflow stage introspection and control)Nice piece of work — the schema, dispatch, tests, and rendering all line up coherently and the iterative fix-up commits show the feedback loop closed cleanly (TOCTOU re-check on reload, Correctness
Design / API surface
Performance / resource
Security
Tests
Style / nits
Overall: solid and well-tested. The README/source-label mismatch on |
Assistant-model: GPT-5.5
Code reviewSolid PR — the new Bugs / correctness
Concurrency / TOCTOU
Code quality
Documentation / nits
Test coverageCoverage looks strong. The chronological ordering tests (1263-1525) cover the trickiest behavior thoroughly. Two gaps worth filling:
Nothing here is a blocker — the bug in (1) is the only behavior issue I'd want fixed before merge; (2)-(7) are quality improvements. |
* feat(workflows): add stage introspection controls Add workflow tool actions for listing stages, inspecting stage details, reading transcripts, sending stage messages or prompt responses, pausing runs, and reloading workflow resources in-process. Document the new workflow actions and cover transcript fallback ordering, prompt-answer payload handling, direct reload behavior, and schema validation with unit tests. Refs: #1023 Assistant-model: GPT-5.5 * fix(workflows): address stage control review feedback Assistant-model: GPT-5.5 * fix(workflows): address stage tool follow-up feedback Assistant-model: GPT-5.5 * fix(workflows): polish stage tool review feedback Assistant-model: GPT-5.5 * fix(workflows): refine transcript control edge cases Assistant-model: GPT-5.5 * fix(workflows): align transcript docs and reload reason Assistant-model: GPT-5.5
Summary
Extends the
workflowtool with six new actions —stages,stage,transcript,send,pause, andreload— giving agents full visibility into running workflow stages and direct control over prompt answering, steering, pausing, and resource reloading.Refs #1023
New
workflowtool actionsstagespending,running,awaiting_input,paused,blocked,completed,failed,skipped,all)stagetranscripttail/limitand snapshot-onlyincludeToolOutput; terminal result/error entries are preserved after tool eventssenddeliverymode selectsauto,answer,prompt,steer,followUp, orresume; omitted payload is a no-op while an explicit empty string remains a valid answerpauseall: truefor bulk pause; rejectsall:truecombined withstageId)reloadChanges
Schema additions (
workflow-schema.ts)New optional parameters:
statusFilter,format(text|json),limit,tail,includeToolOutput,text,response,delivery(auto|answer|prompt|steer|followUp|resume),promptId,reasonRuntime behavior
pauseAllRunsexport for bulk-pause across all in-flight runsstructuredCloneinstead ofJSON.parse(JSON.stringify(...))for safe deep copiespause,interrupt, andkillnow rejectall:true+stageIdinstead of silently ignoringstageId(no body)for entries without text/outputAgent-facing rendering
render-result.ts: TUI notice renderers for all six new result typesrenderWorkflowToolContent: structured plain-text renderers forstages,stage,transcript; compact one-liners forsend,pause,reload;format: "json"falls back to raw JSON for all actionsTests
test/unit/workflow-schema.test.ts— schema validation for all new parameters and action literalstest/unit/slash-dispatch.test.ts— stage inspection/control behavior, transcript fallback ordering,limit/tailsemantics, send semantics (no-op vs. empty string), pause/reload edge cases, and in-process reload behaviortest/integration/mock-extension-api.test.ts— render-result width coverage for transcript noticesDocumentation
packages/workflows/CHANGELOG.mdupdated under[Unreleased]with### Addedand### FixedentriesTest plan
AGENT=1 bun test test/unit/workflow-schema.test.ts test/unit/slash-dispatch.test.tsbun test test/unit/slash-dispatch.test.ts test/unit/workflow-schema.test.ts test/unit/run-detail-render.test.tsbun test test/integration/mock-extension-api.test.ts test/integration/mcp-entrypoint.test.tsbun run typecheckbun packages/coding-agent/src/cli.ts: created a temporary.atomic/workflows/qa-dummy.ts, verified/workflow list,/workflow inputs,/workflow qa-dummy,/workflow status --all, workflow toolstages/stage/transcript, workflow toolpause --all, and workflow toolreload; removed the temporary workflow afterwardbun run lintandbun run test:unitcleanly