fix: create custom Codex home before proxy setup - #136
Open
sylvesterkaczmarek wants to merge 5 commits into
Open
fix: create custom Codex home before proxy setup#136sylvesterkaczmarek wants to merge 5 commits into
sylvesterkaczmarek wants to merge 5 commits into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
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.
Summary
Ensure the resolved Codex home is usable before proxy setup, including the shared server-info path required by
safety-strategy: unprivileged-user.Fixes #135.
Problem
A user-supplied
codex-hometakes an early return from home resolution and may not exist yet. The composite action then immediately derives:and starts
codex-responses-api-proxy --server-info <that path>. A missing parent directory causes proxy setup to fail later withresponses-api-proxy did not write server info.There is a second ownership boundary for
unprivileged-user: Codex home is intentionally owned by the unprivileged account, but the Responses proxy runs as the action's current user. A0755home owned by the Codex user therefore does not let the proxy create a new per-run server-info file. This also affects an existing unprivileged home when a new GitHub run produces a new$GITHUB_RUN_ID.jsonpath.Reproduction
A fresh custom path is enough:
For
unprivileged-user, the same failure can occur when the Codex home already exists but the current run's server-info file does not.Fix
Add an explicit
Ensure Codex home existsstep immediately after home resolution.For ordinary safety strategies, the helper recursively creates the resolved directory under the current runner identity.
For
unprivileged-user, it mirrors the repository's existing shared-home model:sudo mkdir -p;codex-userand keep mode0755;$CODEX_HOME/$GITHUB_RUN_ID.json;0666so the runner-owned proxy can write it.The existing
Wait for Responses API proxystep already hardens that server-info file back toroot:0444after startup.Existing homes and existing server-info files are left untouched.
Regression coverage
Added dependency-free Node tests covering:
codex-useris missing;GITHUB_RUN_IDis unavailable for the shared-file path.The privilege tests use a fake
sudoexecutable so exact command boundaries are asserted without requiring elevated local privileges.Validation
main(c385816875cc2fc8e033ed9d1cba96f8c331210e);src/are changed, so the checked-indist/main.jsbundle remains valid;action.yml,scripts/ensureCodexHome.mjs, andtest/ensureCodexHome.test.mjs.Risk
Low. Existing valid homes and existing server-info files retain their current ownership and permissions. The new behaviour only prepares missing state that the action already expects to use, and follows the same temporary server-info permission model already used by the built-in unprivileged-home path.