Skip to main content

Module work_tasks

Module work_tasks 

Source
Expand description

The agents’ side of the Kanban (docs/specs/SPEC_WARDEN_KANBAN_2026_10_20.md §6.5, §6.8, §6.12), beside the queue’s own routes in work_queue.rs:

POST /agentmux/work/:id/update — a progress note, a checklist, links POST /agentmux/work/:id/ask — a question for the operator (blocked) POST /agentmux/work/:id/submit — hand it in (review, or done) POST /agentmux/work/:id/hold — put a waiting task on hold, or pause one’s own (any agent) POST /agentmux/work/:id/unhold — take a held task off hold (any agent)

And what srv adds to every task an agent touches: its card (number, repository, who asked), its history, the next task waiting for the agent when it finishes one, and leases that a live holder keeps without calling heartbeat.

Structs§

Filing 🔒
What an enqueue adds for the board: who asked, the repository.
HoldRequest 🔒
UpdateRequest 🔒

Constants§

GET_HISTORY 🔒
The most history lines GET /agentmux/work/:id returns.
LEASE_MS 🔒
The lease a live holder’s claim is kept at (work_queue::DEFAULT_LEASE_MS).
MAX_CHECKLIST 🔒
The most checklist steps kept.
MAX_PAYLOAD 🔒
The most characters a task’s payload (the brief its holder is handed) holds.
MAX_TEXT 🔒
The longest note, question or result kept on a card.
QUOTE_WINDOW_MS 🔒
How far a pane’s stored prompt may be from the start of the turn and still be what started it. The pane writes the prompt as the message is sent and srv opens the turn right after, so the two differ by a moment; a prompt from an earlier turn is minutes or more away.

Functions§

annotate 🔒
update without an attempt: any agent leaves a note, and links, on a task nobody holds (waiting, or on hold), as any agent can already hold, move or edit one. It is not a claim: no attempt is used and no lease is touched. The note is written as “: ” so the card says who wrote it, and the history line carries the same agent. A claimed task’s note, checklist and files stay its holder’s.
attempt_of 🔒
The attempt of a call only a holder can make (ask, submit).
caller_reg 🔒
The calling agent’s registration, by its token only: who asked for a task must not be something the caller can claim (§6.5).
card_update 🔒
clean 🔒
Text kept on a card or in the history: sanitized, at most MAX_TEXT characters.
conflict 🔒
doc_problem 🔒
Why a handed-in document path can’t be kept, if it can’t. The card’s Open button gives the path to the Editor as it is, and srv has no way to tell which clone a relative path meant, so only an absolute (or ~/) path will do.
expiring 🔒
The claims about to be reaped: record them as expired after the reap.
extend_live_leases 🔒
Keep the leases of claims whose holder is alive, so a long tool call or a model that never calls heartbeat doesn’t lose its task (§6.8). A holder is alive while it is registered and its process runs; one that is out of quota or signed out is alive but may let go of a task nobody in particular owns (renews_lease). Run before the reap.
failed 🔒
file_card 🔒
Give a just-enqueued task its card and first history line. Returns its number. Synchronous: called right after the enqueue, with nothing awaited between them; a claim or list that got in first made an empty card, which this fills.
finish 🔒
Finish a claimed task, for complete and submit: to Review when it needs review (the agent can’t accept its own work), else done. Answers with the resulting state and the agent’s next waiting task.
finish_task 🔒
handle_work_ask 🔒
POST /agentmux/work/:id/ask: the holder needs the operator. The task goes to Needs you; the holder keeps it, its lease paused.
handle_work_get 🔒
GET /agentmux/work/:id (Tasks get): one task whole, for any agent that sees its board: the instruction it was filed with, who it is for and who holds it, its card (links, note, question, checklist, what it starts after) and its last history lines. A task on a board the caller can’t see is refused like one that doesn’t exist.
handle_work_hold 🔒
POST /agentmux/work/:id/hold: any agent puts a waiting task on hold, so no one takes it until it is taken off hold; the holder of a claimed task pauses it, with its attempt (SPEC_KANBAN_AGENTS_HOLD_AND_UNHOLD_2026_10_22.md §3.1, §3.2).
handle_work_submit 🔒
POST /agentmux/work/:id/submit: the holder hands it in. A task that needs review waits in Review for the operator; one that doesn’t is done. The answer names the next task waiting for the agent.
handle_work_tokens 🔒
GET /agentmux/work/:id/tokens (Tasks tokens): a task’s tally and where it went, as counts, for any agent that sees its board. Never part of the answers an agent gets anyway: it costs nothing unless it asks.
handle_work_unhold 🔒
POST /agentmux/work/:id/unhold: any agent takes a held task off hold; it waits again for whoever it is for (§3.1).
handle_work_update 🔒
POST /agentmux/work/:id/update: a progress note, a checklist, links. Also a heartbeat.
holder_uid 🔒
holds 🔒
Whether the caller holds this claim now: the same rule as the queue’s holder transitions (UID when both are known, else the name), and the fence.
moved 🔒
name_of 🔒
A task as an agent’s answer names it: #12, else its id.
next_for 🔒
The next task waiting for this agent, as the answer to finishing one carries it (§6.5: it proceeds through its backlog).
payload_problem 🔒
Why a payload can’t be filed: it is empty, or longer than MAX_PAYLOAD.
payload_text 🔒
A payload as stored: sanitized and whole, or the reason it is refused.
payload_too_long 🔒
Why a payload is refused when it is longer than MAX_PAYLOAD: said, never cut, because an agent handed half a brief works from half.
pick_board 🔒
The board a call names (none: the default board), if the caller sees it. A board it can’t see is refused like one that doesn’t exist; filing also refuses an archived board, which takes no new tasks.
prepare_card 🔒
The card of a task about to be enqueued: who asked, the repository, the filer. Worked out before the row exists, so nothing awaits between the row and its card (file_card).
provenance 🔒
Who asked for what the agent is doing now: the operator, when a message of theirs started or joined the agent’s current turn (with their words, when they are tied to this task: quote_for_turn); another agent, when its message started it; else other. unknown when the call carried no token.
quote_for_turn 🔒
The operator’s own words for a card, or nothing when they can’t be tied to the task. A task carries a quote only when all of these hold, so a quote is never a guess:
record 🔒
One line of history; a failure to write it is logged, never the caller’s.
ref_of 🔒
How a task is written (#12 on the default board, else work#12) and its board’s slug.
refused 🔒
remote_card 🔒
The card of a task an agent of another machine files: asked by that agent (slug@machine), never by the operator, so it is not held for an Accept unless the request says so.
renews_lease 🔒
Whether a live holder’s lease on item is renewed (R5 of docs/specs/SPEC_UNRESPONSIVE_AGENTS_2026_10_23.md). Always, except for a holder that is out of quota or signed out on a task open to anyone or to a group: after 30 minutes of it, and with its reset more than an hour away (or not known), the lease lapses so someone else can take the task. A task aimed at an agent stays with it and shows in Needs you. The rule is decide with Intent::Lease (backend/agent_status.rs), with the numbers.
repo_of 🔒
The repository the agent works in and the branch it is on, from its work facts.
resolve_after 🔒
The tasks a task starts after (§6.15), as given: ids or numbers (12, "#12"), resolved to ids. The store checks the list when it writes it.
resolve_id 🔒
A task’s id from what an agent or the operator typed: its id, or its number (12, #12).
sees_task 🔒
Whether the caller may see the board a task is on (a call with no token sees every board). A task on a board whose agent list leaves the caller out is refused like one that doesn’t exist.
sensitive_reason 🔒
A hold’s reason shows on the shared Kanban: one that looks like a credential or a destructive command is refused, before anything moves.
target_state_words 🔒
Where the agent a task is aimed at stands, as words after its name: its state when it runs here, else that it is not running (stopped, parked or gone), which no claim of its own will end.
task_brief 🔒
The few fields of a task an agent’s answer names.
text_too_long 🔒
Why agent text is refused when clean would cut it: a note, a question or a result longer than MAX_TEXT is said so, not kept cut.
viewer 🔒
The agent a call comes from, by its token, for which boards it sees: its id and UID. None when the call carries no token, which sees every board.
waiting_for 🔒
Who a waiting task is for, as an answer says it.
why_not_claimed 🔒
Why a named claim (claim with id) took nothing: the first rule the task fails, in words the agent can act on.