Skip to main content

Module work_queue

Module work_queue 

Source
Expand description

Muxqueue HTTP surface — slice 2 of docs/reports/REPORT_UNIVERSAL_AGENT_WORK_QUEUE_2026_09_01.md.

POST /agentmux/work — enqueue POST /agentmux/work/claim — claim the next eligible item POST /agentmux/work/:id/heartbeat — extend a lease POST /agentmux/work/:id/complete — finish POST /agentmux/work/:id/release — give back GET /agentmux/work — list

The Kanban’s additions (cards, history, update/ask/submit, the next task) are in work_tasks.rs (SPEC_WARDEN_KANBAN_2026_10_20.md). An :id may be a task’s number (12) as well as its id.

Auth-gated by the same middleware as the cron and reactive routes.

Store choice: every handler uses state.work_store. In an installed or task package build that is the always-global identity store, not state.shared_store (cron’s place until it moves, SPEC_IDENTITY_STORE_SPLIT_2026_08_17.md step 1b), and deliberately so: a per-channel queue would only ever mean “any agent in this channel can pick it up”. A task dev build is the one exception, with a work-store.db of its own (crate::registry::work_store), so a test there never reads or changes the operator’s real queue.

Structs§

ClaimRequest 🔒
EnqueueRequest 🔒
HolderRequest 🔒
ListQuery 🔒

Enums§

Filer 🔒
Who files a task: a caller on this machine (its token says who it is and what it was asked), or an agent of another machine, named slug@machine, whose request the transport has verified.

Constants§

DEFAULT_LEASE_MS 🔒
Default lease granted by a claim, and the window a heartbeat extends by. Deliberately short relative to a long agent turn: a claimant is expected to heartbeat, and a crashed one should return to the pool in about a minute rather than blocking the item for an hour.

Functions§

after_on_board 🔒
Dependencies stay inside one board.
claimed_body 🔒
The answer to a claim: the attempt (the fence), the card’s number and the item, and after, the tasks it starts after with their documents. A build claimed by an agent no unlock note reached (it was filed for anyone) finds its spec’s path here.
claimed_reply 🔒
The answer to a claim that took: the body above, after the claim’s title is written to the agent’s status line.
claimer_uid 🔒
An Unattributed claimer’s UID: carried, else its block’s row, else "" (name path only). An attributed claim uses its Caller’s UID instead — see handle_work_claim.
count_holder_match 🔒
Count a holder check that matched by name — the row or the caller had no UID. Each is a holder that M5, which drops the name path, would refuse.
enqueue_core 🔒
File a task (or a spec and its build). The one path for a local call and a remote operation, so a task filed from another machine is numbered, carded and noted exactly like a local one.
enqueue_one 🔒
Enqueue one task with what it starts after (the row and the list in one transaction, so no claim takes it in between) and file its card.
err 🔒
file_pair 🔒
A feature as two tasks: its spec (or research), and a build that starts after it, for the same agent, filed and numbered together.
filing_board 🔒
Which board a filing goes to, if its filer sees it and the target agent is on its list. An agent of another machine (slug@machine) is matched against the board’s agent list by that name.
handle_work_claim 🔒
handle_work_complete 🔒
handle_work_enqueue 🔒
handle_work_heartbeat 🔒
handle_work_list 🔒
handle_work_release 🔒
Returns the item’s RESULTING state alongside ok (Codex P2 on PR #2902). A release on the item’s final allowed attempt parks it as failed rather than reopening it, so a bare {ok:true} would let the caller report “handed back to the queue” for an item nobody can ever claim again.
holder_result 🔒
Shared shape for the three holder-only transitions. No match from the store means the caller is not the current holder OR its fence is stale — both are CONFLICT, not NOT_FOUND: the row usually still exists, it just moved on without this caller.
holder_uid 🔒
The caller’s UID for a holder check (identity M4c-2, spec §6.5.9): the token’s, or "" when Unattributed — the store then matches by name.
list_items 🔒
list_view’s tasks alone, for the remote tasks.list.
list_view 🔒
The board’s tasks in state (all when empty), newest first as the store gives them, each with its number and ref, which agents and the operator use. Without board, the default board’s; all lists every board the caller sees. who is the caller’s id and UID, whose agent lists decide the boards it sees (none: all of them). The answer carries a line when more waits for the caller on other boards.
nothing_to_claim 🔒
The answer when an unnamed claim finds nothing. Only when the quota floor is what stood in the way does it say so.
publish_changed 🔒
review_for 🔒
Whether a filing is held for the operator’s Accept: what the filer said, else (a spec-and-build pair) no, as in the operator’s “Spec first”. Left to the provenance default, a spec an operator asked for would wait for an Accept that never comes, and its build could not start.
unclaimable_board 🔒
Why a named task can’t be claimed because of its board: one the claimer doesn’t see is as good as unknown, and an archived board’s tasks are read-only.