Skip to content

feat(server): t3_workflow_run takes templates and shows grown agents as they are added - #20

Merged
EtanHey merged 4 commits into
wf/integrationfrom
wf/10b-grow-tool
Oct 31, 2026
Merged

EtanHey merged 4 commits into
wf/integrationfrom
wf/10b-grow-tool

Conversation

@EtanHey

@EtanHey EtanHey commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Size: S. 10+/2− hand-written, plus 93 lines of tests. Stacked on #19 (wf/10-grow-within); merge that first, then retarget this PR to wf/integration.

Problem

#19 lets a repeat grow within one run from its judge's result. Etan, verbatim: "In an inner loop workflow, the workflow grows within. It doesn't need to go out and get to the one who created it." and "the growth within is deterministic upon what the judge ... decides". For agents to use this, two things were still missing:

  • t3_workflow_run didn't tell them about it.
  • The service didn't check template targets before a run started. A template with a bad model would only fail later, mid-run, when the judge grew it.

Design

  • Up-front checks. WorkflowRuns.run checks every template's target before anything starts, the same way it checks spec agents. That includes refusing environmentId.
  • Tool description. It now mentions dry?, templates?:{name:{task}}, the judge's addAgents:[{key, template, input}] and rerun:[stage], and {{input.x}}.
  • Rows for added agents. They need no change in the service: feat(server): a workflow repeat grows within one run from its judge's result #19 records each added agent as a launch, so it shows up as a queued row with the right phaseIndex (its stage) and attempt (its round). wf/9-ui-parity draws every phase up front and adds per-agent model and timings; this PR leaves that to wf/9 and only supplies the rows.

Tests

One service test drives the real orchestrator: shows a judge's grown agents queued under their phase and round, within 2 KB per update.

  • The judge's round-1 result adds 17 probes and sets rerun: ["critique"], so the run grows to 20 agents.
  • When the last added row (probe-17) appears, the row's round-2 agents are exactly those 17, all queued, phase draft, attempt 2, and nothing from round 2 has started yet.
  • Each probe gets {{input.angle}} filled in.
  • The run ends exit: "accepted", and every row update stays within 2 KB.

I wrote this test before the per-update split in #19. Recording all 17 added agents in one update measured 2,439 B, over the cap. That measurement is why #19 records them one per update.

Bytes

Budget Test Measured
MCP tool list, cap +1,200 B over upstream AgentContextBudget.test.ts 46,990 → 47,106 B (+116 B; after review round 1 it also covers dry:N and addAgents.stage?). The stack total is +1,199 B over upstream 45,907.
Agent instructions AgentContextBudget.test.ts +0 B: Claude 5,135, Codex 6,865, unchanged
Per-update wire, ≤ 2 KB without results the new service test largest update 1,436 B for a run grown to 20 agents
Per-update wire, ≤ 2 KB without results keeps every workflow row update within 2 KB… (20 static agents) largest update 1,465 B, unchanged

Not run

The paid mcp-tool-use evals: this worktree has no eval API keys. evals/mcp-tool-use/run.test.ts, which tests the grader and its decoding of real specs, passes 411/411.

I didn't add an eval case for growth: the case rule says a new case must be shown to fail on the old text first, and I couldn't run one.

Demo

inner-loop-grow-demo.json in the plan folder is a Haiku haiku inner loop:

  • 2 drafters, a reader, and a critic who judges and grows the next round;
  • the critic can add critics, red-teamers or rewriters, using the critic, redteam and rewriter templates;
  • dry: 2, max: 4.

node wf10/decode-demo.mjs decodes it with the real decoder, then drives the real runner with scripted critic results:

decoded: haiku-grow-within, 2 stages, real decoder OK
round 2: … draft.syllable-fix … probe.imagery-critic … probe.cliche-redteam …
loop exit: dry; run: completed

Gate

  • gate.sh wf/10-grow-within: green. Lint 3 files, 0 diagnostics; fmt clean; apps/server typecheck; WorkflowRuns.test.ts 9/9.
  • gate.sh fork/wf/integration on the stack: green. 6 files linted; apps/server and packages/contracts typecheck; 31/31 tests.
  • AgentContextBudget, McpHttpServer and OrchestratorMcpToolkit.integration: 30/30.

Merged the updated #19 (with #18) in (420c7562c5)

Implementer: Claude Opus 5.5. Review rounds: 1. Codex approved #20. Its tool-text SHOULD (dry? had no meaning; addAgents.stage? was missing) is fixed in 0d53251e2a, at +1 B.

🤖 Generated with Claude Opus 5.5 in T3 Code Nightly

…as they are added

t3_workflow_run checks every template's target before it starts, and its description
names templates, dry, addAgents, rerun and {{input.x}} (+115 B of tool list). A service
test grows a run to 20 agents: the 17 grown rows show queued under their phase and round
before round 2 starts, and every row update stays within 2 KB.

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:S Small, bounded pull request labels Oct 31, 2026
EtanHey and others added 3 commits October 31, 2026 04:44
…t can name its stage

The description advertised dry? without its meaning and left out addAgents' stage?.
It now says dry:N ends the loop after N rounds that add no agents and ask for no rerun,
within the same tool-list budget (47,106 B, +1 B over the previous text).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	apps/server/src/mcp/WorkflowRuns.test.ts
#	apps/server/src/mcp/WorkflowRuns.ts
@EtanHey
EtanHey changed the base branch from wf/10-grow-within to wf/integration October 31, 2026 03:07
@EtanHey
EtanHey merged commit c09f44c into wf/integration Oct 31, 2026
9 of 12 checks passed
@EtanHey
EtanHey deleted the wf/10b-grow-tool branch November 2, 2026 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S Small, bounded pull request 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