Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Mission board: card says "Needs you" only for a required check waiting
pixel-bot8a243e14d2b8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 76d3dbac..613b3fde 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -21,6 +21,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).and blocked work. Turn it on in Settings → Mission board. It works on phone and desktop.### Changed+- **A card says "Needs you" only when a check that counts waits for your OK.** A task whose required+ check is still running while an optional check waits now reads as still checking, with a grey+ "1 optional check waiting" note. The quiet "Not run" optional check on a verified task has a grey+ icon instead of the amber hand.- **A task's spend shows up the moment it is verified.** When a bot hands a task in partway throughits turn, the tokens used so far land on the task and mission right away; the rest of the turn isadded when it ends, so nothing is counted twice. Before, a just-verified task showed 0 tokens for adiff --git a/frontend/src/components/MissionBoardView.tsx b/frontend/src/components/MissionBoardView.tsxindex 818148ab..7a244d93 100644--- a/frontend/src/components/MissionBoardView.tsx+++ b/frontend/src/components/MissionBoardView.tsx@@ -464,7 +464,7 @@ export const EvidenceReceipt: React.FC<{{receipt.lines.map((l) => (<li key={l.check.id} className="p-3 space-y-1.5" data-check={l.check.id} data-check-status={l.check.status}><div className="flex items-start gap-2">- <span className="mt-px">{statusIcon(l.status.tone)}</span>+ <span className="mt-px">{statusIcon(receipt.settledVerified && l.check.status === 'needs_approval' && !l.check.required ? 'zinc' : l.status.tone)}</span><div className="min-w-0 flex-1"><p className="flex flex-wrap items-center gap-1.5 text-xs"><span className="font-medium text-zinc-100">{checkKindLabel(l.check.kind)}</span>diff --git a/frontend/src/missions.ts b/frontend/src/missions.tsindex 977e9959..1a355e72 100644--- a/frontend/src/missions.ts+++ b/frontend/src/missions.ts@@ -313,13 +313,17 @@ export function optionalWaitingText(n: number | null | undefined): string | null/*** Whether checks waiting for the person hold the task, from the summary alone (cards only have the- * summary). Only a required one does, and then the server says `checks_summary.status == "pending"`;- * an optional one waiting never blocks Verified. "pending" also covers a required check that hasn't- * finished, so with both at once this errs towards "needs you"; the receipt, which has the checks,- * tells them apart (see [`buildReceipt`]).+ * summary). Only a required one does: `checks_summary.required_needs_approval`. A "pending" status+ * with none of those means a required check is still running, not that it waits for you. Older+ * servers leave the field out; that reads as 0, so they never show "Needs you" on a card.*/export function approvalHolds(s: ChecksSummary): boolean {- return (s.needs_approval ?? 0) > 0 && s.status === 'pending';+ return (s.required_needs_approval ?? 0) > 0;+}++/** Optional checks waiting for the person: they never hold the task. */+function optionalWaitingCount(s: ChecksSummary): number {+ return Math.max(0, (s.needs_approval ?? 0) - (s.required_needs_approval ?? 0));}/**@@ -329,7 +333,7 @@ export function approvalHolds(s: ChecksSummary): boolean {*/export function checksText(s: ChecksSummary): { text: string; tone: Tone } {const n = (k: number, one: string, many: string) => (k === 1 ? one : many.replace('#', String(k)));- if (approvalHolds(s)) return { text: n(s.needs_approval ?? 0, '1 check needs your OK', '# checks need your OK'), tone: 'amber' };+ if (approvalHolds(s)) return { text: n(s.required_needs_approval ?? 0, '1 check needs your OK', '# checks need your OK'), tone: 'amber' };if (s.status === 'not_checked') return { text: 'Not checked', tone: 'zinc' };if (s.status === 'failed') return { text: n(s.failed, '1 check failed', '# checks failed'), tone: 'rose' };if (s.status === 'pending') return { text: s.passed > 0 ? n(s.passed, '1 check passed, still checking', '# checks passed, still checking') : 'Checking', tone: 'zinc' };@@ -338,12 +342,12 @@ export function checksText(s: ChecksSummary): { text: string; tone: Tone } {/*** The grey note next to the chip for optional checks waiting for you ("1 optional check waiting"),- * else null. Only when the summary has passed: then every waiting check is optional, since a required- * one waiting makes it "pending".+ * else null. Shown while a required check is still running too, since the optional one never holds+ * the task.*/export function optionalChecksNote(s: ChecksSummary): string | null {- const k = s.needs_approval ?? 0;- if (k <= 0 || s.status !== 'passed') return null;+ const k = optionalWaitingCount(s);+ if (k <= 0) return null;return k === 1 ? '1 optional check waiting' : `${k} optional checks waiting`;}@@ -382,8 +386,11 @@ export function cardStatus(t: Task, names: Record<string, string> = {}, now: numcase 'needs_you':return t.needs_you[0]?.text ?? 'A bot is waiting for you';case 'review':- if (approvalHolds(t.checks_summary)) return waitingApprovalText(t.checks_summary.needs_approval);- return t.checks_summary.status === 'not_checked' ? 'Bot says done. Not checked yet' : optionalWaitingText(t.checks_summary.needs_approval) ?? 'Bot says done. Checking';+ if (approvalHolds(t.checks_summary)) return waitingApprovalText(t.checks_summary.required_needs_approval);+ if (t.checks_summary.status === 'not_checked') return 'Bot says done. Not checked yet';+ // While a required check runs the card reads as checking; the grey note covers optional ones.+ if (t.checks_summary.status === 'pending') return 'Bot says done. Checking';+ return optionalWaitingText(optionalWaitingCount(t.checks_summary)) ?? 'Bot says done. Checking';case 'verified':return t.finished_at ? `Verified ${ago(t.finished_at, now)}` : 'Verified';default:diff --git a/frontend/tests/missions.test.mjs b/frontend/tests/missions.test.mjsindex a9124dc0..885f1cce 100644--- a/frontend/tests/missions.test.mjs+++ b/frontend/tests/missions.test.mjs@@ -173,7 +173,7 @@ test("the owner's own check waits for you: the receipt says why the task isn't Vconst passed = check({ approved_by: 'mission', counts: true });const t = task({state: 'review',- checks_summary: { status: 'pending', passed: 1, failed: 0, needs_approval: 1, total: 2 },+ checks_summary: { status: 'pending', passed: 1, failed: 0, needs_approval: 1, required_needs_approval: 1, total: 2 },needs_you: [{ kind: 'check_approval', id: 'ch2', text: 'Allow the check “File exists: out.txt”' }],});const d = { task: t, checks: [passed, own], evidence: [], events: [] };@@ -196,7 +196,7 @@ test("the owner's own check waits for you: the receipt says why the task isn't Vassert.match(c, /Needs you/);assert.match(c, /Waiting for you to allow 1 check/);assert.match(c, /1 check needs your OK/);- assert.equal(m.checksText({ status: 'pending', passed: 1, failed: 0, needs_approval: 2, total: 3 }).text, '2 checks need your OK');+ assert.equal(m.checksText({ status: 'pending', passed: 1, failed: 0, needs_approval: 2, required_needs_approval: 2, total: 3 }).text, '2 checks need your OK');assert.equal(m.waitingApprovalText(0), null);assert.equal(m.waitingApprovalText(3), 'Waiting for you to allow 3 checks');// Verified tasks never show the banner, and a passing check that doesn't count can't be the reason.@@ -231,7 +231,7 @@ test('an optional check waiting for you is not worded as blocking; a required on// Same task, but the waiting check is required: the server says "pending" and the wording blocks.const required = { ...optional, required: true };- const held = { ...t, checks_summary: { ...t.checks_summary, status: 'pending' } };+ const held = { ...t, checks_summary: { ...t.checks_summary, status: 'pending', required_needs_approval: 1 } };const rr = m.buildReceipt({ task: held, checks: [passed, required], evidence: [], events: [] }, names);assert.equal(rr.waitingOnYou, 'Waiting for you to allow 1 check');assert.equal(rr.optionalWaiting, null);@@ -251,7 +251,7 @@ test('a Verified task with an optional check waiting never reads "1 of 2"; it saassert.equal(m.optionalChecksNote(summary), '1 optional check waiting');assert.equal(m.optionalChecksNote({ ...summary, needs_approval: 2 }), '2 optional checks waiting');assert.equal(m.optionalChecksNote({ ...summary, needs_approval: 0 }), null);- assert.equal(m.optionalChecksNote({ ...summary, status: 'pending' }), null, 'pending may be a required check waiting');+ assert.equal(m.optionalChecksNote({ ...summary, status: 'pending', required_needs_approval: 1 }), null, 'a required check waiting is not optional');const c = ui.card({ task: t, names, now: NOW, onOpen: noop });assert.doesNotMatch(c, /of 2/);assert.match(c, /Check passed/);@@ -299,6 +299,59 @@ test('a Review task with a required check still running and an optional one waitassert.doesNotMatch(html, /Run this optional check/);});+test('the card says "Needs you" only when a required check waits for your OK (required_needs_approval)', () => {+ // #90: checks_summary.required_needs_approval tells "a required check waits for you" from+ // "a required check is still running and an optional one waits".+ const base = { failed: 0, total: 2 };++ // 1. A required check waits for you: Needs you.+ const held = task({ state: 'review', checks_summary: { ...base, status: 'pending', passed: 1, needs_approval: 1, required_needs_approval: 1 }, needs_you: [{ kind: 'check_approval', id: 'ch2', text: 'Allow …' }] });+ assert.equal(m.approvalHolds(held.checks_summary), true);+ const hc = ui.card({ task: held, names, now: NOW, onOpen: noop });+ assert.match(hc, /Needs you/);+ assert.match(hc, /Waiting for you to allow 1 check/);+ assert.match(hc, /1 check needs your OK/);+ assert.doesNotMatch(hc, /data-optional-note/);++ // 2. A required check still running, an optional one waiting: still checking, grey note, no Needs you.+ const running = task({ state: 'review', checks_summary: { ...base, status: 'pending', passed: 0, needs_approval: 1, required_needs_approval: 0 }, needs_you: [{ kind: 'check_approval', id: 'ch3', text: 'Allow …' }] });+ assert.equal(m.approvalHolds(running.checks_summary), false);+ assert.deepEqual(m.checksText(running.checks_summary), { text: 'Checking', tone: 'zinc' });+ assert.equal(m.checksText({ ...running.checks_summary, passed: 1, total: 3 }).text, '1 check passed, still checking');+ assert.equal(m.optionalChecksNote(running.checks_summary), '1 optional check waiting');+ assert.equal(m.cardStatus(running, names, NOW), 'Bot says done. Checking');+ const rc = ui.card({ task: running, names, now: NOW, onOpen: noop });+ assert.doesNotMatch(rc, /Needs you|needs your OK|Waiting for you to allow/);+ assert.match(rc, /Checking/);+ assert.match(rc, /data-optional-note[^>]*>1 optional check waiting</);++ // Mixed: 1 required + 2 optional waiting counts only the required one as needing you.+ const mixed = { ...base, total: 4, status: 'pending', passed: 1, needs_approval: 3, required_needs_approval: 1 };+ assert.equal(m.checksText(mixed).text, '1 check needs your OK');+ assert.equal(m.optionalChecksNote(mixed), '2 optional checks waiting');++ // 3. An older server leaves the field out: treated as 0, never Needs you.+ const old = task({ state: 'review', checks_summary: { ...base, status: 'pending', passed: 0, needs_approval: 1 } });+ assert.equal(m.approvalHolds(old.checks_summary), false);+ const oc = ui.card({ task: old, names, now: NOW, onOpen: noop });+ assert.doesNotMatch(oc, /Needs you|needs your OK/);+ assert.match(oc, /1 optional check waiting/);+});++test('the quiet "Not run" optional row on a Verified task has a grey icon, not the amber hand', () => {+ const passed = check({ approved_by: 'mission', counts: true });+ const optional = check({ id: 'ch3', required: false, status: 'needs_approval', approved: false, approved_by: null, counts: false, requested_by: 'k_lin', checked_by: null, finished_at: null });+ const t = task({ state: 'verified', finished_at: '2026-10-27T11:58:00Z', checks_summary: { status: 'passed', passed: 1, failed: 0, needs_approval: 1, required_needs_approval: 0, total: 2 } });+ const html = ui.receipt({ task: t, checks: [passed, optional], evidence: [], events: [] }, names);+ const row = html.slice(html.indexOf('data-check="ch3"'));+ assert.match(row, /Not run/);+ assert.doesNotMatch(row.slice(0, row.indexOf('Not run')), /text-amber-300/);+ // In Review the same check still shows the amber hand: it is waiting on you there.+ const review = ui.receipt({ task: task({ state: 'review' }), checks: [optional], evidence: [], events: [] }, names);+ const rrow = review.slice(review.indexOf('data-check="ch3"'));+ assert.match(rrow.slice(0, rrow.indexOf('Needs your OK')), /text-amber-300/);+});+test('only web links open; file paths and other schemes are shown as text', () => {assert.equal(m.safeHttps('https://a.example/x'), 'https://a.example/x');assert.equal(m.safeHttps('javascript:alert(1)'), null);