bug(providers): Pi nodes on a subscription OAuth credential fail in the compiled binary
Problem
In the compiled archon binary, a Pi node fails whenever its model uses a subscription OAuth credential (a type: "oauth" entry in ~/.pi/agent/auth.json, written by pi → /login). The node fails before any model call with:
OAuth auth derivation failed for openai-codex: ResolveMessage: Cannot find module './openai-codex.js' from '/$bunfs/root/archon-linux-arm64'The same workflow on the same credential completes when Archon runs from source (bun run packages/cli/src/cli.ts). So in the binary, Pi is effectively limited to API keys, even though the docs list OAuth subscriptions (ChatGPT Plus/Pro, Claude Pro/Max, GitHub Copilot, …) as supported Pi authentication.
Why
The compiled binary is Archon's released install artifact. A user who has logged into Pi with a ChatGPT/Codex subscription can't use it in workflows at all and has to switch to a pay-per-token API key.
Desired outcome
A Pi node whose model resolves to an OAuth subscription credential runs in the compiled binary the same way it does from source.
Acceptance
- In the compiled binary, a one-node Pi workflow on an
openai-codexOAuth credential completes. - Pi nodes on API-key backends still work in the compiled binary.
- The source (
bun run) path is unchanged.
Evidence
Reproduction
- Log in to Pi with a ChatGPT subscription (
pi→/login→ OpenAI Codex).~/.pi/agent/auth.jsonnow has anopenai-codexentry withtype: "oauth". - In any git repo, add
.archon/workflows/pi-oauth-smoke.yaml:name: pi-oauth-smoke description: One Pi node on an OAuth subscription credential provider: pi model: openai-codex/gpt-5.5 nodes: - id: hello prompt: "Reply with exactly the word: ok" allowed_tools: [] - Build the binary with
scripts/build-binaries.sh, then runarchon workflow run pi-oauth-smoke --no-worktree. - The node fails with the error above. Running the same workflow from source succeeds.
Environment
- Archon version or commit: 0.11.1,
devat 879c99fe (binary built withscripts/build-binaries.sh) - Platform or adapter: CLI, compiled binary (
archon-linux-arm64) - Database: SQLite
- OS: Ubuntu 26.04 (arm64); Bun 1.3.14;
@earendil-works/pi-ai0.87.1
Logs or screenshots
[hello] Started (pi/openai-codex/gpt-5.5)
[hello] Failed: Node 'hello' failed: SDK returned error — OAuth auth derivation failed for openai-codex: ResolveMessage: Cannot find module './openai-codex.js' from '/$bunfs/root/archon-linux-arm64'
❌ DAG workflow 'pi-oauth-smoke' failed: node hello failed. 0 downstream nodes were skipped.
Error: Workflow failed: Workflow did not complete successfullyConstraints and related work
- Must remain true: API-key Pi backends and every other provider are unaffected. Credentials continue to come from Pi's own
auth.jsonwithout Archon rewriting them. - Related issues or PRs: #2154, the same class of compiled-binary gap for Pi's Bedrock backend, fixed by registering the statically bundled module.
- Solution steering: Hint — pi-ai loads OAuth flow modules in
auth/oauth/load.jsthroughimport()on a runtime-computed specifier, whichbun build --compilecan't embed. pi-ai exports a@earendil-works/pi-ai/bun-oauthentrypoint whoseregisterBunOAuthFlows()registers statically imported flows for Bun binaries. Calling it once per process, as with the Bedrock shim, fixes the reproduction above. I have a fix with a unit test on a branch and can open a PR if maintainers agree with this direction.
Source: coleam00/Archon