Skip to content

Commit d2633d9

Browse files
docs: add terminal session states (killed, completed, crashed)
PR #3145 — approved by aegis-gh-agent[bot] (Argus) Documentation for terminal session states, anti-enumeration 404 behavior, kill semantics.
1 parent 0ad9445 commit d2633d9

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,13 @@ All endpoints under `/v1/`.
194194
| `idle` | Waiting for input | Send via `/send` |
195195
| `permission_prompt` | Awaiting approval | `/approve` or `/reject` |
196196
| `asking` | Claude asked a question | Read `/read`, respond `/send` |
197-
| `stalled` | No output for >5 min | Nudge `/send` or `DELETE` |
198197
| `pending` | Initial state, connecting to ACP runtime | Wait a moment and re-poll |
198+
| `error` | Session error | Check diagnostics, recreate |
199+
| `rate_limit` | Rate limited by provider | Wait and retry |
200+
| `killed` | Stopped via API (terminal) | Session retained for audit |
201+
| `completed` | Finished normally (terminal) | Session retained for audit |
202+
| `crashed` | Terminated unexpectedly (terminal) | Check diagnostics |
199203
| `unknown` | Failed to determine state | Check diagnostics |
200-
| `error` | Session crashed | Check diagnostics, recreate |
201204

202205
</details>
203206

docs/api-reference.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,7 @@ curl http://localhost:9100/v1/sessions/abc123 \
759759

760760
| Status | Condition |
761761
|--------|-----------|
762-
| 403 | Not the session owner |
763-
| 404 | Session not found |
762+
| 404 | Session not found (or unauthorized — 404 is returned for both to prevent ID enumeration) |
764763

765764
---
766765

@@ -937,7 +936,9 @@ curl http://localhost:9100/v1/sessions/abc123/read \
937936
}
938937
```
939938

940-
> **Session status values:** `idle`, `working`, `compacting`, `context_warning`, `waiting_for_input`, `permission_prompt`, `plan_mode`, `ask_question`, `bash_approval`, `settings`, `error`, `rate_limit`, `pending`, `unknown`.
939+
> **Session status values:** `idle`, `working`, `compacting`, `context_warning`, `waiting_for_input`, `permission_prompt`, `plan_mode`, `ask_question`, `bash_approval`, `settings`, `error`, `rate_limit`, `pending`, `killed`, `completed`, `crashed`, `unknown`.
940+
>
941+
> **Terminal states:** `killed` (session was stopped via API), `completed` (session finished normally), `crashed` (session terminated unexpectedly). Terminal sessions return 404 on kill attempts and are retained for audit.
941942
942943
---
943944

@@ -1320,7 +1321,7 @@ curl -X POST http://localhost:9100/v1/sessions/abc123/escape \
13201321
DELETE /v1/sessions/:id
13211322
```
13221323

1323-
Terminates the Claude Code process and cleans up all resources.
1324+
Terminates the Claude Code process and marks the session as `killed`. The session record is retained (status = `killed`) for audit purposes. Killing an already-terminated session (`killed`, `completed`, `crashed`) returns `404`.
13241325

13251326
**Aliases:** `POST /v1/sessions/:id/kill`, `POST /v1/sessions/:id/terminate`, `POST /v1/sessions/:id/stop` — all identical.
13261327

@@ -1331,6 +1332,10 @@ curl -X DELETE http://localhost:9100/v1/sessions/abc123 \
13311332

13321333
**Response:** `{ "ok": true }`
13331334

1335+
| Status | Error |
1336+
|--------|-------|
1337+
| `404` | `Session already terminated` — session is in a terminal state (`killed`, `completed`, `crashed`) |
1338+
13341339
---
13351340

13361341
### Approve Permission Request

0 commit comments

Comments
 (0)