Fix BSD mktemp suffix bug in codex skill temp file templates#2285
Open
cathrynlavery wants to merge 1 commit into
Open
Fix BSD mktemp suffix bug in codex skill temp file templates#2285cathrynlavery wants to merge 1 commit into
cathrynlavery wants to merge 1 commit into
Conversation
On macOS/BSD, mktemp does not randomize the X's when the template has a suffix after them: 'mktemp $TMP_ROOT/codex-err-XXXXXX.txt' creates a literal codex-err-XXXXXX.txt, and any second invocation fails with 'mkstemp failed ... File exists', leaving the variable empty and breaking the stderr capture that follows. Drop the .txt suffix from the mktemp templates for TMPERR, _PROMPT_FILE, and TMPRESP in codex/SKILL.md.tmpl and the generated codex/SKILL.md. Nothing downstream depends on the extension; every use goes through the shell variable.
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
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.
Problem
On macOS/BSD,
mktempdoes not randomize theXs when the template has a suffix after them.mktemp "$TMP_ROOT/codex-err-XXXXXX.txt"creates a literalcodex-err-XXXXXX.txt, and any subsequent invocation with the same template fails:When that happens the variable ends up empty and the
2>"$TMPERR"stderr capture that follows breaks. This affects any session that runs a codex mode more than once (or two concurrent sessions sharing$TMP_ROOT).Fix
Drop the
.txtsuffix from themktemptemplates forTMPERR,_PROMPT_FILE, andTMPRESPincodex/SKILL.md.tmpl(3 code blocks) and the generatedcodex/SKILL.md, keeping the two files in sync. Nothing downstream depends on the extension — every use goes through the shell variable (2>"$TMPERR",head,grep,rm -f).Verified on macOS (Darwin 25.5.0) that the suffix-less form randomizes correctly on repeated calls:
Note: the same suffixed-template pattern also exists in
claude/SKILL.md.tmpl,office-hours/SKILL.md,scripts/resolvers/review.ts, andbin/gstack-developer-profile; this PR intentionally scopes to the codex skill, where the double-invocation failure was hit in practice.