Derived Status Board
When you hand several requests to AI agents and step away for a few hours, the worst feeling when you come back is a dashboard full of green "in progress" spinners that quietly stopped moving yesterday afternoon — forcing you to open every chat thread and ask, "Where are we on this?"
Derived Status Board gives you one place showing every request you made, with one plain line per request naming where it stands and who must act next. Nobody writes to the board. Every line is computed directly from the operational records the agents already produce — requests, jobs, and open questions — so status can never go stale from neglect.
LastVisit
Why manually maintained status always lies
Across engineering, research, finance, and operations, directing several agents at once turns status tracking into a hidden tax. Suppose you kick off a request at 12:30 p.m., a lead agent assigns a worker, and at 2:00 p.m. the worker hits a decision only you can make. The question gets posted into a busy chat channel, buried under a dozen routine updates from other work. Meanwhile, your task list still displays "In progress" with a spinning icon.
Two structural failures caused that lost day. First, the status was a hand-maintained label set when work began, and nothing updated it when the worker paused or crashed. Second, the single fact that actually mattered — the request is now waiting on you — lived only inside unstructured chat text instead of a queryable record.
Derived Status Board removes both failure modes by refusing to store status separately from the work itself:
- Every participant writes only operational records. Creating a request, assigning a job, opening or escalating a question, and marking a job done all happen through the hub as a normal part of doing the work. Nobody ever "updates the board."
- Every line names who must act next and since when. When the requester opens the board, the hub computes each request's line on the fly by checking open questions first, then active jobs, then unassigned work, then finished jobs.
- The board and the question queue read the exact same query. If a board line says "Waiting on you," that question is guaranteed to appear in your question queue — and vice versa.
Why does deriving status eliminate "waiting on nobody" blind spots? Because
the projection function has to name a concrete party for every unfinished request. If a
worker goes silent past the hub's grace period, the hub atomically marks the job
lost and assigns a reassignment question to the lead agent.
Work can never sit in limbo behind a cheerful "in progress" badge.
Architecture and participants
The architecture separates writing operational facts from
computing the human view. Every participant — the requester, lead agent,
and workers — records normal work transitions in the Hub.
When the requester opens the board, the hub evaluates one pure projection over those
records, flags everything that moved since LastVisit, and
advances the cursor.
Request,
Job, Question, and
LastVisit, detects silent workers after a grace period,
and computes both the board and every party's open question queue.
answerer_id, and marks completed jobs
done.
Execution flow
Toggle between the normal escalation flow — where a worker's question moves from the lead agent to the requester and flips the board line automatically — and the silent-worker failure path — where the hub detects a dead worker, opens a reassignment question for the lead agent, and rejects a stale late report without ever interrupting the requester.
Each operational step updates one hub record. When the lead agent passes Worker 1's
question on to the requester, answerer_id changes in
place while opened_at stays fixed — so the board
immediately shows "Waiting on you" from the exact moment work stopped.
Begins after Worker 1 has been assigned a job and is actively working.
When Worker 1 stops silently, the hub's grace-period sweep atomically marks the job
lost, hands ownership to the lead agent, and opens a
reassignment question. Once reassigned to Worker 2
under the same job.id, any late completion report from
Worker 1 is rejected with not_current_assignee.
Four-tier precedence: On every read, the hub computes each line's
waiting_on and since by
taking the first matching case: (1) open questions, (2) open jobs or unapplied open
answers, (3) no active jobs (waiting on lead agent), or (4) all non-canceled jobs done
(waiting on nobody).
Concrete examples
Derived Status Board works identically across operations, research, and software delivery — any domain where work moves through hub records while the requester steps away.
Example 1 — Quarterly customer renewal briefs
No code or unit tests- Setup
-
Dana kicks off two concurrent requests on Monday morning:
Q4 Enterprise Renewal Briefs (12 accounts) and
Competitor Pricing Summary. The lead agent assigns
Worker 1to renewal terms andWorker 2to competitor research. - Blocker hits
-
At 2:00 p.m.,
Worker 1discovers three accounts on a legacy multi-year discount and asks the lead agent whether to honor the old rate or switch to current list pricing. The lead agent cannot decide pricing policy and passes the same question on to Dana. - Board result
-
When Dana glances at her board at 2:05 p.m., line 1 reads:
Q4 Enterprise Renewal Briefs — Waiting on you since 2:00 p.m.: "Honor legacy
multi-year discount or move to list pricing?" Line 2 reads:
Competitor Pricing Summary — Waiting on Worker 2 since 12:40 p.m. Nobody
typed either summary; Dana answers in 30 seconds and line 1 flips back to
Worker 1.
Example 2 — Adding Google sign-in to a web app
Software workflow- Setup
-
At 12:30 p.m. Dana asks her agents to add Google sign-in to Acme's web app. The lead
agent assigns
Worker 1to build the sign-in flow. The board computes: Waiting on Worker 1 since 12:30 p.m. - Escalation & crash
-
At 2:00 p.m.,
Worker 1asks whether users should also sign up with email or Google only. The lead passes the question to Dana, so the board immediately flips to Waiting on you since 2:00 p.m. Dana answers "Google only," andWorker 1resumes. At 3:10 p.m., Worker 1's machine shuts down silently. - Board result
-
After the grace period expires, the hub marks the job
lostand opens a reassignment question for the lead agent. The board shows Waiting on Lead agent without pinging Dana. The lead reassigns the same job toWorker 2, the hub ignores a stale completion report when Worker 1 reconnects, and once Worker 2 finishes and the lead marks the jobdone, the line appears once as Finished — Waiting on nobody until Dana's next visit.
What this pattern is NOT — Single live chat or unrecorded offline work
Negative example- Scenario
- One person pairing synchronously with a single agent in one live chat window, or a team whose tasks happen in offline conversations with no hub records.
- Why skip it
- In a live 1-on-1 chat, the thread itself already shows where the single request stands. And if work is not recorded in a hub, someone has to type every status update manually — which creates an ordinary hand-maintained tracker that goes stale the moment people get busy.
When to use and when to skip
Use Derived Status Board when
- One requester directs multiple concurrent agents that keep running while the requester is away.
- Work can pause for blockers — questions, approvals, reviews, or lost workers — that only one specific party can clear.
- Your hub already records requests, job assignments, open questions, and job completions.
- People keep interrupting agents or leads with "where does X stand?" messages.
Skip it when
- One human works interactively with one agent in a single live session.
- Work happens outside structured records, forcing humans or agents to author status prose by hand.
- You actually need proactive alerts between check-ins — pair the board with Question Inbox for notification timing.
Data model and hub invariants
Derived Status Board adds only one tiny stored table —
last_visits — and computes everything else on read from
parties, requests (from
Orchestrator-Workers),
jobs (from Durable Job),
and questions (from
Self-Contained Question). Neither
BoardLine nor MonitorLine
is a stored table.
LastVisit keys directly on
person_id so each requester has at most one board cursor.
The hub joins Request,
Job, Question, and
Party on read to compute every board line without storing
derived status.
Table defined on this page: last_visits
| Column | Postgres type | Nullability | Notes |
|---|---|---|---|
| person_id | uuid | NOT NULL, PK, FK | References parties(id) where kind = 'person'; primary key guarantees at most one cursor per requester. |
| visited_at | timestamptz | NOT NULL | Updated only by the hub, strictly after computing the board lines for that visit. |
Computed projections (never stored)
| Projection | Key computed fields | Derivation rule |
|---|---|---|
| BoardLine | request_id, title, waiting_on[], since, questions[], waits[], open_answers[], claims[] |
First matching rule: (1) open questions → answerers since oldest opened_at; (2) open jobs or unattached open answers → wait supplier / job assignee / lead since earliest timestamp; (3) zero non-canceled jobs → lead_id since last cancellation or asked_at; (4) all done → empty waiting_on ("nobody") since latest finished_at. |
| MonitorLine | monitor_id, statement, status, since, last_ran_at, missed |
One line per active monitor (ended_at IS NULL) owned by the requester, surfacing the newest check's ran_at and whether the latest due check was missed. |
| Changed & visible | changed_since_visit, show_finished |
A line has changed when line.since > last_visit.visited_at. A finished request stays visible until the requester's first board look after completion, then ages off automatically. |
Companion records read (read-only) when other patterns are active
| Record | Defined by | Fields read | Effect on the board line |
|---|---|---|---|
| Wait | Resumable Wait | job_id, needs, supplier_id, acknowledged_at, due_at, state |
For a job in state waiting, names supplier_id in waiting_on and surfaces overdue waits. |
| Answer | Tracked Answer | question_id, job_id, text, answered_at, state |
Lists open answers until applied; an open answer without an active job puts the request back on lead_id. |
| Claim | Evidence-Backed Completion | job_id, kind, holds, made_at |
Constrains a finished line's summary strictly to the newest holding claims on its done jobs. |
| Monitor & Monitor check | Condition Monitor | requester_id, statement, status, status_since, ended_at, due_at, ran_at, outcome |
Renders each active condition monitor as its own MonitorLine with missed-check flags. |
| Impact item | Change Propagation | job_id, decision, applied_at |
Provides the latest applied_at cancellation timestamp when every job of a request was stopped. |
Eight hub invariants
-
01At most one last-visit cursor per person Database constraint
last_visits.person_idis the primary key and a foreign key toparties(id), guaranteeing every requester has a single monotonic visit timestamp. -
02Every job and question belongs permanently to one request Database constraint
jobs.request_idandquestions.request_idareNOT NULLforeign keys torequests(id), ensuring every open blocker rolls up to a concrete board row. -
03Done jobs always carry a completion timestamp Database constraint
A row-level
CHECK ((state = 'done') = (finished_at IS NOT NULL))guarantees the board can always compute a finished request'ssincetimestamp from its completed jobs. -
04Board lines and question queues share one query Hub guard
Both
compute_board_linesandopen_question_queueread the exact same filtered list ofopenquestions sorted oldest-first, making it impossible for the board to show "waiting on you" when your queue is empty. -
05Lost-worker detection and reassignment are atomic Hub guard
When
now - job.last_heard_at > grace_seconds,sweep_lost_jobsmarks the joblost, movesassignee_idtorequest.lead_id, and opens onereassignmentquestion in a single transaction.reassign_jobrejects non-lead callers withonly_lead_may_reassignand non-lost jobs (such asdoneorcanceled) withjob_not_lost; when valid, it preservesjob.id, resetsstatetoworking, and closes the reassignment question atomically. -
06Only the active assignee on a working job may report progress Hub guard
accept_worker_reportrejects a replaced worker withnot_current_assigneeand rejects reports on non-working jobs withjob_not_working. Onlyrequest.lead_idmay callmark_job_done(elseonly_lead_may_mark_done). -
07Passing a question on updates answerer in place Hub guard
pass_question_onrejects closed questions withquestion_not_open, changes onlyanswerer_idon the same row, and preserves the originalopened_atso total wait time never resets. -
08Last visit advances only after computing the board Hub guard
Only
visit_boardwriteslast_visits, and strictly after comparing each computed line'ssinceagainst the previousvisited_atso newly finished requests are shown once.
Reference implementation
The same pure board projection and hub state guards in Lean, TypeScript, Python, and Elixir. Notice that no operational transition touches any board structure — the board is strictly computed from live records on read.
-- Pure read-only board projection + hub guards for Derived Status Board
import Std.Data.HashMap
open Std
inductive JobState where
| unassigned | working | waiting | lost | done | canceled
deriving Repr, BEq
inductive QuestionState where
| «open» | answered | withdrawn | expired -- «» lets the keyword `open` be a name
deriving Repr, BEq
inductive QuestionKind where
| decision | fact | action | review | reassignment
deriving Repr, BEq
structure Request where
id : String
title : String
askedById : String
leadId : String
askedAt : Nat -- unix seconds
deriving Repr
structure Job where
id : String
requestId : String
assigneeId : String
state : JobState
assignedAt : Nat
lastHeardAt : Nat
finishedAt : Option Nat := none
deriving Repr
structure Question where
id : String
requestId : String
jobId : Option String
kind : QuestionKind
answererId : String
text : String
state : QuestionState
openedAt : Nat
deriving Repr
structure BoardLine where
requestId : String
title : String
waitingOn : List String
since : Nat
changedSinceVisit : Bool
questions : List Question
deriving Repr
inductive HubError where
| unknownQuestion | questionNotOpen | unknownRequest | unknownJob
| onlyLeadMayReassign | jobNotLost | notCurrentAssignee | jobNotWorking | onlyLeadMayMarkDone
deriving Repr, BEq
structure Hub where
requests : HashMap String Request := {}
jobs : HashMap String Job := {}
questions : HashMap String Question := {}
lastVisits : HashMap String Nat := {}
namespace Hub
def fetch (map : HashMap String α) (key : String) (err : HubError) : Except HubError α :=
match map[key]? with
| some v => pure v
| none => throw err
-- Single open-question source shared by board and queue
def openQuestionQueue (hub : Hub) (partyId : Option String := none) : List Question :=
(hub.questions.values.filter fun q =>
q.state == .open && (partyId.isNone || partyId == some q.answererId))
|>.mergeSort (·.openedAt <= ·.openedAt)
def computeLine (hub : Hub) (req : Request) (allOpenQs : List Question) (lastVisit : Nat) :
BoardLine :=
let active := hub.jobs.values.filter fun j => j.requestId == req.id && j.state != .canceled
let openJobs := active.filter (·.state != .done)
let openQs := allOpenQs.filter (·.requestId == req.id)
let (waitingOn, since) :=
match openQs, openJobs with
| q :: _, _ => ((openQs.map (·.answererId)).eraseDups, q.openedAt)
| [], j :: _ =>
let earliest := (openJobs.map (·.assignedAt)).foldl min j.assignedAt
((openJobs.map (·.assigneeId)).eraseDups, earliest)
| [], [] =>
if active.isEmpty then ([req.leadId], req.askedAt)
else ([], (active.map (·.finishedAt.getD req.askedAt)).foldl max req.askedAt)
{ requestId := req.id, title := req.title, waitingOn, since
changedSinceVisit := since > lastVisit, questions := openQs }
-- Computes every board line on read, then advances LastVisit
def visitBoard (hub : Hub) (personId : String) (now : Nat) : List BoardLine × Hub :=
let lastVisit := hub.lastVisits.getD personId 0
let allOpenQs := hub.openQuestionQueue
let lines := hub.requests.values
|>.filter (·.askedById == personId)
|>.map (hub.computeLine · allOpenQs lastVisit)
|>.filter fun l => !(l.waitingOn.isEmpty && !l.changedSinceVisit)
(lines, { hub with lastVisits := hub.lastVisits.insert personId now })
def passQuestionOn (hub : Hub) (questionId toPartyId : String) : Except HubError Hub := do
let q ← fetch hub.questions questionId .unknownQuestion
unless q.state == .open do throw .questionNotOpen
-- keeps same id and original openedAt
pure { hub with questions := hub.questions.insert questionId { q with answererId := toPartyId } }
def sweepLostJobs (hub : Hub) (now graceSec : Nat) : Except HubError Hub :=
hub.jobs.values.foldlM (init := hub) fun acc job => do
-- Nat subtraction stops at 0, so a job heard from "in the future" is never lost
if job.state != .working || now - job.lastHeardAt <= graceSec then return acc
let req ← fetch acc.requests job.requestId .unknownRequest
let lost := { job with state := .lost, assigneeId := req.leadId }
let qid := s!"reassign_{job.id}_{now}"
let q : Question := {
id := qid, requestId := req.id, jobId := some job.id, kind := .reassignment
answererId := req.leadId, text := "Worker lost; assign replacement"
state := .open, openedAt := now }
pure { acc with jobs := acc.jobs.insert job.id lost, questions := acc.questions.insert qid q }
def reassignJob (hub : Hub) (jobId leadId workerId : String) (now : Nat) : Except HubError Hub := do
let job ← fetch hub.jobs jobId .unknownJob
let req ← fetch hub.requests job.requestId .unknownRequest
unless req.leadId == leadId do throw .onlyLeadMayReassign
unless job.state == .lost do throw .jobNotLost
let reassigned := { job with
assigneeId := workerId, assignedAt := now, lastHeardAt := now, state := .working }
let questions := hub.questions.map fun _ q =>
if q.jobId == some jobId && q.kind == .reassignment && q.state == .open
then { q with state := .answered } else q
pure { hub with jobs := hub.jobs.insert jobId reassigned, questions }
def acceptWorkerReport (hub : Hub) (jobId actorId : String) (now : Nat) : Except HubError Hub := do
let job ← fetch hub.jobs jobId .unknownJob
unless job.assigneeId == actorId do throw .notCurrentAssignee
unless job.state == .working do throw .jobNotWorking
pure { hub with jobs := hub.jobs.insert jobId { job with lastHeardAt := now } }
def markJobDone (hub : Hub) (jobId actorId : String) (now : Nat) : Except HubError Hub := do
let job ← fetch hub.jobs jobId .unknownJob
let req ← fetch hub.requests job.requestId .unknownRequest
unless req.leadId == actorId do throw .onlyLeadMayMarkDone
let done := { job with state := .done, finishedAt := some now }
pure { hub with jobs := hub.jobs.insert jobId done }
end Hub
// Pure read-only board projection + hub guards for Derived Status Board
type JobState = "unassigned" | "working" | "waiting" | "lost" | "done" | "canceled";
type QuestionState = "open" | "answered" | "withdrawn" | "expired";
type QuestionKind = "decision" | "fact" | "action" | "review" | "reassignment";
interface Request {
id: string;
title: string;
askedById: string;
leadId: string;
askedAt: number; // unix seconds
}
interface Job {
id: string;
requestId: string;
assigneeId: string;
state: JobState;
assignedAt: number;
lastHeardAt: number;
finishedAt: number | null;
}
interface Question {
id: string;
requestId: string;
jobId: string | null;
kind: QuestionKind;
answererId: string;
text: string;
state: QuestionState;
openedAt: number;
}
interface BoardLine {
requestId: string;
title: string;
waitingOn: string[];
since: number;
changedSinceVisit: boolean;
questions: Question[];
}
class Hub {
requests = new Map<string, Request>();
jobs = new Map<string, Job>();
questions = new Map<string, Question>();
lastVisits = new Map<string, number>();
// Single open-question source shared by board and queue
openQuestionQueue(partyId?: string): Question[] {
return [...this.questions.values()]
.filter((q) => q.state === "open" && (!partyId || q.answererId === partyId))
.sort((a, b) => a.openedAt - b.openedAt);
}
// Computes every board line on read, then advances LastVisit
visitBoard(personId: string, now: number): BoardLine[] {
const lastVisit = this.lastVisits.get(personId) ?? 0;
const allOpenQs = this.openQuestionQueue();
const lines: BoardLine[] = [];
for (const req of this.requests.values()) {
if (req.askedById !== personId) continue;
const activeJobs = [...this.jobs.values()].filter(
(j) => j.requestId === req.id && j.state !== "canceled"
);
const openJobs = activeJobs.filter((j) => j.state !== "done");
const openQs = allOpenQs.filter((q) => q.requestId === req.id);
let waitingOn: string[];
let since: number;
if (openQs.length > 0) {
waitingOn = [...new Set(openQs.map((q) => q.answererId))];
since = openQs[0].openedAt;
} else if (openJobs.length > 0) {
waitingOn = [...new Set(openJobs.map((j) => j.assigneeId))];
since = Math.min(...openJobs.map((j) => j.assignedAt));
} else if (activeJobs.length === 0) {
waitingOn = [req.leadId];
since = req.askedAt;
} else {
waitingOn = [];
since = Math.max(...activeJobs.map((j) => j.finishedAt ?? req.askedAt));
}
if (waitingOn.length === 0 && since <= lastVisit) continue;
lines.push({
requestId: req.id, title: req.title, waitingOn, since,
changedSinceVisit: since > lastVisit, questions: openQs
});
}
this.lastVisits.set(personId, now);
return lines;
}
passQuestionOn(questionId: string, toPartyId: string): void {
const q = this.questions.get(questionId);
if (!q) throw new Error("unknown_question");
if (q.state !== "open") throw new Error("question_not_open");
q.answererId = toPartyId; // keeps same id and original openedAt
}
sweepLostJobs(now: number, graceSec: number): void {
for (const job of this.jobs.values()) {
if (job.state !== "working" || now - job.lastHeardAt <= graceSec) continue;
const req = this.requests.get(job.requestId);
if (!req) throw new Error("unknown_request");
job.state = "lost";
job.assigneeId = req.leadId;
const qid = `reassign_${job.id}_${now}`;
this.questions.set(qid, {
id: qid, requestId: req.id, jobId: job.id, kind: "reassignment",
answererId: req.leadId, text: "Worker lost; assign replacement",
state: "open", openedAt: now
});
}
}
reassignJob(jobId: string, leadId: string, workerId: string, now: number): void {
const job = this.jobs.get(jobId);
if (!job) throw new Error("unknown_job");
const req = this.requests.get(job.requestId);
if (!req) throw new Error("unknown_request");
if (req.leadId !== leadId) throw new Error("only_lead_may_reassign");
if (job.state !== "lost") throw new Error("job_not_lost");
job.assigneeId = workerId;
job.assignedAt = now;
job.lastHeardAt = now;
job.state = "working";
for (const q of this.questions.values()) {
if (q.jobId === jobId && q.kind === "reassignment" && q.state === "open") {
q.state = "answered";
}
}
}
acceptWorkerReport(jobId: string, actorId: string, now: number): void {
const job = this.jobs.get(jobId);
if (!job) throw new Error("unknown_job");
if (job.assigneeId !== actorId) throw new Error("not_current_assignee");
if (job.state !== "working") throw new Error("job_not_working");
job.lastHeardAt = now;
}
markJobDone(jobId: string, actorId: string, now: number): void {
const job = this.jobs.get(jobId);
if (!job) throw new Error("unknown_job");
const req = this.requests.get(job.requestId);
if (!req) throw new Error("unknown_request");
if (req.leadId !== actorId) throw new Error("only_lead_may_mark_done");
job.state = "done";
job.finishedAt = now;
}
}
# Pure read-only board projection + hub guards for Derived Status Board
from dataclasses import dataclass
from typing import Literal, Optional
@dataclass
class Request:
id: str
title: str
asked_by_id: str
lead_id: str
asked_at: int
@dataclass
class Job:
id: str
request_id: str
assignee_id: str
state: Literal["unassigned", "working", "waiting", "lost", "done", "canceled"]
assigned_at: int
last_heard_at: int
finished_at: Optional[int] = None
@dataclass
class Question:
id: str
request_id: str
job_id: Optional[str]
kind: Literal["decision", "fact", "action", "review", "reassignment"]
answerer_id: str
text: str
opened_at: int
state: Literal["open", "answered", "withdrawn", "expired"] = "open"
@dataclass
class BoardLine:
request_id: str
title: str
waiting_on: list[str]
since: int
changed_since_visit: bool
questions: list[Question]
class HubError(Exception):
pass
class Hub:
def __init__(self) -> None:
self.requests: dict[str, Request] = {}
self.jobs: dict[str, Job] = {}
self.questions: dict[str, Question] = {}
self.last_visits: dict[str, int] = {}
def open_question_queue(self, party_id: Optional[str] = None) -> list[Question]:
qs = [
q for q in self.questions.values()
if q.state == "open" and (party_id is None or q.answerer_id == party_id)
]
return sorted(qs, key=lambda q: q.opened_at)
def visit_board(self, person_id: str, now: int) -> list[BoardLine]:
last_visit = self.last_visits.get(person_id, 0)
all_open_qs = self.open_question_queue()
lines: list[BoardLine] = []
for req in self.requests.values():
if req.asked_by_id != person_id:
continue
active = [j for j in self.jobs.values() if j.request_id == req.id and j.state != "canceled"]
open_jobs = [j for j in active if j.state != "done"]
open_qs = [q for q in all_open_qs if q.request_id == req.id]
if open_qs:
waiting_on = list(dict.fromkeys(q.answerer_id for q in open_qs))
since = open_qs[0].opened_at
elif open_jobs:
waiting_on = list(dict.fromkeys(j.assignee_id for j in open_jobs))
since = min(j.assigned_at for j in open_jobs)
elif not active:
waiting_on, since = [req.lead_id], req.asked_at
else:
waiting_on = []
since = max((j.finished_at or req.asked_at) for j in active)
if not waiting_on and since <= last_visit:
continue
lines.append(BoardLine(req.id, req.title, waiting_on, since, since > last_visit, open_qs))
self.last_visits[person_id] = now
return lines
def pass_question_on(self, question_id: str, to_party_id: str) -> None:
q = self.questions.get(question_id)
if q is None:
raise HubError("unknown_question")
if q.state != "open":
raise HubError("question_not_open")
q.answerer_id = to_party_id
def sweep_lost_jobs(self, now: int, grace_sec: int) -> None:
for job in self.jobs.values():
if job.state != "working" or now - job.last_heard_at <= grace_sec:
continue
req = self.requests.get(job.request_id)
if req is None:
raise HubError("unknown_request")
job.state = "lost"
job.assignee_id = req.lead_id
qid = f"reassign_{job.id}_{now}"
self.questions[qid] = Question(
qid, req.id, job.id, "reassignment", req.lead_id,
"Worker lost; assign replacement", now
)
def reassign_job(self, job_id: str, lead_id: str, worker_id: str, now: int) -> None:
job = self.jobs.get(job_id)
if job is None:
raise HubError("unknown_job")
req = self.requests.get(job.request_id)
if req is None:
raise HubError("unknown_request")
if req.lead_id != lead_id:
raise HubError("only_lead_may_reassign")
if job.state != "lost":
raise HubError("job_not_lost")
job.assignee_id = worker_id
job.assigned_at = now
job.last_heard_at = now
job.state = "working"
for q in self.questions.values():
if q.job_id == job_id and q.kind == "reassignment" and q.state == "open":
q.state = "answered"
def accept_worker_report(self, job_id: str, actor_id: str, now: int) -> None:
job = self.jobs.get(job_id)
if job is None:
raise HubError("unknown_job")
if job.assignee_id != actor_id:
raise HubError("not_current_assignee")
if job.state != "working":
raise HubError("job_not_working")
job.last_heard_at = now
def mark_job_done(self, job_id: str, actor_id: str, now: int) -> None:
job = self.jobs.get(job_id)
if job is None:
raise HubError("unknown_job")
req = self.requests.get(job.request_id)
if req is None:
raise HubError("unknown_request")
if req.lead_id != actor_id:
raise HubError("only_lead_may_mark_done")
job.state = "done"
job.finished_at = now
# Pure read-only board projection + hub guards for Derived Status Board
defmodule DerivedStatusBoard.Hub do
defstruct requests: %{}, jobs: %{}, questions: %{}, last_visits: %{}
# Single open-question query shared by the board and every party's queue
def open_question_queue(%__MODULE__{} = hub, party_id \\ nil) do
hub.questions
|> Map.values()
|> Enum.filter(&(&1.state == :open and (party_id == nil or &1.answerer_id == party_id)))
|> Enum.sort_by(& &1.opened_at)
end
def visit_board(%__MODULE__{} = hub, person_id, now) do
last_visit = Map.get(hub.last_visits, person_id, 0)
all_open_qs = open_question_queue(hub)
lines =
hub.requests
|> Map.values()
|> Enum.filter(&(&1.asked_by_id == person_id))
|> Enum.map(&compute_line(&1, hub, all_open_qs, last_visit))
|> Enum.reject(&(&1.waiting_on == [] and not &1.changed_since_visit))
{lines, %{hub | last_visits: Map.put(hub.last_visits, person_id, now)}}
end
defp compute_line(req, hub, all_open_qs, last_visit) do
active = hub.jobs |> Map.values() |> Enum.filter(&(&1.request_id == req.id and &1.state != :canceled))
open_jobs = Enum.reject(active, &(&1.state == :done))
open_qs = Enum.filter(all_open_qs, &(&1.request_id == req.id))
{waiting_on, since} =
cond do
open_qs != [] ->
{open_qs |> Enum.map(& &1.answerer_id) |> Enum.uniq(), hd(open_qs).opened_at}
open_jobs != [] ->
{open_jobs |> Enum.map(& &1.assignee_id) |> Enum.uniq(),
open_jobs |> Enum.map(& &1.assigned_at) |> Enum.min()}
active == [] ->
{[req.lead_id], req.asked_at}
true ->
{[], active |> Enum.map(&(&1.finished_at || req.asked_at)) |> Enum.max()}
end
%{
request_id: req.id, title: req.title, waiting_on: waiting_on,
since: since, changed_since_visit: since > last_visit, questions: open_qs
}
end
def pass_question_on(%__MODULE__{} = hub, q_id, to_party_id) do
with {:ok, q} <- fetch(hub.questions, q_id, :unknown_question),
true <- q.state == :open || {:error, :question_not_open} do
{:ok, %{hub | questions: Map.put(hub.questions, q_id, %{q | answerer_id: to_party_id})}}
end
end
def sweep_lost_jobs(%__MODULE__{} = hub, now, grace_sec) do
Enum.reduce_while(hub.jobs, {:ok, hub}, fn {job_id, job}, {:ok, acc} ->
if job.state == :working and now - job.last_heard_at > grace_sec do
case fetch(acc.requests, job.request_id, :unknown_request) do
{:ok, req} ->
lost = %{job | state: :lost, assignee_id: req.lead_id}
qid = "reassign_" <> job_id <> "_" <> Integer.to_string(now)
q = %{
id: qid, request_id: req.id, job_id: job_id, kind: :reassignment,
answerer_id: req.lead_id, text: "Worker lost; assign replacement",
state: :open, opened_at: now
}
next = %{acc | jobs: Map.put(acc.jobs, job_id, lost), questions: Map.put(acc.questions, qid, q)}
{:cont, {:ok, next}}
{:error, err} ->
{:halt, {:error, err}}
end
else
{:cont, {:ok, acc}}
end
end)
end
def reassign_job(%__MODULE__{} = hub, job_id, lead_id, worker_id, now) do
with {:ok, job} <- fetch(hub.jobs, job_id, :unknown_job),
{:ok, req} <- fetch(hub.requests, job.request_id, :unknown_request),
true <- req.lead_id == lead_id || {:error, :only_lead_may_reassign},
true <- job.state == :lost || {:error, :job_not_lost} do
reassigned = %{job | assignee_id: worker_id, assigned_at: now, last_heard_at: now, state: :working}
questions =
Map.new(hub.questions, fn {id, q} ->
if q.job_id == job_id and q.kind == :reassignment and q.state == :open do
{id, %{q | state: :answered}}
else
{id, q}
end
end)
{:ok, %{hub | jobs: Map.put(hub.jobs, job_id, reassigned), questions: questions}}
end
end
def accept_worker_report(%__MODULE__{} = hub, job_id, actor_id, now) do
with {:ok, job} <- fetch(hub.jobs, job_id, :unknown_job),
true <- job.assignee_id == actor_id || {:error, :not_current_assignee},
true <- job.state == :working || {:error, :job_not_working} do
{:ok, %{hub | jobs: Map.put(hub.jobs, job_id, %{job | last_heard_at: now})}}
end
end
def mark_job_done(%__MODULE__{} = hub, job_id, actor_id, now) do
with {:ok, job} <- fetch(hub.jobs, job_id, :unknown_job),
{:ok, req} <- fetch(hub.requests, job.request_id, :unknown_request),
true <- req.lead_id == actor_id || {:error, :only_lead_may_mark_done} do
done = %{job | state: :done, finished_at: now}
{:ok, %{hub | jobs: Map.put(hub.jobs, job_id, done)}}
end
end
defp fetch(map, key, err), do: case(Map.fetch(map, key), do: ({:ok, v} -> {:ok, v}; :error -> {:error, err}))
end
Escalation and lost-worker trace
Walking Example 2 (Google sign-in) through these functions shows how
escalating a question flips the board line automatically, how a silent worker crash triggers
a lead-only reassignment without interrupting Dana, and how the hub rejects a stale report
with not_current_assignee:
1. hub.passQuestionOn("q_email_signup", to: "dana")
hub.visitBoard("dana", now: 14:05)
-> line[req_google_signin]: waiting_on=["dana"], since=14:00, changed=true
-> openQuestionQueue("dana"): ["q_email_signup"] (exact match with board)
2. Dana answers "Google only"; Worker 1 resumes, then stops silently at 15:10.
hub.sweepLostJobs(now: 15:13, graceSec: 120)
-> job_oauth: state="lost", assignee="lead_1"; opens reassignment Q for "lead_1"
-> line[req_google_signin]: waiting_on=["lead_1"] (Dana is never interrupted)
3. hub.reassignJob("job_oauth", lead: "lead_1", worker: "worker_2", now: 15:14)
-> ok (same job_oauth id; state="working", reassignment Q closed)
4. Worker 1 reconnects late: hub.acceptWorkerReport("job_oauth", "worker_1", now: 15:18)
-> error: not_current_assignee (stale worker cannot touch job_oauth)
5. hub.acceptWorkerReport("job_oauth", "worker_2", now: 15:25)
hub.markJobDone("job_oauth", actor: "lead_1", now: 15:30)
hub.visitBoard("dana", now: 16:00)
-> line[req_google_signin]: waiting_on=[] ("nobody"), since=15:30, changed=true
Tradeoffs and practical guidance
Deriving status eliminates drift, but it shifts discipline onto your underlying records. Weigh three honest tradeoffs before adopting it:
- Only as truthful as your hub records: side-channel work that bypasses the hub (an ad-hoc chat DM or unlogged script) will never appear on the board.
- The board does not push for attention: if a request flips to "Waiting on you" at 2:00 p.m., you still will not notice until you open the board. Pair it with Question Inbox for scheduled digests and urgent interrupt rules.
- One line compresses complexity: a request with six parallel jobs still renders as one line. Listing every party currently waited on avoids hiding blockers, while keeping click-through drill-down available when you want details.
Practical implementation notes
- Start with pure on-read computation: for dozens or hundreds of active requests, computing lines directly on read takes milliseconds and guarantees zero stale caches. If scale later demands a materialized table, recompute it with the exact same function inside the write transaction.
-
Render sentences in the UI, not the database: compute structured
waiting_onIDs andsincetimestamps in the hub so the interface can address the viewer as "You" while addressing other teammates by name. -
Distinguish quiet workers from dead ones: tune the grace period long
enough for slow tool calls, pair with
Progress Heartbeat for long jobs, and always
fence out late reports from replaced workers by checking
assignee_id. -
Let finished items show once, then clear: comparing
since > visited_atgives the requester calm closure on completed requests without turning the board into an ever-growing archive.
Known uses and related patterns
- CQRS Read Models & Event Sourcing: compute read-only projections directly from operational state transitions so UI dashboards cannot drift from source records.
- Procore "Ball in Court": construction management workflows compute exactly which party owes the next signature or response on each submittal or RFI rather than relying on generic "in progress" labels.
-
GitHub pull request review decision: derives
REVIEW_REQUIRED,CHANGES_REQUESTED, orAPPROVEDfrom review records and queriesuser-review-requested:@me— scoped to one PR, whereas a Derived Status Board rolls up multi-job requests across tools and questions. -
Kubernetes controller status & Jira Service Desk transitions:
Kubernetes separates desired
specfrom controller-computedstatus, and service desks automatically flip tickets between "Waiting for customer" and "Waiting for support" on each recorded reply. - Volgenic: coordinates multi-agent work through durable hub records so requesters can see what is waiting on them versus what agents are actively driving without polling chat threads.
Related patterns
- Orchestrator-Workers — defines the
PartyandRequestrecords every board line starts from. - Durable Job — keeps each job's identity and current assignee separate from individual agent runs so the board can always name who owns open work.
- Question Inbox — schedules when the requester checks in and defines which urgent items interrupt between visits; shares the exact same open-question query as the board.
- Self-Contained Question — defines the
Questionrecord so a blocked board line can show the exact ask directly. - Tracked Answer & Resumable Wait — supply the open
AnswerandWaitrecords the board reads to show pending application and external dependencies. - Evidence-Backed Completion, Condition Monitor & Change Propagation — supply holding
Claims, activeMonitorLines, and cancellation timestamps read by the board.