fix(agent-server): bypass lifecycle lock for cached event services - #4596
Closed
jstar0 wants to merge 1 commit into
Closed
fix(agent-server): bypass lifecycle lock for cached event services#4596jstar0 wants to merge 1 commit into
jstar0 wants to merge 1 commit into
Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
Member
|
This PR is superseded by merged PR #4570, which replaced the global lifecycle lock with per-conversation locking. That broader fix removes the cross-conversation blocking scenario this cached-event-service fast path targeted. This comment was created by an AI agent (OpenHands) on behalf of the user. |
Member
|
Thank you for the focused investigation and implementation. Closing this PR as superseded by merged PR #4570, which addresses the broader lifecycle-lock problem with per-conversation locking. This action was performed by an AI agent (OpenHands) on behalf of the user. |
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:
AGENT:
Why
ConversationService._get_or_load_event_servicewaits on the global lifecycle lock even when the requested conversation already has an open in-memoryEventService. During a slow persistence/runtime preparation, those waits can consume the server's worker threads and block unrelated event endpoints.Summary
EventServicebefore entering lifecycle serialization or disk hydration.Issue Number
Fixes #4514
How to Test
uv run pytest -q tests/agent_server/test_conversation_service.py -k 'cached_event_service_bypasses_lifecycle_lock or get_event_service or conversation_lifecycle' --maxfail=1uv run pre-commit run --files openhands-agent-server/openhands/agent_server/conversation_service.py tests/agent_server/test_conversation_service.pymake buildThe focused regression/lifecycle tests pass, and the relevant pre-commit hooks pass: Ruff format/lint, pycodestyle, pyright, import rules, and tool registration. The full conversation/event service files were also run; unrelated workspace/git initialization tests fail in this local outer worktree because pytest temporary paths are detected as Git-backed and therefore use conversation worktrees. The changed code is not involved in those failures.
Video/Screenshots
Not applicable for this backend concurrency fix; the regression is covered by an in-process async test.
Type
Notes
This is an internal agent-server scheduling change with no REST/WebSocket schema changes. The cached fast path is limited to open in-memory runtimes; closed or uncached conversations retain the existing lifecycle and hydration path.