Problem
Telemetry from 2026-05-21 (memory/telemetry-analysis-2026-05-21.md, 2,503 machines, 14 days) shows agent_outcome events with agent: "build" reporting 0% completion across 133 invocations. This appears in the P0 triage as a possible routing/aliasing bug.
Root cause
The build agent was renamed to builder at some point. Agent.get() in packages/opencode/src/agent/agent.ts:408 has an alias so Agent.get("build") returns the builder agent — but the telemetry event in packages/opencode/src/session/prompt.ts:1153 records the literal sessionAgentName value, which comes from lastUser.agent. Two places still write "build" instead of the canonical "builder":
packages/opencode/src/tool/plan.ts:56 — when a user exits plan mode via plan_exit, the synthetic user message it creates hardcodes agent: "build". Every plan-exit invocation in the 14-day window funnelled into the phantom build bucket. This is the dominant source.
- Persisted sessions created before the rename may still carry
agent: "build" in their stored state.
The actual execution works fine (via the alias). The "0% completion" reading is a measurement artifact: the dashboard bucket is named after a defunct agent that nothing actively succeeds against. Real builder completion is recorded under the correct name.
Fix
Three changes:
tool/plan.ts:56 — write agent: "builder" (the current canonical name)
session/prompt.ts:1153 — normalize agent at the telemetry-emit boundary: if sessionAgentName === "build", emit "builder". Belt-and-suspenders for any persisted-session that still references the old name.
cli/cmd/github.ts:954 — update stale comment that referenced the old fallback name.
Expected telemetry impact
The phantom build bucket disappears. Plan-exit invocations now fold into builder's real completion rate. The "0% completion" reading vanishes.
Problem
Telemetry from 2026-05-21 (
memory/telemetry-analysis-2026-05-21.md, 2,503 machines, 14 days) showsagent_outcomeevents withagent: "build"reporting 0% completion across 133 invocations. This appears in the P0 triage as a possible routing/aliasing bug.Root cause
The
buildagent was renamed tobuilderat some point.Agent.get()inpackages/opencode/src/agent/agent.ts:408has an alias soAgent.get("build")returns thebuilderagent — but the telemetry event inpackages/opencode/src/session/prompt.ts:1153records the literalsessionAgentNamevalue, which comes fromlastUser.agent. Two places still write"build"instead of the canonical"builder":packages/opencode/src/tool/plan.ts:56— when a user exits plan mode viaplan_exit, the synthetic user message it creates hardcodesagent: "build". Every plan-exit invocation in the 14-day window funnelled into the phantombuildbucket. This is the dominant source.agent: "build"in their stored state.The actual execution works fine (via the alias). The "0% completion" reading is a measurement artifact: the dashboard bucket is named after a defunct agent that nothing actively succeeds against. Real
buildercompletion is recorded under the correct name.Fix
Three changes:
tool/plan.ts:56— writeagent: "builder"(the current canonical name)session/prompt.ts:1153— normalizeagentat the telemetry-emit boundary: ifsessionAgentName === "build", emit"builder". Belt-and-suspenders for any persisted-session that still references the old name.cli/cmd/github.ts:954— update stale comment that referenced the old fallback name.Expected telemetry impact
The phantom
buildbucket disappears. Plan-exit invocations now fold intobuilder's real completion rate. The "0% completion" reading vanishes.