8000 refactor(harness)!: retire the subagent tool by geminixiang · Pull Request #190 · geminixiang/mikan · GitHub
[go: up one dir, main page]

Skip to content

refactor(harness)!: retire the subagent tool - #190

Merged
geminixiang merged 4 commits into
mainfrom
refactor/retire-subagent
Oct 18, 2026
Merged

geminixiang merged 4 commits into
mainfrom
refactor/retire-subagent

Conversation

@geminixiang
@geminixiang geminixiang commented Oct 18, 2026 •
Copy link
Copy Markdown
Owner

What

Retire the subagent tool. A conversation now does the work itself; Pi already runs one turn's tool calls in parallel, and Slack direct messages keep start_task for long work. ADR 0028 supersedes ADR 0020.

Removed: the tool, built-in and <workspace>/agents/*.md profiles, the slot pool, the progress dashboard, the Slack persona posting for a profile's answer, and the subagent telemetry. 53 files, +115 / −4,434 lines.

Why

docs/research/delegation-cost-2026-10.md: on measured tasks, parallel subagents shared one small sandbox (1 CPU, 512 MB), ran CPU work slower than in sequence and OOM-killed npm install, missed the provider cache with every new child, and cost 2–3× more than direct work.

Context isolation, checked before deciding

The one remaining reason to keep a subagent was keeping a large investigation out of the parent's context. A single-task variant was built and measured on this branch (commit a0c494a, reverted in 88547d4):

  • A parent doing the work itself searches for what it needs; a child starts without context and reads what it is pointed at.
  • Lab: six 24 KB reports, then three follow-ups. Directly: $0.029–0.049, follow-up prompts 38–42k. Through a subagent: $0.063–0.068, follow-up prompts 40–43k, one follow-up wrong.
  • The simpler tool made the model delegate the three-repository task in 3 of 3 runs at about twice the cost.

So the PR removes the tool entirely, as Pi keeps subagents out of its core. Details: experiment 7 in the research doc.

Acceptance eval

Local daemon, real Slack, cliproxyapi gpt-6-luna, same harness and fixtures (complex.mjs). Baseline is main from the research runs. Median seconds to the final reply (range) | score per rep | median cost (assumed prices, for comparison only).

Case Baseline (main) This branch
C2 sales report, channel 42 s (41–43) · 10/10 ×2 · $0.027 · subagent 2/2 14 s (14–17) · 10/10 ×3 · $0.021
C3 three packages, DM 70 s (67–74) · 36/36 ×2 · $0.117 · subagent 2/2 46 s (39–53) · 36/36 ×2 · $0.059
C1 fix a package, DM 54 s (48–61) · 12/12 ×2 · $0.054 48 s (44–51) · 12/12 ×2 · $0.050
C4 three repos, channel 66 s (54–82) · 14, 14, 14 · $0.032 51 s (49–63) · 12, 14, 14 · $0.045
C4 three repos, channel, "use parallel subagents" 148 s (122–175) · 12, 12, 14 · $0.107 106 s (84–114) · 14, 11, 14 · $0.041
L1 three 90 s waits, channel 109 s (108–115) · 3/3 ×3 · $0.031 100 s (100–292) · 3/3 ×3 · $0.015
L1 three 90 s waits, channel, "parallel" 108 s (107–112) · 3/3 ×3 · $0.029 101 s (99–101) · 3/3 ×3 · $0.013

Accepted regressions, both measured:

  • L1 channel, 1 of 3: the model ran the three waits one per turn (292 s). With subagents it always fanned out. The same happens in DMs on main (1 of 3 in the research runs).
  • C4 channel, 1 of 3 in each variant: the model ran three npm installs at once through codemode and the 512 MB sandbox killed one (exit 137), so one or two test counts were missing. Parallel subagents hit the same OOM on main (2 of 3). The cause is the sandbox size under parallel work, not delegation; it is a separate follow-up.

Compatibility

  • ConversationResponder drops the optional replaceSubagentProgress and respondAsRole; Workspace drops agentsDir. An embedder that set or read them must drop them.
  • <workspace>/agents/*.md is ignored.
  • Slack's chat:write.customize stays in the manifest so installed apps need no scope change; docs say it is unused.

Verification

  • New test the model is offered no subagent tool fails on main and passes here.
  • lint, fmt:check, knip, typecheck, build, full test suite (2,063 passed), duplication guard.
  • Slack E2E workflow on this branch: run 39088287133 passed on attempt 3. Attempts 1 and 2 each failed one different test on a model slip unrelated to this change: the model scheduled a "10 seconds from now" event about two minutes out (event-thread-fork), and it mistyped an attachment path (multi-file-upload, ENOENT on a path missing two characters).
  • Site docs updated in en / ja / zh-cn / zh-tw.

A conversation now does delegated work itself. Measured on real tasks,
parallel subagents shared one small sandbox and were slower, dearer, and
less correct than direct work, and Pi already runs a turn's tool calls in
parallel. start_task stays for direct messages. ADR 0028 supersedes 0020.

BREAKING CHANGE: ConversationResponder drops replaceSubagentProgress and
respondAsRole; Workspace drops agentsDir; <workspace>/agents profiles are
ignored.
Production subagents read a median 56k tokens and returned about 190,
so isolation keeps large investigations out of the parent's context.
The tool now takes one task, gives the child the parent's model and
tools, and has no profiles, batches, DAG, dashboard, budget, or timeout.
ADR 0028 records the measurements.
@cloudflare-workers-and-pages
cloudflare-workers-and-pages Bot commented Oct 18, 2026 •
Copy link
Copy Markdown

Deploying m 9EEF ikan with  Cloudflare Pages  Cloudflare Pages

Latest commit: e5ab5dd
Status: ✅  Deploy successful!
Preview URL: https://5ff7cda0.mikan-1wv.pages.dev
Branch Preview URL: https://refactor-retire-subagent.mikan-1wv.pages.dev

View logs

@geminixiang
geminixiang merged commit ca5e581 into main Oct 18, 2026
6 checks passed
@geminixiang
geminixiang deleted the refactor/retire-subagent branch October 18, 2026 07:02
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.

1 participant

0