Hi @choufeng! Great PR β exactly what we need. We tested it in our environment and applied fixes for all the CodeRabbit review items. Here's a patch you can apply directly:
curl -L https://gist.github.com/rm-rf-etc/fcdb35b3d0fba3a2e126d75b30c07c4c/raw/opencode-fixes.patch | git applyOr if you prefer, add our branch as a remote and merge:
git remote add fixes https://github.com/obra/Archon fix/opencode-provider-review-fixes
git fetch fixes
git merge fixes/fix/opencode-provider-review-fixes| File | Fix | Source |
|---|---|---|
provider.ts |
Pass server password via HTTP Basic Auth in createOpencodeClient β prevents 401s |
CodeRabbit π Major |
server-manager.ts |
Use crypto.randomBytes instead of Math.random for password generation |
CodeRabbit π Major |
server-manager.ts |
Add proc.stdout?.resume() to prevent pipe buffer deadlock |
CodeRabbit π‘ Minor |
server-manager.ts |
Add proc.on('exit', ...) handler to clear stale managedServer reference |
CodeRabbit π‘ Minor |
server-manager.ts |
Support OPENCODE_BIN_PATH env var for compiled binary spawn resolution |
Our testing |
event-bridge.ts |
Guard tokens.total with ?? 0 to prevent NaN when fields are missing |
CodeRabbit π‘ Minor |
event-bridge.ts |
Remove dead token/cost accumulator (unreachable after early return) |
CodeRabbit Nitpick |
config.ts |
Validate port range (1β65535, integer) in parseOpencodeConfig |
CodeRabbit Nitpick |
provider.test.ts |
Fix mock: session.status β session.get to match provider code |
CodeRabbit π΄ Critical |
All fixes pass bun run type-check with zero errors. Provider successfully connects to an existing OpenCode server (autoStartServer: false) and creates sessions with model refs like zai/glm-5.1.