Retry transient provider 500 errors on session start instead of permanently failing #SUPERLOG - #450
Open
superlog-app[bot] wants to merge 1 commit into
Open
Retry transient provider 500 errors on session start instead of permanently failing #SUPERLOG#450superlog-app[bot] wants to merge 1 commit into
superlog-app[bot] wants to merge 1 commit into
Conversation
…nently failing #SUPERLOG Delivery-Id: 83a8d5edb230edadceb3a4bc755782631dcf78d9c205254058718e926e7c910f Delivery-Base: main
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 Anthropic's managed sessions API returns a transient
500 api_errorduring session creation, the worker permanently marks the investigation asstart_failedwith no retry. This means the affected incident gets no automatic re-investigation — the user's incident remains unresolved unless they manually trigger a new run.Root Cause
The
catchblock at the end ofstartQueuedAgentRunWorkflowinstart.tsunconditionally calleddeps.fail(ctx, "start_failed", ...)for every error thrown fromstartRunnerSession(). This included transient provider-side errors such as Anthropic'sapi_errorwith HTTP 500, which indicate a temporary internal server error — not a permanent configuration or logic failure. The Anthropic SDK already exhausted its internal retries (3 POST attempts visible in the triggering trace) before the error reached application code.The same workflow already handles transient GitHub failures correctly:
isRetryableRepositoryErrorerrors cause the function to log a warning and return without callingfail(), leaving the run inrepo_discoverystate for the sweep to pick up. Session-start errors had no equivalent path.Remediation
Adds
isRetryableStartError(error: unknown): booleantoStartQueuedAgentRunDepsfollowing the existing retry dep pattern. When the error is retryable,startQueuedAgentRunWorkflowlogs a warning and returns — the run stays inrepo_discoveryand the next sweep retries the start. Non-retryable errors still calldeps.fail()as before.The concrete implementation in
start-run.tscheckserror.status === 500 && error.error?.type === "api_error"(plain object-property read, no provider-specific import). Permanent failures (400, auth errors, invalid configuration) still hard-fail immediately.Two new tests cover the retry path and the permanent-failure path.
Incident: feisty-yak — 6f311883-f5f1-4a01-be4e-59ee0bcf237c
Was this PR helpful? Leave feedback — goes straight to the Superlog team.
Summary by cubic
Retries transient provider 500 “api_error” responses on session start instead of permanently failing the run, so incidents auto-retry on the next sweep. This prevents unresolved incidents caused by temporary provider outages.
isRetryableStartErrorto deps and updatedstartQueuedAgentRunWorkflowto skipfail()on retryable errors.status === 500 && error.type === "api_error"as retryable; non-retryable errors still hard-fail.repo_discoveryfor auto retry; added tests for both retry and permanent-failure paths.Written for commit 6ec847f. Summary will update on new commits.