Skip to content

armgit / kwant

Public Imported from GitHub
0

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.

Mission board: count only checks that count, and a quiet optional check once Verified

Pixelbdabac2cc9e1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9dc05209..11bf18bf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
its turn, the tokens used so far land on the task and mission right away; the rest of the turn is
added when it ends, so nothing is counted twice. Before, a just-verified task showed 0 tokens for a
few seconds. Engines that report usage only at the end (Codex, Grok, custom CLIs) still add it then.
+- **Mission board checks read plainly.** A card counts only the checks that count, so a Verified
+ task with an optional check still waiting says "Check passed" and "1 optional check waiting" instead
+ of "1 of 2 checks passed". Once a task is Verified, that check's button is a quieter "Run this
+ optional check".
- **Deciding for you costs fewer tokens.** Before deciding a choice itself, a bot now hears at most one
teammate, and only when the choice or an open check names that teammate.
diff --git a/frontend/src/components/MissionBoardView.tsx b/frontend/src/components/MissionBoardView.tsx
index 517fd032..818148ab 100644
--- a/frontend/src/components/MissionBoardView.tsx
+++ b/frontend/src/components/MissionBoardView.tsx
@@ -43,6 +43,7 @@ import {
cardStatus,
checkKindLabel,
checksText,
+ optionalChecksNote,
approvalHolds,
columnOf,
costRatio,
@@ -77,6 +78,8 @@ const TONES: Record<Tone, string> = {
const actionBtn =
'inline-flex items-center justify-center gap-1.5 min-h-[40px] sm:min-h-[32px] px-3 py-1 rounded-lg text-xs font-medium transition-colors disabled:opacity-50 focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-500';
const quietBtn = `${actionBtn} border border-zinc-700 bg-zinc-800/80 text-zinc-100 hover:bg-zinc-700 hover:border-zinc-600`;
+/** A secondary action that shouldn't pull the eye: text only, same tap target. */
+const subtleBtn = `${actionBtn} -ml-3 text-zinc-400 hover:text-zinc-200 hover:bg-zinc-800/60 underline underline-offset-2 decoration-zinc-600`;
const mainBtn = `${actionBtn} bg-sky-600 text-white hover:bg-sky-500`;
const goodBtn = `${actionBtn} bg-emerald-600 text-white hover:bg-emerald-500`;
const dangerBtn = `${actionBtn} border border-rose-500/30 text-rose-200 hover:bg-rose-500/10`;
@@ -228,6 +231,7 @@ export const TaskCard: React.FC<{
}> = ({ task: t, names, now = Date.now(), showMission = true, onOpen }) => {
const owner = (t.owner_kwant_id && names[t.owner_kwant_id]) || t.owner_name;
const checks = checksText(t.checks_summary);
+ const optionalNote = optionalChecksNote(t.checks_summary);
const status = cardStatus(t, names, now);
const dimmed = t.state === 'backlog';
return (
@@ -269,6 +273,11 @@ export const TaskCard: React.FC<{
{checks.text}
</span>
)}
+ {optionalNote && (
+ <span className="text-zinc-500" data-optional-note>
+ {optionalNote}
+ </span>
+ )}
</span>
</button>
</li>
@@ -438,7 +447,8 @@ export const EvidenceReceipt: React.FC<{
)}
{receipt.optionalWaiting && (
<p className="px-3 py-2 rounded-lg border border-zinc-800 text-xs text-zinc-400" data-optional-waiting>
- {receipt.optionalWaiting}. It doesn’t hold the task: it can be verified without it.
+ {receipt.optionalWaiting}.{' '}
+ {receipt.settledVerified ? 'The task is verified without it. You can still run it.' : 'It doesn’t hold the task: it can be verified without it.'}
</p>
)}
{receipt.notChecked && (
@@ -458,14 +468,18 @@ export const EvidenceReceipt: React.FC<{
<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>
- <Badge tone={l.status.tone}>{l.status.label}</Badge>
+ {receipt.settledVerified && l.check.status === 'needs_approval' && !l.check.required ? (
+ <Badge tone="zinc">Not run</Badge>
+ ) : (
+ <Badge tone={l.status.tone}>{l.status.label}</Badge>
+ )}
{!l.check.required && <span className="text-[10px] text-zinc-500">Optional</span>}
</p>
{l.target && <code className="block mt-1 text-[11px] text-zinc-300 break-all whitespace-pre-wrap">{l.target}</code>}
<p className="mt-1 text-[10px] text-zinc-500">
{[l.by ? `Checked by ${l.by}` : null, l.check.finished_at ? ago(l.check.finished_at) : null].filter(Boolean).join(' · ') || 'Hasn’t run yet'}
</p>
- {l.notCounting && !l.ownClaim && (
+ {l.notCounting && !l.ownClaim && !(receipt.settledVerified && !l.check.required) && (
<p className="mt-1 text-[11px] text-amber-200" data-not-counting>
{l.notCounting}
</p>
@@ -473,7 +487,13 @@ export const EvidenceReceipt: React.FC<{
{l.ownClaim && <p className="mt-1 text-[11px] text-amber-200">This is the owner’s own check, so it doesn’t count toward Verified.</p>}
</div>
</div>
- {l.check.status === 'needs_approval' && onApproveCheck && (
+ {l.check.status === 'needs_approval' && onApproveCheck && receipt.settledVerified && !l.check.required ? (
+ <div className="pl-6">
+ <button type="button" disabled={busy} onClick={() => onApproveCheck(l.check)} className={subtleBtn} data-run-optional>
+ Run this optional check
+ </button>
+ </div>
+ ) : l.check.status === 'needs_approval' && onApproveCheck && (
<div className="flex flex-wrap items-center gap-2 pl-6">
<p className="text-[11px] text-amber-200 flex-1 min-w-[10rem]">{l.notCounting ? '' : 'A bot added this check. It runs only after you OK it.'}</p>
<button type="button" disabled={busy} onClick={() => onApproveCheck(l.check)} className={quietBtn}>
diff --git a/frontend/src/missions.ts b/frontend/src/missions.ts
index ae86cf4a..ba34991d 100644
--- a/frontend/src/missions.ts
+++ b/frontend/src/missions.ts
@@ -310,20 +310,39 @@ export function optionalWaitingText(n: number | null | undefined): string | null
}
/**
- * Whether checks waiting for the person hold the task. Only a required one does, and the server
- * says so with `checks_summary.status == "pending"`; an optional one waiting never blocks Verified.
+ * 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`]).
*/
export function approvalHolds(s: ChecksSummary): boolean {
return (s.needs_approval ?? 0) > 0 && s.status === 'pending';
}
-/** The one-line check chip on a card. A task that has never been checked says so, plainly. */
+/**
+ * The one-line check chip on a card. It counts only checks that count (`passed`/`failed`), never
+ * `total`: an optional check waiting for you isn't a check that didn't pass. A task that has never
+ * been checked says so, plainly.
+ */
export function checksText(s: ChecksSummary): { text: string; tone: Tone } {
- if (s.needs_approval && s.needs_approval > 0 && approvalHolds(s)) return { text: s.needs_approval === 1 ? '1 check needs your OK' : `${s.needs_approval} checks need your OK`, tone: 'amber' };
- if (s.total === 0 || s.status === 'not_checked') return { text: 'Not checked', tone: 'zinc' };
- if (s.status === 'failed') return { text: s.failed === 1 ? '1 check failed' : `${s.failed} checks failed`, tone: 'rose' };
- if (s.status === 'pending') return { text: `${s.passed} of ${s.total} checks passed`, tone: 'amber' };
- return { text: s.total === 1 ? 'Check passed' : `${s.passed} of ${s.total} checks passed`, tone: 'emerald' };
+ 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 (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' };
+ return { text: s.passed > 1 ? `${s.passed} checks passed` : 'Check passed', tone: 'emerald' };
+}
+
+/**
+ * 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".
+ */
+export function optionalChecksNote(s: ChecksSummary): string | null {
+ const k = s.needs_approval ?? 0;
+ if (k <= 0 || s.status !== 'passed') return null;
+ return k === 1 ? '1 optional check waiting' : `${k} optional checks waiting`;
}
/** "in 12 min", "in 1 h", or "now" once it has passed. */
@@ -446,8 +465,10 @@ export interface Receipt {
verifiedBy: ReceiptLine | null;
/** Why a task in Review isn't Verified yet because required checks wait for the person ("Waiting for you to allow 1 check"). */
waitingOnYou: string | null;
- /** Optional checks waiting for the person; they don't hold the task ("Optional check waiting for your OK"). */
+ /** Optional checks waiting for the person, in Review or Verified; they don't hold the task ("Optional check waiting for your OK"). */
optionalWaiting: string | null;
+ /** The task is Verified: a waiting optional check is offered quietly ("Run this optional check"). */
+ settledVerified: boolean;
}
/** Builds the evidence receipt: every check with its result and output, newest result first per check. */
@@ -475,13 +496,16 @@ export function buildReceipt(d: Pick<TaskDetail, 'task' | 'checks' | 'evidence'>
const waitingChecks = d.checks.filter((c) => c.status === 'needs_approval');
const requiredWaiting = waitingChecks.filter((c) => c.required).length;
const review = d.task.state === 'review';
+ const settled = review || d.task.state === 'verified';
return {
lines,
attachments: d.evidence.filter((e) => e.kind !== 'check_output').sort((a, b) => Date.parse(b.captured_at) - Date.parse(a.captured_at)),
notChecked: !ran,
verifiedBy,
- waitingOnYou: review && approvalHolds(d.task.checks_summary) ? waitingApprovalText(requiredWaiting || d.task.checks_summary.needs_approval) : null,
- optionalWaiting: review ? optionalWaitingText(waitingChecks.length - requiredWaiting) : null,
+ // From the checks, not the summary: "pending" can mean a required check is still running.
+ waitingOnYou: review ? waitingApprovalText(requiredWaiting) : null,
+ optionalWaiting: settled ? optionalWaitingText(waitingChecks.length - requiredWaiting) : null,
+ settledVerified: d.task.state === 'verified',
};
}
diff --git a/frontend/tests/missions.test.mjs b/frontend/tests/missions.test.mjs
index c8d2cdd8..a9124dc0 100644
--- a/frontend/tests/missions.test.mjs
+++ b/frontend/tests/missions.test.mjs
@@ -106,7 +106,9 @@ test('a card shows owner, cost and an honest check chip', () => {
test('checksText and costText read plainly', () => {
assert.deepEqual(m.checksText({ status: 'not_checked', passed: 0, failed: 0, total: 0 }), { text: 'Not checked', tone: 'zinc' });
assert.equal(m.checksText({ status: 'failed', passed: 1, failed: 2, total: 3 }).text, '2 checks failed');
- assert.equal(m.checksText({ status: 'pending', passed: 1, failed: 0, total: 2 }).text, '1 of 2 checks passed');
+ assert.equal(m.checksText({ status: 'pending', passed: 1, failed: 0, total: 2 }).text, '1 check passed, still checking');
+ assert.equal(m.checksText({ status: 'pending', passed: 0, failed: 0, total: 1 }).text, 'Checking');
+ assert.equal(m.checksText({ status: 'passed', passed: 2, failed: 0, total: 3 }).text, '2 checks passed');
assert.equal(m.checksText({ status: 'passed', passed: 1, failed: 0, total: 1 }).text, 'Check passed');
assert.equal(m.costText(12400, 50000), '12.4k of 50k tokens');
assert.equal(m.costText(2_000_000, 0), '2M tokens');
@@ -239,6 +241,64 @@ test('an optional check waiting for you is not worded as blocking; a required on
assert.equal(m.approvalHolds(held.checks_summary), true);
});
+test('a Verified task with an optional check waiting never reads "1 of 2"; it says passed, plus a grey note', () => {
+ // Rigel eval 3 §1: one required check passed, one optional check the owner added waits for you.
+ 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 summary = { status: 'passed', passed: 1, failed: 0, needs_approval: 1, total: 2 };
+ const t = task({ state: 'verified', finished_at: '2026-10-27T11:58:00Z', checks_summary: summary });
+ assert.deepEqual(m.checksText(summary), { text: 'Check passed', tone: 'emerald' });
+ assert.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');
+ const c = ui.card({ task: t, names, now: NOW, onOpen: noop });
+ assert.doesNotMatch(c, /of 2/);
+ assert.match(c, /Check passed/);
+ assert.match(c, /data-optional-note[^>]*>1 optional check waiting</);
+ assert.doesNotMatch(c, /Needs you|needs your OK/);
+});
+
+test('once Verified, a waiting optional check is a quiet "Run this optional check"; approving still works', () => {
+ 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, total: 2 } });
+ const d = { task: t, checks: [passed, optional], evidence: [], events: [] };
+ const r = m.buildReceipt(d, names);
+ assert.equal(r.waitingOnYou, null);
+ assert.equal(r.optionalWaiting, 'Optional check waiting for your OK');
+ assert.equal(r.settledVerified, true);
+ let approved = null;
+ const html = ui.detail({ detail: d, names, now: NOW, onAction: noop, onApproveCheck: (x) => (approved = x), onOpenChat: noop });
+ assert.match(html, /data-run-optional[^>]*>Run this optional check</);
+ assert.doesNotMatch(html, /Allow this check/);
+ assert.doesNotMatch(html, /Needs your OK/, 'no amber badge on a verified task');
+ assert.doesNotMatch(html, /Doesn’t count yet/);
+ assert.match(html, /The task is verified without it\. You can still run it\./);
+ assert.doesNotMatch(html, /Not verified yet/);
+ // The button calls the same approve action (the handler is wired; SSR can't click).
+ const rh = ui.receipt(d, names);
+ assert.match(rh, /Optional check waiting for your OK/);
+ assert.equal(approved, null);
+});
+
+test('a Review task with a required check still running and an optional one waiting: optional wording, not "Needs you" on the receipt', () => {
+ // The server says "pending" here (the required check hasn't finished), so the summary alone can't tell.
+ const running = check({ status: 'pending', approved_by: 'mission', counts: true, checked_by: null, finished_at: null });
+ 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: 'review', checks_summary: { status: 'pending', passed: 0, failed: 0, needs_approval: 1, total: 2 }, needs_you: [{ kind: 'check_approval', id: 'ch3', text: 'Allow this check: …' }] });
+ const d = { task: t, checks: [running, optional], evidence: [], events: [] };
+ const r = m.buildReceipt(d, names);
+ assert.equal(r.waitingOnYou, null, 'no required check waits for you');
+ assert.equal(r.optionalWaiting, 'Optional check waiting for your OK');
+ assert.equal(r.settledVerified, false);
+ const html = ui.detail({ detail: d, names, now: NOW, onAction: noop, onApproveCheck: noop, onOpenChat: noop });
+ assert.match(html, /Optional check waiting for your OK\. It doesn’t hold the task/);
+ assert.doesNotMatch(html, /Not verified yet\. Waiting for you/);
+ assert.match(html, /Allow this check/, 'in Review the normal Allow button stays');
+ assert.doesNotMatch(html, /Run this optional check/);
+});
+
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);