Repository navigation
fix(agent-server): answer 404 for an unknown conversation on pause, interrupt, delete and update - #5831
Draft
murmaider227 wants to merge 2 commits into
Draft
fix(agent-server): answer 404 for an unknown conversation on pause, interrupt, delete and update#5831murmaider227 wants to merge 2 commits into
murmaider227 wants to merge 2 commits into
Conversation
…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>
Contributor
|
📁 PR Artifacts Notice This PR contains a |
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.
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 /interruptandDELETE /api/conversations/{id}answer400 {"detail": "Bad Request"}andPATCHanswers200 {"success": false}, although all four declare404in/openapi.jsonandGET,/run,/condenseand/secretsalready 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_conversationandupdate_conversationraiseHTTPException(404)when the service returnsFalse. InConversationServicethat value means "no conversation found" for all four.success: false), plus a newtest_interrupt_conversation_not_found.F04,F05) drops the known-bug markers and the "today it is 400/200" prose forF05.unknown-id-pause,F04.patch-unknown-idandF04.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-bookwormcontainer, since the dev environment does not build on Windows):The four new/changed
*_not_foundtests fail onmainand pass with this change.Live reproduction from the issue (
SESSION_API_KEY=dev-key uv run python -m openhands.agent_server, then thecurlcommands forpause,interrupt,DELETEandPATCHon a random UUID) should now answer404 {"detail": "Not Found"}.What I did not run: the live
control-agent-server map runbullets (F05.unknown-id-pause,F04.patch-unknown-id,F04.delete-unknown-id) and the TypeScript client tests. I only checked by reading thatRemoteConversation(pause/interrupt/set_title/close) andclients/typescriptthrow 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 unmodifiedmainin the same container, andtest_conversation_large_event_handlingerrored 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
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/ TypeScriptsetTitleon an unknown id now raises instead of silently doing nothing.POST /ask_agentreturning 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: openhandstrailer; I usedCo-Authored-By: Claude Sonnet 5.5instead because the change was written by Claude, not by an OpenHands agent.