Skip to content

Lead kanban: owner sets capacity and goal, workers pull from a Ready column, slots refill automatically until the goal is met #244

Open

Description

@n0rpan

Owner 2026-11-21: "oxa repeatedly does not use the machines effectively. The lead needs to use the capacity the owner states; if we want speed, plan larger workflows and keep refilling the backlog in a smart way. Should the lead have a kanban board that workers take tasks from? Make it really easy for the owner and the lead to make sure the workers work until the real goal is achieved."

Seen today: air ran 2 of 5+ workers for over an hour while three finished slots stayed empty; n0rpan workers finished and waited for the lead to notice; 1.5 h of commits never became PRs (#2304); merges ran at 2-5 per hour against a target of 10. The cause is the model: the lead pushes each task to a worker by hand, so every free slot waits on the lead's next pass.

Make it pull-based (Rust, in oxa; builds on oxa work --queue, the work board, #191, #221)

  1. Owner states capacity and the goal, once. oxa.lead.capacity: workers per host (e.g. n0rpan: 8, air: 6), and the goal with measurable done-when (e.g. "FH score > Pi", "10 merged PRs/h", "lead web S1-S12 shipped"). Live, no restart (#2194).
  2. One board with columns: Backlog -> Ready -> Running (worker, host) -> PR open -> In queue -> Merged, plus Stuck with the reason. Every item is one slice (<= ~800-line PR) with a done-when and the issue it closes. The board is the lead web Board page (#2350) and oxa lead board in the terminal.
  3. Workers pull. A dispatcher in oxa keeps every host at its capacity: when a slot frees, it starts a worker on the top Ready item for that host (RAM-heavy and arm64 work prefers air), with the right model kind. The worker lands its own PR (#2304), reports, and the slot refills at once. No lead pass needed.
  4. The lead plans instead of dispatching. Its job is to keep Ready at least 2x total capacity: split issues into slices, order them by the owner's priorities (local speed and FH first), and keep refilling as items merge. Planning a larger chunk of work at once is fine and encouraged.
  5. Stop only at the goal. Running continues until the goal's done-when is met, not until Ready is empty; an empty Ready with an unmet goal is itself a stuck item the lead must fix.
  6. Visible to the owner in one glance: capacity used per host (e.g. n0rpan 8/8, air 6/6), Ready depth, merged per hour against the target, and the stuck list with causes.

Done when

  • With capacity n0rpan 8, air 6 and a filled Ready column, both hosts stay at capacity for a full hour with no lead action, and a finished worker's slot is refilled within a minute.
  • The lead web Home shows capacity used, Ready depth, merged/h vs target and stuck items.
  • A dogfood day reaches the owner's merge target, or the board names exactly what blocked it.

Activity

  1. n0rpan commented on Nov 21, 2026

    @n0rpan
    ContributorAuthor

    Plan (Fable 5.2, from the code at main 5e28e63; slices filed separately with label lead-kanban)

    Pull-based kanban in the lead web (issue #244)

    Scope: oxa lead serve and the worker tool as on main (5e28e63). Paths are relative to oxa/ unless stated. Builds on the lead-web plan (#2339, slices S1-S12); nothing here re-does those slices.

    Verdict. oxa has every part of a pull system except the two that matter: a list of planned work and a process that starts it. Today "the board" is a read-only projection of open GitHub PRs, and work starts only when the lead model calls worker start. So an idle slot costs a model turn to notice and a second one to fill. The fix is small: one owner-private work-board file (kanban), a model-free dispatcher thread inside oxa lead serve that fills slots from it through the existing worker launch path, and a reconciler that moves cards from GitHub facts the sampler already collects. The lead stops dispatching and only keeps Ready full. The web page and oxa lead board are two front ends over the same typed operations.

    Naming: board already means "GitHub PR policy board" in the code (oxa-work/src/board.rs). The new thing is called kanban in code and Board in the UI; the old PR list becomes the PRs view of the same page.


    1. What exists, what to reuse, what is missing

    Need Exists today Reuse Gap
    Board of work oxa-work/src/board.rs: Board{observed_at, entries: Vec<Entry>}, Entry{number, head, action: Action, lease, attempts_today, eligible}. Built from open PRs + issues by work_board.rs::Reader, written to the shadow log by shadow::run_with_landing Action (FixFindings, FixRequiredCi, ResolveConflict, WaitReview, Ready ...) as the "what does this PR need" fact on a card; Alarms.queue for merge-queue membership (lead_page.rs:21) It is derived, read-only, PR-keyed. No Backlog, no Ready order, no done-when, no host, no title (S7 adds title). Nothing planned-but-not-started can live in it
    Goal with measurable done-when oxa_session::Goal{objective, plan: Option<GoalPlan>}, GoalPlan{acceptance: Vec<GoalCheck>, subgoals[]{board_items}}, GoalCheck{id, acceptance, done_check, result}; rendered by lead_page/goal.rs; Board::next_goal_step (board/goal_plan.rs) GoalCheck/CheckResult as the type of a manual measure Bound to one session's goal mode; not editable by the owner from the web; no machine-evaluated measures (issues closed, merged count)
    Start a worker oxa-cli/src/workers/tool.rs::WorkerCore::start_at: worktree agent/<name>, goal file 0600, model by model_policy::choose(policy, explicit, kind, job, ...) from oxa.workers.models with escalation after failures, registry workers/<parent>.json (registry.rs), supervisor (proc.rs), resume of dead unfinished workers (resume.rs) All of it. The dispatcher is a second caller of the same launch path Only callable as a model tool inside a session; parent must be a session id; no host concept (WorkerRecord has none)
    Capacity oxa.workers.max (default 4, user-only, tool.rs:72) refuses a start past the limit; read at session build As the default per-host capacity One number per session, not per host; changing it needs a new session; nothing fills to it
    Worker state tool.rs::bindings() -> Binding{name, branch, model, state: WorkerState, status_age_secs}; registry::state (Starting/Working/Idle/Finished(outcome)/Dead/Stopped) Slot liveness and failure detection Local host only
    Hosts oxa_proto::work running rows carry host; incidents HostIdle, WorkerStalled; lane branches air/ (lane.rs:25) Host names in the Workers view (S11) No host registry, no remote launch in Rust. Air is reached by the lead running ssh air in bash (handover note; product version is #221)
    Stuck detection lead_loop.rs::stuck_signals, stall_reason, idle_worker; oxa-cli/src/lead/stuck.rs Its signals become Stuck causes Reports and asks only; no item to attach the cause to
    Owner priorities oxa_work::standing kinds Goal, Priority, Placement, Hold with Authority::{Owner, Lead} and revision checks (standing/types.rs, store.rs) Authority; live Priority/Hold rules as ordering input for the lead's planning packet Not a work list; 128-item cap; heavy for card moves
    Queue of prepared tasks oxa work board --refill -> helper_queue::publish directory queue, consumed by the oxa work runner (queue.rs, QueueOptions.max) with Claims leases Private-directory checks (helper_queue::directory), checkpoint::write_atomic_in It is the unattended runner path (packet per PR action, partitioned), not what the lab's lead uses; it has no owner-editable order or columns. Not extended here
    Web writes lead_http.rs::connection_fixed: POST /chat and /approvals behind owner identity, CSRF, Origin and Sec-Fetch-Site: same-origin, https; OwnerSubmission enum; 303 redirect so it works without JS One more path and variant on the same checks No board write path
    CLI CommandId::LeadBoard (["lead","board"], tail args) is registered but LEAD_PENDING and falls into the "handler unavailable" arm of dispatch.rs:269 The slot is already reserved No handler
    Telling the lead The session inbox writer behind oxa send (used by WorkerCore::send); steers arrive at the lead's next tool call (#2188) Dispatcher notices Nothing sends board events today
    Data to the page S4 Frame with per-panel revisions, S5 sampler in serve, S7 entries[].title/checks/review and merges[], S8 frame event Kanban is one more panel; reconciler reads the same sample Sample has no head branch name and no closing-issue numbers (needed to match a PR to a card)

    Gaps to build: (1) the kanban store and its operations, (2) a headless worker launch usable without a session and over ssh, (3) the dispatcher, (4) the reconciler, (5) the board page and its edits, (6) capacity/goal editors and goal measures, (7) lead planning instructions and CLI.


    2. Data model and storage

    2.1 Types (oxa-work/src/kanban.rs, kanban/{model,ops,store}.rs)

    Kanban { schema: 1, revision: u64, repo, goal: Option<Goal>, capacity: BTreeMap<HostId, Capacity>,
             dispatch: Dispatch, items: Vec<Item>, next_id: u32 }
    
    Item {
      id: u32                      // shown as K41; never reused
      rev: u32                     // bumped on every change to this item (edit conflict check)
      title: String                // <= 200 chars
      issue: Option<u64>           // the issue this slice closes
      done_when: String            // one measurable sentence; a Ready item must have one
      kind: String                 // job kind, validated by model_policy::valid_kind (build, review, docs, tests, hard ...)
      model: Option<String>        // explicit pin; normally None and the kind decides
      host: HostPref               // Any | Prefer(host) | Only(host)
      needs: BTreeSet<Need>        // Arm64 | X86 | RamHeavy  (placement facts, not free text)
      column: Column               // Backlog | Ready | Running | PrOpen | InQueue | Merged
      rank: u32                    // dense order inside the column; Ready rank is the pull order
      rank_by: Authority           // Owner order is kept when the lead re-sorts
      stuck: Option<Stuck>         // orthogonal: a stuck card keeps the column it returns to
      run: Option<Run>             // worker name, host, model, session_id, started_at, attempt
      pr: Option<Pr>               // number, head, branch, ci: RequiredCi, next: board::Action, queued_at, lines
      parent: Option<u32>          // set on the children of a split
      by: Authority, created_at, updated_at, column_since, merged_at: Option<u64>
    }
    Stuck   { cause: Cause, detail: String, since, by: Actor }
    Cause   = WorkerFailed | WorkerStalled | NoPr | CiRed | ReviewBlocked | Conflict | QueueRejected
            | PrClosed | NeedsOwner(ask_id) | HostDown | NoModel | Manual
    Goal    { text, measures: Vec<Measure>, target_per_hour: Option<f32>, set_at, met_at: Option<u64> }
    Measure = IssuesClosed{numbers | label | milestone} | ItemsMerged{all | parent} | MergedCount{n, since}
            | Manual(oxa_session::GoalCheck)        // owner ticks it, with evidence text
    Capacity{ slots: u32, paused: bool }            // per host; HostId must be a configured host
    Dispatch= Paused | Running | GoalMet | Starved  // owner sets Paused/Running; the dispatcher sets the other two
    

    Rules kept deliberately loose (warn and record, never refuse): an item without issue is allowed; a PR over ~800 changed lines gets a large chip (pr.lines), nothing more; a Ready item without done_when is the one thing an operation refuses, because the worker brief is built from it.

    2.2 Where it lives

    <agent_dir>/kanban/<owner>__<repo>/ (0700, checked with the helper_queue::directory rules: owner uid, no group/other write, canonical):

    • board.json (0600): the whole Kanban. Written with checkpoint::write_atomic_in under an flock on the directory, exactly like helper_queue::publish_reserved. Goal and capacity are in this file, not in settings.json: that is what makes them live without a restart, and it avoids the settings-mode trap (a 644 settings file takes lead-web down).
    • ops.jsonl (0600, append): one line per applied operation {seq, at, actor, op, inverse}. It is the undo source, the audit trail and the input for flow metrics (time in column, slot idle time). Rotated by size; never read on the request path.
    • archive.jsonl: merged items leave board.json when the owner clears the Merged lane or sets a new goal. Keeps the live file small with no arbitrary cap.

    Static host facts (how to reach a host, its repo path, its tags) are owner settings, because they are machine config, not work state: oxa.lead.hosts (section 3.2). Defaults, all owner-configurable under oxa.lead.board.*: ready_factor 2, retries 1, stall_minutes 30, stall_action notify, brief (path to the brief template; built-in text otherwise).

    2.3 Operations, not documents

    Every change is one typed Op applied by kanban::Store::apply(actor, op) -> Result<Applied> under the lock: Add, Edit{id, rev, fields}, Move{id, to, before: Option<id>}, Reorder{id, before}, Split{id, rev, children}, SetStuck{id, cause, detail}, Unstick{id}, Remove{id}, SetCapacity{host, slots, paused}, SetGoal, CheckMeasure{id, result}, SetDispatch, LinkPr{id, number}, Undo{seq}, plus system ops Started, Finished, Observed (reconciler). Moves and reorders are relative ("put K41 before K12"), so two phones or the owner and the lead never overwrite each other's whole board; only text edits carry the item rev and answer "changed since you opened it" with both versions.

    2.4 Who may write what

    Actor = Owner | Lead | Worker(item id) | System. The front end supplies the actor; it is never read from the request body or tool JSON (same rule as standing::Authority).

    Actor How it is established May
    Owner Web: verified Tailscale owner + CSRF (existing path). CLI: not inside an agent tool (is_agent(env) false) Everything
    Lead CLI run from the configured Lead session (agent env, no OXA_WORKER_DEPTH) Add, edit, split, reorder, Backlog<->Ready, stuck/unstick, link PR, tick a manual measure with evidence. Not: capacity, goal text/measures, dispatch on/off, removing owner-created items, re-ranking above an owner-ranked card. For those it opens an ask through the existing ask path
    Worker CLI with OXA_WORKER_DEPTH set and OXA_BOARD_ITEM given by the dispatcher note and stuck on its own item only
    System Dispatcher and reconciler threads in serve Running, PrOpen, InQueue, Merged, automatic Stuck causes, Dispatch::GoalMet/Starved

    All of these are the same OS user, so this is attribution and guard rails, not a security boundary; the security boundary stays where it is (who can reach the web page, CSRF, file modes).

    2.5 GitHub facts into columns (reconciler)

    kanban::reconcile(&Kanban, &Facts) -> Vec<Op> is a pure function; the serve process runs it whenever the board sample changes (each S5 sample, default every 60 s; on S4 it is a subscriber of the Frame). No GitHub call of its own.

    Fact in the sample Effect
    Open PR whose head branch is the item's worker branch (agent/k41-...) or whose body closes the item's issue pr filled; Running -> PrOpen when the worker has finished, otherwise the card stays Running and shows the PR chip
    Entry.action / PullRequest.required_ci pr.next, pr.ci on the card. FixRequiredCi, FixFindings, ResolveConflict with no live worker make the card a fix candidate for the dispatcher (3.3)
    PR in Alarms.queue at the same head PrOpen -> InQueue; queue rejection (LandingSample.queue_rejections) -> back to PrOpen as a fix candidate, cause QueueRejected if it repeats
    PR in S7 merges[] -> Merged, merged_at; goal measures re-evaluated
    PR gone and not in merges[] Stuck PrClosed
    Worker finished done and no PR after two samples (S7 branches_without_pr) Stuck NoPr
    S7 review.state blocking, Restricts: hold, thread hold Stuck ReviewBlocked / NeedsOwner with the ask id

    Two sample fields are added for matching (in the same GraphQL page, like S7's): entries[].branch (head ref name) and entries[].closes[] (closing issue numbers). Closed-issue facts for IssuesClosed come from one small issue-state query per sample for the numbers the goal names.

    2.6 Restarts

    Everything durable is in board.json and the worker registry. On start the dispatcher loads the board, lists live workers per host (3.2), and for each Running item either re-adopts its worker, resumes it (existing resume::due rule: dead or interrupted and not owner-stopped), or counts a failed attempt. An op that was applied but whose process died before the response is simply visible on reload; ops are idempotent by (id, rev) or by target state.


    3. Dispatcher

    3.1 Which process

    A thread in oxa lead serve (oxa-cli/src/lead_dispatch.rs, started from lead_serve::run next to the S5 sampler). Reasons: it is the always-on, model-free process; it already owns the sample and (S4) the frame; a refill then costs zero tokens and no model latency. The lead session cannot be the dispatcher: that is today's design and the cause of #244. oxa lead board dispatch --once runs one pass from the CLI for tests and for hosts without serve.

    3.2 Slots per host

    oxa.lead.hosts (user settings, object keyed by host id; live-reloaded by the dispatcher on file mtime):

    "oxa.lead.hosts": {
      "n0rpan": { "launch": [],              "repo": "~/oxa-dev/tasks/ox-llm", "arch": "x86_64", "tags": [] },
      "air":    { "launch": ["ssh", "air"],  "repo": "~/oxa-dev/tasks/ox-llm", "arch": "arm64",  "tags": ["ram-heavy"] }
    }
    

    With the key unset there is one host, the local one, with capacity oxa.workers.max. Nothing about n0rpan or air is in the code.

    One launch path for every host: a new headless command oxa worker run (--name --kind --job --goal-file - [--model] [--resume] --parent kanban), which is WorkerCore::start_at without a session: same name checks, worktree, goal file, model_policy::choose, registry (workers/kanban.json), supervisor. It stays in the foreground, prints one JSON line per state change (started{session_id, branch, model, why}, status{phase}, finished{outcome, reason}) and exits with the worker. The dispatcher spawns launch + ["oxa", "worker", "run", ...] with the brief on stdin; launch empty means a local child. The child process is the slot: a slot is used while its child lives. This is the existing ssh path made typed; #221 later replaces launch with its transport and nothing else changes.

    • Model choice happens on the host that runs the worker (its own oxa.workers.models and keys), from kind and the job key k<id>; air has its own model settings. The dispatcher passes --model only when the card pins one.
    • After a serve restart: local slots are recovered from workers/kanban.json; remote ones from launch + oxa worker list --parent kanban --json.
    • capacity[host].slots is read from the board on every pass, so the owner's change applies to the next pass. Lowering it never stops a running worker; it only stops refills.
    • Host readout for the capacity sheet (load, free memory, live workers) rides on the same worker list --json reply. Low memory is a warn chip on the host, not a block.

    3.3 The pull loop

    Event-driven; a pass runs when a child exits, when board.json changes (owner moved a card, raised capacity), when a new sample arrives, and every 15 s as a floor.

    if dispatch != Running: return                       # Paused, GoalMet
    evaluate goal measures; if all pass: dispatch = GoalMet, notify, return
    for each host with free = slots - live > 0 and not paused:
        candidates = fix candidates (PR open, needs a fix, no live worker)   # finish before starting
                   ++ Ready items by rank
        pick the first candidate this host may take:
            Only(h) / needs arch  -> hard: only that host or arch
            Prefer(h) / RamHeavy  -> soft: skipped by another host only while the preferred host has a free slot
        start it: brief from title + issue + done_when + template; op Started
    if Ready < ready_factor * total slots: notify lead (once per level change)
    if free slots exist and no candidate: dispatch = Starved, notify lead now
    
    • Refill latency. Local: child exit to next start under 5 s. Remote: under 15 s with an ssh control connection. Target shown to the owner: p95 slot idle time under 60 s while Ready is not empty; measured from ops.jsonl (Finished to next Started on that host) and shown on Home. GitHub is not on this path.
    • Brief. Built from the card only: title, Closes #issue, the done-when, "one PR, about 800 lines at most, land it yourself as AGENTS.md says". It never restates or overrides repo rules. Fix runs resume the same worker session (--resume) with the failing fact (pr.next, failed job names) as the message.
    • Failure. A worker that ends dead, failed, blocked, or stopped by nobody counts one attempt. retries (default 1): it is started again once; model_policy sees the failed attempt for the same job and escalates as the owner configured. The second failure sets Stuck WorkerFailed with the worker's last status reason (masked like session text), frees the slot and pulls the next card. A worker whose status file has not changed for stall_minutes is marked Stuck WorkerStalled and keeps its slot (stall_action: notify, the default) or is stopped and retried (restart).
    • Stop at the goal. Empty Ready with an unmet goal is Starved, an alarm on Home ("3 slots idle for 4 min: Ready is empty") and a notice to the lead, never a stop. Only passing measures or the owner's pause stop it. At GoalMet running workers finish; nothing new starts.
    • Telling the lead. One line per event to the configured Lead session through the session inbox writer (the one oxa send uses), coalesced per pass: board: Ready 3, want 12 (2 x 6 slots). Run: oxa lead board plan, board: K41 stuck: worker failed twice (required CI: clippy), board: goal met (4/4 measures). lead_loop.rs::stuck_signals gets the same facts for its report. The owner sees them as Home attention rows.
    • Default state is Paused until the owner presses Start once: adding the feature never starts workers by itself.

    4. Design

    Same tokens and components as the approved mock (--accent only on tappable things, status colour only when not OK, tabular numbers). Uses the S1 layer: ui::panel, row, chip, meter, btn, empty, missing, age. New components, all in lead_page/ui.rs: lane, card, stepper, sheet.

    4.1 Board on a phone (390 px)

    ┌──────────────────────────────────────────┐
    │ ox-llm            ● 12 s ago         ◐  │  top bar (S1)
    ├──────────────────────────────────────────┤
    │ Board                         [PRs] [+]  │  h1 · view switch · add
    │ Goal  v0.2.1 out            ███████░ 5/7 │  tap -> goal sheet
    │ n0rpan ●●●○ 3/4   air ●●○ 2/3   ▶ Running│  tap -> capacity sheet
    │ 8.2 merged/h · target 10    Ready 9/14   │
    ├──────────────────────────────────────────┤
    │ Stuck 2 · Backlog 14 · Ready 9 · Running5│  chips = lane index, counts, scroll-x
    ├──────────────────────────────────────────┤
    │ READY  9                      + Add    │▒│  lane 86vw wide, next lane peeks
    │ ┌──────────────────────────────────────┐│▒│
    │ │ 1  Per-panel swap keeps scroll   ▲ ▼ ││▒│  rank · title (2 lines) · reorder
    │ │ oxstack/ox-llm#2347 · build · any host             ││▒│  chips: issue, kind, host
    │ │ Done when: board change swaps only…  ││▒│  muted, one line
    │ │                              [Move ▾]││▒│
    │ └──────────────────────────────────────┘│▒│
    │ ┌──────────────────────────────────────┐│▒│
    │ │ 2  arm64 release build check     ▲ ▼ ││▒│
    │ │ oxstack/ox-llm#2301 · tests · air only · RAM       ││▒│
    │ └──────────────────────────────────────┘│▒│
    ├──────────────────────────────────────────┤
    │  Home   Asks•3   Board   Workers  Usage  │
    └──────────────────────────────────────────┘
    
    • Lanes are one horizontal scroll-snap-type: x mandatory container; each lane scrolls vertically inside the page. The chip row is the lane index (plain anchors, works without JS) and shows counts. Lane order: Stuck, Backlog, Ready, Running, PR open, In queue, Merged. The page opens on Stuck when it is not empty, otherwise on Running, so the first thing seen is the thing to look at.
    • No drag as the primary gesture on a phone (it fights the scroll). Move opens a small sheet with the legal targets as full-width buttons: one tap, then a toast with Undo. Ready cards have ▲ ▼ and, in the sheet, "To top".
    • Lanes that follow GitHub (PR open, In queue, Merged) carry a small lock in the header; the Move sheet does not offer them and says why in one muted line.

    Card anatomy by column:

    Column Line 1 Chips Line 3 (muted)
    Backlog title issue, kind, no done-when (warn) done-when
    Ready rank + title issue, kind, host pref, needs done-when
    Running title worker state (working / starting / idle), host, model "started 14 min ago · attempt 2" · PR chip once it exists
    PR open title #PR, CI 7/9 or CI red (bad), next action from board::Action, large "waiting for review 22 min"
    In queue title #PR, queue age
    Merged title #PR "merged 14:02 · 48 min from Ready"
    Stuck title cause chip (warn or bad), column it came from detail; buttons: Retry · Unstick · Ask lead

    4.2 Item sheet (/board/k/41, a real URL; with JS it opens as a bottom sheet)

    ┌──────────────────────────────────────────┐
    │ ─────                                    │
    │ K41 · Ready · oxstack/ox-llm#2347                 Done │
    │ Title    [Per-panel swap keeps scroll  ] │
    │ Done when                                │
    │ [A board change swaps only the board   ] │
    │ [panel; scroll and focus stay.         ] │
    │ Kind  [build ▾]   Host [Any ▾]  Model [–]│
    │ Needs  ( ) arm64  ( ) x86  ( ) RAM-heavy │
    │ ──────────────────────────────────────── │
    │ [ Move ▾ ]  [ Split ]  [ Mark stuck ]    │
    │ History  14:02 lead added · 14:10 you ▲  │
    │                              Remove item │
    └──────────────────────────────────────────┘
    

    Fields save on blur or Done (one Edit op per field, 16 px inputs so iOS does not zoom). Kind options come live from oxa.workers.models.kinds; host options from oxa.lead.hosts. Split opens two (or more) title + done-when pairs prefilled from the original; the children take its place in the same column and rank, and the original is archived as their parent. Mark stuck asks for a cause from the list and an optional line. A Running card adds Stop worker (held for the undo window before it is applied, the S12 mechanism) and Send follow-up (goes through worker send).

    4.3 Capacity and goal sheets

    ┌─ Capacity ───────────────────────────────┐   ┌─ Goal ───────────────────────────────────┐
    │ n0rpan   x86 · 16 cores · 6.1 GB free    │   │ [v0.2.1 out: Rust-only release        ]  │
    │ 3 running            [ − ]   4   [ + ]   │   │ Done when                                │
    │ air      arm64 · 8 cores · 9.4 GB free   │   │ ✓ Issues closed: oxstack/ox-llm#951 oxstack/ox-llm#2262 oxstack/oxa#221  2/3   │
    │ 2 running            [ − ]   3   [ + ]   │   │ ✓ All board items merged          14/19  │
    │ ! air: 1.1 GB free, lower it?            │   │ ○ Installs on yoga (manual)   [ Tick ]   │
    │ Applies now. Lowering never stops a      │   │ + Add measure                            │
    │ running worker.                          │   │ Target  [10] merged/h                    │
    │ Dispatch   [ ▶ Running ]  [ Pause ]      │   │ [ Save ]                                 │
    └──────────────────────────────────────────┘   └──────────────────────────────────────────┘
    

    Both open from the strip at the top of Board and from the Home flow card. Steppers are 44 px, one SetCapacity op per tap, with the result echoed in the strip at once.

    4.4 Desktop (>= 900 px)

    ┌ rail ┬────────────────────────────────────────────────────────────────────────────────────────┐
    │ Home │ Board   Goal v0.2.1 ███████░ 5/7   n0rpan 3/4 · air 2/3   8.2/h (10)   [Kanban|PRs] [+] │
    │ Asks ├──────────┬──────────┬──────────┬──────────┬──────────┬──────────┬──────────────────────┤
    │ Board│ STUCK 2  │BACKLOG 14│ READY 9  │RUNNING 5 │PR OPEN 4🔒│IN QUEUE 1🔒│ MERGED 14 🔒       │
    │ Work │ ┌──────┐ │ ┌──────┐ │ ┌──────┐ │ ┌──────┐ │ ┌──────┐ │ ┌──────┐ │ ┌──────┐             │
    │ Usage│ │K38   │ │ │K52   │ │ │1 K41 │ │ │K33   │ │ │K29   │ │ │K27   │ │ │K21   │             │
    │ Chat │ │CI red│ │ │      │ │ │2 K44 │ │ │air   │ │ │CI 7/9│ │ │      │ │ │      │             │
    │      │ └──────┘ │ └──────┘ │ └──────┘ │ └──────┘ │ └──────┘ │ └──────┘ │ └──────┘             │
    └──────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────┴──────────────────────┘
    

    Seven equal columns with sticky headers; cards are draggable (HTML drag-and-drop) between Backlog/Ready/Stuck and within Ready; a locked column refuses the drop with its one-line reason. The same Move button and item sheet (as a right-side panel) remain, so every action has a non-drag path. Keys: j/k select, [ ] move column, Shift+j/k reorder, e edit, s stuck, u undo. A Table toggle shows the same items as rows (sortable by column, host, age) for long boards.

    4.5 Home flow card (extends S6/S7)

    Flow                                         ▶ Running
    n0rpan ●●●○ 3/4     air ●●○ 2/3     slot idle p95 38 s
    Ready 9 of 14 wanted        8.2 merged/h · target 10  ▂▃▅▆▅▇▆▅▃▅▆▇
    Stuck 2   K38 CI red twice (clippy) · K40 no PR after 12 min     >
    

    Capacity used per host, Ready depth against ready_factor x slots, merged per hour against the goal's target (S7's bars), and the stuck list with causes. Starved and GoalMet are banner states: amber "3 slots idle: Ready is empty, lead told 2 min ago" and green "Goal met 14:20: dispatch stopped".

    4.6 Interaction rules

    • Writes: each control is a plain form posting to /board with op=... and the CSRF token; without JS it is POST + 303 back to the lane. With JS the same POST goes by fetch, the card moves optimistically (150 ms), and a refused op puts it back with the reason inline.
    • Undo: every op records its inverse; the toast offers Undo for 6 s and oxa lead board undo does the same later, as long as nothing else has touched the item. Stopping a worker and removing an item are held server-side for the undo window before they take effect.
    • Live: the board is a data-panel=kanban whose lanes are sub-panels keyed by the store revision; the S8 frame event carries kanban: rev, and only changed lanes are swapped. A card with focus or an open sheet is never swapped; it gets a "changed elsewhere" line instead. Ages tick client-side (S3).
    • States (S3 components): no board file yet -> empty "No board yet. Add the first item or let lead plan: oxa lead board plan"; store unreadable -> missing with the allow-listed cause (mode, owner, corrupt) and last good rows dimmed; dispatch paused -> grey strip with Start; host unreachable -> the host's dots hollow with "air: no reply for 3 min", other hosts unaffected; reconciler behind -> PR lanes show the sample age in their header.
    • Security: unchanged model. Board writes need the verified Tailscale owner, CSRF, same-origin and https, like /approvals; a new toggle oxa.lead.serve.owner_board (WebEdit::Confirm, widening) turns them on. In local identity the board is read-only. All item text is escaped by the one escape; worker-reported reasons pass the existing masking. Host and kind values are chosen from configured lists, never free text. CSP is untouched (no inline script; drag-and-drop lives in live.js).

    5. Lead behaviour and CLI

    The lead plans; it does not dispatch. Its instructions (oxa-resources/builtin-skills/lead/SKILL.md and the lab's LEAD.md) change to:

    1. Never start a build worker for board work by hand while dispatch is Running; use worker only for planning helpers (kind plan) and for answering a stuck card.
    2. Keep Ready at ready_factor x slots or more. On a board: Ready ... notice, run oxa lead board plan: it prints one bounded packet (goal and unmet measures, lane counts, Backlog, open issues not on the board from the sample's issue intake, the owner's live Priority/Hold standing rules, stuck cards). From it the lead slices in one planning turn for the whole shortfall (a chunk of 6-12 cards, not one card per turn): each card one PR of about 800 lines, with an issue and a done-when a reviewer can check.
    3. Order Ready by the owner's priorities; never re-rank above a card the owner placed (rank_by: Owner), and say why when it disagrees (an ask, not a move).
    4. For each Stuck card: fix the cause (split it, rewrite the done-when, change kind or host, answer the review) and Unstick, or open an ask when the decision is the owner's.
    5. When Ready cannot be filled because the goal's measures are nearly met, say so; do not invent work. When all measures pass, report and stop.

    CLI, same operations as the web (oxa-cli/src/lead_board_cmd.rs, wiring the already registered CommandId::LeadBoard):

    oxa lead board                         lanes with counts, top cards, capacity, goal progress
    oxa lead board list [--column C] [--json]
    oxa lead board show K41 [--json]
    oxa lead board add --title T [--issue N] [--done-when S] [--kind K] [--host H|--only H] [--needs arm64,ram-heavy] [--ready]
    oxa lead board add --from-json -       many cards in one write (the lead's planning chunk)
    oxa lead board edit K41 [--title ..] [--done-when ..] [--kind ..] [--host ..] [--model ..]
    oxa lead board move K41 ready|backlog [--before K12|--top]
    oxa lead board split K41 --from-json -
    oxa lead board stuck K41 --cause ci_red [--detail S]      |  unstick K41  |  retry K41
    oxa lead board link K41 --pr 2360      |  rm K41  |  undo
    oxa lead board capacity [HOST N] [--pause HOST|--resume HOST]
    oxa lead board goal [--text S] [--measure issues:951,2262] [--measure merged-all] [--measure manual:"Installs on yoga"] [--target 10]
    oxa lead board check M3 --passed --evidence S
    oxa lead board dispatch start|pause|--once
    oxa lead board plan                    the planning packet (read-only)
    

    Every command prints the applied op with its sequence number, or the refusal and its reason; --json everywhere. The actor comes from the environment (2.4), so the owner in a terminal has owner powers and the lead session has lead powers with the same words.


    6. Slices

    Each is one PR of about 800 lines or less, default-on behind the Paused dispatch state (nothing starts workers until the owner presses Start). K1, K2 and K6 have no lead-web dependency and can be built by agent workers on day one, in parallel.

    # Title Files Done when Depends on
    K1 Kanban store: items, goal, capacity, typed ops, undo new oxa-work/src/kanban.rs, kanban/{model,ops,store}.rs, oxa/docs/kanban.md A board survives a kill at any point with no torn file; two writers moving different cards both win; a stale text edit is refused with both versions; each actor can do exactly its row of the table in 2.4; undo restores the previous state none
    K2 oxa lead board: the whole board from the CLI new oxa-cli/src/lead_board_cmd.rs, dispatch.rs, oxa-interactive/src/command_registry.rs (LeadBoard supported), help.rs, docs/pages/cli.md Owner and lead can add, edit, move, reorder, split, stick, set capacity and goal from a terminal; --json round-trips; a worker environment can only note its own item K1
    K3 Board page: lanes on a phone, columns on desktop (read-only) new lead_page/kanban.rs, lead_page/ui.rs (lane, card), lead_page/pages.rs (/board = kanban, ?v=prs = PR list, /board/k/N), style.css, lead_serve.rs (read store) /board shows seven lanes with counts, goal and capacity strip, card anatomy per column, at 390 px and 1280 px in both themes; the PR list is one tap away; missing/unreadable store states say why K1, S1; uses S3 components when landed; coordinate with S11 (same page)
    K4 Edit the board from the web lead_http.rs (POST /board, OwnerSubmission::Board), lead_serve.rs (owner board handler), lead_page/kanban.rs (forms, Move sheet, item sheet, add), live.js (fetch + toast), oxa-config/src/descriptor/lead.rs (owner_board), docs/pages/lead-web.md From an iPhone the owner adds a card, edits title and done-when, moves it between Backlog/Ready/Stuck, reorders Ready and undoes each; all of it works with JS off; a non-owner or cross-origin POST is refused and logged like approvals K3, S1; shares the toast/undo-hold with S12 (whichever lands first adds it)
    K5 oxa worker run: headless launch for dispatch and ssh new oxa-cli/src/workers/run_cmd.rs, workers/tool.rs (expose the start path for a non-session parent), workers/registry.rs (host-less reuse), command_registry.rs, docs/work.md oxa worker run --kind build --job k41 --goal-file - starts the same worktree/branch/model choice as the tool, streams JSON state lines, exits with the worker; worker list --parent kanban --json reports live workers with load and free memory; --resume continues a dead one none
    K6 Dispatcher: keep the local host at capacity new oxa-cli/src/lead_dispatch.rs, lead_serve.rs::run (start/stop thread), oxa-work/src/kanban/ops.rs (system ops), oxa-config descriptors oxa.lead.board.*, docs/kanban.md With dispatch Running and Ready not empty, a freed slot is refilled in under 5 s with the top Ready card and the model its kind selects; a failed worker is retried once, then the card is Stuck with the cause and the next card is pulled; raising capacity from the CLI fills the new slot with no restart; a serve restart re-adopts or resumes Running cards; the lead session receives one line per event K1, K5
    K7 Reconciler: PRs, CI, queue and merges move the cards new oxa-work/src/kanban/reconcile.rs, work_board.rs (sample branch, closes[], issue states for goal numbers), oxa-work/src/shadow.rs, lead_input.rs, lead_dispatch.rs (fix candidates) A card follows its PR to PR open, In queue and Merged within one sample; red CI or findings with no live worker restarts the same worker session before any new card; a closed PR or a finished worker with no PR becomes Stuck with that cause K1, K6; S7 for merges[]/checks/review (carries a minimal merges[] if S7 has not landed); S5 for a 60 s sample; S4 when present (frame subscriber)
    K8 Capacity and goal editors, measures, stop at the goal oxa-work/src/kanban/goal.rs (measure evaluation), lead_page/kanban.rs (two sheets, stepper), lead_http.rs (ops), lead_dispatch.rs (GoalMet, Starved), lead_page/goal.rs (link) The owner sets slots per host and the goal with measures from the phone and sees them apply on the next pass; dispatch stops when every measure passes and reports it; empty Ready with an unmet goal raises Starved and tells the lead instead of stopping K4, K6, K7
    K9 Hosts over ssh: air as a second host, placement oxa-config descriptor oxa.lead.hosts, lead_dispatch.rs (launch prefix, per-host slots, placement by host/needs, host health), lead_page/workers.rs (capacity meter per host), docs/kanban.md With air configured, arm64 and RAM-heavy cards start on air first, other cards fill whichever host is free, an unreachable host shows its cause and does not hold up the other; no host name appears in code K6; extends S11 Workers by host
    K10 Lead plans, not dispatches oxa-resources/builtin-skills/lead/SKILL.md, lead_board_cmd.rs (plan packet, add --from-json), lead_loop.rs (kanban signals in stuck_signals), docs/lead.md On a low-Ready notice the lead adds a chunk of sliced, ordered cards in one turn and Ready returns to ready_factor x slots; it does not start board workers by hand; owner-ranked cards keep their place K2, K6
    K11 Flow on Home: capacity, Ready depth, merged/h vs target, stuck list lead_page/home.rs (flow card, Starved/GoalMet banner), oxa-work/src/kanban/metrics.rs (slot idle, time in column from ops.jsonl), lead_page/usage.rs Home shows capacity used per host, Ready depth against the wanted depth, merged per hour against the goal's target and the stuck cards with causes; slot idle p95 is a measured number K6, K7; S6, S7
    K12 Live board: per-lane updates, optimistic moves, desktop drag and keys lead_http.rs (kanban rev in the frame event), lead_observer.rs (kanban panel), live.js, style.css A move on one device appears on another within 1 s with only the changed lanes swapped; scroll, focus and an open sheet survive; drag between columns and within Ready works on desktop with a keyboard equivalent K4; S4, S8
    K13 Split, stuck actions and item history lead_page/kanban.rs (split form, Retry / Stop worker / Send follow-up, history from ops.jsonl), lead_dispatch.rs (stop, retry on request), tests/fixtures/lead/ (kanban fixtures for S10 screenshots) A card can be split into children that take its place; a stuck card is retried, reassigned or stopped with one tap and undo; the sheet shows who did what and when K4, K6; S10, S12

    Order: K1, K5 in parallel on day one; K2 and K3 the same day behind K1; then K6 (the slice that ends idle machines, usable from the CLI alone), K4, K7, K8, K9, K10, K11, K12, K13. After K6 + K7 + K10 the lab can run pull-based with the CLI; the web edits follow without blocking it.

    Relation to the lead-web slices

    • S11 (Board rows, Workers by host, Item detail): kept, not replaced. Its PR rows become the PRs view (/board?v=prs); the kanban is the default /board. Its /items/N page is what a card's PR chip links to. Its Workers-by-host view gains the capacity meter in K9. S11 and K3 touch the same page, so K3 lives in its own file (lead_page/kanban.rs) and S11's board.rs only gains the view switch.
    • S7 (Throughput and stuck): kept as the data source (merges[], titles, checks, review, branches_without_pr). Extended two ways: its target oxa.lead.target.merges_per_hour becomes the default for the goal's live target_per_hour, and its stuck counts stay as filters on the PRs view while the Home stuck group becomes the kanban Stuck list with causes (K11). K7 adds two sample fields beside S7's.
    • S6 (Home): gains the flow card and two banner states (K11). S4/S8: kanban is one more panel and one more revision in the frame event (K12); K3 and K4 do not wait for them (reading a small file per render is fine until S4). S5: sets how fast PR lanes follow GitHub; refill speed does not depend on it. S12: one shared toast and undo-hold. S3: its missing/empty components carry every board state. S10: gets kanban fixtures.

    7. Risks and what was not verified

    Not verified (read the code only; nothing was built or run, and line counts are estimates):

    • How air workers are started today. The handover says the lead reaches air with ssh air; the exact command is in the lab's LEAD.md on n0rpan, which was not read. K9 assumes "ssh air oxa worker run ... with the brief on stdin" works there (same dev build, clone and keys). Check the lab's command first and wire to it.
    • WorkerCore without a session. start_at takes the parent from self.session(); K5 assumes it can run with a fixed parent id (kanban) and no session Host (the host is already optional for model verification). The registry path check accepts that id.
    • Workers die with their parent (PR_SET_PDEATHSIG in proc.rs). A serve restart (the dev auto-update restarts lead-web every 4 h) interrupts every dispatched worker; K6 relies on the existing resume rule to continue them. That costs a few minutes of throughput per restart. If it hurts, the fix is a small per-host dispatch process that outlives serve, which is what Remote worker hosts: the lead runs workers on other machines that connect out to it (a2a) #221 is for; not designed here.
    • POST body size in lead_http.rs: the chat/approval paths bound the body; whether a 2 KB done-when fits the current limit was not checked. K4 sets the board path's bound explicitly.
    • Sample fields: the head branch name and closing issue numbers are assumed to be available in the GraphQL page the Reader already fetches; issue open/closed state for goal measures is one extra small read per sample and counts against oxa.lead.github_reserve.
    • Standing rules as priorities: whether the lab actually records owner priorities in oxa_work::standing was not checked; if not, K10's packet falls back to owner-ranked cards and the goal text.
    • Landing: "the worker lands its own PR" still depends on the lab's review and merge loops (tools/auto-approve.sh, merge-flow.sh). The kanban observes them; it does not replace them.
    • Actor by environment (owner / lead / worker in the CLI) is attribution inside one OS user, not a boundary. A yolo lead could edit board.json directly; the op log would not show it. Accepted for a lab tool; the web path keeps the real checks.

    Risks:

    • Two sources of "running": the lead can still start workers by hand through the tool; those do not appear as cards and do use the machine. K9's host readout shows live workers not owned by the board ("2 other workers on n0rpan") so the owner can see why a host is busy; capacity counts only board slots.
    • Wrong PR match (a PR that closes the same issue from another branch) moves the wrong card. Branch match wins over issue match, and link fixes it by hand.
    • Starved loops: if the lead cannot slice fast enough, hosts idle with a clear cause instead of silently. The planning packet and chunked adds (K10) are the lever; the Home number (Ready depth against wanted) makes it visible.
    • Memory on n0rpan (15 GB, 16 cores): the capacity default is oxa.workers.max (4), not a computed number; the sheet shows free memory and warns, and the owner decides. RAM-heavy cards prefer air by the ram-heavy tag, which is owner config.
    • Scope creep with S11: both change /board. Land S11 first or agree the file split above before K3 starts.
  2. transferred this issue fromon Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions