v2: permission.replied not mapped to v1 shape, so child permission waits never clear (root cause of #1356)

Author: stevekstevekCreated Sep 30, 2026Updated Sep 30, 2026

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: mapV2EventToV1 is 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):

  1. payloadOf(event) returns event.data for v2 events.
  2. mapV2EventToV1(event) starts with out = [event] (raw passthrough) and then adds v1 translations for session.execution.*, form.replied, form.cancelled and permission.asked (through permissionAskedToV1). It has no branch for permission.replied.
  3. OpenCode v2 defines the event as permission.replied with schema { sessionID, requestID, reply } carried in data. The OpenCode binary itself consumes it as A.data.sessionID / A.data.requestID.
  4. routeChildInputWait reads input.event.properties?.sessionID. For the raw v2 event that value is undefined, so the function returns early and never reaches clearChildInputWait(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.*.log files: 5 background child input wait opened lines and 0 background child input wait resolved lines, 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_reply then fails with Permission request not found because 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:

typescript
} 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