Skip to main content

Pack · tracking

tracking.queue

packs/tracking/blocks/queue.yaml

packtracking
2entities
7commands
7events
2views
22refusals
3KPIs

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​

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).

fieldtype
queue_idQueueId
issue_idoptional IssueId
task_idoptional TaskId
enqueued_attimestamp
claimed_byoptional PrincipalId
claimed_atoptional timestamp

Relations:

  • issue references Issue of tracking.issue (one, by issue_id)
  • task references Task of work (one, by task_id)
  • claimer references Principal of principal (one, by claimed_by)

Lifecycle of QueueItem

ClaimedDoneWaitingWithdrawnclaimreleasefinishwithdrawClaimedDoneWaitingWithdrawnclaimreleasefinishwithdraw
Ends in Done, Withdrawn.

WorkQueue​

One queue of work.

Identified by queue_id (QueueId).

fieldtype
nameName
ownerPrincipalId
created_attimestamp

Relations:

  • owned_by references Principal of principal (one, by owner)
  • items owns QueueItem (many, by queue_id)

Lifecycle of WorkQueue

ClosedOpencloseClosedOpenclose
Ends in Closed.

Commands​

Claim​

Claim a waiting item.

Called by: Taker.

fieldtype
item_idQueueItemId
byPrincipalId
attimestamp
outcomewhenresult
no-such-item refusedno such QueueItemItemNotFound: No item of this identity exists.
not-waiting refusedstate != WaitingItemStateConflict: The item is not in a state this command acts from.
unknown-claimer refusedno Principal for byUnknownPrincipal: No principal of this identity is registered.
claimedotherwisemoves the QueueItem Waiting → Claimed; emits ItemClaimed

CloseQueue​

Close a work queue.

Called by: Dispatcher.

fieldtype
queue_idQueueId
attimestamp
outcomewhenresult
no-such-queue refusedno such WorkQueueQueueNotFound: No queue of this identity exists.
closedotherwisemoves the WorkQueue Open → Closed; emits QueueClosedEvent
wrong-state refusedthe WorkQueue is in a state that does not allow itQueueStateConflict: The queue is already closed.

CreateQueue​

Create a work queue.

Called by: Dispatcher.

fieldtype
queue_idQueueId
nameName
ownerPrincipalId
attimestamp
outcomewhenresult
already-exists refusedthe WorkQueue exists alreadyQueueExists: A queue of this identity exists.
unknown-owner refusedno Principal for ownerUnknownPrincipal: No principal of this identity is registered.
createdotherwisecreates a WorkQueue in Open; emits QueueCreated

Enqueue​

Put an issue or a task into a queue.

Called by: Dispatcher.

fieldtype
item_idQueueItemId
queue_idQueueId
issue_idoptional IssueId
task_idoptional TaskId
attimestamp
outcomewhenresult
no-item refusednot (defined(issue_id)) and not (defined(task_id))ItemMissing: An item stands for exactly one issue or one task; the request names none or both.
two-items refuseddefined(issue_id) and defined(task_id)ItemMissing: An item stands for exactly one issue or one task; the request names none or both.
already-exists refusedthe QueueItem exists alreadyItemExists: An item of this identity exists.
no-such-queue refusedno WorkQueue for queue_idQueueNotFound: No queue of this identity exists.
unknown-issue refusedno Issue for issue_idUnknownIssue: No issue of this identity exists.
unknown-task refusedno Task for task_idUnknownTask: No task of this identity exists.
queue-closed refusedthe WorkQueue of queue_id has state == ClosedQueueClosed: The queue is closed; it takes no new item.
enqueuedotherwisecreates a QueueItem in Waiting; emits ItemEnqueued

Finish​

Finish a claimed item.

Called by: Taker.

fieldtype
item_idQueueItemId
byPrincipalId
attimestamp
outcomewhenresult
no-such-item refusedno such QueueItemItemNotFound: No item of this identity exists.
not-claimed refusedstate != ClaimedItemStateConflict: The item is not in a state this command acts from.
not-the-claimer refusedclaimed_by != input.byNotTheClaimer: Only the principal that claimed the item finishes or releases it.
finishedotherwisemoves the QueueItem Claimed → Done; emits ItemFinished

Release​

Release a claimed item back to the queue.

Called by: Taker.

fieldtype
item_idQueueItemId
byPrincipalId
attimestamp
outcomewhenresult
no-such-item refusedno such QueueItemItemNotFound: No item of this identity exists.
not-claimed refusedstate != ClaimedItemStateConflict: The item is not in a state this command acts from.
not-the-claimer refusedclaimed_by != input.byNotTheClaimer: Only the principal that claimed the item finishes or releases it.
releasedotherwisemoves the QueueItem Claimed → Waiting; emits ItemReleased

Withdraw​

Withdraw a waiting item.

Called by: Dispatcher.

fieldtype
item_idQueueItemId
attimestamp
outcomewhenresult
no-such-item refusedno such QueueItemItemNotFound: No item of this identity exists.
withdrawnotherwisemoves the QueueItem Waiting → Withdrawn; emits ItemWithdrawn
wrong-state refusedthe QueueItem is in a state that does not allow itItemStateConflict: The item is not in a state this command acts from.

Events​

eventfieldsemitted by
ItemClaimeditem_id QueueItemId, by PrincipalId, at timestampClaim
ItemEnqueueditem_id QueueItemId, queue_id QueueId, issue_id optional IssueId, task_id optional TaskId, at timestampEnqueue
ItemFinisheditem_id QueueItemId, by PrincipalId, at timestampFinish
ItemReleaseditem_id QueueItemId, by PrincipalId, at timestampRelease
ItemWithdrawnitem_id QueueItemId, at timestampWithdraw
QueueClosedEventqueue_id QueueId, at timestampCloseQueue
QueueCreatedqueue_id QueueId, name Name, owner PrincipalId, at timestampCreateQueue

Views​

viewrowsfields
QueueItems
Queue items
each QueueItemitem_id QueueItemId, queue_id QueueId, issue_id optional IssueId, task_id optional TaskId, enqueued_at timestamp, claimed_by optional PrincipalId, claimed_at optional timestamp, state State
WorkQueues
Work queues
each WorkQueuequeue_id QueueId, name Name, owner PrincipalId, created_at timestamp, state State

Types​

typeisvalues or fields
QueueIdan identifier or valueuuid
QueueItemIdan identifier or valueuuid

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​

KPIunitbettergatestatus
queue_wait_seconds
Seconds an item waits in a queue before its first claim.
How: Median of the first ItemClaimed time minus ItemEnqueued time per item.
secondslower–planned
source: design
claim_release_share
Share of claims given back without finishing the item.
How: ItemReleased events divided by ItemClaimed events. A released claim is work started and dropped.
sharelower–planned
source: design
claim_out_of_order
Claims 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.
countlower–planned
source: design

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:

settingtypeunitdefaultcontractwhat
countinteger of at least 11How many copies of the part run.
perpartOne copy of the part for each copy of the named part.
notesnotesFree 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.