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 G1: approved-at line when a roll back restores an approved task (#516)

Oleksandr Ivanchenkodaff40fb2f3c
diff --git a/frontend/src/components/ReviewItemView.tsx b/frontend/src/components/ReviewItemView.tsx
index fe5767cd..817cb9bb 100644
--- a/frontend/src/components/ReviewItemView.tsx
+++ b/frontend/src/components/ReviewItemView.tsx
@@ -1218,10 +1218,17 @@ const RollBackDialog: React.FC<{
) : undoFrom ? (
<p className="text-zinc-300">Puts the files back to how they were just before the roll back (the safety checkpoint{cpTime ? ` · ${cpTime}` : ''}).</p>
) : (
- <p className="text-zinc-300">
- Puts this task’s files back to how they were before {item.kwant_name} started (checkpoint <strong className="text-zinc-100">before the run{cpTime ? ` · ${cpTime}` : ''}</strong>). Only files
- this task changed are touched.
- </p>
+ <>
+ {approvedAt && (
+ <p className="text-zinc-200" data-after-approval>
+ This was approved at <strong>{approvedAt}</strong>. Rolling it back undoes that approval.
+ </p>
+ )}
+ <p className="text-zinc-300">
+ Puts this task’s files back to how they were before {item.kwant_name} started (checkpoint <strong className="text-zinc-100">before the run{cpTime ? ` · ${cpTime}` : ''}</strong>). Only files
+ this task changed are touched.
+ </p>
+ </>
)}
{step && (
<p className="rounded-xl border border-amber-500/40 px-3 py-2 text-zinc-100" data-step-down>
diff --git a/frontend/tests/reviewItemView.test.mjs b/frontend/tests/reviewItemView.test.mjs
index c04dfd71..d10fde26 100644
--- a/frontend/tests/reviewItemView.test.mjs
+++ b/frontend/tests/reviewItemView.test.mjs
@@ -385,6 +385,24 @@ test('roll back by restore (in review, person check passed) still shows the step
const { q: q2 } = await mount(FX.oneTap, api2);
await click(q2('[data-roll-back]'));
assert.equal(q2('[data-step-down]'), null);
+ assert.equal(q2('[data-after-approval]'), null);
+});
+
+test('roll back by restore after a person check passed shows "This was approved at <time>"', async () => {
+ const base = fakeApi();
+ const { api, calls } = fakeApi({
+ restorePreview: async () => ({ ...base.preview, via: 'restore', verified_at: '2026-11-10T14:50:00Z', step_down: null }),
+ });
+ const { q } = await mount(FX.oneTap, api);
+ await click(q('[data-roll-back]'));
+ const line = q('[data-after-approval]');
+ assert.ok(line, 'approved-at line in the restore branch');
+ assert.match(line.textContent, /^This was approved at \S.*\. Rolling it back undoes that approval\.$/);
+ assert.ok(line.querySelector('strong').textContent.trim().length > 0, 'the time is shown');
+ assert.match(q('[data-rollback-body]').textContent, /Puts this task’s files back to how they were before/);
+ await click(q('[data-rollback-confirm]'));
+ assert.ok(calls.some((c) => c[0] === 'restore'));
+ assert.equal(calls.some((c) => c[0] === 'forkFromCheckpoint'), false);
});
test('no roll back button when rollback_ok is false; Escape closes the dialog', async () => {