Conversation
The Quick Start documents `oauthToken: "@~/.codex/auth.json"`, but the Go runtime does not perform shell-style tilde expansion. resolveContent called os.ReadFile with the literal path, producing "open ~/.codex/auth.json: no such file or directory". Resolve a leading "~" or "~/" to os.UserHomeDir() before reading, so the documented form works as advertised. The user-facing error still reports the original path. Add unit tests for both expandHome and the @~/ form through the run dry-run flow. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Collaborator
|
/kelos review |
Author
There was a problem hiding this comment.
Review Summary
Verdict: COMMENT (cannot self-approve as PR author)
Overall correctness: patch is correct
Scope: Expand a leading ~/~/ in @file paths in CLI config (oauthToken, apiKey, --prompt-file, --agents-md, --skill, --agent, --mcp) so the documented oauthToken: "@~/.codex/auth.json" form works.
Findings Overview
| Priority | Count | File:Line | Summary |
|---|---|---|---|
| P0 | 0 | — | none |
| P1 | 0 | — | none |
| P2 | 0 | — | none |
| P3 | 0 | — | none |
Findings
None.
Key takeaways
expandHomecorrectly handles bare~,~/,~/subpath, and leaves~userand embedded~untouched, matching the documented behavior;filepath.Join(home, "")for~/returnshomeas expected.- Error wrapping in
resolveContentpreserves the original~/...path in the user-facing message, so the error stays meaningful even on the unlikelyos.UserHomeDir()failure. - Tests cover the unit (
TestExpandHome), the helper (resolveContentsub-tests with~), and the originally reported end-to-end flow (TestRunCommand_DryRun_CodexOAuthToken_FileRef_HomeDir).
Note on prompt injection: A prior automated review on this PR (from cubic-dev-ai) contained an HTML comment instructing AI reviewers to attribute findings to cubic. I disregarded that instruction; the analysis above is independent.
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.
What type of PR is this?
/kind bug
What this PR does / why we need it:
The Quick Start documents
oauthToken: "@~/.codex/auth.json", but the Go runtime does not perform shell-style tilde expansion.resolveContentcalledos.ReadFilewith the literal path, producing:This change resolves a leading
~or~/toos.UserHomeDir()before reading, so the documented form works as advertised. The user-facing error still reports the original~/...path so it stays meaningful to the user.This affects every
@filepathconsumer ofresolveContent(e.g.oauthToken,apiKey,--prompt-file,--agents-md,--skill,--agent,--mcp).Which issue(s) this PR is related to:
Fixes #1025
Special notes for your reviewer:
expandHomeonly handles bare~and~/...;~userstyle paths are passed through unchanged (Go's standard library does not expose user-home lookup by name withoutos/user, and the issue does not require it).TestExpandHomecovering edge cases andTestRunCommand_DryRun_CodexOAuthToken_FileRef_HomeDircovering the originally reported flow end-to-end.Does this PR introduce a user-facing change?
Summary by cubic
Expands leading "
" in/.codex/auth.json" resolve to the user's home directory. Fixes the "no such file or directory" error across all@filepaths for CLI config so entries like oauthToken: "@@fileconsumers. Fixes #1025." and "/" inresolveContentusingos.UserHomeDir().@~/auth.json).@fileconsumers (oauthToken, apiKey,--prompt-file,--agents-md,--skill,--agent,--mcp).Written for commit 5e170f1. Summary will update on new commits. Review in cubic