Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions api-reference/openapi/sessions.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,94 @@
}
}
}
},
"patch": {
"operationId": "patchSessionById",
"summary": "Update session",
"description": "Renames a session or changes its status (e.g. archive / unarchive). All body fields are optional; omitted fields are left unchanged.",
"parameters": [
{
"name": "sessionId",
"in": "path",
"required": true,
"description": "The id of the session to update.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": false,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PatchSessionRequest"
}
}
}
},
"responses": {
"200": {
"description": "Session updated successfully.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetSessionResponse"
}
}
}
},
"400": {
"description": "Bad request — malformed JSON body.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized — invalid or missing API key / Bearer token.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Forbidden — the authenticated account does not own this session.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Not found — no session exists with the given id.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"500": {
"description": "Internal server error — the session could not be updated.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/api/sessions/{sessionId}/chats": {
Expand Down Expand Up @@ -346,6 +434,36 @@
}
}
},
"PatchSessionRequest": {
"type": "object",
"description": "All fields are optional. Omitted fields are left unchanged.",
"properties": {
"title": {
"type": "string",
"description": "New display title for the session (rename)."
},
"status": {
"type": "string",
"enum": [
"running",
"completed",
"failed",
"archived"
],
"description": "Lifecycle status (matches the DB CHECK). `running` is active / unarchived; `completed` and `failed` are terminal; `archived` archives the row. Use `running` to unarchive from `archived`."
},
"linesAdded": {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: PatchSessionRequest exposes linesAdded/linesRemoved as client-writable fields even though they are documented as cached metrics, which makes the request contract inconsistent and likely incorrect.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At api-reference/openapi/sessions.json, line 445:

<comment>`PatchSessionRequest` exposes `linesAdded`/`linesRemoved` as client-writable fields even though they are documented as cached metrics, which makes the request contract inconsistent and likely incorrect.</comment>

<file context>
@@ -290,9 +436,85 @@
-            "description": "Set to `\"archived\"` to archive the session or `\"running\"` to unarchive it."
+            "description": "Lifecycle status. Use `archived` to archive, `running` to unarchive."
+          },
+          "linesAdded": {
+            "type": "integer",
+            "minimum": 0,
</file context>

Tip: Review your code locally with the cubic CLI to iterate faster.

"type": "integer",
"minimum": 0,
"description": "Updates the persisted `lines_added` column on the session (≥ 0)."
},
"linesRemoved": {
"type": "integer",
"minimum": 0,
"description": "Updates the persisted `lines_removed` column on the session (≥ 0)."
}
}
},
"GetSessionResponse": {
"type": "object",
"required": [
Expand Down
4 changes: 4 additions & 0 deletions api-reference/sessions/patch.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: "Update Session"
openapi: "/api-reference/openapi/sessions.json PATCH /api/sessions/{sessionId}"
---
1 change: 1 addition & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
"pages": [
"api-reference/sessions/create",
"api-reference/sessions/get",
"api-reference/sessions/patch",
"api-reference/sessions/list-chats",
"api-reference/sessions/create-chat"
]
Expand Down