openai / openai/codex-action

Invalid prompt-file and working-directory paths fail only after setup side effects

Open
#141 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.2k
Forks
170
PR merge metrics
No merged PRs in 30d

Description

Summary

Path inputs that can be validated locally are currently checked only when the final Codex execution begins. With the default safety strategy, that means a missing prompt-file or invalid working-directory can be discovered only after the action has installed packages, started the Responses proxy, changed Linux host settings, and irreversibly dropped sudo.

Reproduction

For example:

- uses: openai/codex-action@v1
  with:
    openai-api-key: ${{ secrets.OPENAI_API_KEY }}
    prompt-file: .github/does-not-exist.md

runCodexExec eventually tries:

input = await readFile(prompt.path, "utf8");

but that helper runs near the end of the composite action. With the default drop-sudo strategy, the file-not-found error is therefore reported after sudo privileges have already been revoked for the rest of the job.

A working-directory path that does not exist has the same ordering problem, except the failure is deferred to codex exec itself.

Expected behavior

Inputs whose validity depends only on the local filesystem should fail before proxy startup or irreversible host changes.

Suggested fix

Add a small path preflight immediately after Node setup that:

  • checks a non-empty prompt-file exists, is not a directory, and is readable by the action process;
  • checks the effective working-directory exists and is a directory.

Keep the existing runtime checks in place as defense in depth and to handle races where paths change after preflight.

Impact

This is failure ordering and job reliability. Simple path typos can currently leave a job permanently modified even though Codex never had enough valid input to start.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the action's Node setup entry point and trace the path to runCodexExec, including the existing prompt-file and working-directory checks. Verify how the effective working directory and prompt path are resolved, then exercise invalid paths to confirm they fail before proxy startup or host changes while runtime checks remain in place.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.