Pack · tracking
tracking.queue
Work waiting to be taken, in the order it came. A work queue holds items, each standing for one issue (agentic.tracking.issue) or one task (agentic.work). A principal claims a waiting item and holds it until it finishes it or releases it back; only the claimer finishes or releases. The queue publishes when each item joined (enqueued_at), the order it is meant to be taken in. A closed queue takes no new item.
Depends on
- tracking.issue · pack tracking · 6 references
- work · layer 5 · 6 references
- principal · layer 1 · 15 references
- shared · layer 0 · 4 references
Used by
No block depends on this one.
Entities
QueueItem
One issue or task in a queue, waiting, claimed, done or withdrawn.
Identified by item_id (QueueItemId).
| field | type |
|---|---|
queue_id | QueueId |
issue_id | optional IssueId |
task_id | optional TaskId |
enqueued_at | timestamp |
claimed_by | optional PrincipalId |
claimed_at | optional timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Relations:
issuereferences Issue of tracking.issue (one, byissue_id)taskreferences Task of work (one, bytask_id)claimerreferences Principal of principal (one, byclaimed_by)
Lifecycle of QueueItem
Done, Withdrawn.WorkQueue
One queue of work.
Identified by queue_id (QueueId).
| field | type |
|---|---|
name | Name |
owner | PrincipalId |
created_at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Relations:
owned_byreferences Principal of principal (one, byowner)itemsowns QueueItem (many, byqueue_id)
Lifecycle of WorkQueue
Closed.Commands
Claim
Claim a waiting item.
Called by: Taker.
| field | type |
|---|---|
item_id | QueueItemId |
by | PrincipalId |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
no-such-item refused | no such QueueItem | Item: No item of this identity exists. |
not-waiting refused | state != Waiting | Item: The item is not in a state this command acts from. |
unknown-claimer refused | no Principal for by | Unknown: No principal of this identity is registered. |
claimed | otherwise | moves the QueueItem Waiting → Claimed; emits Item |
More columns: swipe horizontally, or focus the table and use the arrow keys.
CloseQueue
Close a work queue.
Called by: Dispatcher.
| field | type |
|---|---|
queue_id | QueueId |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
no-such-queue refused | no such WorkQueue | Queue: No queue of this identity exists. |
closed | otherwise | moves the WorkQueue Open → Closed; emits Queue |
wrong-state refused | the WorkQueue is in a state that does not allow it | Queue: The queue is already closed. |
More columns: swipe horizontally, or focus the table and use the arrow keys.
CreateQueue
Create a work queue.
Called by: Dispatcher.
| field | type |
|---|---|
queue_id | QueueId |
name | Name |
owner | PrincipalId |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
already-exists refused | the WorkQueue exists already | Queue: A queue of this identity exists. |
unknown-owner refused | no Principal for owner | Unknown: No principal of this identity is registered. |
created | otherwise | creates a WorkQueue in Open; emits Queue |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Enqueue
Put an issue or a task into a queue.
Called by: Dispatcher.
| field | type |
|---|---|
item_id | QueueItemId |
queue_id | QueueId |
issue_id | optional IssueId |
task_id | optional TaskId |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
no-item refused | not (defined(issue_ | Item: An item stands for exactly one issue or one task; the request names none or both. |
two-items refused | defined(issue_ | Item: An item stands for exactly one issue or one task; the request names none or both. |
already-exists refused | the QueueItem exists already | Item: An item of this identity exists. |
no-such-queue refused | no WorkQueue for queue_ | Queue: No queue of this identity exists. |
unknown-issue refused | no Issue for issue_ | Unknown: No issue of this identity exists. |
unknown-task refused | no Task for task_ | Unknown: No task of this identity exists. |
queue-closed refused | the WorkQueue of queue_ has state == Closed | Queue: The queue is closed; it takes no new item. |
enqueued | otherwise | creates a QueueItem in Waiting; emits Item |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Finish
Finish a claimed item.
Called by: Taker.
| field | type |
|---|---|
item_id | QueueItemId |
by | PrincipalId |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
no-such-item refused | no such QueueItem | Item: No item of this identity exists. |
not-claimed refused | state != Claimed | Item: The item is not in a state this command acts from. |
not-the-claimer refused | claimed_ | Not: Only the principal that claimed the item finishes or releases it. |
finished | otherwise | moves the QueueItem Claimed → Done; emits Item |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Release
Release a claimed item back to the queue.
Called by: Taker.
| field | type |
|---|---|
item_id | QueueItemId |
by | PrincipalId |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
no-such-item refused | no such QueueItem | Item: No item of this identity exists. |
not-claimed refused | state != Claimed | Item: The item is not in a state this command acts from. |
not-the-claimer refused | claimed_ | Not: Only the principal that claimed the item finishes or releases it. |
released | otherwise | moves the QueueItem Claimed → Waiting; emits Item |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Withdraw
Withdraw a waiting item.
Called by: Dispatcher.
| field | type |
|---|---|
item_id | QueueItemId |
at | timestamp |
More columns: swipe horizontally, or focus the table and use the arrow keys.
| outcome | when | result |
|---|---|---|
no-such-item refused | no such QueueItem | Item: No item of this identity exists. |
withdrawn | otherwise | moves the QueueItem Waiting → Withdrawn; emits Item |
wrong-state refused | the QueueItem is in a state that does not allow it | Item: The item is not in a state this command acts from. |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Events
| event | fields | emitted by |
|---|---|---|
ItemClaimed | item_ QueueItemId, by PrincipalId, at timestamp | Claim |
ItemEnqueued | item_ QueueItemId, queue_ QueueId, issue_ optional IssueId, task_ optional TaskId, at timestamp | Enqueue |
ItemFinished | item_ QueueItemId, by PrincipalId, at timestamp | Finish |
ItemReleased | item_ QueueItemId, by PrincipalId, at timestamp | Release |
ItemWithdrawn | item_ QueueItemId, at timestamp | Withdraw |
QueueClosedEvent | queue_ QueueId, at timestamp | Close |
QueueCreated | queue_ QueueId, name Name, owner PrincipalId, at timestamp | Create |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Views
| view | rows | fields |
|---|---|---|
QueueItemsQueue items | each QueueItem | item_ QueueItemId, queue_ QueueId, issue_ optional IssueId, task_ optional TaskId, enqueued_ timestamp, claimed_ optional PrincipalId, claimed_ optional timestamp, state State |
WorkQueuesWork queues | each WorkQueue | queue_ QueueId, name Name, owner PrincipalId, created_ timestamp, state State |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Types
| type | is | values or fields |
|---|---|---|
QueueId | an identifier or value | uuid |
QueueItemId | an identifier or value | uuid |
More columns: swipe horizontally, or focus the table and use the arrow keys.
KPIs
3 KPIs from the pack's catalogue, packs/tracking/kpis.yaml. A gate must be zero for a variant of an architecture to count.
Quality
| KPI | unit | better | gate | status |
|---|---|---|---|---|
queue_wait_secondsSeconds an item waits in a queue before its first claim. How: Median of the first ItemClaimed time minus ItemEnqueued time per item. | seconds | lower | – | planned source: design |
claim_release_shareShare of claims given back without finishing the item. How: ItemReleased events divided by ItemClaimed events. A released claim is work started and dropped. | share | lower | – | planned source: design |
claim_out_of_orderClaims of an item while an older item of the same queue was waiting. How: ItemClaimed events where an item of the same queue with an earlier ItemEnqueued was waiting (enqueued, not claimed, withdrawn or finished). Whether this is an error depends on the queue's order rule, which the pack leaves open. | count | lower | – | planned source: design |
More columns: swipe horizontally, or focus the table and use the arrow keys.
Settings
The settings a part of this block carries in an architecture document. agenticspec sim check refuses any other setting (setting_unknown) and a value outside its type (setting_invalid), and a part that lacks a setting marked required in the default column; the contract copies a setting into the ports it narrows. The last rows of each table are the settings every part takes. What no setting here types (a file, a path, an audience, the use of a model) goes into the part's notes, a map with free keys and values that the check takes as written and nothing reads.
A part tracking.queue:
| setting | type | unit | default | contract | what |
|---|---|---|---|---|---|
count | integer of at least 1 | 1 | How many copies of the part run. | ||
per | part | One copy of the part for each copy of the named part. | |||
notes | notes | Free notes on the part, a map with keys and values of any kind: what no setting of its block types. The check takes any map; the simulator, the search and the contract never read it. |
More columns: swipe horizontally, or focus the table and use the arrow keys.