feat: support custom session_id via ACP _meta field in new_session()#755
Open
michaelsinghk wants to merge 1 commit into
Open
feat: support custom session_id via ACP _meta field in new_session()#755michaelsinghk wants to merge 1 commit into
michaelsinghk wants to merge 1 commit into
Conversation
Allows ACP clients to pass a deterministic session_id through the standard ACP _meta extensibility field in session/new requests. When _meta contains a 'session_id' key, the agent uses it instead of generating a random UUID. This enables: - Clients controlling conversation identity for persistence/resume - Deterministic mapping between client tasks and agent conversations - Simplified reconnection to existing conversations The _meta field is part of the ACP protocol specification and is already collected by the NewSessionRequest schema as field_meta. All existing behavior is preserved when _meta is absent. Change is purely additive — 5 lines inserted in new_session().
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.
Summary
Allows ACP clients to pass a deterministic
session_idthrough the standard ACP_metaextensibility field insession/newrequests. When_metacontains asession_idkey, the agent uses it instead of generating a random UUID.Motivation
ACP clients (like Virtual Team orchestrators or CI pipelines) need deterministic session IDs to:
Currently,
session/newalways generates a random UUID, giving the client no control over the session identity.Change
File:
openhands_cli/acp_impl/agent/base_agent.py—new_session()method7 lines inserted, 1 deleted. Purely additive — all existing behavior is preserved when
_metais absent. The_metafield is already part of the ACP protocol spec and collected by theNewSessionRequestschema.Usage
ACP clients can now send:
{ "jsonrpc": "2.0", "id": 1, "method": "session/new", "params": { "cwd": "/workspace", "_meta": { "session_id": "my-task-id-001" } } }Testing
_metais absent (random UUID continues)_metais used as the conversation ID~/.openhands/conversations/{custom_id}.hex/as expected