Skip to content

fix(agent-server): accept short event kinds in events search and count - #5773

Merged
enyst merged 1 commit into
mainfrom
claude/umbrella-bug-fixes-tgz9ai-search-kind-short
Oct 17, 2026
Merged

enyst merged 1 commit into
mainfrom
claude/umbrella-bug-fixes-tgz9ai-search-kind-short

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:

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=MessageEvent returned 200 {"items": [], "next_page_id": null} and events/count?kind=MessageEvent returned 0, even for a conversation full of MessageEvents. The route docs (e.g., ActionEvent, MessageEvent), the kind field every event carries, and the TypeScript client's EventSearchOptions.kind all 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 by search_events and count_events) now accepts either the bare class name or the fully-qualified class path. Unknown or partial names still give an empty page / 0, and kind still combines with the other filters. No change to the wire format, the schema or the TypeScript client.
  • Unit tests in tests/agent_server/test_event_service.py cover the short kind for search (same ids and next_page_id as the full path, combined with source, a partial path not matching) and for count.
  • verify-agent-server map: dropped the known-bug markers from F06.search-kind-short and F34.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 gave F06.search-kind-short the Requires: F06.send-no-run line it needs to run on its own (without it --only ran 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).
  • Map proof (with AGENT_SERVER_VERIFY_HOME isolated):
    • main (a430c77): control-agent-server map run --file F06 --only F06.search-kind-short --fresh --repeat 2 --checkout <main checkout> reports xfail twice; same for --file F34 --only F34.events-search-kind.
    • this branch: the same commands without --checkout report xpass twice for both bullets.
    • after removing the markers: control-agent-server map check is ok and map run --only F06.search-kind-short --fresh / --only F34.events-search-kind --fresh both pass (the F34 bullet drives RemoteEventsList.search/count with {kind: 'MessageEvent'} from clients/typescript against a live server).
  • pre-commit run on the changed files: ruff, pycodestyle and the repo hooks pass; pyright on the changed files reports 0 errors.

Video/Screenshots

n/a

Type

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

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

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:7b0ea38-python

Run

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

All tags pushed for this build

ghcr.io/openhands/agent-server:7b0ea38-golang-amd64
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-golang-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-golang-amd64
ghcr.io/openhands/agent-server:7b0ea38-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:7b0ea38-golang-arm64
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-golang-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-golang-arm64
ghcr.io/openhands/agent-server:7b0ea38-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:7b0ea38-java-amd64
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-java-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-java-amd64
ghcr.io/openhands/agent-server:7b0ea38-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:7b0ea38-java-arm64
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-java-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-java-arm64
ghcr.io/openhands/agent-server:7b0ea38-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:7b0ea38-python-amd64
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-python-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-python-amd64
ghcr.io/openhands/agent-server:7b0ea38-python-node-runtime-amd64
ghcr.io/openhands/agent-server:7b0ea38-python-arm64
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-python-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-python-arm64
ghcr.io/openhands/agent-server:7b0ea38-python-node-runtime-arm64
ghcr.io/openhands/agent-server:7b0ea38-python-minimal-amd64
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-python-minimal-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-python-minimal-amd64
ghcr.io/openhands/agent-server:7b0ea38-python-node-runtime-minimal-amd64
ghcr.io/openhands/agent-server:7b0ea38-python-minimal-arm64
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-python-minimal-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-python-minimal-arm64
ghcr.io/openhands/agent-server:7b0ea38-python-node-runtime-minimal-arm64
ghcr.io/openhands/agent-server:7b0ea38-python-slim-amd64
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-python-slim-amd64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-python-slim-amd64
ghcr.io/openhands/agent-server:7b0ea38-python-node-runtime-slim-amd64
ghcr.io/openhands/agent-server:7b0ea38-python-slim-arm64
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-python-slim-arm64
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-python-slim-arm64
ghcr.io/openhands/agent-server:7b0ea38-python-node-runtime-slim-arm64
ghcr.io/openhands/agent-server:7b0ea38-golang
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-golang
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-golang
ghcr.io/openhands/agent-server:7b0ea38-golang_tag_1.21-bookworm
ghcr.io/openhands/agent-server:7b0ea38-java
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-java
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-java
ghcr.io/openhands/agent-server:7b0ea38-eclipse-temurin_tag_17-jdk
ghcr.io/openhands/agent-server:7b0ea38-python-minimal
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-python-minimal
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-python-minimal
ghcr.io/openhands/agent-server:7b0ea38-python-node-runtime-minimal
ghcr.io/openhands/agent-server:7b0ea38-python-slim
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-python-slim
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-python-slim
ghcr.io/openhands/agent-server:7b0ea38-python-node-runtime-slim
ghcr.io/openhands/agent-server:7b0ea38-python
ghcr.io/openhands/agent-server:7b0ea38ca081852d268baa913d6bae0c6c1ba01c-python
ghcr.io/openhands/agent-server:claude-umbrella-bug-fixes-tgz9ai-search-kind-short-python
ghcr.io/openhands/agent-server:7b0ea38-python-node-runtime

About Multi-Architecture Support

  • Each variant tag (e.g., 7b0ea38-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., 7b0ea38-python-amd64) are also available if needed

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

Copy link
Copy Markdown
Contributor

REST API breakage checks (OpenAPI) — ✅ PASSED

Result: ✅ PASSED

Action log

@github-actions

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-agent-server/openhands/agent_server
   event_service.py103312188%154, 160–161, 280–281, 404, 408, 413, 440, 447, 481, 484–485, 489–490, 501, 507, 536–538, 541–542, 632–633, 754, 774, 801, 825–826, 830, 838, 841, 857, 891, 895–896, 930, 937, 943, 1003, 1006, 1021–1022, 1110, 1140, 1143, 1221, 1239, 1253, 1411–1412, 1455, 1492, 1632–1635, 1639, 1682, 1686, 1693, 1707, 1721, 1745, 1792–1794, 1878, 1903, 1909, 1911, 1921, 1923, 1930, 1938, 1940–1941, 1945, 1993, 1999, 2008–2009, 2015–2018, 2026–2029, 2078–2080, 2140–2141, 2143–2150, 2152–2153, 2162–2163, 2165–2166, 2173–2174, 2176–2177, 2188, 2213, 2219, 2225, 2234–2235, 2257, 2267
TOTAL497361988360% 

@enyst
enyst marked this pull request as ready for review October 13, 2026 22:33
@enyst
enyst requested a review from all-hands-bot October 13, 2026 22:35

@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

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_filters now matches either cls.__name__ or f"{cls.__module__}.{cls.__name__}". Exercised directly against a real MessageEvent: kind=MessageEvent matches, the fully-qualified path matches, message.MessageEvent does not, an unknown name does not, and kind still ANDs with source. The wire kind value is exactly self.__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 the kind field names.
  • Backward compatibility. The fully-qualified form still matches, so existing callers and the F05/F08/F33 recipes that pass $REJECT_KIND/$OBSERVATION_KIND are unaffected. Unknown and partial names still yield an empty page / 0 rather than an error.
  • Tests. uv run pytest tests/agent_server/test_event_service.py tests/agent_server/test_event_router.py gives 141 passed. The new tests assert short-kind search returns the same ids and next_page_id as the full path, combine with source, and reject a partial path, plus the count case.
  • Feature map. map check reports {"ok": true, "files": 34, "ids": 935, "problems": {}}. The added Requires: F06.send-no-run is the correct dependency (the bullet consumes the two MessageEvents 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 with bug / 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

@enyst
enyst merged commit 75abe1e into main Oct 17, 2026
56 checks passed
@enyst
enyst deleted the claude/umbrella-bug-fixes-tgz9ai-search-kind-short branch October 17, 2026 04:00
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]: events/search and /count with kind=MessageEvent return nothing; only the full class path matches

3 participants