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.

0.9.0 G2: Inbox roll back on the copy path can be run, with no "isn't restored" warning (#517)

Oleksandr Ivanchenko78a956996bd2
diff --git a/frontend/src/components/ReviewItemView.tsx b/frontend/src/components/ReviewItemView.tsx
index 817cb9bb..edf9a9ca 100644
--- a/frontend/src/components/ReviewItemView.tsx
+++ b/frontend/src/components/ReviewItemView.tsx
@@ -1136,6 +1136,9 @@ const RollBackDialog: React.FC<{
}, [load]);
const fork = preview?.via === 'fork';
+ // missionsApi.restorePreview marks a fork-path preview as refused 'fork_instead' for the Mission
+ // board's restore dialog. Here the fork is the roll back itself, so that refusal doesn't apply.
+ const refused = fork ? null : preview?.refused ?? null;
const run = async () => {
if (!cp || !preview || inFlight.current) return;
inFlight.current = true;
@@ -1174,7 +1177,7 @@ const RollBackDialog: React.FC<{
const step = preview ? stepDownText(preview.step_down ?? null) : null;
const cpTime = clock(cp?.created_at);
const approvedAt = clock(preview?.verified_at);
- const canRun = !!preview && !preview.refused && preview.changes.length > 0 && !busy;
+ const canRun = !!preview && !refused && preview.changes.length > 0 && !busy;
const footer = (
<div className={phone ? 'grid grid-cols-2 gap-2' : 'flex justify-end gap-2'}>
@@ -1204,10 +1207,10 @@ const RollBackDialog: React.FC<{
)}
{preview && (
<>
- {preview.refused && (
- <p className="flex items-start gap-1.5 rounded-xl border border-rose-400/30 bg-rose-500/[0.08] px-3 py-2 text-rose-200" data-rollback-refused={preview.refused}>
+ {refused && (
+ <p className="flex items-start gap-1.5 rounded-xl border border-rose-400/30 bg-rose-500/[0.08] px-3 py-2 text-rose-200" data-rollback-refused={refused}>
<AlertTriangle size={14} className="mt-1 shrink-0" aria-hidden="true" />
- {preview.refused === 'running' ? 'A bot is working on it now. Roll back once it stops.' : restoreErrorText(new MissionError('', 409, preview.refused))}
+ {refused === 'running' ? 'A bot is working on it now. Roll back once it stops.' : restoreErrorText(new MissionError('', 409, refused))}
</p>
)}
{fork ? (
diff --git a/frontend/tests/reviewItemView.test.mjs b/frontend/tests/reviewItemView.test.mjs
index d10fde26..8ca9f7b4 100644
--- a/frontend/tests/reviewItemView.test.mjs
+++ b/frontend/tests/reviewItemView.test.mjs
@@ -350,12 +350,15 @@ test('roll back with a held action denies it first; a stale preview reloads', as
test('roll back after approval (via fork): after-approval lines, step-down, fork call, copy', async () => {
const base = fakeApi();
const { api, calls } = fakeApi({
- restorePreview: async () => ({ ...base.preview, via: 'fork', verified_at: '2026-11-10T14:50:00Z', step_down: { kwant_id: 'k-mira', class: 'copy changes', from: 'trusted', to: 'sandbox' } }),
+ // As missionsApi.restorePreview returns it: a fork-path preview carries refused 'fork_instead'.
+ restorePreview: async () => ({ ...base.preview, via: 'fork', refused: 'fork_instead', verified_at: '2026-11-10T14:50:00Z', step_down: { kwant_id: 'k-mira', class: 'copy changes', from: 'trusted', to: 'sandbox' } }),
});
const opened = [];
const { q, done } = await mount(FX.oneTap, api, { onOpenTask: (id) => opened.push(id) });
await click(q('[data-roll-back]'));
assert.ok(q('[data-after-approval]'));
+ assert.equal(q('[data-rollback-refused]'), null, 'the copy path is the roll back: no "isn\u2019t restored" warning');
+ assert.equal(q('[data-rollback-confirm]').disabled, false);
assert.match(q('[data-step-down]').textContent, /Mira moves down one Flight School tier for copy changes/);
await click(q('[data-rollback-confirm]'));
const f = calls.find((c) => c[0] === 'forkFromCheckpoint');