The work item object
A work item reaches a client in three shapes, and the route entries name the one each answers with. This page lists the fields of each shape, then explains the ones that need it. The detail object carries more keys than are listed here: the ones left out are for the board's own screens, and /openapi.json describes only the stable fields of the list and detail answers, so this page is the full reference.
The three shapes
| Shape | Answered by | What it holds |
|---|---|---|
| The stored row | An approve, a reject and a retry that stops at once. | Every column of the item's row, as saved. |
| The list row | One per item in GET /api/work-items. | A short subset of the columns, and a few computed fields. |
| The detail object | GET /api/work-items/{id}. | The stored row, and the computed fields below. |
The stored row
The stored row has one key per column of the item's row. A column that holds JSON comes as text, except the three override columns, which are decoded. It has none of the computed fields, such as display_status, stop or budget_cap.
| Column | Type | Meaning |
|---|---|---|
id | string | The item's ID. |
title | string | One line of plain text. |
description | string or null | The brief the agents are given. |
repo | string | The absolute path of the connected repo. |
status | string | active, needs_human, waiting, rate_limited, paused, queued, blocked, completed or abandoned. Work item statuses says what each means. |
chain_template | string or null | The chain named when the item was filed, or @one-off for an item filed with a one-off chain of its own. |
materialized_chain | string or null | The chain the item runs, frozen when it was filed, as JSON text. Its target.in_place is true for an in-place item. |
current_node_id | string or null | The node the item stands on. null before it first runs. |
stop_kind | string or null | Why the item is stopped, while it is needs_human, waiting or rate_limited. See stop.kind. |
retry_at | string or null | While rate_limited, when the limit resets and the item may relaunch. |
pending_steer_context | string or null | The note left while the item was paused, which the next agent launch takes. |
base_ref | string or null | The commit the item's diff is measured against. null until the item first runs. |
branch | string or null | The git branch the item's worktree, merge request and merge all name. |
bead_id, implements_beads | string or null | The item's own bead, and the bead IDs it implements as a JSON list. |
attachments | string or null | The spec and plan attached at intake, as a JSON list of {kind, path, ...}. |
auto_gate | integer | 1 when agent review of the item's auto_escalate gates is armed. |
budget_set, budget_usd | integer, number or null | With budget_set 1, budget_usd is the item's own dollar cap, and null means no cap. With 0, the policy default applies. |
agent_overrides, node_overrides, policy_override | object or null | The item's overrides, decoded. node_overrides is {} when there are none. |
archived_at, archived_by | string or null | When the item was archived, and whether by you or auto. |
created_at, updated_at | string | When the row was made and last changed, as UTC timestamps. |
The list row
The list row is built for the board, from one grouped query, so it leaves out the fields that need a lookup per item. It has these keys:
- From the stored row:
id,title,description,repo,status,chain_template,current_node_id,bead_id,created_at,updated_at,retry_at,archived_atandarchived_by. chain_definition, as the chain's nodes, andattachments, as a decoded list.pending_gate, the gate waiting on a person, ornull.one_off,display_status,stop,step,mr_ref,progress,actionsandworktree_exists, explained below.
It has no agent_overrides, node_overrides or policy_override.
The detail object
The detail object is the stored row, with chain_definition replaced by the chain's nodes and attachments by a decoded list, plus these keys:
| Key | Meaning |
|---|---|
effective_chain | The chain with the item's node overrides folded over it. |
usage | The item's usage per node and in total: tokens, cost and wall time. |
worktree_path | Where the worktree is, or is due to be, on the server's disk. For an in-place item, the repo's own folder. |
head_sha | The worktree's HEAD commit, or null when there is no worktree. |
pending_gate | The gate waiting on a person, or null. |
review_head | While the pending gate is the final review, the head a decision on it must name. null otherwise. Send it back as head. Added in 2.3 |
reject_default | The node a rejection would re-enter at. null with no gate pending. |
stop_reason | The stop's reason text, or null when the item isn't stopped. |
started_at, ended_at | When the chain first started a node, and when the item completed, was cancelled or was abandoned. null until then. Added in 2.4 |
dependencies | [{id, title, status, met}] for each item this one comes after; met is true only for a completed one. |
suggested_action | {action, reason}: what the chain or a repair concluded a person should do, where action is skip, retry or abandon. null when none. |
ended_reason | Why a person ended the item, from the reason on its cancel or abandon event. null otherwise. |
needs_context_question | The worker's question, while the item is stopped on one. null otherwise. |
steerable | Whether a note sent now to POST /api/work-items/{id}/steer or /resume would be accepted. |
worker_sessions | One entry per session. skipped is true when a skip cut the session short. |
Fields that need an explanation
| Field | Meaning |
|---|---|
display_status | List and detail. The board's status badge, one of archived, done, cancelled, paused, queued, blocked, running, waiting, needs_you, escalated, failed. Computed on read, not stored: see Displayed status. |
stop | List and detail. null unless the item is needs_human, waiting or rate_limited. See The stop field. |
actions | List and detail. The doors a request would be admitted through now. See The actions field. |
test_result | Detail only. The latest changed-test-scope verification run. See The test_result field. |
budget_cap | Detail only. The item's effective dollar cap and spend. See The budget_cap field. |
running_time | Detail only. {running_s, cap_minutes}: seconds any session ran since the last retry a person made, against the item-wide time_cap_minutes. |
summary | Detail only. A run's progress: summary. |
step | List and detail. {index, count, name, task} or null: the step the item is in. |
mr_ref | List and detail. The item's merge request, {number, url}, or null. |
progress | List and detail. The item's place in its plan. See The progress field. |
worktree_exists | List and detail. See The worktree_exists field. |
The one_off field
Added in 2.5
null for an item on a library chain. For an item filed with a one-off chain, an object:
| Key | Meaning |
|---|---|
extends | The library chain it was written on, or null. |
custom | How many parts a person must review: its own prompts, commands, tools or gates. 0 when it is library-only. |
needs_review | true until a person has approved it. An item with needs_review set doesn't start. |
approval | by, door, at, digest and review_digest of the approval, or null. |
The list row and the detail object carry it; the stored row doesn't.
Why the item stopped
The stop field
stop is {kind, node, resume_at, reason} on the list. The detail adds task, attempt and facts. On a cap or budget stop it adds limit, and on a budget stop scope.
facts.cause names why an infra stop happened, when Kraft knows. The facts field lists the values. A rate_limit stop's facts also carries fallback and fallback_allowed: the stopped task's declared fallback harnesses, and which of those its resolved policy still allows.
stop.kind
stop.kind is one of fourteen values: gate, question, cap, budget, failed, conflict, mr_closed, config, infra, stuck, wait, rate_limit, checkout and slices. Stop kinds says what each means, and The troubleshooting pages give each stop's reason with its fix.
Slices: children, slices, group, parent_id and slice_key
Added in 2.6
A parent whose plan was sliced carries its children. A child names its parent. An ordinary item carries none of these.
| Field | On | Meaning |
|---|---|---|
slices | A parent | The counts of its children of the current generation: {done, needs_you, paused, running, queued, dropped, total}. |
children | A parent | Its children of the current generation, in slice order, each {id, title, slice_key, status, display_status, current_node_id, cost_usd}. |
group | An item whose chain has a slice group, on the detail | {id, phase, groundwork, slices, joined}: the phase, the plan's shared-groundwork tasks, its slices and how many the join replayed. |
parent_id, slice_key | A child | The parent's ID and the slice's number. |
A child isn't a row of GET /api/work-items: its parent's row carries it. A parent's display_status is needs_you while a child needs a person, whatever the parent's own status.
stop.limit
A cap or budget stop on the detail also carries limit: {path, key, value, maximum} when a PATCH of the item's policy can raise what stopped it, and omits it when none can.
key | What it caps | path |
|---|---|---|
max_attempts, timeout_minutes | A fix loop's attempts or its clock. | The node ID. |
time_cap_minutes, total_time_cap_minutes | The work item's own cap. | "" |
budget_usd | On a budget stop, the item-wide policy dollar cap. | "" |
value is the limit that stopped it, in attempts, minutes or dollars. maximum is the maxima ceiling or null. Raise it with PATCH /api/work-items/{id} and {policy: {<key>: N}}, or {policy: {paths: {<path>: {<key>: N}}}} for one node, then POST /api/work-items/{id}/retry.
There is no limit for a budget stop on the item's own cap, which POST /api/work-items/{id}/budget/raise raises, nor for a node, step or task cap, a token_budget, the daily cap, a gate's timeout, a loops: cap in policy.yaml or exhausted rate-limit retries.
stop.scope
A budget stop on the detail also carries scope, the cap that stopped it:
scope | The cap |
|---|---|
work_item | The item's own dollar cap. |
usd | A budget_usd, item-wide or on a node, step or task, or spend a harness never reported. |
tokens | A token_budget. |
daily | budget.daily_usd. |
What can be done now
The actions field
Added in 2.1
actions lists the doors a request would be admitted through now, in this order: approve, reject, resume, steer, retry, raise_budget, reopen_mr, unblock, skip, pause, escalate, complete, cancel, restore, archive, abandon.
Each is read from the item's status and the same facts its door checks, such as a pending gate, an open must-fix thread or a spend-cap stop. Who asks isn't one of them, so a worker's own item still lists doors that refuse the worker. An archived item lists restore, not archive.
Tests and spend
The test_result field
test_result is {scopes: [{command, scope, passed, exit_code, session_id}], passed}, or null when no scope has finished.
- One entry per scope, passed or failed.
passedis true when every scope passed. - An area's setup appears only when it failed.
- A scope still running is left out.
session_idis the scope's session. Read its log withGET /api/work-items/{id}/sessions/{session_id}/log. See Session IDs in a path.
The budget_cap field
budget_cap is {cap_usd, source, key, spent_usd, daily}.
cap_usdis whichever cap stops the item first: the lower of its own cap and the item-widebudget_usdof its policy. It isnullwhen neither is set.keysays which cap it is, and thePATCHfield that changes it:budget_usdfor the item's own cap,policy.budget_usdfor the policy one.sourceisitemwhen the item itself set the reported cap, andpolicywhen it comes frompolicy.yamlor the chain.spent_usdis the item's own, all-time spend.dailyis{spent_usd, cap_usd}: the instance's spend since local midnight againstpolicy.budget.daily_usd.
POST /api/work-items/{id}/budget/raise (kraft item raise-budget) raises whichever of the two caps stopped the item.
Progress and the worktree
The summary field
summary is a run's progress at a glance:
{"nodes_done": 3, "nodes_total": 8, "gates_passed": 1, "step": {"index": 2, "count": 2}}
nodes_done and nodes_total count against the frozen chain. gates_passed is how many of the completed nodes carry a gate after them. step is the current node's step out of its own steps when the node declares more than one, and null otherwise.
The progress field
progress is {current, total, title, tasks}, or null when the item has no plan to follow. Each task is {n, title, state, sha}. state is done, current or pending, and sha is the short hash of the newest commit on the item's branch that names the task, or null. Rows on the list carry only current, total and title.
The worktree_exists field
worktree_exists is whether worktree_path is a directory on disk. It is false before the item first runs and after its worktree was reclaimed or deleted.
open-worktree, mr-labels and the viewed routes answer 404 when the directory is missing. A retry or resume recreates it.
Related
- Filing, reading and deciding work items: the routes that answer these shapes.
- Events: the
stop.kindvalues, thefactsof a stop, and the events behind each field. - Work item statuses: what each stored and displayed status means.
Filing, reading and deciding work items
The routes a script plausibly calls on a work item, which file one, read the board and one item, approve or reject a gate, and retry a stopped item.
Connecting a repo
The routes a script calls to list the connected repos, probe a repository, connect it and disconnect it.