feat: carry ConversationErrorEvent on ConversationRunError for automation callbacks - #4458
Draft
neubig wants to merge 3 commits into
Draft
feat: carry ConversationErrorEvent on ConversationRunError for automation callbacks#4458neubig wants to merge 3 commits into
neubig wants to merge 3 commits into
Conversation
…n callback Include failure metadata in the workspace completion callback so automations can attribute outcomes and count them toward auto-disablement: - On a failing exit, classify the exception into the shared SDK failure vocabulary and send it as `failure_kind`. - Add `BaseWorkspace.register_blocking_factor(kind, reason)` so an agent can mark a run that "succeeded but was blocked" (e.g. a configured MCP integration was unreachable); the kind and reason are sent in the callback as `failure_kind` / `blocking_reason`. The automation service (`OpenHands/automation`) accepts these fields on its run completion endpoint and uses them to persist blocking metadata and auto-disable chronically unhealthy automations. Co-authored-by: openhands <openhands@all-hands.dev>
Contributor
Python API breakage checks — ✅ PASSEDResult: ✅ PASSED |
Contributor
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
Contributor
Coverage Report •
|
|||||||||||||||||||||||||||||||||||
Remove callback-side exception reclassification and the premature blocked-run API. Conversation close now registers the FailureKind already attached to the latest ConversationErrorEvent, and the workspace completion callback transports that single field. Co-authored-by: openhands <openhands@all-hands.dev>
Replace mutable workspace failure registration with the existing typed conversation error. ConversationRunError now carries the authoritative ConversationErrorEvent emitted during the failed run. The workspace completion callback serializes that event directly as the callback error, falling back to a classified ConversationErrorEvent for failures outside a conversation. Co-authored-by: openhands <openhands@all-hands.dev>
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
Carries the SDK's existing typed
ConversationErrorEventonConversationRunErrorso the workspace automation completion callback can serialize it directly. This is the SDK side ofOpenHands/automation#325 / issue #323.Changes
ConversationRunError.conversation_error: New optional field carrying the authoritativeConversationErrorEventemitted during the failed run.run()andarun()attach the latestConversationErrorEventemitted during the current run (scoped by_run_start_event_count)._handle_conversation_statusretrieves the latest structured error from cached events and attaches it._send_completion_callbackserializesConversationRunError.conversation_errordirectly as the callbackerrorfield. For exceptions outside a conversation (e.g. setup failures), it constructs a fallbackConversationErrorEventthat self-classifies via the existingclassify_error.Why this design
ConversationRunErroralready travels fromconversation.run()throughworkspace.__exit__.exc.conversation_errordirectly.erroris now a structuredConversationErrorEvent(or a legacy string for older SDKs).Validation
This PR was created by an AI agent (OpenHands) on behalf of neubig.