Skip to content

Retry transient LLM upstream errors#346

Merged
marccampbell merged 3 commits into
mainfrom
fix-llm-upstream-retry
Jun 4, 2026
Merged

Retry transient LLM upstream errors#346
marccampbell merged 3 commits into
mainfrom
fix-llm-upstream-retry

Conversation

@marccampbell

Copy link
Copy Markdown
Contributor

Summary

  • retry bridge sends when the gateway reports transient LLM/provider failures such as api_error upstream error
  • use bounded backoff retries before surfacing the error to chat
  • keep permanent failures such as tool-policy errors non-retryable

Tests

  • env GOCACHE=/private/tmp/elasticclaw-go-build go test ./cmd/claw-bridge
  • env GOCACHE=/private/tmp/elasticclaw-go-build go test ./...

@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Comments Outside Diff (1)

  1. cmd/claw-bridge/main.go, line 1427-1433 (link)

    P1 Duplicate message sent to gateway on lifecycle-error retry

    sendMessageOnce fails via two distinct paths: sendReq failure (message never reached the gateway) and inf.done lifecycle error (message was delivered, the LLM returned a transient error). In the second case — which is the exact scenario the retry logic targets — the outer loop calls sendReq a second time with the same message payload. For a stateful persistent session, this sends the user message twice into the conversation context, which could produce double-processing or corrupt the session's turn history. Consider distinguishing the two failure modes and only retrying a full sendReq when the original send itself failed.

Reviews (1): Last reviewed commit: "Retry transient LLM upstream errors" | Re-trigger Greptile

Comment thread cmd/claw-bridge/main.go
Comment thread cmd/claw-bridge/main.go Outdated
@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "Avoid resending delivered LLM turns" | Re-trigger Greptile

@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Reviews (3): Last reviewed commit: "Address LLM retry review feedback" | Re-trigger Greptile

@marccampbell marccampbell force-pushed the fix-llm-upstream-retry branch from 416077d to 738b001 Compare June 4, 2026 17:01
@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Reviews (4): Last reviewed commit: "Address LLM retry review feedback" | Re-trigger Greptile

@marccampbell marccampbell merged commit 2444402 into main Jun 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant