Skip to content

[DOCS] Go SDK: retry cancellation preserves the underlying HTTP error #381

Closed

Description

Summary

A bug fix in the Go SDK changes the error returned when a request's context is cancelled while the retry layer is sleeping between attempts.

What changed

Previously, cancelling the context during backoff returned a bare context.Canceled / context.DeadlineExceeded and dropped the underlying HTTP failure. As of inference-gateway/sdk PR 119, the returned error wraps both:

  • errors.Is(err, context.Canceled) still reports the cancellation.
  • The underlying HTTP status (for example HTTP 500) stays visible in the error message and via errors.Is / errors.As.

Affected pages

  • The Go SDK error-handling / retry documentation (the page that documents retry behavior). Add a note that on cancellation mid-retry the returned error preserves the underlying failure.

Reference

  • SDK PR: inference-gateway/sdk PR 119
  • SDK issue: inference-gateway/sdk issue 118

Activity

  1. added
    documentation
    on Jul 10, 2026
  2. edenreich commented on Jul 10, 2026

    @edenreich
    Contributor

    @claude Can you document it?

  3. moved this to Todo in 2026on Jul 10, 2026
  4. added theissue type on Jul 10, 2026
  5. inference-gateway-maintainer commented on Jul 10, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    Claude finished @edenreich's task in 5m 25s —— View job • docs/issue-381-20260710-2131 • [Create PR ➔](https://github.com/inference-gateway/docs/compare/main...docs/issue-381-20260710-2131?quick_pull=1&title=Issue%20%23381%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23381%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)


    Documented Go SDK retry cancellation behavior

    • Locate the Go SDK retry/backoff docs (sdks.md, "Retry and backoff")
    • Verify the exact error-wrapping behavior (SDK PR 119)
    • Add the cancellation note to the "Retry and backoff" section
    • Run lint / format / build checks (all pass; note is server-rendered into the HTML)
    • Commit and open a PR

    PR: #382 - docs: note Go SDK retry cancellation preserves HTTP error

    What changed

    Added a "Cancellation preserves the underlying error" note to the Go SDK "Retry and backoff" section in sdks.md. It documents that when the context is cancelled (or its deadline expires) while the retry loop is sleeping between attempts, the returned error now wraps both the underlying transport/HTTP failure and the cancellation cause, formatted as <last error> (cancelled while retrying: <context error>):

    • errors.Is(err, context.Canceled) / context.DeadlineExceeded still report the cancellation.
    • The underlying HTTP status (for example HTTP 500) stays readable in the message and via errors.Is / errors.As.

    Includes a short code example, matching the behavior from inference-gateway/sdk#119.

    Verification

    bun run lint:md, bun run format:check, and bun run build all pass. Confirmed the note lands in the server-rendered HTML (dist/sdks/index.html), so it stays indexable. The edit is in the hand-authored retry section, not a generated provider region, so no task generate run was needed.
    · branch docs/issue-381-20260710-2131

  6. moved this from Todo to In progress in 2026on Jul 10, 2026
  7. moved this from In progress to QA in 2026on Jul 10, 2026
  8. moved this from QA to Done in 2026on Jul 11, 2026
  9. inference-gateway-releaser commented on Jul 18, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.9.2 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions