Skip to content

fix(agent-server): answer 404 for an unknown conversation on pause, interrupt, delete and update - #5831

Draft
murmaider227 wants to merge 2 commits into
OpenHands:mainfrom
murmaider227:fix/agent-server-unknown-conversation-404
Draft

murmaider227 wants to merge 2 commits into
OpenHands:mainfrom
murmaider227:fix/agent-server-unknown-conversation-404

Conversation

@murmaider227

@murmaider227 murmaider227 commented Oct 13, 2026 •

Copy link
Copy Markdown

HUMAN:

This PR is part of agentic self-healing work for the SDK.


AGENT:

Why

For an unknown or already deleted conversation id, POST /pause, POST /interrupt and DELETE /api/conversations/{id} answer 400 {"detail": "Bad Request"} and PATCH answers 200 {"success": false}, although all four declare 404 in /openapi.json and GET, /run, /condense and /secrets already answer 404. A client cannot tell a missing conversation from a malformed request, and one that checks only the PATCH status believes a rename worked.

This PR was written with AI assistance (Claude Code, Claude Sonnet 5.5) and the diff was reviewed and the tests run by the AI agent; a human has not reviewed it yet.

Summary

  • pause_conversation, interrupt_conversation, delete_conversation and update_conversation raise HTTPException(404) when the service returns False. In ConversationService that value means "no conversation found" for all four.
  • Router tests now assert 404 for each route (replacing the ones that locked 400 / success: false), plus a new test_interrupt_conversation_not_found.
  • The verify-agent-server feature map (F04, F05) drops the known-bug markers and the "today it is 400/200" prose for F05.unknown-id-pause, F04.patch-unknown-id and F04.delete-unknown-id. The whitespace-only title bullet (F04.patch-whitespace-title, [Bug]: PATCH /api/conversations/{id} with a whitespace-only title returns 200 and erases the stored title #5799) is untouched.

Issue Number

Closes #5800

How to Test

Unit tests (run in a ghcr.io/astral-sh/uv:python3.13-bookworm container, since the dev environment does not build on Windows):

uv sync --dev --frozen
uv run pytest tests/agent_server/test_conversation_router.py

The four new/changed *_not_found tests fail on main and pass with this change.

Live reproduction from the issue (SESSION_API_KEY=dev-key uv run python -m openhands.agent_server, then the curl commands for pause, interrupt, DELETE and PATCH on a random UUID) should now answer 404 {"detail": "Not Found"}.

What I did not run: the live control-agent-server map run bullets (F05.unknown-id-pause, F04.patch-unknown-id, F04.delete-unknown-id) and the TypeScript client tests. I only checked by reading that RemoteConversation (pause/interrupt/set_title/close) and clients/typescript throw on any non-2xx and do not branch on 400, as the issue's triage notes.

Test results with this change: tests/agent_server + tests/sdk/conversation: 3457 passed; 2 failures (test_cleanup_stale_tmux_sessions_includes_isolated_sockets, test_server_info_reports_configured_conversation_runtime) also fail on unmodified main in the same container, and test_conversation_large_event_handling errored once under the full run but passes when run alone, with and without this change. pre-commit: ruff format, ruff lint, pycodestyle, pyright (0 errors), import-rule and tool-registration hooks pass.

Video/Screenshots

N/A (API status codes only).

Design Doc

N/A (small bug fix).

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

This is a status-code correction to match the already published 404 contract for "not found". The only observable client difference is that RemoteConversation.set_title / TypeScript setTitle on an unknown id now raises instead of silently doing nothing. POST /ask_agent returning 500 for an unknown id (F10.ask-agent-unknown) and the whitespace-only title (#5799, already in #5802) are separate and not touched.

The repository's AGENTS.md asks for a Co-authored-by: openhands trailer; I used Co-Authored-By: Claude Sonnet 5.5 instead because the change was written by Claude, not by an OpenHands agent.

murmaider227 and others added 2 commits October 14, 2026 02:58
…nterrupt, delete and update

POST /pause, POST /interrupt and DELETE answered 400 and PATCH answered
200 {"success": false} when the conversation id was unknown, although each
route declares 404 in its OpenAPI entry and GET, /run and /condense already
answer 404 for the same id. The service returns False in all four cases only
when no conversation is found, so map that to 404.

Router tests now assert 404 for each route, including a new one for
interrupt, and the verify-agent-server feature map drops the known-bug
markers for these routes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

Copy link
Copy Markdown
Contributor

📁 PR Artifacts Notice

This PR contains a .pr/ directory with temporary PR-specific documents. The directory will be automatically removed after this PR merges to main through a cleanup PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unknown conversation ids get 400 on /pause, /interrupt and DELETE and 200 {"success": false} on PATCH instead of the documented 404

2 participants