Repository navigation
fix(sleep): make --bare conditional on ANTHROPIC_API_KEY (#68) - #73
Merged
Yifan Yang (Yif-Yang) merged 2 commits intoJun 20, 2026
Merged
Conversation
ClaudeCliBackend._call() and attempt_with_tools() hardcoded --bare, which skips Claude CLI's credential resolution. This broke subscription- token auth: every model call silently returned "Not logged in" and scored 0 — the user saw "baseline 0.0 → candidate 0.0, gate reject" with no indication of an auth failure. Fix: only pass --bare when ANTHROPIC_API_KEY is set. The remaining isolation flags (--disable-slash-commands, --disallowedTools, --exclude-dynamic-system-prompt-sections, clean temp cwd) already provide the needed isolation without --bare. Also adds _detect_cli_error() to log a warning when CLI output matches known auth error patterns, so auth failures surface loudly instead of deflating every score to 0. Co-Authored-By: Claude Fable 5 <[email protected]>
Address codex review: "API key" was too generic — a model response
about configuring API keys would trigger a false auth warning. Now:
- Use specific phrases ("Invalid API key", "Unauthorized: invalid x-api-key")
- Only check short stdout (<300 chars) to skip real model responses
- Still check stderr unconditionally
Co-Authored-By: Claude Fable 5 <[email protected]>
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.
Summary
Fixes #68.
ClaudeCliBackendhardcoded--barein both_call()andattempt_with_tools(), which broke subscription-token auth — every model call silently returned "Not logged in" and scored 0.Changes
--bare: only passed whenANTHROPIC_API_KEYis set. Without it, the remaining isolation flags (--disable-slash-commands,--disallowedTools,--exclude-dynamic-system-prompt-sections, clean temp cwd) already provide the needed isolation._detect_cli_error(): logs a warning when CLI output matches known auth error patterns ("Not logged in", "Invalid API key", etc.), so auth failures surface loudly instead of deflating every score to 0.Verified by
claudeCLI to confirm:--barewith no API key →"Not logged in · Please run /login"✅ detected--barewith invalid API key →"Invalid API key · Fix external API key"✅ detected--bareincluded/omitted, error detection)Test plan
test_bare_included_when_api_key_set—--bareappears whenANTHROPIC_API_KEYis settest_bare_omitted_without_api_key—--bareabsent without API keytest_cli_error_detected_and_logged— auth error string recorded inlast_call_error🤖 Generated with Claude Code