Repository navigation
fix(agent-server): stop rescanning Docker conversations - #5137
Conversation
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
ff23ea3 to
872c9bc
Compare
Coverage Report •
|
|||||||||||||||||||||||||||||||||||
872c9bc to
060f102
Compare
|
🚦 CI is currently failing on this PR's latest commit. Please fix the failing checks before OpenHands reviews it - this is re-checked automatically once you push a new commit. (A maintainer can also request This is an automated check - no AI was used to generate this comment. |
|
🤖 OpenHands is reviewing this PR. Head commit: This comment was posted by an AI agent (OpenHands). |
|
@all-hands-bot The earlier review run has not completed. Please review the current green head and submit an approval if there are no material findings. |
all-hands-bot
left a comment
There was a problem hiding this comment.
Reviewed the green head commit 060f102e2.
Verification
- CI: all checks pass on this head (no failures).
- Locally ran the two test suites cited in the PR description:
tests/agent_server/test_conversation_service.py— 117 passedtests/agent_server/docker_runtime+tests/agent_server/test_conversation_router.py— 123 passed
Findings
No material findings. Approving.
The change cleanly removes the per-request full-catalog rescan (sync_external_catalog) from Docker-mode get/search/count paths and replaces it with targeted refresh_persisted_conversation(conversation_id) calls at Docker lifecycle boundaries (start, release, delete, mutating proxy, socket close).
refresh_persisted_conversationmirrors the old per-record reconcile semantics exactly:setdefaultinto_conversation_records, only updatestoredand invalidatecached_infowhenstoredactually differs, and live (open) event services still win. The "not on disk → pop unless live" branch preserves deletion behavior, so no semantic regression versus the prior_reconcile_active_records.- Refresh decrypts only the single conversation's
meta.json(via_load_catalog_sync(conversation_id)), which is the whole point of the perf fix; the hotGET/search/countpaths no longer touch disk at all. - Refresh is only invoked on mutations (status < 400) and lifecycle boundaries, never on reads. The socket-close refresh is correctly scoped in a
finallyaroundbridge_websocket(after auth/container resolution). - Tests assert the refresh is awaited on release/delete/secret-update and cover add/remove, metadata-update-without-state-change, live-preservation, and single-record decryption.
Two non-blocking observations:
refresh_persisted_conversationraisesValueError("inactive_service")if_event_services is None; in a post-mutation path this could turn a successful op into a 500, but that state is only reachable during shutdown when requests aren't being processed.- Per-mutation refresh re-reads
meta.jsoneven for mutations that don't change persisted metadata; it's cheap (one record) and only clears the cache whenstoredactually changed.
Generated by OpenHands AI on behalf of the user.
|
Reviewing the green head commit Verification
FindingsNo material findings — approval submitted. The change cleanly removes the per-request full-catalog rescan (
Two non-blocking observations:
Generated by OpenHands AI on behalf of the user. |
HUMAN:
On the OSS Agent Canvas, loading the conversations appears to stall.
AGENT:
Why
ConversationServicealready loads its persisted catalog once at startup and serves search and count from that in-memory index. Docker runtime mode addedsync_external_catalog, which instead rescanned and decrypted all persisted metadata before every search and count request. With 2,335 conversations on the OSS Agent Canvas, a 20-row sidebar request took 13–36 seconds.Docker containers are external writers to the same persisted catalog, but they do not require a second query mechanism. This change removes
sync_external_catalog. Docker create, mutation, release, deletion, and socket-close lifecycle boundaries now refresh only the conversation record they changed. Search and count use the existing catalog again.Summary
Issue Number
Closes #5136.
How to Test
uv run pytest -q tests/agent_server/test_conversation_service.py(117 passed)uv run pytest -q tests/agent_server/docker_runtime tests/agent_server/test_conversation_router.py(123 passed)uv run pre-commit run --files openhands-agent-server/openhands/agent_server/conversation_service.py openhands-agent-server/openhands/agent_server/docker_runtime/registry.py openhands-agent-server/openhands/agent_server/docker_runtime/routers.py tests/agent_server/docker_runtime/test_routes.py tests/agent_server/test_conversation_service.py060f102e2:Video/Screenshots
No visual UI change. The live backend timings and create/update/delete lifecycle results are recorded above.
Design Doc
Not needed for this focused removal of the per-request catalog scan.
Type
Notes
The startup catalog load remains unchanged. No REST or WebSocket contract changes.