-
Notifications
You must be signed in to change notification settings - Fork 2
feat: say why a run failed when the LLM quota runs out or the key is rejected #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,13 +5,20 @@ | |
|
|
||
| import argparse | ||
| import json | ||
| import os | ||
| import shutil | ||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| PROG = "codeboarding" | ||
|
|
||
| # The engine's exit codes for an LLM refusal the user has to fix, and what to tell them. | ||
| ENGINE_REFUSALS = { | ||
| 2: "The LLM provider rejected the API key. Check the key's secret and re-run.", | ||
| 3: "The LLM provider's token or credit quota is exhausted. Add credits or raise the quota, then re-run.", | ||
|
Comment on lines
+18
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
|
|
||
| class AnalysisError(RuntimeError): | ||
| pass | ||
|
|
@@ -84,6 +91,12 @@ def _run_command(args: list[str], output_dir: Path) -> str: | |
| return_code = process.wait() | ||
| stdout = "".join(stdout_lines) | ||
| if return_code != 0: | ||
| reason = ENGINE_REFUSALS.get(return_code) | ||
| if reason: | ||
| # Written straight to the step's outputs: the shell never sees this script's stdout on failure. | ||
| with open(os.environ.get("GITHUB_OUTPUT", os.devnull), "a", encoding="utf-8") as outputs: | ||
| outputs.write(f"failure_reason={reason}\n") | ||
| raise AnalysisError(reason) | ||
| details = stdout.strip() or f"exit code {return_code}; see command logs above" | ||
| raise AnalysisError(f"Command failed ({' '.join(args)}): {details}") | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
action.yml:362still installscodeboarding==0.14.4, which does not emit the newly handled exit code 3; the corresponding engine change requires a later release. Consequently, quota exhaustion can retain the old behavior—including publishing partial analysis—while this commit's README promises an actionable failure and no partial output. Ship the supporting engine release and update both the pin and mirrored provider table with this change.AGENTS.md reference: AGENTS.md:L12-L16
Useful? React with 👍 / 👎.