feat(gateway): complete openclaw phase1 queue parity v2

This commit is contained in:
William Valentin
2026-02-16 12:04:33 -08:00
parent 78da226542
commit 813a0dc5c5
19 changed files with 678 additions and 53 deletions
+14 -1
View File
@@ -33,6 +33,8 @@ The gateway serialises agent work **per session**, not per WebSocket connection:
- Requests that target the same `sessionId` run one-at-a-time (FIFO) in a per-session lane.
- Requests for different sessions can run in parallel.
- Lane policy is configurable (`collect`, `followup`, `steer_backlog`, `interrupt`) with per-channel and per-session overrides.
- Session-local overrides can be managed at runtime via `agent.send` commands: `/queue`, `/queue set ...`, `/queue reset`.
This is implemented via a per-lane queue (`LaneQueue`) in the gateway server, and used by `agent.send` and `agent.cancel`.
@@ -555,6 +557,8 @@ Send a message to the agent and stream response.
}
```
When queue policy rejects/supersedes a request before execution, the server emits an `error` event with `code: 3` (`AgentBusy`) and includes `data.queue` metadata (`code`, `laneId`, `mode`, `overflow`, `droppedCount`).
#### `agent.cancel`
Cancel the current agent operation.
@@ -876,11 +880,20 @@ Error occurred during processing.
"event": "error",
"data": {
"code": 5,
"message": "Internal error: ..."
"message": "Internal error: ...",
"queue": {
"code": "overflow",
"laneId": "ws:abc123",
"mode": "followup",
"overflow": "drop_new",
"droppedCount": 1
}
}
}
```
`data.queue` is optional and only present for queue policy rejections/superseded requests.
## Error Codes
| Code | Name | Description |