You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This started as the v0.8.68 entrypoint/wiring issue: the workflow runtime
crates compiled and tested, but the TUI exposed no model-facing workflow
tool, no normal user path led from a model turn into a workflow run, and the
JS-authoring -> typed plan -> sub-agent execution -> bounded events -> TUI run
view bridge was missing. Since then most of that bridge has landed on main
(evidence below). What remains of this lynchpin for v0.9.2 is the telemetry
and boundedness half of the original scope: per-worker usage telemetry in the
run event stream (which #4039 needs to render Tokens/Tools columns without
scraping transcripts), and bounding the run-record payloads the tool returns
to the parent transcript. Per the maintainer cutline decision (2026-07-17),
this issue moves to v0.9.2 together with #4175, #4177, #4178, and #4179;
landed groundwork stays (#4297, #4299, #4300, #4306, #4307, #4325).
Current evidence
Shipped (verified on main, workspace version 0.9.1):
Tool registration: crates/tui/src/tools/registry.rs::with_subagent_tools
registers WorkflowTool unconditionally alongside AgentTool and the agents/* coordination tools — no feature flag needed.
Tool surface: crates/tui/src/tools/workflow.rs::WorkflowTool with actions start/run/status/cancel (parse_workflow_action), sources script/source_path/plan (workflow_source), fleet, token_budget, wait, verify. read_workflow_source_path confines source_path to the
workspace unless trust_mode, so workflows/*.workflow.js runs work.
Run driver: SubAgentWorkflowDriver in the same file bridges each VM task(...) to crates/tui/src/tools/subagent/mod.rs::spawn_workflow_task
— one delegation axis, no revived agent_swarm (the /swarm-style entry
the 2026-06-12 Kimi audit comment warned about does not exist; entry is /workflow -> workflow tool, matching that guidance).
Events: WorkflowUiEventKind (run_started/phase_started/task_started/
task_completed/gate_updated/handoff_promoted/budget_updated/...) flows as Event::WorkflowUi (crates/tui/src/core/events.rs, v0.9.0 2.5: route workflow events to panel and compact history card #4122) into crates/tui/src/tui/tool_routing.rs::apply_workflow_ui_event -> WorkflowPanel
and history cards.
Bare /workflow behavior: the 2026-07-07 comment recorded a 0.8.68-branch
fix making bare /workflow local-help-only (commit 7ae540204; not in
main's history). Main supersedes that: bare /workflow is a deliberate
context-dependent opt-in that authorizes orchestrating the current work
(test bare_workflow_is_context_dependent_opt_in in crates/tui/src/commands/groups/core/workflow.rs).
WorkflowUiEventKind::TaskCompleted carries only task_id + status. No
per-worker token count, tool-call/step count, duration, or artifact handle,
although the manager already tracks them (SubAgentResult::steps_taken, SubAgentResult::duration_ms, AgentRunUsage totals in crates/tui/src/tools/subagent/mod.rs). crates/tui/src/tools/workflow.rs::completion_from_manager maps the
terminal snapshot to TaskCompletion status+text and drops usage.
WorkflowRunRecord.events is an unbounded Vec<WorkflowUiEvent> and workflow_result_for serializes the entire record (all events, full result, full execution) into the parent transcript on every status
call and final result — high-fan-out runs bloat the transcript the panel
exists to protect.
Scope
Extend the per-task completion telemetry: add tokens_total (plus
input/output when available), tool_calls (from steps_taken), duration_ms, and an optional result/artifact reference to the task_completed UI event, sourced from the manager record in completion_from_manager / the driver delivery path
(crates/tui/src/tools/workflow.rs).
Reconcile per-run usage totals into run_completed (aggregate helper WorkflowUsage already exists in crates/workflow/src/lib.rs).
Bound the model-facing payloads: cap WorkflowRunRecord.events retention
(summary + bounded tail; the full stream already persists in .codewhale/workflow-runs.jsonl) and make workflow_result_for / status_workflow return compact summaries with large child output
retrievable by reference, not pasted inline.
Keep WORKFLOW_HANDOFF_MAX_CHARS (4000) handoff compaction and gate
receipts unchanged; telemetry fields must not alter gate semantics.
Update the workflow_panel.rs JSON event parser contract note so v0.9.2 Workflow: background task phase ledger UI #4039
can consume the new fields (WorkflowPanelEvent::from_json_value must
tolerate their absence for old journals).
Tests: task_completed carries usage for a completed child; run_completed
totals match the sum; status payload for a simulated 30+ event run stays
under the cap; journal round-trip with and without the new fields.
Key files
crates/tui/src/tools/workflow.rs
crates/tui/src/tools/subagent/mod.rs
crates/workflow-js/src/driver.rs
crates/workflow/src/lib.rs
crates/tui/src/core/events.rs
crates/tui/src/tui/tool_routing.rs
crates/tui/src/tui/widgets/workflow_panel.rs
Acceptance criteria
A model turn can call workflow(...) with source_path pointing at a
checked-in workflows/*.workflow.js example and the run dispatches
children through spawn_workflow_task (already true — keep green).
task_completed events include worker tokens, tool-call/step count,
and duration; run_completed includes run totals.
workflowstatus/final results stay bounded for a high-fan-out run;
full event history remains available via .codewhale/workflow-runs.jsonl
and child output via receipts/references, not inline text.
Existing plan approval, gate, and handoff behavior is unchanged
(plan_approval receipt still present in result metadata).
cargo test -p codewhale-workflow and cargo test -p codewhale-workflow-js stay green.
New tests cover telemetry emission, total reconciliation, and payload
caps.
Verification
cargo fmt
cargo test -p codewhale-workflow
cargo test -p codewhale-workflow-js
cargo test -p codewhale-tui --bin codewhale-tui --locked workflow
cargo test -p codewhale-tui --bin codewhale-tui --locked workflow_panel
Problem
This started as the v0.8.68 entrypoint/wiring issue: the workflow runtime
crates compiled and tested, but the TUI exposed no model-facing
workflowtool, no normal user path led from a model turn into a workflow run, and the
JS-authoring -> typed plan -> sub-agent execution -> bounded events -> TUI run
view bridge was missing. Since then most of that bridge has landed on
main(evidence below). What remains of this lynchpin for v0.9.2 is the telemetry
and boundedness half of the original scope: per-worker usage telemetry in the
run event stream (which #4039 needs to render Tokens/Tools columns without
scraping transcripts), and bounding the run-record payloads the tool returns
to the parent transcript. Per the maintainer cutline decision (2026-07-17),
this issue moves to v0.9.2 together with #4175, #4177, #4178, and #4179;
landed groundwork stays (#4297, #4299, #4300, #4306, #4307, #4325).
Current evidence
Shipped (verified on
main, workspace version 0.9.1):crates/tui/src/tools/registry.rs::with_subagent_toolsregisters
WorkflowToolunconditionally alongsideAgentTooland theagents/*coordination tools — no feature flag needed.crates/tui/src/tools/workflow.rs::WorkflowToolwith actionsstart/run/status/cancel(parse_workflow_action), sourcesscript/source_path/plan(workflow_source),fleet,token_budget,wait,verify.read_workflow_source_pathconfinessource_pathto theworkspace unless
trust_mode, soworkflows/*.workflow.jsruns work.SubAgentWorkflowDriverin the same file bridges each VMtask(...)tocrates/tui/src/tools/subagent/mod.rs::spawn_workflow_task— one delegation axis, no revived
agent_swarm(the/swarm-style entrythe 2026-06-12 Kimi audit comment warned about does not exist; entry is
/workflow->workflowtool, matching that guidance).codewhale-workflow-js(WorkflowVm,WorkflowDrivertrait,WORKFLOW_MAX_CONCURRENT = 16incrates/workflow-js/src/lib.rs).WorkflowUiEventKind(run_started/phase_started/task_started/task_completed/gate_updated/handoff_promoted/budget_updated/...) flows as
Event::WorkflowUi(crates/tui/src/core/events.rs, v0.9.0 2.5: route workflow events to panel and compact history card #4122) intocrates/tui/src/tui/tool_routing.rs::apply_workflow_ui_event-> WorkflowPaneland history cards.
crates/tui/src/tools/workflow_plan_approval.rs(v0.9.0 2.9: add approval card for elevated Workflow plans #4126)with durable
plan_approvalreceipts on the run record;codewhale_config::WorkflowConfigToml(crates/config/src/lib.rs)..codewhale/workflow-runs.jsonljournal(
crates/tui/src/tools/workflow.rs::journal::WorkflowWorkspaceState),hydrated across tool-registry rebuilds.
/workflow [objective|status|cancel <run_id>](
crates/tui/src/commands/groups/core/workflow.rs); CLIcodewhale workflow run(crates/cli/src/lib.rs::run_workflow_command,v0.9.1 Phase 2: Workflow steps reference Fleet roles (not raw prompts/profiles) #4177/v0.9.1: Stopship workflow as fleet-backed lane (dogfood #4090/#4093/#4094) #4178) and the hidden Lane dispatcher
codewhale-tui workflow-tool(
crates/tui/src/main.rs::run_workflow_tool_command)./workflowbehavior: the 2026-07-07 comment recorded a 0.8.68-branchfix making bare
/workflowlocal-help-only (commit7ae540204; not inmain's history). Main supersedes that: bare
/workflowis a deliberatecontext-dependent opt-in that authorizes orchestrating the current work
(test
bare_workflow_is_context_dependent_opt_inincrates/tui/src/commands/groups/core/workflow.rs).crates/tui/src/tools/verifier.rs::run_workflow_completion_gatesbehind the
verifyflag; lane gates surface asGateStatusLine(v0.9.1 Phase 3: Workflow gates and handoffs between Fleet roles #4179).Remaining gaps (verified):
WorkflowUiEventKind::TaskCompletedcarries onlytask_id+status. Noper-worker token count, tool-call/step count, duration, or artifact handle,
although the manager already tracks them (
SubAgentResult::steps_taken,SubAgentResult::duration_ms,AgentRunUsagetotals incrates/tui/src/tools/subagent/mod.rs).crates/tui/src/tools/workflow.rs::completion_from_managermaps theterminal snapshot to
TaskCompletionstatus+text and drops usage.WorkflowRunRecord.eventsis an unboundedVec<WorkflowUiEvent>andworkflow_result_forserializes the entire record (all events, fullresult, fullexecution) into the parent transcript on everystatuscall and final result — high-fan-out runs bloat the transcript the panel
exists to protect.
Scope
tokens_total(plusinput/output when available),
tool_calls(fromsteps_taken),duration_ms, and an optional result/artifact reference to thetask_completedUI event, sourced from the manager record incompletion_from_manager/ the driver delivery path(
crates/tui/src/tools/workflow.rs).run_completed(aggregate helperWorkflowUsagealready exists incrates/workflow/src/lib.rs).WorkflowRunRecord.eventsretention(summary + bounded tail; the full stream already persists in
.codewhale/workflow-runs.jsonl) and makeworkflow_result_for/status_workflowreturn compact summaries with large child outputretrievable by reference, not pasted inline.
WORKFLOW_HANDOFF_MAX_CHARS(4000) handoff compaction and gatereceipts unchanged; telemetry fields must not alter gate semantics.
workflow_panel.rsJSON event parser contract note so v0.9.2 Workflow: background task phase ledger UI #4039can consume the new fields (
WorkflowPanelEvent::from_json_valuemusttolerate their absence for old journals).
totals match the sum; status payload for a simulated 30+ event run stays
under the cap; journal round-trip with and without the new fields.
Key files
Acceptance criteria
workflow(...)withsource_pathpointing at achecked-in
workflows/*.workflow.jsexample and the run dispatcheschildren through
spawn_workflow_task(already true — keep green).task_completedevents include worker tokens, tool-call/step count,and duration;
run_completedincludes run totals.workflowstatus/final results stay bounded for a high-fan-out run;full event history remains available via
.codewhale/workflow-runs.jsonland child output via receipts/references, not inline text.
(
plan_approvalreceipt still present in result metadata).cargo test -p codewhale-workflowandcargo test -p codewhale-workflow-jsstay green.caps.
Verification
Out of scope
stopship lane, v0.9.1 Phase 3: Workflow gates and handoffs between Fleet roles #4179 gate hardening) — same v0.9.2 cluster, separate issues.
(v0.9.4 WhaleFlow: worktree pool management for parallel agent isolation #4016).
agent_swarmtool/card path (v0.8.5 chore(swarm): drop model-callable agent_swarm tool surface #332/v0.8.5: drop /swarm + agent_swarm tools; polish agent_spawn #336 retired it;the Kimi audit comment reaffirms: swarm-style entry stays a workflow run
intent).
Related
codewhale-workflow/codewhale-workflow-js).agent_swarm.Triage note: body restructured for agent execution on 2026-07-18; prior
comment refinements folded in. Original wording preserved in edit history.