Skip to content

fix: reject conflicting inputs before setup side effects - #140

Open
sylvesterkaczmarek wants to merge 3 commits into
openai:mainfrom
sylvesterkaczmarek:fix/early-input-preflight
Open

fix: reject conflicting inputs before setup side effects#140
sylvesterkaczmarek wants to merge 3 commits into
openai:mainfrom
sylvesterkaczmarek:fix/early-input-preflight

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Summary

Reject known-invalid input combinations immediately after Node setup, before the action starts the proxy, changes host configuration, or irreversibly drops sudo.

Fixes #139.

Problem

The final run-codex-exec helper already validates several mutually exclusive inputs, but those checks happen very late in the composite action.

For example, setting both:

prompt: Review this change
prompt-file: .github/codex-prompt.md

is guaranteed to fail, but the action currently reaches that error only after setup steps that may include:

  • package installation;
  • Responses API proxy startup;
  • Linux user-namespace/AppArmor changes;
  • drop-sudo, which is intentionally irreversible for the remainder of the job.

The same ordering applies to other conflicts the helper already knows how to reject.

Fix

Add a small dependency-free preflight immediately after Ensure Node.js available and before repository checks or other side effects.

The preflight mirrors the helper's simple deterministic conflicts:

  • prompt + prompt-file;
  • output-schema + output-schema-file;
  • permission-profile + sandbox;
  • permission-profile + safety-strategy: read-only.

Values are trimmed before the check, matching the helper's existing emptyAsNull semantics, so whitespace-only values remain equivalent to empty inputs.

The validation inside dist/main.js remains unchanged as defense in depth and for callers that invoke the helper command directly.

Why this belongs before setup

None of these checks needs repository contents, credentials, network access, a running proxy, or modified host state. Failing after those operations provides no additional information and can leave the job changed even though Codex could never have run.

Regression coverage

Added six direct Node-stdlib tests covering:

  1. compatible inputs succeed;
  2. whitespace-only values are treated as empty;
  3. prompt + prompt-file fails;
  4. output-schema + output-schema-file fails;
  5. permission-profile + sandbox fails;
  6. permission-profile + read-only safety strategy fails.

Validation

  • all 6/6 focused behavioural tests pass locally with Node's built-in test runner;
  • branch is based directly on current upstream main (c385816875cc2fc8e033ed9d1cba96f8c331210e);
  • branch is 0 commits behind upstream;
  • production manifest change is only 13 added lines;
  • no files under src/ change, so the checked-in dist/main.js bundle remains valid.

Risk

Low. These configurations already fail today. The only behaviour change is when they fail: before side effects instead of after them.

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@sylvesterkaczmarek

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mutually exclusive inputs are rejected only after irreversible setup steps

1 participant