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: one Needs-you count, and a failure panel that says each fact once

Pixel253a11fef312
diff --git a/CHANGELOG.md b/CHANGELOG.md
index df1c11f5..5c0b1935 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -87,6 +87,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
file path is no longer shown as `[redacted]`, short passwords after a flag like `--key` or `-p` (for
mysql, sshpass, redis-cli) are hidden, and a stray `]` no longer appears. A sign-in or usage-limit
card says what to do once instead of repeating the failure.
+- **Mission board: "Needs you now" matches the Needs you column.** The tile counted only questions and
+ approvals, so failed tasks waiting on a fix showed 0 next to a full column. It now counts the column's
+ cards, and a task whose check waits for your OK sits in Needs you. A failure's panel says the summary,
+ what to fix and whether AutoFix retries once each, instead of up to three times.
- **Mission Control: racing Redo requests make one copy, and restore refuses unknown forced paths.**
Two Redo requests on the same flag at the same moment, without an `Idempotency-Key`, could each make
a copy; now the flag is claimed in the same step as the copy, so one wins and the rest get 409. A
diff --git a/frontend/src/components/MissionBoardView.tsx b/frontend/src/components/MissionBoardView.tsx
index 5b1df9eb..0fe851f8 100644
--- a/frontend/src/components/MissionBoardView.tsx
+++ b/frontend/src/components/MissionBoardView.tsx
@@ -47,8 +47,11 @@ import {
failureClassLabel,
failureTone,
autofixErrorText,
+ fixTextShown,
+ needsYouCount,
recoveryText,
restoreErrorText,
+ skippedWithFixText,
restoredText,
workflowTargetLabel,
COLUMNS,
@@ -166,8 +169,13 @@ const initials = (name: string) =>
// ---------- Insights ----------
-export const InsightsStrip: React.FC<{ insights: Insights | null }> = ({ insights }) => {
+export const InsightsStrip: React.FC<{
+ insights: Insights | null;
+ /** The Needs you column's count across all work; the tile shows it instead of the server's count. */
+ needsYou?: number;
+}> = ({ insights, needsYou }) => {
if (!insights) return null;
+ const needsNow = needsYou ?? insights.needs_you_now;
const blockedMin = insights.blocked_minutes_7d;
const items: Array<{ label: string; value: string; hint: string; tone?: Tone; sub?: string }> = [
{ label: 'Verified this week', value: String(insights.verified_7d), hint: 'Tasks a check confirmed in the last 7 days', tone: 'emerald' },
@@ -177,7 +185,7 @@ export const InsightsStrip: React.FC<{ insights: Insights | null }> = ({ insight
hint: 'A bot said done, then the check failed (last 7 days)',
tone: insights.false_success_7d > 0 ? 'rose' : undefined,
},
- { label: 'Needs you now', value: String(insights.needs_you_now), hint: 'Waiting on a question, approval or step from you', tone: insights.needs_you_now > 0 ? 'amber' : undefined },
+ { label: 'Needs you now', value: String(needsNow), hint: 'Waiting on a question, approval or step from you', tone: needsNow > 0 ? 'amber' : undefined },
typeof blockedMin === 'number'
? {
label: 'Blocked this week',
@@ -715,7 +723,10 @@ export const FailureBox: React.FC<{
const recovery = recoveryText(task);
if (!f && !a) return null;
const tone = f ? failureTone(f.class) : 'violet';
- const status = a ? autofixStatusText(a, now) : null;
+ const fix = fixText ? fixTextShown(fixText, f?.summary) : null;
+ // With a "To fix", a skipped retry gets one short line (or none), not the reason again.
+ const folded = fix && a ? skippedWithFixText(a) : undefined;
+ const status = folded !== undefined ? folded : a ? autofixStatusText(a, now) : null;
const waiting = a && a.status === 'suggested' && a.strategy !== 'propose_change' && (task.state === 'failed' || task.state === 'blocked');
const scheduled = a && a.status === 'scheduled';
const earlier = failures.slice(0, -1).reverse();
@@ -736,10 +747,10 @@ export const FailureBox: React.FC<{
<span className="text-[11px] text-zinc-500">{ago(f.created_at, now)}</span>
</p>
)}
- {fixText && (
+ {fix && (
<p className="px-2.5 py-2 rounded-md border border-amber-500/30 bg-amber-500/10 text-amber-100" data-fix-needed>
<span className="font-medium">To fix: </span>
- {fixText}
+ {fix}
</p>
)}
{latest?.excerpt && (
@@ -1815,7 +1826,7 @@ export const MissionBoardView: React.FC<MissionBoardViewProps> = ({
{tasks !== null && (
<>
- <InsightsStrip insights={insights} />
+ <InsightsStrip insights={insights} needsYou={needsYouCount(tasks)} />
{visibleMissions.length > 0 && (
<div className="flex flex-wrap items-center gap-2">
diff --git a/frontend/src/missions.ts b/frontend/src/missions.ts
index 9f713fcd..de45bedb 100644
--- a/frontend/src/missions.ts
+++ b/frontend/src/missions.ts
@@ -448,17 +448,25 @@ export function sortTasks(tasks: Task[]): Task[] {
}
/**
- * Which column a task card sits in: its state's column, except that an open "may be invalid" flag, or an
- * AutoFix item (a retry to OK, something to fix, a proposed change), puts it in Needs you: they wait for
- * the person in any state.
+ * Which column a task card sits in: its state's column, except that an open "may be invalid" flag, an
+ * AutoFix item (a retry to OK, something to fix, a proposed change) or a required check waiting for the
+ * person's OK puts it in Needs you: they wait for the person in any state.
*/
export function columnOfTask(t: Pick<Task, 'state' | 'flags' | 'needs_you'>): Column | null {
const c = columnOf(t.state);
return c && (openFlags(t).length || (t.needs_you ?? []).some((n) => PERSON_ITEMS.has(n.kind))) ? 'needs_you' : c;
}
-/** AutoFix items that wait for the person whatever the task's state, so its card sits in Needs you. */
-const PERSON_ITEMS = new Set<NeedsYouItem['kind']>(['autofix_suggested', 'fix_needed', 'workflow_change']);
+/** Items that wait for the person whatever the task's state, so its card sits in Needs you. */
+const PERSON_ITEMS = new Set<NeedsYouItem['kind']>(['autofix_suggested', 'fix_needed', 'workflow_change', 'check_approval']);
+
+/**
+ * The "Needs you now" count: the cards the Needs you column holds across all work, so the tile and the
+ * column never disagree. The server's `needs_you_now` leaves out tasks only AutoFix items hold.
+ */
+export function needsYouCount(tasks: Task[]): number {
+ return tasks.filter((t) => columnOfTask(t) === 'needs_you').length;
+}
export function groupByColumn(tasks: Task[]): Record<Column, Task[]> {
const out: Record<Column, Task[]> = { ready: [], working: [], needs_you: [], review: [], verified: [] };
@@ -827,6 +835,32 @@ export function autofixStatusText(a: Pick<AutofixAttempt, 'status' | 'strategy'
}
}
+/**
+ * The "To fix" text without the failure summary an older server appends after it ("…then retry: <summary>",
+ * often cut short with "…"): the panel shows the summary once, on the failure line above.
+ */
+export function fixTextShown(fix: string, summary?: string | null): string {
+ const s = (summary ?? '').trim();
+ if (!s) return fix;
+ const at = fix.indexOf(s.slice(0, Math.min(40, s.length)));
+ if (at <= 0) return fix;
+ const head = fix.slice(0, at).replace(/[\s:;,.\u2013\u2014-]+$/, '');
+ return head ? `${head}.` : fix;
+}
+
+/**
+ * The AutoFix line under a failure the person must fix, else null to leave it out. "To fix" already says
+ * what to do, so this only adds that AutoFix won't retry, in one short line, and says nothing when it
+ * repeats "To fix" (a used-up retry budget). Works with the older server's reason, which is the fix text.
+ */
+export function skippedWithFixText(a: Pick<AutofixAttempt, 'status' | 'reason'>): string | null | undefined {
+ if (a.status !== 'skipped') return undefined;
+ const r = a.reason.trim();
+ if (r.startsWith('over_recovery_budget')) return null;
+ if (r.startsWith('no_attempts_left')) return 'AutoFix didn’t retry: no tries left.';
+ return 'AutoFix doesn’t retry this kind of failure.';
+}
+
/** The card line for a failed task AutoFix is handling, else null. */
export function autofixCardText(t: Pick<Task, 'autofix'>, now: number = Date.now()): string | null {
const a = t.autofix;
diff --git a/frontend/tests/missionAutofix.test.mjs b/frontend/tests/missionAutofix.test.mjs
index 8cab1ad0..53074acf 100644
--- a/frontend/tests/missionAutofix.test.mjs
+++ b/frontend/tests/missionAutofix.test.mjs
@@ -96,7 +96,7 @@ test('a usage limit reads as "Usage limit reached", is never retried by AutoFix,
const html = ui.detail(detailProps(t));
assert.match(html, /data-failure-class="quota"[\s\S]*Usage limit reached/);
assert.match(html, /data-fix-needed[^>]*><span[^>]*>To fix: <\/span>Usage limit reached: wait for it to reset or switch account/);
- assert.match(html, /data-autofix-status="skipped"[^>]*>[\s\S]*this kind of failure isn’t retried/);
+ assert.match(html, /data-autofix-status="skipped"[^>]*>[\s\S]*AutoFix doesn’t retry this kind of failure\./);
assert.doesNotMatch(html, /data-autofix-retry/, 'no AutoFix Retry now for a usage limit');
assert.doesNotMatch(html, /data-autofix-skip/);
// Even if an older server left a suggested attempt, a refused retry reads plainly.
@@ -106,6 +106,62 @@ test('a usage limit reads as "Usage limit reached", is never retried by AutoFix,
assert.doesNotMatch(refused, /409|not_retryable/, 'no codes shown to the person');
});
+// The text eval 10 saw on a real server (before #103): the summary echoed in "To fix" (cut at 200
+// characters) and again as the skipped attempt's reason.
+const REAL_SUMMARY = '⚠ [Evalbot] The claude profile "This machine" is out of usage until 21:01 UTC. Add another profile or wait for the limit to reset.';
+const OLD_FIX = `Usage limit reached: wait for it to reset or switch account, then retry: ${REAL_SUMMARY}`;
+const count = (html, text) => html.split(text).length - 1;
+
+test('the failure panel says each fact once, with the older server text and the newer one', () => {
+ for (const [label, fixText, reason] of [
+ ['older server', `${OLD_FIX.slice(0, 199)}…`, OLD_FIX],
+ ['newer server', 'Usage limit reached: wait for it to reset or switch account, then retry.', 'not_retryable: Usage limit reached: wait for it to reset or switch account, then retry.'],
+ ]) {
+ const t = task({
+ state: 'failed', autofix_attempts: 0,
+ last_failure: { class: 'quota', summary: REAL_SUMMARY, created_at: '2026-10-27T11:50:00Z' },
+ autofix: attempt({ status: 'skipped', strategy: 'none', reason }),
+ needs_you: [{ kind: 'fix_needed', id: 'fl5', text: fixText }],
+ });
+ const html = ui.detail(detailProps(t));
+ assert.equal(count(html, 'is out of usage until 21:01 UTC'), 1, `${label}: the summary appears once`);
+ assert.equal(count(html, 'wait for it to reset or switch account'), 1, `${label}: the fix appears once`);
+ assert.match(html, /To fix: <\/span>Usage limit reached: wait for it to reset or switch account, then retry\.</, label);
+ assert.match(html, /data-autofix-status="skipped"[^>]*>[\s\S]*?<span>AutoFix doesn’t retry this kind of failure\.<\/span>/, `${label}: one short line`);
+ assert.doesNotMatch(html, /…/, `${label}: nothing cut short`);
+ }
+ // An older sign-in fix text, and one without an echo, keep their own words.
+ assert.equal(m.fixTextShown('Sign in to the bot\'s engine again, then retry: bad key', 'bad key'), 'Sign in to the bot\'s engine again, then retry.');
+ assert.equal(m.fixTextShown('Raise the task\'s budget, then retry it.', 'Out of tokens'), 'Raise the task\'s budget, then retry it.');
+ assert.equal(m.fixTextShown('Sign in to GitHub again.', null), 'Sign in to GitHub again.');
+ assert.equal(m.fixTextShown('bad key', 'bad key'), 'bad key', 'a fix that is only the summary is kept');
+ assert.equal(m.skippedWithFixText(attempt({ status: 'skipped', reason: 'no_attempts_left: the task used all its attempts' })), 'AutoFix didn’t retry: no tries left.');
+ assert.equal(m.skippedWithFixText(attempt({ status: 'failed' })), undefined, 'only a skipped attempt is folded');
+});
+
+test('"Needs you now" counts the same cards as the Needs you column', () => {
+ const tasks = [
+ task({ id: 'q', state: 'needs_you' }),
+ failed({ id: 'f', needs_you: [{ kind: 'fix_needed', id: 'fl1', text: 'Usage limit reached.' }] }),
+ failed({ id: 's', needs_you: [{ kind: 'autofix_suggested', id: 'af1', text: 'Retry?' }] }),
+ task({ id: 'w', state: 'blocked', needs_you: [{ kind: 'workflow_change', id: 'wc1', text: 'Allow this change' }] }),
+ task({ id: 'r', state: 'review', checks_summary: { ...none, status: 'pending', needs_approval: 1, required_needs_approval: 1, total: 1 }, needs_you: [{ kind: 'check_approval', id: 'c1', text: 'Allow this check' }] }),
+ task({ id: 'v', state: 'verified', flags: [{ id: 'fg1', kind: 'may_be_invalid', cause: 'upstream_forked', cause_task_id: 'u', cause_title: 'Upstream', detail: {}, created_at: '2026-10-27T11:00:00Z' }] }),
+ task({ id: 'x', state: 'review' }),
+ failed({ id: 'y' }),
+ task({ id: 'z', state: 'working' }),
+ ];
+ const grouped = m.groupByColumn(tasks);
+ assert.deepEqual(grouped.needs_you.map((t) => t.id).sort(), ['f', 'q', 'r', 's', 'v', 'w']);
+ assert.equal(m.needsYouCount(tasks), grouped.needs_you.length);
+ assert.equal(m.columnOfTask(tasks[4]), 'needs_you', 'a check waiting for your OK waits on you, like its "Needs you" badge says');
+ // Eval 10: the server said 0 while 9 failed tasks waited on a fix; the tile follows the column.
+ const nine = Array.from({ length: 9 }, (_, i) => failed({ id: `f${i}`, needs_you: [{ kind: 'fix_needed', id: `fl${i}`, text: 'Sign in again.' }] }));
+ const ins = { verified_7d: 1, false_success_7d: 7, needs_you_now: 0, blocked_now: 0, tokens_7d: 0, tokens_per_verified_7d: null };
+ assert.match(ui.insights({ insights: ins, needsYou: m.needsYouCount(nine) }), /Needs you now<\/dt><dd class="[^"]*text-amber-300[^"]*">9</);
+ assert.match(ui.insights({ insights: ins }), /Needs you now<\/dt><dd[^>]*>0</, 'without the board it falls back to the server count');
+});
+
test('AutoFix tries come from the server count, not from counting failures in the browser', () => {
const failures = [1, 2, 3].map((n) => ({ id: `fl${n}`, attempt: n, source: 'turn', class: 'transient', summary: 'timed out', excerpt: null, checkpoint_id: null, created_at: '2026-10-27T11:00:00Z', autofix: attempt({ id: `af${n}`, status: 'succeeded' }) }));
assert.match(ui.failure({ task: failed({ autofix_attempts: 2 }), failures, now: NOW }), />AutoFix tries<\/dt><dd[^>]*>2</);
@@ -120,7 +176,7 @@ test('a retry skipped over the retry budget shows the Needs-you card and why it
});
const html = ui.detail(detailProps(t));
assert.match(html, /data-fix-needed[^>]*><span[^>]*>To fix: <\/span>Retry budget used up: raise it or retry by hand\./);
- assert.match(html, /data-autofix-status="skipped"[\s\S]*retry budget/);
+ assert.doesNotMatch(html, /data-autofix-status/, '"To fix" already says the budget is used up, so no second line says it again');
assert.doesNotMatch(html, /data-autofix-retry/, 'AutoFix offers no retry of its own; the person retries by hand');
assert.doesNotMatch(html, /data-needs-you/, 'the card is shown once, in What went wrong');
});