Skip to content

[mason] Retry transient API errors and stop rendering None on message-less failures - #528

Open
annzhang-db wants to merge 3 commits into
databricks:mainfrom
annzhang-db:mason-transient-error-retry
Open

[mason] Retry transient API errors and stop rendering None on message-less failures#528
annzhang-db wants to merge 3 commits into
databricks:mainfrom
annzhang-db:mason-transient-error-retry

Conversation

@annzhang-db

@annzhang-db annzhang-db commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

mason dev -s <store> (and other agents/v1 commands) could fail with an unhelpful Error [CANCELLED]: None that only succeeded on a second try. Two independent causes:

  • The backend returned a transient CANCELLED with no message. The databricks SDK stringifies a message-less error as the literal "None", and our fallback treated that non-empty string as a real message and printed it verbatim.
  • Nothing retried the transient failure — the SDK only retries connection/timeout errors, not these error-code responses.

This PR:

  • Retries transient gRPC-style codes (CANCELLED, UNAVAILABLE, DEADLINE_EXCEEDED, ABORTED) once for requests that are safe to replay: reads, read-only search, and exclusive store creation. Stateful operations such as session-item append and pop are never retried because the first attempt may have committed even when its response was lost. Duplicate store creation surfaces ALREADY_EXISTS, which the ensure-store callers already reconcile as success.
  • Stops printing the literal None: falls back to the error code and adds a "usually transient — re-run" hint for these codes.

Found during the Custom Agents bug bash.

This pull request and its description were written by Isaac.

annzhang-db and others added 3 commits September 3, 2026 18:29
…ge-less failures

Session-store (and other agents/v1) commands could fail with the unhelpful
`Error [CANCELLED]: None` and only succeed on a second try. Two fixes:

- `client._do` now retries transient gRPC-style codes (CANCELLED, UNAVAILABLE,
  DEADLINE_EXCEEDED, ABORTED) with a short backoff before surfacing them. The
  SDK only retries connection/timeout errors, not these error-code responses.
- `wrap_api_error` no longer prints the literal "None" a message-less
  DatabricksError stringifies to; it falls back to the error code and adds a
  "usually transient — re-run" hint for the transient codes.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@annzhang-db
annzhang-db force-pushed the mason-transient-error-retry branch from 7895a33 to d0c2371 Compare September 3, 2026 18:34
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