Skip to content

fix(agent-server): return 404 for unknown ids on pause, interrupt, PATCH and DELETE - #5814

Merged
enyst merged 2 commits into
mainfrom
claude/umbrella-bug-fixes-tgz9ai-unknown-id-404
Oct 22, 2026
Merged

enyst merged 2 commits into
mainfrom
claude/umbrella-bug-fixes-tgz9ai-unknown-id-404

Conversation

@enyst

@enyst enyst commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

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

 unknown conversation ID
- POST /pause       → 400
- POST /interrupt   → 400
- DELETE            → 400
- PATCH             → 200 {success: false}
+ all four          → 404
 GET and POST /run  → 404 (already)

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 (Python RemoteConversation against a live server).
  • Map proof (--fresh --repeat 2):
    • On main (--checkout at 6a298a4), F05.unknown-id-pause, F04.patch-unknown-id and F04.delete-unknown-id each report xfail twice.
    • On this branch with the markers still in place, each reports xpass twice.
    • With the markers removed, control-agent-server map check is clean, and map run --only <ID> --fresh reports pass for 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

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

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_agent failure 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

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python-slim amd64, arm64 python-node-runtime Link
python-minimal amd64, arm64 python-node-runtime Link
python amd64, arm64 python-node-runtime Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:d1eead3-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-d1eead3-python \
  ghcr.io/openhands/agent-server:d1eead3-python

All tags pushed for this build

ghcr.io/openhands/agent-server:d1eead3-golang-amd64
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-golang-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-golang-amd64
ghcr.io/openhands/agent-server:d1eead3-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:d1eead3-golang-arm64
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-golang-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-golang-arm64
ghcr.io/openhands/agent-server:d1eead3-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:d1eead3-java-amd64
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-java-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-java-amd64
ghcr.io/openhands/agent-server:d1eead3-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:d1eead3-java-arm64
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-java-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-java-arm64
ghcr.io/openhands/agent-server:d1eead3-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:d1eead3-python-amd64
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-python-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-python-amd64
ghcr.io/openhands/agent-server:d1eead3-python-node-runtime-amd64
ghcr.io/openhands/agent-server:d1eead3-python-arm64
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-python-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-python-arm64
ghcr.io/openhands/agent-server:d1eead3-python-node-runtime-arm64
ghcr.io/openhands/agent-server:d1eead3-python-minimal-amd64
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-python-minimal-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-python-minimal-amd64
ghcr.io/openhands/agent-server:d1eead3-python-node-runtime-minimal-amd64
ghcr.io/openhands/agent-server:d1eead3-python-minimal-arm64
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-python-minimal-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-python-minimal-arm64
ghcr.io/openhands/agent-server:d1eead3-python-node-runtime-minimal-arm64
ghcr.io/openhands/agent-server:d1eead3-python-slim-amd64
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-python-slim-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-python-slim-amd64
ghcr.io/openhands/agent-server:d1eead3-python-node-runtime-slim-amd64
ghcr.io/openhands/agent-server:d1eead3-python-slim-arm64
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-python-slim-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-python-slim-arm64
ghcr.io/openhands/agent-server:d1eead3-python-node-runtime-slim-arm64
ghcr.io/openhands/agent-server:d1eead3-golang
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-golang
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-golang
ghcr.io/openhands/agent-server:d1eead3-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:d1eead3-java
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-java
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-java
ghcr.io/openhands/agent-server:d1eead3-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:d1eead3-python-minimal
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-python-minimal
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-python-minimal
ghcr.io/openhands/agent-server:d1eead3-python-node-runtime-minimal
ghcr.io/openhands/agent-server:d1eead3-python-slim
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-python-slim
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-python-slim
ghcr.io/openhands/agent-server:d1eead3-python-node-runtime-slim
ghcr.io/openhands/agent-server:d1eead3-python
ghcr.io/openhands/agent-server:d1eead34a1b888da21da59a9184eee0e57a65f02-python
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-unknown-id-404-python
ghcr.io/openhands/agent-server:d1eead3-python-node-runtime

About Multi-Architecture Support

  • Each variant tag (e.g., d1eead3-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., d1eead3-python-amd64) are also available if needed

…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
@enyst enyst self-assigned this Oct 13, 2026
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result: ✅ PASSED

Action log

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-agent-server/openhands/agent_server
   conversation_router.py3051894%110–111, 115–116, 248, 336, 479, 526, 586, 770, 782–785, 825, 861–862, 899
TOTAL514042039960% 

@enyst
enyst marked this pull request as ready for review October 13, 2026 23:57
@enyst
enyst requested a review from all-hands-bot October 14, 2026 00:02

@all-hands-bot all-hands-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 False only for a missing conversation. pause_conversation/interrupt_conversation return bool(event_service) where _get_or_load_event_service returns None when the id is neither live nor in _conversation_records; delete_conversation returns False only in the two not-found branches; update_conversation returns False only when the event service is None. So mapping False -> 404 introduces no false 404 for existing conversations, and genuinely-unavailable cases surface as raised exceptions, not False.
  • All four handlers (/pause, /interrupt, DELETE, PATCH) were changed consistently with the other conversation routes; GET and /run already answered 404.
  • Docker runtime parity holds: DELETE already 404s (routers.py), and /pause, /interrupt, PATCH are proxied through _container, which raises 404 for an unknown id before reaching the inner server.
  • Clients do not branch on 400: the Python RemoteConversation uses _send_request -> raise_for_status() (raises on any non-2xx; close() swallows DELETE errors), and the TypeScript HttpClient throws HttpError on non-2xx. The only observable behavior change is that set_title/setTitle on 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 /interrupt not-found test), and the feature-map markers/prose for F04.patch-unknown-id, F04.delete-unknown-id, and F05.unknown-id-pause are 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>
@enyst
enyst merged commit 6d65010 into main Oct 22, 2026
51 checks passed
@enyst
enyst deleted the claude/umbrella-bug-fixes-tgz9ai-unknown-id-404 branch October 22, 2026 13:28
@github-actions github-actions Bot mentioned this pull request Oct 22, 2026
1 of 7 tasks
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

3 participants