Surface provider/error on thread.failed instead of a generic workflow failure - #2079
Open
MPIsaac-Per wants to merge 1 commit into
Conversation
… failure (get-bb#1914) Provider failures persist as provider/error. thread.failed only read system/error, so workflows fell back to "Workflow worker failed" and hid 429s. Look up the newest of both types and format provider detail with category, HTTP status, and provider code.
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.
What was wrong
getLastThreadErrorMessage()only readsystem/errorrows. Providers persist failures asprovider/error(with optionaldetailanderrorInfofor category, HTTP status, and provider code). On a workflow child that died on a Claude 429,emitThreadFailed()therefore publishederror: null, and the workflows plugin storederror ?? "Workflow worker failed".bb workflows statusandhistoryshowed that fallback. The 429 was only in the hidden child thread.Root cause and independent repro: #1914, report.
What changed
TIER-2. No
HOST_DAEMON_PROTOCOL_VERSIONbump.thread.failedstays{ thread, error: string | null }. No plugin SDK change.packages/db/src/data/events.ts—getLatestThreadErrorEventRow()returns the newestsystem/errororprovider/errorfor one thread, ordered bysequencedescending. A later terminal failure outranks an earlierwillRetry: truerow. FilteringwillRetryout would hide a 429 that is itself the newest event.apps/server/src/services/threads/thread-data.ts—getLastThreadErrorMessage()uses that query.system/errorstill returnsmessage.provider/errorformatsdetail(elsemessage), thencategory,http, andproviderCodewhen present.thread.failed.errorstring; no plugin change.Deviation from the issue comment's optional structured
errorInfo/resetsAtfield: this slice keeps the existing string payload.How you verified
Red before green in
apps/server/test/services/plugins/plugin-thread-events.test.ts:delivers thread.failed with a provider/error detail and metadata— failed before the query/format change; now asserts the exact string429 rate limit: too many requests | category: rate-limit | http: 429 | providerCode: rate_limit_event.surfaces a terminal provider/error over an earlier willRetry provider/error— sequence 1willRetry: truedoes not beat sequence 2 terminal.delivers thread.failed with the latest system/error messagestill passes.Query contract:
packages/db/test/data/events.test.tsreturns the newest system/error or provider/error by sequence.db: 84 passed. server plugin-thread-events: 13 passed. typecheck: 0 errors. eslint on the five changed files: 0 errors.
Fixes #1914