app-server: support caller-supplied thread and turn IDs

Add optional threadId/turnId fields to the v2 app-server API and document them as UUIDs.

Validate caller-supplied IDs in the app server, reject duplicates, and route custom turn IDs through submit_with_id while surfacing invalid-request errors correctly. Canonicalize caller-supplied turn IDs to hyphenated UUID strings so case variants cannot bypass duplicate checks.

Plumb requested thread IDs through core thread spawning and add duplicate-ID guards in core (session-level duplicate submission IDs and ThreadManager thread-ID collision checks).

Cache known turn IDs per loaded thread so rollout history is only parsed once when validating custom turn IDs, and track active turn IDs without cloning full turn state on each streamed event.

Update docs/schema fixtures and add app-server tests for caller-supplied IDs, UUID validation, and duplicate-turn rejection.
This commit is contained in:
Eric Horacek
2026-02-20 09:56:17 -08:00
parent 5a30cd3f92
commit 4b1bc6e4ec
16 changed files with 575 additions and 23 deletions

View File

@@ -16625,6 +16625,13 @@
"type": "null"
}
]
},
"threadId": {
"description": "Optional caller-supplied thread ID (UUID). If omitted, the server generates a new thread ID.",
"type": [
"string",
"null"
]
}
},
"title": "ThreadStartParams",
@@ -17204,6 +17211,13 @@
},
"threadId": {
"type": "string"
},
"turnId": {
"description": "Optional caller-supplied turn ID (UUID). If omitted, the server generates a new turn ID.",
"type": [
"string",
"null"
]
}
},
"required": [