Page kind: Reference
queue_enqueue#
Puts a change (head, with its first-parent chain since base) in target's landing queue and starts its runner: the entry lands once a check of it on the target's head passes (the repository's check, .swarmops/workspaces.json), with no other call. Pass a key to make a retry safe; wait for it with queue_wait.
- Since
0.13.0- Mutates
- yes
- Identity required
- yes
- Envelope op
queue_enqueue- Cli command
swarmops queue enqueue- Request type
QueueEnqueueReq- Annotations
{"destructiveHint":false,"idempotentHint":false,"openWorldHint":false,"readOnlyHint":false}- Max result chars
null- CLI command
swarmops queue enqueue
Input schema#
arguments is a QueueEnqueueReq: swarmops schema QueueEnqueueReq prints the type. A field the type does not know is ignored.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
base | string or null | no | Where the change starts: a first-parent ancestor of head. When omitted, the merge base of head and the target's head. | |
head | string | yes | The change's head. A revision as the caller wrote it, for the store to resolve: a ref name (main, release/1.2), a full 64-hex changeset id or a unique prefix of at least 12 hex digits, or a ref's earlier value: <ref>@{N} the value it held N moves before its current one (@{0} is the current value), <ref>@{at=<unix seconds>} the value set by its newest move recorded at or before that instant (the writer's clock, moves read in journal order); optionally followed by ~N for the N-th first-parent ancestor. | |
key | string or null | no | Makes a retry safe: at most 128 bytes. The same key with the same target, head and base answers the entry it made; with another, E_INVALID_ARG (details.reason key_reused). When omitted, each enqueue makes a new entry. | |
target | string | yes | The ref to land on, which must exist. |
JSON Schema#
As tools/list gives it: each $ref replaced by its definition, so that it stands alone.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "`queue_enqueue`: put a change in a target's queue. The answer comes once the entry is\ndurable. A store before `FORMAT 3` is `E_FORMAT_REQUIRED`; a change the target holds already\nis `E_NOTHING_TO_LAND`.",
"properties": {
"base": {
"anyOf": [
{
"description": "A revision as the caller wrote it, for the store to resolve: a ref name (`main`,\n`release/1.2`), a full 64-hex changeset id or a unique prefix of at least 12 hex digits, or a\nref's earlier value: `<ref>@{N}` the value it held N moves before its current one (`@{0}`\nis the current value), `<ref>@{at=<unix seconds>}` the value set by its newest move\nrecorded at or before that instant (the writer's clock, moves read in journal order);\noptionally followed by `~N` for the N-th first-parent ancestor.",
"type": "string"
},
{
"type": "null"
}
],
"description": "Where the change starts: a first-parent ancestor of `head`. When omitted, the merge base\nof `head` and the target's head."
},
"head": {
"description": "The change's head. A revision as the caller wrote it, for the store to resolve: a ref name (`main`,\n`release/1.2`), a full 64-hex changeset id or a unique prefix of at least 12 hex digits, or a\nref's earlier value: `<ref>@{N}` the value it held N moves before its current one (`@{0}`\nis the current value), `<ref>@{at=<unix seconds>}` the value set by its newest move\nrecorded at or before that instant (the writer's clock, moves read in journal order);\noptionally followed by `~N` for the N-th first-parent ancestor.",
"type": "string"
},
"key": {
"description": "Makes a retry safe: at most 128 bytes. The same key with the same target, head and base\nanswers the entry it made; with another, `E_INVALID_ARG` (`details.reason`\n`key_reused`). When omitted, each enqueue makes a new entry.",
"type": [
"string",
"null"
]
},
"target": {
"description": "The ref to land on, which must exist.",
"type": "string"
}
},
"required": [
"target",
"head"
],
"title": "QueueEnqueueReq",
"type": "object"
}Annotations#
It adds to the store and changes nothing there. Run again, a commit adds again, another changeset signed at its own time, unless the call carries an idempotency_key, which makes the same call again a replay; a blob_put of the same content finds it stored, and says so in its result.
| Annotation | Value | Meaning |
|---|---|---|
destructiveHint | false | True: a tool that changes the store may overwrite or delete what is there, not only add to it. |
idempotentHint | false | True: calling it again with the same arguments changes nothing more. |
openWorldHint | false | True: it reaches beyond a closed set of things. Every tool here stays inside the store. |
readOnlyHint | false | True: the tool does not change its environment, the store. |
Its entry in tools/list carries no _meta.
CLI command#
swarmops queue enqueue runs the same operation and prints the same envelope.
Examples#
{
"id": 2,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"head": "[first]",
"key": "k-1",
"target": "main"
},
"name": "queue_enqueue"
}
}{
"id": 2,
"jsonrpc": "2.0",
"result": {
"content": [
{
"text": "{\"api\":1,\"meta\":{\"auth\":\"trust\",\"elapsed_ms\":\"[elapsed_ms]\",\"repo\":\"[tmp]/store\",\"resolved\":{\"[first]\":\"[first]\",\"main\":\"[main]\"}},\"ok\":true,\"op\":\"queue_enqueue\",\"result\":{\"entry\":{\"base\":\"[main]\",\"head\":\"[first]\",\"id\":\"[entry1]\",\"key\":\"k-1\",\"position\":1,\"state\":\"waiting\",\"target\":\"main\"},\"replayed\":false}}",
"type": "text"
}
],
"isError": false,
"structuredContent": {
"api": 1,
"meta": {
"auth": "trust",
"elapsed_ms": "[elapsed_ms]",
"repo": "[tmp]/store",
"resolved": {
"[first]": "[first]",
"main": "[main]"
}
},
"ok": true,
"op": "queue_enqueue",
"result": {
"entry": {
"base": "[main]",
"head": "[first]",
"id": "[entry1]",
"key": "k-1",
"position": 1,
"state": "waiting",
"target": "main"
},
"replayed": false
}
}
}
}The server ran as swarmops mcp --repo [tmp]/store --as agent/worker-17, after initialize. Recorded by the MCP tests. A name in square brackets, such as [tmp] or [c1], stands for what differs from run to run: the test's temporary directory, an id, a time, the version.
Return information#
A tool result: the envelope, whose op is queue_enqueue, as structuredContent and again as the text of its one content block. isError is true exactly when the envelope's ok is false. On success the envelope's result is what swarmops queue enqueue returns.
Errors#
A failed call is a tool result with isError: true; the envelope's error.code is one of the error codes.
- E_INVALID_ARG: arguments that do not fit
QueueEnqueueReq, a field named twice among them included, or that break one of the server's own rules. - E_IDENTITY_REQUIRED: the server runs with no identity.
- E_NOT_A_REPO: the server's store is not there; the server serves on.
- E_INTERNAL: the operation panicked, a bug.
Then the errors of the operation, as swarmops queue enqueue lists them.
See also#
push
Sends a store ref (main by default) to a git remote's branch by compare-and-swap, never by force: the remote moves only from what the last fetch saw. A remote…
queue_status
The landing queue's entries, one target's or every target's or one entry, open ones in queue order first: each one's state, candidate, verdict and removal…