fix(docker): run as root so Codex can read auth.json#266
Merged
Conversation
Codex stores its API key in /root/.codex/auth.json at runtime. Running the Node process as a non-root tinyagi user via gosu meant Codex could not read the auth file, causing WebSocket 500 errors against the OpenAI Responses API. Switch Docker to run as root directly — container isolation is handled by gVisor at the infrastructure level, making the in-container user separation unnecessary. Also fix Codex adapter to always use `resume --last` by default and auto-reset on first invocation for new agent directories. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix Codex failing with WebSocket 500 errors inside Docker. The root cause was that
gosu tinyagidropped privileges, preventing Codex from reading/root/.codex/auth.jsonwhere it stores the OpenAI API key at runtime.Changes
gosuand non-roottinyagiuser — run the Node process as root directly/home/tinyagito/rootdocker-compose.ymlvolume mount accordinglyreset_flagon first agent bootstrap so Codex doesn't try toresume --lasta non-existent sessioninvoke.tsTesting
codex exec --jsonworks as root inside the containerChecklist
type(scope): description)