Make Claude workflow resilient to external credit failures#493
Make Claude workflow resilient to external credit failures#493
Conversation
Agent-Logs-Url: https://github.com/kimocoder/wifite2/sessions/4e63d543-3435-4adb-b9ba-eb8180a3f78e Co-authored-by: kimocoder <4252297+kimocoder@users.noreply.github.com>
Agent-Logs-Url: https://github.com/kimocoder/wifite2/sessions/4e63d543-3435-4adb-b9ba-eb8180a3f78e Co-authored-by: kimocoder <4252297+kimocoder@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Updates the Claude Code GitHub Actions workflow so external Anthropic quota/credit failures don’t fail the overall workflow run.
Changes:
- Adds a job-level
if:guard intended to skip the job whenANTHROPIC_API_KEYis missing or whenCLAUDE_CODE_ENABLED=false. - Sets
continue-on-error: trueon the Claude action step to prevent external service errors from failing the job.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| jobs: | ||
| claude: | ||
| if: ${{ secrets.ANTHROPIC_API_KEY != null && vars.CLAUDE_CODE_ENABLED != 'false' }} |
There was a problem hiding this comment.
The job guard secrets.ANTHROPIC_API_KEY != null will still evaluate to true when the secret is missing, because GitHub Actions secrets are exposed as strings and an unset secret typically resolves to an empty string (not null). This means the job can still run without credentials. Consider checking for a non-empty string instead (e.g., secrets.ANTHROPIC_API_KEY != '' or truthiness) so the job reliably skips when the secret isn't configured.
| if: ${{ secrets.ANTHROPIC_API_KEY != null && vars.CLAUDE_CODE_ENABLED != 'false' }} | |
| if: ${{ secrets.ANTHROPIC_API_KEY != '' && vars.CLAUDE_CODE_ENABLED != 'false' }} |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f54698883
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| jobs: | ||
| claude: | ||
| if: ${{ secrets.ANTHROPIC_API_KEY != null && vars.CLAUDE_CODE_ENABLED != 'false' }} |
There was a problem hiding this comment.
Remove secrets context from job-level if condition
This job guard uses secrets.ANTHROPIC_API_KEY directly in if, but GitHub Actions does not support referencing secrets in if conditionals, so the condition will not evaluate reliably and can prevent the workflow from running as intended (or fail workflow validation) on every trigger. The net effect is that Claude automation may be silently disabled regardless of repository state; move the secret into an environment variable and gate on that value instead.
Useful? React with 👍 / 👎.
The Claude Code workflow fails the entire job when the Anthropic service returns a credit/quota error — an external failure unrelated to repo code. The downstream 404s for branch creation are side effects of this primary failure.
Changes
ANTHROPIC_API_KEYis absent (!= null) or when repo variableCLAUDE_CODE_ENABLED=falsecontinue-on-error: trueto the Claude action step so external service errors degrade gracefully instead of failing the workflowOriginal prompt
Update the GitHub Actions workflow in
kimocoder/wifite2to prevent theClaude Codejob from failing the entire workflow when the external Anthropic service is unavailable or has insufficient credits.Context:
kimocoder/wifite2.github/workflows/claude.ymlClaude Code returned an error result: Credit balance is too lowclaude/issue-484-20260413-2125appear to be downstream effects after the primary failure.issue_commentandpull_request_review_commentand runsanthropics/claude-code-action@v1.Desired changes:
.github/workflows/claude.ymlso the Claude action step does not fail the whole job if the external service errors. A practical approach is to addcontinue-on-error: trueto theRun Claude Code Actionstep.ANTHROPIC_API_KEYis presentCLAUDE_CODE_ENABLEDis not equal tofalseAcceptance criteria:
.github/workflows/claude.ymlis updated accordingly.kimocoder/wifite2with the workflow fix.Suggested PR title:
Make Claude workflow resilient to external credit failuresThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: Fix the workflow issue
Assistant: I’ve applied a workflow-side mitigation: the Claude step is now allowed to fail without failing the whole job, and the job is gated so it can be disabled with
CLAUDE_CODE_ENABLED=false.Root cause: the failure was not from your repo code — the action log shows the external Claude service failed with “Credit balance is too low”, which then caused the workflow to exit with code 1.
What changed in
.github/workflows/claude.yml:ANTHROPIC_API_KEYexistsCLAUDE_CODE_ENABLED=falsecontinue-on-error: trueto the Claude action stepWhy this fixes it:
If you want, I can next help you make this stricter by:
User: @copilot Accepted Confirmation: Are you sure?
Assistant: The workflow failure is caused by the external Claude action running out of credits, not by code in
wifite2.Recommended fix for
.github/workflows/claude.yml:What this does:
continue-on-error: trueprevents the whole workflow from failing when the Claude service errors.if: ${{ secrets.ANTHROPIC_API_KEY != '' && vars.CLAUDE_CODE_ENABLED != 'false' }}lets you disable the job with a repo variable and skips it if the secret is missing.Why this is the right fix:
Credit balance is too low.claude/issue-484-20260413-2125are secondary ef...This pull request was created from Copilot chat.