Repository navigation
Description
Six findings from migrating the OpenCode V1 runtime surface to scenario tests (#183, PR #208). Nothing was changed in that PR beyond tests and docs — every item below is a product decision. I verified each one against the source rather than taking the migration report at its word, and one of them needs a severity qualification the report did not make.
First, the qualification — who can actually reach this code
runWorkflow, startPlanExecution and RuntimeCommandProjection are exported from the adapter barrel but called by nothing in this repository:
$ grep -rn "\"\./run-workflow\.js\"" packages/adapters/opencode/src --include=*.ts | grep -v __tests__
packages/adapters/opencode/src/start-plan-execution.ts:48
packages/adapters/opencode/src/projection-helpers.ts:32 (type-only)
packages/adapters/opencode/src/index.ts:95,96 (re-export)
So findings 1, 4 and 6 are reachable through the public API of @weaveio/weave-adapter-opencode, not by a user who installs the plugin and runs OpenCode. That does not make them harmless — they are published surface — but it does mean this is not an active production incident, and I would not treat #1 as a hotfix on that basis alone.
1. Running a workflow strips the agents it dispatches
buildConfiguredRunAgentEffect() (packages/engine/src/execution-lifecycle/dispatch.ts:79) emits a placeholder descriptor:
agentDescriptor: {
name: step.agent,
composedPrompt: "",
models: [],
mode: "subagent",
effectiveToolPolicy: evaluateEffectiveToolPolicy(undefined), // every capability -> default
...
}buildProjectEffect hands that straight to the adapter — projection-helpers.ts:65, adapter.spawnSubagent(effect.runAgent.agentDescriptor) — which reconciles it into OpenCode with updateAgent(). The configured agent is overwritten by the placeholder and stays that way for the session:
| before | after | |
|---|---|---|
| prompt | "You are Shuttle, and you know this codebase." |
"" |
| model | anthropic/claude-sonnet-4-5 |
(none) |
| edit / bash | allow |
ask |
| description | (the user's) | [weave-managed] |
A tapestry-execution run does this to shuttle, weft and warp.
The descriptor is a placeholder because the dispatch builder has the WorkflowStep but not the composed agent. The fix is to carry the materialized descriptor to the dispatch site; the shape of that is an engine/adapter boundary question, which is why I am not guessing at it here.
2. The collision protection is not on the live path
SDK reconciliation was deliberately disabled (a config.update() per agent caused an O(n) plugin reload storm), so the config hook is the only materialization mechanism, and it does cfg.agent[name] = tagged unconditionally. A user's own shuttle in opencode.json is silently replaced.
All 42 cases in reconcile-agent.test.ts were exercising a module nothing reaches. This is a second instance of the shape in finding 11 of docs/testing-strategy.md — not a reimplementing double this time, but the same outcome: a protection that is thoroughly tested and not in force.
3. Exported surfaces with no production caller
runWorkflow, startPlanExecution, RuntimeCommandProjection, OpenCodeAdapter.spawnSubagent, plus the constants WEAVE_START_COMMAND / WEAVE_START_LEGACY_COMMAND and WeavePluginOptions.clientFacade (accepted, never read).
The six /weave:* commands the projection layer labels and documents are registered with nothing — only start-work and weave:start exist, both prompt templates dispatching to Tapestry.
This is the same question as #209 for the V2 adapter: delete the surface, or give it a real consumer.
4. startPlanExecution() discards every lifecycle error's cause
Its mapCommandError reads error.message / error.reason, but a command_lifecycle error carries its text on error.cause.message. So an unticked plan reports "Unknown command operation error", while the identical failure through RuntimeCommandProjection.handleStartPlan reports:
Plan ".weave/plans/auth-work.md" has incomplete checkbox(es)
run-workflow.ts's mapper already has the branch this one lacks — so this is a one-sided omission, not a design difference.
5. /weave:health can never report ready
buildOpenCodeHealthReport() declares 12 capabilities, and none of them is among the 7 optional ones (idle-continuation, compaction-recovery, context-window-monitor, analytics-dashboard, eval-integration, static-artifact-generation, multiple-active-workflows). Every undeclared capability counts as missing, so the report is permanently degraded and the success branch is unreachable.
Worth noting how this survived: two of its unit cases asserted outcome === "success" || outcome === "degraded" — the entire union, so the assertion was true no matter what the code did.
6. disable agents ["tapestry"] removes the agent but keeps its commands
Both start-work and weave:start are still registered with agent: "tapestry", pointing at an agent that is no longer there.
Covered
tests/adapters/opencode-runtime.scenario.test.ts in #208 pins every one of these as observed, each with a docblock saying it is recorded and not endorsed. I verified the scenarios bite: suppressing the spawnSubagent call in projection-helpers.ts turns 11 of them red, matching the migration's own mutation table. Whichever fixes land will turn the corresponding scenarios red, which is the intended signal.
🤖 Generated with Claude Code
Activity