Repository navigation
feat(sdk): expose restart recovery provenance and outcome dispositions - #6778
Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
Coverage Report •
|
||||||||||||||||||||||||||||||
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Assessment: no material findings.
The change stays squarely in this repository's ownership (SDK events, view selection, agent-server recovery producer, canonical REST/WebSocket delivery) and delivers the issue #6769 acceptance criteria on the current head:
AgentErrorEvent.recovery_reasonis additive and optional (Literal["server_restart"] | None, defaultNone), so legacy payloads without it still load under the model'sextra="forbid"config; the legacy-payload round-trip test through the realEventLogpath covers this, and the live-server test proves the field flows through HTTP retrieval and WebSocket delivery.get_observation_dispositions()andObservationUniquenessProperty.enforcenow share one selection implementation, so the disposition's canonical choice agreeing with the LLM view is structural, not merely tested. The refactoredenforceis semantically identical to the previous seen-set loop (first observation-like event pertool_call_idin view order wins).- Provenance is set only at the restart-recovery producer in
event_service.py; otherAgentErrorEventproducers (pause orphans, validation failures, tool execution errors, parallel executor) correctly remain untagged, and the INTERNAL / non-retryable classification is preserved and asserted. - The disposition surface is read-only: frozen dataclass, and tests assert neither
model_dump_json()output nor persisted event bytes change. - The restart/late-completion lifecycle test exercises the real path (persisted in-flight action, RUNNING reload through lease takeover, real recovery producer, late completion, canonical selection against
View.from_events()).
CI on this head is green for all review-gating checks (pre-commit, sdk-tests, cross-tests, agent-server-tests, REST API/OpenAPI, integration-test, public-type-budget). I additionally ran the PR's focused test groups in the workspace: 309 view/event tests, 3 lease-behavior lifecycle tests, the live HTTP/WebSocket provenance test, and 6 TestEventServiceStartWithRunningStatus startup tests all pass.
The recording-consumer contract is documented in the companion PR OpenHands/docs#1127 (open at review time). No new endpoints, failure-classification values, or TypeScript client mirrors are needed for an additive optional field, consistent with the PR notes.
✅ APPROVED
- F05.restart-hard-tool-call: a hard restart during a tool call ends it with recovery_reason server_restart (#6778). - F06.send-during-tool-call (known bug #6729) and F07.snapshot-compact-stats (known bug #6741): open bugs filed since the baseline, reproduced live. - F02.default-bind uses LiteLLM's local cost map offline (#6749 is F24's). - F09: claude-agent-acp 0.99.1 (#5994) answers an unknown model with 400 and offers effort levels on haiku. - F10.fork-run-memory: match DeepSeek's 'Authentication Fails' wording. - F21.ts-payload-types: #6747 is fixed in v1.62.0; the known-bug marking goes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ArwwNZe7p1P7oMgnFNYcy
- F25.long-description: a long skill description is cut with an invoke_skill pointer and no file path (#6664). - F26.conversation-resume-disabled drives the MCP half: a disabled ambient plugin's MCP server is dropped on resume (#5756). - F27.tool-schema-keywords: known bug #6766, reproduced through the server; F27 owns tool/schema.py; F27.import-modules uses LiteLLM's local cost map under env -i (#6749). - F31.crash-tool-call checks recovery_reason and classification (#6778). - F34.manager-batch-over-limit: the TypeScript client splits more than 99 ids into batches (#6771). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ArwwNZe7p1P7oMgnFNYcy
- S02: deepseek-v4.1-flash is vision-capable (#5524); new Responses bullets for the streamed reasoning summary (known failure #6695) and cache-write tokens (known failure #6691), with the fake provider's new opt-ins. - S06.observation-dispositions: after recovery the first outcome per tool call is canonical and a late observation leaves the view (#6778). - S08.ambient-plugins: a disabled ambient plugin's skills and MCP servers are dropped on resume (#5756). - S04.cancel-token captures the token from an event callback. - Known failures that reproduced today carry today's date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ArwwNZe7p1P7oMgnFNYcy
HUMAN:
A restart recovery error and the original tool's late completion can coexist in the raw log. Recording consumers need machine-readable recovery provenance and the SDK's existing first-outcome selection rule without matching error text or rewriting events.
AGENT:
Why
A restart recovery error and the original tool's late completion can coexist in the raw log. Recording consumers need machine-readable recovery provenance and the SDK's existing first-outcome selection rule without matching error text or rewriting events.
Summary
AgentErrorEvent.recovery_reason="server_restart"on the restart recovery producer, preserving the INTERNAL, non-retryable classification and legacy event loading.ObservationDispositionrecords throughget_observation_dispositions()and share selection withObservationUniquenessProperty.REST API contract changes
Compared with base OpenAPI
9f7d5cb11b12for public/api/**paths.Issue Number
Fixes #6769
How to Test
318 relevant tests passed: 312 view/event/lifecycle tests, the live HTTP/WebSocket test, and five server startup tests. All changed files pass pre-commit (including Pyright).
The adjacent
test_start_initializes_workspace_as_git_repofails because the fresh workspace lacks.git; it fails identically on unchanged base commit9f7d5cb11, verified in a separate detached worktree using the same dependency environment. This PR does not change workspace git initialization.The lifecycle test persists an in-flight action, reloads a RUNNING conversation through lease takeover, observes the real recovery producer, appends the late completion, and verifies canonical selection against
View.from_events()while preserving the original persisted event bytes.Video/Screenshots
Design Doc
Type
Notes
The disposition reports observation uniqueness in input order. Branch selection, condensation, and other view filters remain separate. There are no new endpoints, failure classification values, or TypeScript client mirrors. Companion docs: OpenHands/docs#1127.
🐳 Agent Server images for this PR — GHCR package, pull/run commands, and all pushed tags (click to expand)
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdkpython-node-runtimepython-node-runtimepython-node-runtimegolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:69a800c-pythonRun
All tags pushed for this build
About Multi-Architecture Support
69a800c-python) is a multi-arch manifest supporting both amd64 and arm6469a800c-python-amd64) are also available if needed