fix(agent-server): recover conversations after PID reuse - #4897
Open
jstar0 wants to merge 1 commit into
Open
Conversation
Co-authored-by: openhands <openhands@all-hands.dev>
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:
I tested the lease unit suite, the conversation-service restart cases including a persisted RUNNING state with a reused PID, and the event-service suite.
AGENT:
This pull request was prepared by an AI agent (OpenHands) on behalf of jstar0.
Why
When an agent-server restarts quickly, especially as PID 1 in a container, the replacement process can reuse the PID recorded in a conversation lease. The existing liveness check treats that PID as the original owner and skips the conversation until the lease TTL expires. A conversation left in RUNNING state is then unavailable through the normal resume API.
Summary
Issue Number
Fixes #4893
How to Test
From the repository root:
Results:
The new conversation-service regression persists a RUNNING conversation, simulates a still-valid lease from a previous process that reused the current PID, and verifies that startup takes over the lease and loads the conversation through the existing stale-run recovery path.
Video/Screenshots
Not applicable: this is an agent-server lease and conversation lifecycle fix.
Type
Notes
Lease files written by older versions without a process token retain the existing conservative behavior. Cross-host ownership still relies on lease expiration because local PID information cannot establish liveness on another host.