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: "To fix" doesn't start with the failure's name again

Pixel (kwant bot)b048ef2a247d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 811daa12..17282f4f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -115,6 +115,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
and its spend doesn't change. Before, the check was only approved and never ran.
### Fixed
+- **Mission board: "To fix" no longer repeats the failure's name.** A usage-limit failure read "Usage
+ limit reached" on its badge and again at the start of "To fix"; "To fix" now starts with what to do.
- **Mission board: AutoFix hides passwords without hiding command names.** A check's command name or a
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
diff --git a/frontend/src/components/MissionBoardView.tsx b/frontend/src/components/MissionBoardView.tsx
index 0fe851f8..e512431c 100644
--- a/frontend/src/components/MissionBoardView.tsx
+++ b/frontend/src/components/MissionBoardView.tsx
@@ -723,7 +723,7 @@ export const FailureBox: React.FC<{
const recovery = recoveryText(task);
if (!f && !a) return null;
const tone = f ? failureTone(f.class) : 'violet';
- const fix = fixText ? fixTextShown(fixText, f?.summary) : null;
+ const fix = fixText ? fixTextShown(fixText, f?.summary, f ? failureClassLabel(f.class) : null) : 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;
diff --git a/frontend/src/missions.ts b/frontend/src/missions.ts
index ec46793d..c9348351 100644
--- a/frontend/src/missions.ts
+++ b/frontend/src/missions.ts
@@ -837,15 +837,22 @@ 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.
+ * often cut short with "…"): the panel shows the summary once, on the failure line above. A leading
+ * `heading` (the failure's badge, e.g. "Usage limit reached: wait…") is dropped too.
*/
-export function fixTextShown(fix: string, summary?: string | null): string {
+export function fixTextShown(fix: string, summary?: string | null, heading?: 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;
+ const at = s ? fix.indexOf(s.slice(0, Math.min(40, s.length))) : -1;
+ const head = at > 0 ? fix.slice(0, at).replace(/[\s:;,.\u2013\u2014-]+$/, '') : '';
+ return dropHeading(head ? `${head}.` : fix, heading);
+}
+
+/** `text` without a leading "<heading>:" the failure's badge already shows; kept whole when nothing follows. */
+function dropHeading(text: string, heading?: string | null): string {
+ const h = (heading ?? '').trim();
+ if (!h || text.slice(0, h.length).toLowerCase() !== h.toLowerCase()) return text;
+ const rest = text.slice(h.length).replace(/^[\s:;,.\u2013\u2014-]+/, '');
+ return rest ? rest.charAt(0).toUpperCase() + rest.slice(1) : text;
}
/**
diff --git a/frontend/tests/missionAutofix.test.mjs b/frontend/tests/missionAutofix.test.mjs
index 53074acf..0ceede4b 100644
--- a/frontend/tests/missionAutofix.test.mjs
+++ b/frontend/tests/missionAutofix.test.mjs
@@ -95,7 +95,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-fix-needed[^>]*><span[^>]*>To fix: <\/span>Wait for it to reset or switch account/);
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/);
@@ -125,8 +125,10 @@ test('the failure panel says each fact once, with the older server text and the
});
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.equal(count(html.toLowerCase(), 'wait for it to reset or switch account'), 1, `${label}: the fix appears once`);
+ assert.match(html, /To fix: <\/span>Wait for it to reset or switch account, then retry\.</, label);
+ const panel = html.slice(html.indexOf('data-failure'));
+ assert.equal(count(panel, 'Usage limit reached'), 1, `${label}: the failure panel names the class once`);
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`);
}
@@ -135,6 +137,11 @@ test('the failure panel says each fact once, with the older server text and the
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');
+ // The badge already names the failure: "To fix" doesn't start with it again.
+ assert.equal(m.fixTextShown('Usage limit reached: wait for it to reset or switch account, then retry.', null, 'Usage limit reached'), 'Wait for it to reset or switch account, then retry.');
+ assert.equal(m.fixTextShown('Usage limit reached: wait, then retry: is out of usage', 'is out of usage', 'Usage limit reached'), 'Wait, then retry.');
+ assert.equal(m.fixTextShown('Sign in to GitHub again.', null, 'Signed out, or the key was rejected'), 'Sign in to GitHub again.');
+ assert.equal(m.fixTextShown('Usage limit reached', null, 'Usage limit reached'), 'Usage limit reached', 'a fix that is only the heading 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');
});