feat: expose error and retry messages to SDK consumers#47
Merged
Conversation
Previously, `transformMessage()` returned null for `type=error` and `type=retry` wire messages, causing them to be silently dropped in the background pump. Consumers only saw the opaque `type=result` with `error="error"` and `stopReason="error"`, losing all detail. Now both message types are transformed into `SDKErrorMessage` and `SDKRetryMessage` and included in the `SDKMessage` union, so consumers can access the actual error text, API error details, retry attempt counts, and backoff timing. Written by Cameron and Letta Code "There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies." -- C.A.R. Hoare
3 tasks
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
SDKErrorMessageandSDKRetryMessagetypes to the SDK message uniontype=errorandtype=retrywire messages intransformMessage()instead of silently dropping themPreviously, when the Letta API returned errors (rate limiting, auth failures, etc.), the SDK dropped the
type=errorwire message that contained the actual error detail (message,stop_reason,api_error). Consumers only saw the subsequenttype=resultwith the opaque string"error"as both itserrorandstopReasonfields. Similarly,type=retrymessages with attempt counts and backoff timing were silently discarded.Now both message types flow through to consumers, enabling meaningful error display instead of "Agent run failed: error [error]".
Test plan
bun test-- 47/47 passbun run build-- cleanWritten by Cameron and Letta Code
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies." -- C.A.R. Hoare