fix: surface actionable error messages for billing and auth failures#1249
Open
anishesg wants to merge 1 commit intoanthropics:mainfrom
Open
fix: surface actionable error messages for billing and auth failures#1249anishesg wants to merge 1 commit intoanthropics:mainfrom
anishesg wants to merge 1 commit intoanthropics:mainfrom
Conversation
## Summary Signed-off-by: anish k <ak8686@princeton.edu>
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
When an API key has no credits (or has an auth failure), the action exited with code 1 and printed only a minified JavaScript stack trace with no useful diagnostic information. Users had no way to know from the logs that the problem was billing-related.
There were two root causes in
base-action/src/run-sdk.ts:isSuccesson line 205 only checkedresultMessage.subtype === "success"and ignored theis_errorflag entirely, so a result withsubtype: "success", is_error: true(the billing failure case) was treated as successful by the conclusion logic but then fell through to the error path with no useful message.sanitizeSdkOutputstripped theerrorsarray andresultstring fields from the logged result summary, so the actual error text from the SDK was never visible in action logs.Changes
getResultErrorText()to extract error details from both theerrorsarray and theresultstring field of anSDKResultMessage.formatErrorMessage()to map known error patterns (insufficient credits, invalid API key) to clear, actionable messages with links to the console.isSuccessto require bothsubtype === "success"AND!is_error.sanitizeSdkOutputto include the error text in the logged summary whenis_erroris true, ensuring failures are always visible even whenshow_full_outputis disabled.getResultErrorText+formatErrorMessageso the GitHub Actions step error annotation shows a human-readable message.Fixes #874