v2: permission.replied not mapped to v1 shape, so child permission waits never clear (root cause of #1356)
Summary
On OpenCode v2, mapV2EventToV1 translates permission.asked into the v1 shape but lets permission.replied through unchanged. routeChildInputWait reads event.properties, and a raw v2 event has no properties, so a child's permission wait is never cleared once it has been answered. The parent orchestrator keeps seeing waiting_input, and task_reply fails with Permission request not found. I think this is the root cause of the symptoms in #1356, including the OpenChamber auto-accept case described in the comments there.
Environment
- OpenCode 2.0.19 / 2.0.20 (
@opencode/cli, Linux x64) - oh-my-opencode-slim 2.2.25. I also checked the published 3.0.1 bundle:
mapV2EventToV1is unchanged, so 3.0.x is affected too. - OpenChamber 2.0.4 with permission auto-accept. Background children hit permission prompts that the UI answers automatically.
Root cause
In dist/server/index.js (3.0.1):
payloadOf(event)returnsevent.datafor v2 events.mapV2EventToV1(event)starts without = [event](raw passthrough) and then adds v1 translations forsession.execution.*,form.replied,form.cancelledandpermission.asked(throughpermissionAskedToV1). It has no branch forpermission.replied.- OpenCode v2 defines the event as
permission.repliedwith schema{ sessionID, requestID, reply }carried indata. The OpenCode binary itself consumes it asA.data.sessionID/A.data.requestID. routeChildInputWaitreadsinput.event.properties?.sessionID. For the raw v2 event that value isundefined, so the function returns early and never reachesclearChildInputWait(sessionID, requestID).
The wait opens correctly because the permission.asked translation fills properties.id / properties.sessionID, but it never closes.
docs/opencode-v2-compatibility.md says "permission.replied passes through raw — v2's shape already matches the v1 event". That no longer holds, because the v2 payload is in data, not properties.
Evidence
- Across 173 local
oh-my-opencode-slim.*.logfiles: 5background child input wait openedlines and 0background child input wait resolvedlines, even though every one of those permissions was answered (auto-accepted) and the children went on to complete. - In the orchestrator, the parent is repeatedly reminded that the child is waiting.
task_replythen fails withPermission request not foundbecause OpenCode has already removed the request. This matches #1356. - Side effect: the orchestrator may needlessly revive or cancel children that are in fact running normally.
Suggested fix
In mapV2EventToV1, next to the permission.asked branch:
} else if (type === "permission.replied") {
if (typeof props.sessionID === "string" && typeof props.requestID === "string") {
out.push({
type: "permission.replied",
properties: { sessionID: props.sessionID, requestID: props.requestID, reply: props.reply },
});
}
}(props = payloadOf(event), as elsewhere in the function.) Consumers that only look at event.type (for example the companion manager's onInputResolved) keep working, and routeChildInputWait gets the properties it expects. Treating Permission request not found from task_reply as "already resolved" (as proposed in #1356) would still be a useful extra safety net.
Related: #1356 (symptom), #1374 (v2 default permissions, same area), #1297.
Diagnosis note: this analysis (bundle reading, OpenCode binary schema check, log correlation) was done by Claude Opus 5.5 running as a coding agent under my direct supervision. I reviewed the findings before filing.
Source: alvinunreal/oh-my-opencode-slim