fix: codex auth error message — use codex login, not OPENAI_API_KEY

Codex authenticates via ChatGPT OAuth (codex login), not an env var.
This commit is contained in:
Garry Tan
2026-03-18 21:22:54 -07:00
parent c9cead34e2
commit 0b009d2e84
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -424,8 +424,8 @@ If token count is not available, display: `Tokens: unknown`
## Error Handling
- **Binary not found:** Detected in Step 0. Stop with install instructions.
- **API key missing:** Codex prints an auth error to stderr. Surface the error:
"Codex authentication failed. Set OPENAI_API_KEY in your environment."
- **Auth error:** Codex prints an auth error to stderr. Surface the error:
"Codex authentication failed. Run `codex login` in your terminal to authenticate via ChatGPT."
- **Timeout:** If the Bash call times out (5 min), tell the user:
"Codex timed out after 5 minutes. The diff may be too large or the API may be slow. Try again or use a smaller scope."
- **Empty response:** If `$TMPRESP` is empty or doesn't exist, tell the user:
+2 -2
View File
@@ -278,8 +278,8 @@ If token count is not available, display: `Tokens: unknown`
## Error Handling
- **Binary not found:** Detected in Step 0. Stop with install instructions.
- **API key missing:** Codex prints an auth error to stderr. Surface the error:
"Codex authentication failed. Set OPENAI_API_KEY in your environment."
- **Auth error:** Codex prints an auth error to stderr. Surface the error:
"Codex authentication failed. Run `codex login` in your terminal to authenticate via ChatGPT."
- **Timeout:** If the Bash call times out (5 min), tell the user:
"Codex timed out after 5 minutes. The diff may be too large or the API may be slow. Try again or use a smaller scope."
- **Empty response:** If `$TMPRESP` is empty or doesn't exist, tell the user:
+2 -2
View File
@@ -1176,10 +1176,10 @@ describe('Codex skill', () => {
expect(content).not.toContain('/opt/homebrew/bin/codex');
});
test('codex/SKILL.md contains error handling for missing binary and API key', () => {
test('codex/SKILL.md contains error handling for missing binary and auth', () => {
const content = fs.readFileSync(path.join(ROOT, 'codex', 'SKILL.md'), 'utf-8');
expect(content).toContain('NOT_FOUND');
expect(content).toContain('OPENAI_API_KEY');
expect(content).toContain('codex login');
});
test('codex/SKILL.md uses mktemp for temp files', () => {