Skip to content

fix: reject signal-killed helpers, create custom codex-home, and clean temp output on failure - #163

Open
Alphaxiaoteng wants to merge 1 commit into
openai:mainfrom
Alphaxiaoteng:fix/signal-termination-and-temp-cleanup-and-codex-home
Open

fix: reject signal-killed helpers, create custom codex-home, and clean temp output on failure#163
Alphaxiaoteng wants to merge 1 commit into
openai:mainfrom
Alphaxiaoteng:fix/signal-termination-and-temp-cleanup-and-codex-home

Conversation

@Alphaxiaoteng

Copy link
Copy Markdown

Summary

  1. Rejects signal-terminated helper commands in drop-sudo (Fixes drop-sudo treats signal-terminated helper commands as successful #152): Previously, code ?? 0 treated child processes terminated by signal (code === null) as successful exits (code 0). Now signal termination explicitly rejects with an error containing the terminating signal name/code.
  2. Ensures custom and environment codex-home directories exist before proxy startup (Fixes Custom codex-home fails when the target directory does not exist yet #135): Pre-creates custom codex-home directories (with sudo -u <codex-user> under unprivileged-user strategy or fs.mkdir otherwise) so proxy and server-info creation do not fail due to missing parent directories.
  3. Always cleans up action-created temporary output directories on failure (Fixes Failed Codex runs can leave temporary output directories behind #137): Moved cleanupTempOutput() into the finally block of runCodexExec(), ensuring that temporary output directories created for --output-last-message are cleaned up when Codex fails or exits non-zero, rather than being abandoned on runner disk.

Changes

  • src/dropSudo.ts:
    • Handled (code, signal) event in execCommand(). If code === null, rejects with a descriptive signal error unless ignoreFailure is set.
  • src/main.ts:
    • Updated resolveCodexHome() to create custom inputCodexHome and envHome paths before returning them.
  • src/runCodexExec.ts:
    • Moved cleanupTempOutput(outputFile, runAsUser) into the finally block of runCodexExec().
  • test/cleanupAndCustomHome.test.mjs:
    • Added unit test verifying resolve-codex-home creates non-existent custom directory structures.
    • Added regression test verifying implicit temporary output directory is deleted even when Codex exits with code 1.

Verification

  • npm run build cleanly compiled with esbuild.
  • npm test passed: 146/146 tests passing.

@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

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

@Alphaxiaoteng
Alphaxiaoteng force-pushed the fix/signal-termination-and-temp-cleanup-and-codex-home branch from 3739939 to 9dea3db Compare August 25, 2026 07:51
@Alphaxiaoteng

Copy link
Copy Markdown
Author

recheck

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

Labels

None yet

Projects

None yet

1 participant