Skip to content

Pin, archive, move or eject a thread in the caller's list​

PATCH
/api/threads/{threadId}/rail

Changes how the caller's own list shows one thread (ADR 0042): a change of the thread's row, written to no event of its log (the log is the conversation, which a fork copies, an export carries and the readers of a share see: none of them sees or inherits it), so version, updatedAt and the thread's events do not change. At least one member is given, and an unknown one is a 400:

  • pinned: true pins the thread and puts it on top of the pinned; false unpins it and puts it on top of the rest. Pinning a thread that is pinned writes nothing.
  • archived: true archives the thread (it leaves the list listThreads gives by default and is listed with archived=only), false brings it back in the place it had. Archiving does not touch a share: the link keeps working, and share stays on the thread.
  • nested: false ejects a thread nested under another (a fork made nested under its parent): it becomes a thread of the list's own level, right after the block it left (on top of the unpinned when that block is pinned or archived). Its forkedFrom is untouched: ejecting is display grouping, not history. A thread that is not nested has nothing to eject. nested: true is a 422: nesting a thread by moving it is not built.
  • place: where a thread of the list's own level goes among the caller's: "top" (on top of its section), {"before": id} or {"after": id} (right before, or right after, that thread). The server makes the place; a client never sends a key. The anchor must be a thread of the caller's that is on the list's own level, not archived and not the thread itself, else 422 bad_anchor; a client that gets it reads the list again. With nested: false the place is where the ejected thread goes. A thread nested under another is not pinned and not placed: 422 nested_row (eject it first, or give nested: false with the place).

Changing a row to the state it already has is a 200 that writes nothing. Two arrangements at once may leave two threads of one place: they are ordered newest first, and nothing errors. It needs the thread to be the caller's and thread.read, not thread.write: it changes nothing in the conversation and nobody else sees it, the way taking a share down needs only ownership. Another person's thread is a 404 indistinguishable from one that does not exist, whatever the caller's roles.

Authorizations​

bearerToken

A JWT signed by the configured issuer (RS256, RS384, ES256 or EdDSA), with the configured audience. Read when auth.mode is jwt or jwt_or_proxy_header. A missing or refused token gets 401 with WWW-Authenticate: Bearer; an issuer whose keys cannot be fetched gets 503.

Type
HTTP (bearer)
or
dpopToken

A JWT as bearerToken, bound to the key of the client (cnf.jkt, RFC 7638), sent as Authorization: DPoP <token> with one DPoP header holding a proof signed by that key (RFC 9449, ADR 0054). Read only when auth.dpop is configured. A bad proof gets 401 with WWW-Authenticate: DPoP error="invalid_dpop_proof", algs="ES256 EdDSA", a bad or unbound token error="invalid_token".

Type
HTTP (DPoP)
or
proxyIdentity

Set by oauth2-proxy after OIDC login; requests without it get 401. Read when auth.mode is proxy_header (the default) or jwt_or_proxy_header without a bearer token.

Type
API Key (header: X-Auth-Request-Email)

Request Body​

JSON
{
  
"pinned": true,
  
"archived": true,
  
"nested": false,
  
"place": "top"
}

Responses​

The thread as it is now, with pinned, archived and nestedUnder where they hold

JSON
{
  
"id": "123e4567-e89b-12d3-a456-426614174000",
  
"owner": "string",
  
"title": "string",
  
"description": "string",
  
"target": {
  
  
"agentId": "string",
  
  
"release": "string"
  
},
  
"state": "queued",
  
"tools": [
  
  
"string"
  
],
  
"job": {
  
  
"number": 0,
  
  
"attempt": 0,
  
  
"maxAttempts": 0,
  
  
"gate": [
  
  
  
"ci"
  
  
],
  
  
"sha": "string"
  
},
  
"share": {
  
  
"visibility": "internal",
  
  
"effective": "private",
  
  
"url": "string"
  
},
  
"createdAt": "2024-01-01T00:00:00Z",
  
"updatedAt": "2024-01-01T00:00:00Z",
  
"lastSeq": 0,
  
"pinned": true,
  
"archived": true,
  
"nestedUnder": "123e4567-e89b-12d3-a456-426614174000",
  
"childOf": {
  
  
"threadId": "123e4567-e89b-12d3-a456-426614174000",
  
  
"session": "string",
  
  
"agent": "string",
  
  
"state": "working",
  
  
"keepOpen": true,
  
  
"closing": true,
  
  
"closeAsked": true
  
},
  
"forkedFrom": {
  
  
"threadId": "123e4567-e89b-12d3-a456-426614174000",
  
  
"seq": 0,
  
  
"kind": "fork"
  
}
}

Samples​

Powered by VitePress OpenAPI