Skip to content

fix(server): server-run workflows list every phase up front with each agent's model and time - #18

Merged
EtanHey merged 3 commits into
wf/integrationfrom
wf/9-ui-parity
Oct 31, 2026
Merged

EtanHey merged 3 commits into
wf/integrationfrom
wf/9-ui-parity

Conversation

@EtanHey

@EtanHey EtanHey commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Size: M (320 hand-written non-test lines added, 96 removed; 529 test lines). 3 commits: the change, plus review rounds 1 and 2.

Problem

Etan watched a live t3_workflow_run and said: "the UI does not work like the Claude Code native Workflows UI ... workflow starts, it only shows the first phase, and then when the first phase finishes, only then the second one shows." He also said the agents "show as not reported for the type of agent it is", and that no agent or phase showed a run time.

The cause: the row's workflow.agents held only launched agents, and Lineage hides phases that have no members. Agents carried no model, so resolveSubagentMetadata printed "Not reported". They had no timestamps, so neither member rows nor phase headers had anything to time.

Change

  • All phases up front. workflowPhases(spec, state) lists every stage. A repeat's stages appear once per round reached, with round 1 listed up front and titled revise · round 1.
    • toRow emits every agent of every phase in phase order, and agents the run hasn't launched are queued.
    • A later round's stages join when the round starts. They're inserted before the stages that follow the repeat.
    • The phase list is derived from workflowRun (cursor, round, exits), so restore recomputes it. snapshotOf maps phaseIndex back to a stage and round.
    • An agent that is queued with no queuedAt hasn't launched yet.
  • Model, provider and effort.
    • Before launch, checkTarget returns the ModelSelection that delegate_task resolves, with the parent's defaults filled in.
    • Once a child exists, the member takes providerInstanceId, model and effort from the child's own run (run.modelSelection). That applies even when the parent's model changed in between.
    • A later round is planned with what round 1 actually ran.
    • Effort is read as reasoningEffort ?? effort, the same way ProviderEventIngestor reads it.
  • Times come from the child's persisted runs, not from when the runner observes them.
    • startedAt is the child's first run's startedAt. Until that run starts, its requestedAt stands in, so a live row can tick.
    • completedAt is the last run's completedAt, and durationMs is the difference.
    • They're read when the child is delegated and again when it settles, including a settle the server only sees after a restart.
    • The runner keeps only queuedAt, which is its own persisted launch decision.
  • Never-started members. When a run ends before a planned agent launches, the client marks that member notStarted. It has no completion time, it isn't counted in settledCount, and its phase stays pending.
    • Web Lineage says "not started" for the phase, in the member's screen-reader text and in its tooltip.
    • Mobile shows "Not started", and the rail tone is queued.
  • Row version. workflowRun.version = 2 is written on every row update.
    • A row without it comes from the earlier layout. Per the lead's ruling there's no migration: the row is never expanded or resumed, and clients render it as it is.
    • On recovery, a running legacy row cancels its live children and fails with error: "This run was recorded by an older T3 build, so it cannot be resumed.". That wakes the parent once.
    • t3_workflow_status reports the same reason.
  • Contract. Two new optional fields: OrchestrationV2WorkflowAgent.providerInstanceId and OrchestrationV2WorkflowRunState.version.
  • Clients, from round 0.
    • A phase whose members are all queued is pending.
    • RuntimeSubagent carries the member's providerInstanceId. Web Lineage and the mobile Agents sheet use it before a child task exists.
    • The web tooltip shows the agent's effort.
    • The mobile Agents sheet opens on the last phase a member started.

Provider decision: the change is provider-agnostic. Each member's provider, model and effort come from delegate_task's resolver, and then from the child's own run. Claude-native workflow ingestion (claudeWorkflowProgress.ts) is untouched.

Tests that failed first

Round 0:

  • "lists every phase and agent, with its model and effort, in the run's first update". It failed with titles ['draft','revise','review','ship'] and no model, effort or provider fields.
  • "times each agent and adds a later round before the stages after it". It hung, because the round 2 phase never appeared.
  • subagentRuntime.test.ts, "leaves a phase of only queued members not started, and keeps each member's provider". The phase came out as running.
  • threadAgentsPresentation.test.ts, "opens where a stopped run stopped, not a planned phase it never reached". It returned "2" instead of "1".

Round 1, for the review's 4 MUST_FIX findings:

  1. Timing.
    • "times an agent from its child's run, even one that ended while the server was down". It reported completedAt as the observation time, 10 s later than the child's 1 s run.
    • "times each agent ..." now starts each child's run 500 ms after delegation. It reported the delegation ack as startedAt.
  2. Model. "shows the model a child actually runs once it starts, not the planned one". It reported codex/gpt-5.4 for a child that ran claudeAgent/claude-sonnet-5-5 at effort low.
  3. Never-started. subagentRuntime.test.ts, "planned members a run never launched: stay not started, unsettled and untimed when the coordinator is failed/cancelled". The phase came out done with 1 settled. The mobile rail-tone assertion got stopped instead of queued.
  4. Legacy. "fails a running row an older build recorded instead of resuming it". It hung, because the runner resumed the old row.

Round 2, for the review's 2 MUST_FIX findings:

  1. Start time after a timeout. "keeps a child's real start when the run times out after it started". The member kept the child's request time (+0) instead of its run start (+500). Fix: every launched child's runs are read again just before the run's terminal row is written.
  2. Planned effort. "drops a planned effort once the child runs a model without one". The member kept effort: "low" on a child that ran Claude Sonnet with no effort. Fix: once a child's facts exist, the member shows the child's whole target and none of the plan.

The parent-wake helper in WorkflowRuns.test.ts now waits on a SubscriptionRef for the offer, which follows the row's commit, instead of reading it once. The old single read only passed because of scheduling order.

All tests drive time with TestClock and wait on persisted row and child events, with no sleeps.

Measured bytes (largest workflow row update on the wire, deduped, results excluded)

Test: keeps every workflow row update within 2 KB on the wire across a 20-agent stage and 3 rounds. It now runs at a real epoch (TestClock.setTime(1_793_404_800_000)), so every timestamp costs its full 13 digits.

Case Before (base) Round 0 (clock at 0) Round 1 (real epoch) Budget
20-agent fan-out + 3-round repeat, accepted 1,465 B 1,739 B 1,793 B ≤ 2,048 B
20-agent fan-out, stopped mid-run 1,435 B 1,525 B 1,580 B ≤ 2,048 B

The record event carries the full plan, so it isn't budgeted, the same as before: the record already carries the spec once. Each later update is a delta. The tool list and agent instructions are unchanged, and AgentContextBudget.test.ts passes.

Gate

bash gate.sh fork/wf/integration at 82651a9492:

  • lint: 13 files, 0 diagnostics;
  • fmt clean;
  • typecheck green for apps/mobile, apps/server, apps/web, packages/client-runtime and packages/contracts;
  • tests: mobile 29/29, server WorkflowRuns.test.ts 15/15, client-runtime 15/15;
  • result: gate: green against fork/wf/integration.

Also run: workflowRun.test.ts, claudeWorkflowProgress.test.ts, orchestrationV2DedupedBodies.test.ts, OrchestratorMcpService.test.ts and AgentContextBudget.test.ts, 73/73 green.

Not done: no live client capture yet. That belongs to the lead's integrated pass on the dev env.

Implementer: Claude Opus 5.5. Review rounds: 2.

  • Round 1: Codex found 4 defects: observation-time timing, the planned model after launch, never-started members shown as failed, and legacy rows mis-expanded. All are fixed in 007a48e5c8.
  • Round 2: Codex found 2 defects: a stand-in start time surviving into the terminal row, and a stale planned effort. Both are fixed in 82651a9492. Wire bytes are unchanged at 1,793 / 1,580 B.

🤖 Generated with Claude Opus 5.5 in T3 Code Nightly

… agent's model and time

A t3_workflow_run row only showed a phase once an agent in it launched, and its
agents carried no provider, model, effort or timestamps, so Lineage and the
mobile Agents sheet showed "Not reported" and no run time.

The row now lists every stage from the spec when the run is recorded (a repeat's
stages labelled round 1), each agent queued. A later round's stages join when
the round starts, before the stages after the repeat. Each agent carries the
provider, model and effort delegate_task resolves for its target, plus queuedAt,
startedAt, completedAt and durationMs. Clients treat a phase of only queued
agents as not started and use a member's own provider before it launches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L Large coherent reviewed change, over 400 added lines labels Oct 31, 2026
EtanHey and others added 2 commits October 31, 2026 04:31
…and old rows fail cleanly

Review of #18 found four gaps. Times were stamped when the runner noticed a
change, so a child that ended during a restart showed the restart time. A
member kept its planned model after its child ran another one. A planned agent
a run never reached showed as failed with a completion time. Rows from the
earlier layout would be expanded with the new one.

Each launched member now reads its provider, model, effort, start and end from
its child's run records when it starts and when it settles. Clients mark a
planned member the run ended before as not started: no completion time, not
settled. The row's workflowRun carries version 2; a running row without it
fails with a reason and cancels its children instead of resuming, and status
reports that reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd drops a planned effort

Review round 2 of #18 found two gaps. A child whose run started after it was
delegated kept its request time as its start when the run ended by timeout or
stop, because nothing read its runs again before the final row. And a member
kept the planned effort when its child ran a model that has none.

Before the run's terminal row, every launched child's runs are read once more.
Once a child's facts exist, the member shows the child's whole target, so a
missing effort stays missing.

The parent-wake test helper now waits for the offer, which follows the row's
commit, instead of reading it once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EtanHey
EtanHey merged commit bebada3 into wf/integration Oct 31, 2026
9 of 11 checks passed
@EtanHey
EtanHey deleted the wf/9-ui-parity branch November 2, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L Large coherent reviewed change, over 400 added lines vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant