Skip to content

Commit 03713d3

Browse files
Copilotedburns
andauthored
Add non-determinism note to findSession helper Javadocs
Agent-Logs-Url: https://github.com/github/copilot-sdk-java/sessions/4ea5c73c-1940-4862-8afb-019a8de0bca2 Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
1 parent df45f3a commit 03713d3

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/main/java/com/github/copilot/sdk/RpcHandlerDispatcher.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,13 @@ private void handleSystemMessageTransform(JsonRpcClient rpc, String requestId, J
381381

382382
/**
383383
* Finds the first registered session that has a hooks handler registered.
384+
* <p>
385+
* Used as a fallback when the session ID in an incoming {@code hooks.invoke}
386+
* request is not in the registry (e.g. sub-agent sessions created internally by
387+
* the CLI). When multiple sessions have hooks registered, the selection is
388+
* non-deterministic because the underlying
389+
* {@link java.util.concurrent.ConcurrentHashMap} does not guarantee iteration
390+
* order.
384391
*
385392
* @return a session with hooks, or {@code null} if none is found
386393
*/
@@ -395,6 +402,13 @@ private CopilotSession findSessionWithHooks() {
395402

396403
/**
397404
* Finds the first registered session that has a permission handler registered.
405+
* <p>
406+
* Used as a fallback when the session ID in an incoming
407+
* {@code permission.request} request is not in the registry (e.g. sub-agent
408+
* sessions created internally by the CLI). When multiple sessions have
409+
* permission handlers registered, the selection is non-deterministic because
410+
* the underlying {@link java.util.concurrent.ConcurrentHashMap} does not
411+
* guarantee iteration order.
398412
*
399413
* @return a session with a permission handler, or {@code null} if none is found
400414
*/

0 commit comments

Comments
 (0)