Bug Report
Apologies in advance - I'm filing this with AI assistance as I don't have the bandwidth to debug this further myself.
Environment
- OpenCode: v1.3.10 (30e609e0)
- Plugin:
@cortexkit/aft-opencode@0.9.1
- Binary:
aft v0.9.1 (from versioned cache)
- OS: Debian (Linux 6.1), 2 vCPU Intel Xeon, 3.7GB RAM
Problem
The configure request times out after 30s on every startup. The aft binary spawns successfully but never receives the NDJSON command on stdin. After 3 restart attempts, the plugin gives up entirely.
[aft-plugin] Spawning binary: aft (cwd: /home/user)
[aft-plugin] [aft] started, pid XXXX
[aft-plugin] Request "configure" (id=1) timed out after 30000ms — restarting bridge
[aft-plugin] Max restarts (3) reached, giving up.
Root cause (upstream)
This is a bug in OpenCode's embedded JS runtime (Go-based), not in the AFT plugin or binary. OpenCode's implementation of child_process.spawn() has a buffering issue where stdin.write() data is accepted but never flushed to the child process.
Evidence:
echo '{"id":"1","command":"configure",...}' | aft → responds instantly
bun test-bridge.mjs (same spawn + stdin.write code) → responds instantly
node test-bridge.mjs → responds instantly
- Inside OpenCode plugin runtime → binary sits in
unix_stream_data_wait forever
I've filed the upstream issue at https://github.com/sst/opencode/issues (stdin.write buffering bug).
Possible workaround
Since the root cause is in OpenCode's stdio pipe handling, the AFT plugin could potentially work around it by using an alternative IPC mechanism instead of stdin/stdout pipes:
- Unix domain socket
- Temp file polling
- Named pipe (FIFO)
- TCP localhost
This would bypass OpenCode's broken child_process.spawn() stdin implementation entirely.
Impact
The plugin is completely non-functional - all AFT tools fail because the bridge can never complete the initial configure handshake. The tools register successfully with OpenCode but every actual invocation triggers the configure flow which always times out.
Bug Report
Apologies in advance - I'm filing this with AI assistance as I don't have the bandwidth to debug this further myself.
Environment
@cortexkit/aft-opencode@0.9.1aftv0.9.1 (from versioned cache)Problem
The
configurerequest times out after 30s on every startup. Theaftbinary spawns successfully but never receives the NDJSON command on stdin. After 3 restart attempts, the plugin gives up entirely.Root cause (upstream)
This is a bug in OpenCode's embedded JS runtime (Go-based), not in the AFT plugin or binary. OpenCode's implementation of
child_process.spawn()has a buffering issue wherestdin.write()data is accepted but never flushed to the child process.Evidence:
echo '{"id":"1","command":"configure",...}' | aft→ responds instantlybun test-bridge.mjs(same spawn + stdin.write code) → responds instantlynode test-bridge.mjs→ responds instantlyunix_stream_data_waitforeverI've filed the upstream issue at https://github.com/sst/opencode/issues (stdin.write buffering bug).
Possible workaround
Since the root cause is in OpenCode's stdio pipe handling, the AFT plugin could potentially work around it by using an alternative IPC mechanism instead of stdin/stdout pipes:
This would bypass OpenCode's broken
child_process.spawn()stdin implementation entirely.Impact
The plugin is completely non-functional - all AFT tools fail because the bridge can never complete the initial
configurehandshake. The tools register successfully with OpenCode but every actual invocation triggers the configure flow which always times out.