Repository navigation
fix(agent-server): accept short event kinds in events search and count - #5773
Merged
Merged
Conversation
The kind filter of events/search and events/count only matched the fully-qualified class path, while the route docs, the wire `kind` field and the TypeScript client all use the bare class name, so kind=MessageEvent silently returned an empty page and a count of 0. Accept either form in EventService._event_matches_filters. Drop the known-bug markers from F06.search-kind-short and F34.events-search-kind, give F06.search-kind-short the Requires line it needs to run alone, and update the gotchas that described the bug. Fixes #5631 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014MKndVj7XWvRQmvW9w2bDg
Contributor
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
Contributor
Coverage Report •
|
||||||||||||||||||||
enyst
marked this pull request as ready for review
October 13, 2026 22:33
all-hands-bot
approved these changes
Oct 13, 2026
all-hands-bot
left a comment
Collaborator
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
Scope
The change belongs here: openhands-agent-server/ owns the canonical REST API and the verify-agent-server feature map is a repository-owned skill. The fix is confined to the kind filter shared by events/search and events/count, and it moves the server toward the behavior its own route docs (e.g., ActionEvent, MessageEvent), the wire kind field, and the TypeScript client's EventSearchOptions.kind already describe.
What I verified on the current head (7b0ea38)
- Filter semantics.
_event_matches_filtersnow matches eithercls.__name__orf"{cls.__module__}.{cls.__name__}". Exercised directly against a realMessageEvent:kind=MessageEventmatches, the fully-qualified path matches,message.MessageEventdoes not, an unknown name does not, andkindstill ANDs withsource. The wirekindvalue is exactlyself.__class__.__name__(DiscriminatedUnionMixin.kind), and event class names are unique across the event package, so the bare-name match cannot resolve to a different event type than the one thekindfield names. - Backward compatibility. The fully-qualified form still matches, so existing callers and the F05/F08/F33 recipes that pass
$REJECT_KIND/$OBSERVATION_KINDare unaffected. Unknown and partial names still yield an empty page /0rather than an error. - Tests.
uv run pytest tests/agent_server/test_event_service.py tests/agent_server/test_event_router.pygives 141 passed. The new tests assert short-kind search returns the same ids andnext_page_idas the full path, combine withsource, and reject a partial path, plus the count case. - Feature map.
map checkreports{"ok": true, "files": 34, "ids": 935, "problems": {}}. The addedRequires: F06.send-no-runis the correct dependency (the bullet consumes the twoMessageEvents that bullet persists), and the known-bug markers were dropped consistently with the rewrite of the F05/F06/F08/F33/F34 prose. - CI. All check runs for this head are green (
integration-test,cross-tests,agent-server-stress-tests,endpoint-audit, coverage, image builds). No unresolved review threads. Linked issue #5631 is open withbug/priority:low/ready-for-dev, and the head delivers its stated expected behavior.
No material correctness, security, compatibility, or acceptance-criterion defect found. No inline comments.
✅ APPROVED
5 tasks
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 proposes a fix for a bug uncovered during the first full agentic run of
verify-agent-server.AGENT:
I'm an AI agent (Claude Code) helping Engel Nyst (@enyst) with project maintenance.
Requested by Engel · project thread
Why
GET /api/conversations/{id}/events/search?kind=MessageEventreturned200 {"items": [], "next_page_id": null}andevents/count?kind=MessageEventreturned0, even for a conversation full ofMessageEvents. The route docs (e.g., ActionEvent, MessageEvent), thekindfield every event carries, and the TypeScript client'sEventSearchOptions.kindall use the bare class name, but the service only matched the fully-qualified<module>.<ClassName>, so a client following the docs silently got an empty history.Summary
EventService._event_matches_filters(shared bysearch_eventsandcount_events) now accepts either the bare class name or the fully-qualified class path. Unknown or partial names still give an empty page /0, andkindstill combines with the other filters. No change to the wire format, the schema or the TypeScript client.tests/agent_server/test_event_service.pycover the short kind for search (same ids andnext_page_idas the full path, combined withsource, a partial path not matching) and for count.F06.search-kind-shortandF34.events-search-kind, rewrote their prose as the expected behaviour, updated the Gotchas lines in F05, F06, F08, F33 and F34 that described the bug, and gaveF06.search-kind-shorttheRequires: F06.send-no-runline it needs to run on its own (without it--onlyran against an empty log and failed before reaching the marked line).Issue Number
Fixes #5631
How to Test
uv run pytest tests/agent_server/test_event_service.py tests/agent_server/test_event_router.py: 141 passed. The two new/extended tests fail on main (assert 0 == 5).AGENT_SERVER_VERIFY_HOMEisolated):control-agent-server map run --file F06 --only F06.search-kind-short --fresh --repeat 2 --checkout <main checkout>reportsxfailtwice; same for--file F34 --only F34.events-search-kind.--checkoutreportxpasstwice for both bullets.control-agent-server map checkis ok andmap run --only F06.search-kind-short --fresh/--only F34.events-search-kind --freshbothpass(the F34 bullet drivesRemoteEventsList.search/countwith{kind: 'MessageEvent'}fromclients/typescriptagainst a live server).pre-commit runon the changed files: ruff, pycodestyle and the repo hooks pass; pyright on the changed files reports 0 errors.Video/Screenshots
n/a
Type
Notes
An independent fix for comparison with #5658, written without reading it, at the maintainer's request.
🤖 Generated with Claude Code
https://claude.ai/code/session_014MKndVj7XWvRQmvW9w2bDg
Generated by Claude Code
🐳 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:7b0ea38-pythonRun
All tags pushed for this build
About Multi-Architecture Support
7b0ea38-python) is a multi-arch manifest supporting both amd64 and arm647b0ea38-python-amd64) are also available if needed