Skip to content

Commit b5b06ee

Browse files
committed
docs: fix session externalId, list pagination, and read-scope docs
From bot review of the Sessions API docs: - externalId is read-only after create (cannot be changed or cleared, it keys the durable streams and token scope). Drop the "null clears it" claim from the OpenAPI spec and the ai-chat/sessions page. - List sessions uses a sessions-specific pagination parameter (min 1, default 20) instead of the shared runs one (min 10, default 25, "runs per page"). - read:sessions grants listing the session's runs, not listing sessions.
1 parent 2f33c66 commit b5b06ee

3 files changed

Lines changed: 33 additions & 7 deletions

File tree

docs/ai-chat/sessions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ console.log(session.currentRunId, session.tags, session.closedAt);
138138

139139
### `sessions.update(idOrExternalId, body, requestOptions?)`
140140

141-
Mutate `tags`, `metadata`, or `externalId` on an existing Session. Pass `externalId: null` to explicitly clear it.
141+
Mutate `tags` or `metadata` on an existing Session. `externalId` is read-only after create: it cannot be changed or cleared (it keys the session's durable streams and token scope), so sending a different value returns `422`.
142142

143143
### `sessions.close(idOrExternalId, body?, requestOptions?)`
144144

docs/management/authentication.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Unlike `TriggerClient` instances (which stay isolated unless you opt in), `auth.
196196

197197
| Scope | Grants |
198198
| --- | --- |
199-
| `read:sessions:{id}` | Retrieve and list the session, and subscribe to and drain both its `.in` and `.out` [channels](/management/sessions/channels). |
199+
| `read:sessions:{id}` | Retrieve the session, list its runs, and subscribe to and drain both its `.in` and `.out` [channels](/management/sessions/channels). |
200200
| `write:sessions:{id}` | Append to the session's `.in` channel, and create runs on the session (including the create call itself). |
201201

202202
Two boundaries follow from the table, and both are enforced server-side:

docs/v3-openapi.yaml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3350,7 +3350,7 @@ paths:
33503350
33513351
List rows omit `triggerConfig`; retrieve a single session to read it.
33523352
parameters:
3353-
- $ref: "#/components/parameters/cursorPagination"
3353+
- $ref: "#/components/parameters/sessionsCursorPagination"
33543354
- $ref: "#/components/parameters/sessionsFilter"
33553355
responses:
33563356
"200":
@@ -3430,8 +3430,9 @@ paths:
34303430
34313431
34323432
Requires a secret key — a session public token cannot update a session.
3433-
`externalId` is read-only after create: sending a different value returns
3434-
`422`; sending the same value (or `null` to clear) is accepted.
3433+
`externalId` is read-only after create: it cannot be changed or cleared.
3434+
Sending a value different from the current one (including `null` when one is
3435+
set) returns `422`; sending the same value is accepted as a no-op.
34353436
requestBody:
34363437
required: true
34373438
content:
@@ -3576,6 +3577,30 @@ components:
35763577
before:
35773578
type: string
35783579
description: The ID of the run to start the page before. This will set the direction of the pagination to backward.
3580+
sessionsCursorPagination:
3581+
in: query
3582+
name: page
3583+
style: deepObject
3584+
explode: true
3585+
description: |
3586+
Paginate the results. Specify the number of sessions per page, and the ID of the session to start the page after or before.
3587+
3588+
For object fields like `page`, use the "form" encoding style. For example, to get the next page, use `page[after]=session_1234`.
3589+
schema:
3590+
type: object
3591+
properties:
3592+
size:
3593+
type: integer
3594+
maximum: 100
3595+
minimum: 1
3596+
default: 20
3597+
description: Number of sessions per page. Maximum is 100.
3598+
after:
3599+
type: string
3600+
description: The ID of the session to start the page after. Sets the pagination direction to forward.
3601+
before:
3602+
type: string
3603+
description: The ID of the session to start the page before. Sets the pagination direction to backward.
35793604
runId:
35803605
in: path
35813606
name: runId
@@ -4393,8 +4418,9 @@ components:
43934418
minLength: 1
43944419
maxLength: 256
43954420
description: >-
4396-
Read-only after create. Sending a value different from the current one
4397-
returns `422`; sending the same value is idempotent, and `null` clears it.
4421+
Read-only after create: cannot be changed or cleared. Sending a value
4422+
different from the current one (including `null` when one is set) returns
4423+
`422`; sending the same value is idempotent.
43984424
CloseSessionRequestBody:
43994425
type: object
44004426
description: Body for `POST /api/v1/sessions/{session}/close`. Up to 1KB.

0 commit comments

Comments
 (0)