Repository navigation
fix(agent-server): return 404 for unknown ids on pause, interrupt, PATCH and DELETE - #5814
Conversation
…TCH and DELETE
POST /pause, POST /interrupt and DELETE answered 400 and PATCH answered
200 {"success": false} when the conversation does not exist, although
each route declares 404 in the OpenAPI document and GET and /run answer
404 for the same id. The service returns False only when it finds no
conversation, so map that to 404. Update the router tests and drop the
known-bug markers of F05.unknown-id-pause, F04.patch-unknown-id and
F04.delete-unknown-id.
Fixes #5800
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014MKndVj7XWvRQmvW9w2bDg
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
all-hands-bot
left a comment
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope gate: this change is squarely in this repository's ownership. The Agent Server REST API is canonical here, and the PR aligns the implementation with the 404 that the routes already declare in OpenAPI, so there is no OpenAPI contract change (the Check OpenAPI Schema / REST API (OpenAPI) checks pass on the head).
Verified against the workspace code:
- Each service method returns
Falseonly for a missing conversation.pause_conversation/interrupt_conversationreturnbool(event_service)where_get_or_load_event_servicereturnsNonewhen the id is neither live nor in_conversation_records;delete_conversationreturnsFalseonly in the two not-found branches;update_conversationreturnsFalseonly when the event service isNone. So mappingFalse-> 404 introduces no false 404 for existing conversations, and genuinely-unavailable cases surface as raised exceptions, notFalse. - All four handlers (
/pause,/interrupt,DELETE,PATCH) were changed consistently with the other conversation routes;GETand/runalready answered 404. - Docker runtime parity holds:
DELETEalready 404s (routers.py), and/pause,/interrupt,PATCHare proxied through_container, which raises 404 for an unknown id before reaching the inner server. - Clients do not branch on 400: the Python
RemoteConversationuses_send_request->raise_for_status()(raises on any non-2xx;close()swallows DELETE errors), and the TypeScriptHttpClientthrowsHttpErroron non-2xx. The only observable behavior change is thatset_title/setTitleon an unknown id now raises instead of silently no-op'ing, which matches the declared contract. - Tests updated correctly (three renamed
*_not_found, a new/interruptnot-found test), and the feature-map markers/prose forF04.patch-unknown-id,F04.delete-unknown-id, andF05.unknown-id-pauseare consistent with the new behavior.
Local runs on this head: tests/agent_server/test_conversation_router.py 101 passed; tests/agent_server/docker_runtime/test_routes.py + tests/agent_server/test_conversation_service.py 143 passed. Current-head GitHub Actions are green across all jobs.
No material correctness, security, or compatibility findings. The linked issue's stated scope (all four routes 404 for an unknown id) is fully delivered.
✅ APPROVED
Co-authored-by: openhands <openhands@all-hands.dev>
HUMAN:
This PR proposes a fix for a bug uncovered during the first full agentic run of
verify-agent-server.AGENT:
Why
A missing conversation should have the same HTTP meaning across lifecycle operations. PATCH previously looked successful even when no conversation existed.
Summary
The four route handlers translate the service’s “not found” result into 404. Successful operations keep their existing responses; the lifecycle map and regression tests follow the corrected contract.
Source: conversation_router.py.
Issue Number
Fixes #5800
How to Test
Previously recorded verification
uv run pytest tests/agent_server/test_conversation_router.py: the four not-found tests fail on main (400 / 200), and all 101 tests pass on this branch.uv run pytest tests/agent_server/test_parent_child_conversations.py tests/agent_server/docker_runtime/test_routes.py tests/agent_server/test_credential_binding.py tests/agent_server/test_conversation_tags.py: 64 passed.uv run pytest tests/cross/test_remote_conversation_live_server.py: 25 passed, 1 skipped (PythonRemoteConversationagainst a live server).--fresh --repeat 2):--checkoutat 6a298a4),F05.unknown-id-pause,F04.patch-unknown-idandF04.delete-unknown-ideach reportxfailtwice.xpasstwice.control-agent-server map checkis clean, andmap run --only <ID> --freshreportspassfor all three (F05: 4 pass, F04: 2 + 2 pass).uv run pre-commit run --files <changed files>: all hooks pass.Video/Screenshots
n/a
Type
Notes
Python and TypeScript clients already treat non-2xx responses as errors. The observable client change is that setting a title on a missing conversation now raises. The separate unknown-ID
/ask_agentfailure remains out of scope.Visual explanation by Codex using HumanLayer show-me.
🐳 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:d1eead3-pythonRun
All tags pushed for this build
About Multi-Architecture Support
d1eead3-python) is a multi-arch manifest supporting both amd64 and arm64d1eead3-python-amd64) are also available if needed