#3551·Archon

OpenCode provider: fail fast on permission events instead of hanging

Author: ThorStarlordCreated Sep 30, 2026Updated Sep 30, 2026

Problem

The OpenCode provider treats a turn as finished only on a session.idle event and has no handling for OpenCode permission events (packages/providers/src/community/opencode/session.ts). When a tool needs approval — the ship writes to the Archon artifacts directory, outside the working directory, so OpenCode raises an external_directory permission request — the session pauses waiting for an answer. Nobody answers inside Archon, no further events arrive, and the node hangs silently until Archon's idle timeout (30 min) fails it.

Evidence

Discovered live during Dark Factory's E2E-6 qualification. The OpenCode server log showed, at each stall instant:

message=evaluated permission=external_directory pattern="C:\...\.archon\workspaces\...\artifacts\runs\<run>\*" action=allow
message=asking id=per_... permission=external_directory patterns=[...]

The stall reproduced with both [email protected] and 1.18.32, with two models, and only via Archon (the same CLI+model completed outside it). external_directory defaults to "ask". Every other tool permission resolved allow; only external_directory asked.

Proposed fix (fail fast, do not auto-approve)

When the provider observes a permission event for the session, fail the step immediately with a clear, typed error naming the permission kind and patterns, instead of waiting for the idle timeout. Do not auto-approve — the current safe posture is that the operator supplies an OpenCode config that allowlists exactly what is needed (OPENCODE_CONFIG), and the provider should refuse loudly when a request was not pre-allowed.

Workaround in use

An Archon-only OpenCode config passed via OPENCODE_CONFIG that allowlists external_directory for the Archon workspaces tree. This makes runs proceed but leaves the silent-hang failure mode for anything not allowlisted.

Reference

Dark Factory E2E-6 receipt, finding F16: dark-factory docs/qualification/2026-09-26-outer-loop-e2e-006.md §5.5. Pinned Archon in use: 611b53d051d7ec4657023e3663076c710fc31369.