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.

Approvals: say the risks before they turn off, and keep saying it while off

Pixel (kwant bot)f8d2da4e9266
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1b8fd384..811daa12 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
card numbers. It can't catch everything, such as a plain "Continue" on an unusual checkout page or a
card a site already saved: see `docs/payments.md`. Sending, deleting, publishing and signing in still
run without asking when approvals are off.
+- **Approvals: the risks are said before they turn off.** Choosing "Don't ask" for a space or a bot
+ now says plainly that bots can then send messages and emails, delete files or data, publish and sign
+ in to your accounts without asking, that payments still ask you first, and that bots with access to
+ money or accounts are better kept on "Ask" or "Ask only when risky". Nothing changes until you press
+ Turn off approvals; Cancel (or Escape) keeps the current setting. While approvals are off, a note next
+ to the setting keeps saying so.
- **Mission board: AutoFix, change approvals and restore.** A failed task shows why it failed in plain
words, what AutoFix plans, its tries and what retries cost, with Retry now and Don't retry. Proposed
changes to a check, the acceptance or a routine appear in Needs you with before and after, and only
diff --git a/frontend/src/approvalMode.ts b/frontend/src/approvalMode.ts
index 27614e5a..6bd9b498 100644
--- a/frontend/src/approvalMode.ts
+++ b/frontend/src/approvalMode.ts
@@ -46,7 +46,7 @@ export const SPACE_OPTIONS: Array<{ value: SpaceApprovals; label: string; hint:
label: 'Ask only when risky',
hint: 'Ordinary work in the bot’s folder runs on its own; a card asks before network calls, git fetch and push, publishing, anything outside the folder or anything unclear. Not a sandbox: scripts, make and npm install inside the folder run without a card, and can do anything you can.',
},
- { value: 'off', label: 'Don’t ask', hint: 'Bots run everything without approval.' },
+ { value: 'off', label: 'Don’t ask', hint: 'Bots act without asking, including sending, deleting, publishing and signing in. Payments still ask you.' },
];
/** The per-bot choices; "Same as space" names what the space is set to. */
@@ -59,14 +59,23 @@ export function botOptions(space: SpaceApprovals): Array<{ value: BotApprovals;
];
}
-/** What turning approvals off means, said plainly on the confirm. */
+/** What turning approvals off means, said plainly on the confirm (Oleks, 2026-10-27: off means off, with the risks said first). */
export const OFF_CONSEQUENCES = [
- 'Shell commands run without asking you.',
- 'Files can be written or deleted anywhere the computer allows, not just in the bot’s folder.',
- 'Tools (MCP servers, browser, web) run without asking.',
- 'No approval cards appear. Everything that runs is still recorded.',
+ 'Bots can send messages and emails, delete files or data, publish, and sign in to your accounts without asking you.',
+ 'Shell commands, file writes anywhere the computer allows, and tools (MCP servers, browser, web) run without a card.',
+ 'Payments still ask you first, though a payment made by filling in a card form on a website may not be caught.',
+ 'Everything that runs is still recorded.',
];
+/** Under the list: who shouldn't be on "Don't ask". */
+export const OFF_ADVICE = 'For bots with access to money or your accounts, keep approvals on or choose “Ask only when risky”.';
+
+/** Next to the setting for as long as it's off. */
+export const OFF_HINT = 'Approvals are off: bots act without asking, including deletions, publishing and sign-ins. Payments still ask you.';
+
+/** True when a change newly turns approvals off, so the confirm comes before the save. Takes effective values. */
+export const needsOffConfirm = (current: SpaceApprovals, next: SpaceApprovals): boolean => next === 'off' && current !== 'off';
+
/** The same, with the saved-passwords sentence for where passwords are kept. */
export const offConsequences = (store: StoreStatus | null | undefined): string[] => [...OFF_CONSEQUENCES, autofillGapNote(store)];
diff --git a/frontend/src/components/ApprovalsSetting.tsx b/frontend/src/components/ApprovalsSetting.tsx
index dd0c9f3e..638364f2 100644
--- a/frontend/src/components/ApprovalsSetting.tsx
+++ b/frontend/src/components/ApprovalsSetting.tsx
@@ -13,7 +13,10 @@ import {
botOptions,
effectiveApprovals,
offConfirmTitle,
+ needsOffConfirm,
+ OFF_ADVICE,
OFF_CONSEQUENCES,
+ OFF_HINT,
offConsequences,
} from '../approvalMode';
import { StoreStatus, moveFirstLabel, moveFirstText } from '../passwordStore';
@@ -21,7 +24,7 @@ import { ExposedBanner, MoveToBitwardenFirst, PasswordStoreState, usePasswordSto
/** "Approvals off": in a chat header (full) or a sidebar row (icon, with the words for screen readers). */
export const ApprovalsOffBadge: React.FC<{ compact?: boolean; onClick?: () => void; title?: string }> = ({ compact, onClick, title }) => {
- const tip = title ?? 'Approvals are off: this bot runs commands, file writes and tools without asking.';
+ const tip = title ?? 'Approvals are off: this bot acts without asking. Payments still ask you.';
if (compact) {
return (
<span className="shrink-0 inline-flex items-center text-amber-300" title={tip}>
@@ -49,6 +52,14 @@ export const ApprovalsOffBadge: React.FC<{ compact?: boolean; onClick?: () => vo
);
};
+/** The standing reminder next to the setting while approvals are off. */
+export const OffHint: React.FC = () => (
+ <p data-approvals-off-hint className="flex items-start gap-1.5 text-[11px] leading-snug text-amber-200/90">
+ <ShieldOff size={12} className="mt-px shrink-0" aria-hidden="true" />
+ {OFF_HINT}
+ </p>
+);
+
/**
* The plain-words confirm before anything runs without asking. With passwords still saved on this
* server, "off" isn't offered: they move to Bitwarden first (the server refuses otherwise, F-10).
@@ -67,7 +78,18 @@ export const OffConfirm: React.FC<{
// Still finding out: don't offer "off" for the moment it takes.
const checking = !!passwords && !status && !passwords.problem;
return (
- <div role="alertdialog" aria-labelledby={`${id}-t`} aria-describedby={`${id}-d`} className="rounded-lg border border-amber-500/40 bg-amber-500/10 p-3 space-y-2.5">
+ <div
+ role="alertdialog"
+ onKeyDown={(e) => {
+ if (e.key === 'Escape' && !busy) {
+ e.stopPropagation();
+ onCancel();
+ }
+ }}
+ aria-labelledby={`${id}-t`}
+ aria-describedby={`${id}-d`}
+ className="rounded-lg border border-amber-500/40 bg-amber-500/10 p-3 space-y-2.5"
+ >
<p id={`${id}-t`} className="flex items-center gap-2 text-xs font-semibold text-amber-100">
<AlertTriangle size={14} aria-hidden="true" /> {title}
</p>
@@ -83,7 +105,10 @@ export const OffConfirm: React.FC<{
<MoveToBitwardenFirst store={passwords!} label={moveFirstLabel(status!.local_count)} />
</div>
) : (
- <p className="text-[11px] text-amber-100/80">Bots can’t change this. You can turn approvals back on here at any time.</p>
+ <>
+ <p className="text-[11px] font-medium text-amber-100">{OFF_ADVICE}</p>
+ <p className="text-[11px] text-amber-100/80">Bots can’t change this. You can turn approvals back on here at any time.</p>
+ </>
)}
<div className="flex flex-wrap gap-2">
<button
@@ -92,7 +117,7 @@ export const OffConfirm: React.FC<{
autoFocus
className="px-3 py-1.5 rounded-lg text-xs font-medium text-zinc-200 border border-zinc-700/60 bg-zinc-800/60 hover:bg-zinc-700/70"
>
- Keep asking
+ Cancel
</button>
{!mustMove && (
<button
@@ -102,7 +127,7 @@ export const OffConfirm: React.FC<{
className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-white bg-rose-600 hover:bg-rose-500 disabled:opacity-50"
>
{(busy || checking) && <Loader2 size={12} className="animate-spin motion-reduce:animate-none" aria-hidden="true" />}
- {checking ? 'Checking saved passwords…' : 'Turn approvals off'}
+ {checking ? 'Checking saved passwords…' : 'Turn off approvals'}
</button>
)}
</div>
@@ -163,7 +188,7 @@ export const SpaceApprovalsSetting: React.FC<{
};
const pick = (v: SpaceApprovals) => {
if (v === current || busy) return;
- if (v === 'off') setConfirming(true);
+ if (needsOffConfirm(current, v)) setConfirming(true);
else save(v);
};
const exceptions = current === 'off' ? overrides?.ask ?? [] : overrides?.off ?? [];
@@ -207,6 +232,7 @@ export const SpaceApprovalsSetting: React.FC<{
{confirming && (
<OffConfirm title={offConfirmTitle({ space: spaceName })} busy={busy} passwords={passwords} onCancel={() => setConfirming(false)} onConfirm={() => save('off')} />
)}
+ {current === 'off' && !confirming && <OffHint />}
{exceptions.length > 0 && !confirming && (
<p className="text-[11px] text-zinc-500">
{current === 'off' ? 'Still asks, set on the bot: ' : 'Runs without asking, set on the bot: '}
@@ -279,7 +305,8 @@ export const BotApprovalsSetting: React.FC<{
};
const pick = (v: BotApprovals) => {
if (v === state.approvals || busy) return;
- if (effectiveApprovals(v, state.space_approvals) === 'off' && state.approvals_effective !== 'off') setPending(v);
+ // "Same as space" counts as off when the space is: that needs the confirm too.
+ if (needsOffConfirm(state.approvals_effective, effectiveApprovals(v, state.space_approvals))) setPending(v);
else save(v);
};
@@ -289,7 +316,7 @@ export const BotApprovalsSetting: React.FC<{
<label htmlFor={selectId} className="text-xs font-medium text-zinc-400">
Approvals
</label>
- {state.approvals_effective === 'off' && <ApprovalsOffBadge title={`${kwantName} runs commands, file writes and tools without asking.`} />}
+ {state.approvals_effective === 'off' && <ApprovalsOffBadge title={`${kwantName} acts without asking. Payments still ask you.`} />}
</div>
<select
id={selectId}
@@ -305,6 +332,7 @@ export const BotApprovalsSetting: React.FC<{
))}
</select>
<p className="text-[11px] text-zinc-500">Saved as soon as you change it.</p>
+ {state.approvals_effective === 'off' && !pending && <OffHint />}
<ExposedBanner
store={passwords}
onApprovalsOn={() =>
diff --git a/frontend/tests/approvalsNeedBitwarden.test.mjs b/frontend/tests/approvalsNeedBitwarden.test.mjs
index 3616159c..16cf7d0d 100644
--- a/frontend/tests/approvalsNeedBitwarden.test.mjs
+++ b/frontend/tests/approvalsNeedBitwarden.test.mjs
@@ -186,22 +186,22 @@ test('confirm with passwords here: "off" isn\'t offered; it says why and offers
const t = text(html);
assert.match(html, /data-off-needs-bitwarden/);
assert.match(t, /3 saved passwords are kept on this server\. Under “Ask only when risky” or “Don't ask”, any bot that can run commands could read them, so move them to Bitwarden first\./);
- assert.deepEqual(buttons(html), ['Move 3 saved passwords to Bitwarden first', 'Keep asking']);
- assert.doesNotMatch(t, /Turn approvals off/);
+ assert.deepEqual(buttons(html), ['Move 3 saved passwords to Bitwarden first', 'Cancel']);
+ assert.ok(!buttons(html).includes('Turn off approvals'));
// The paragraph says it; the note isn't repeated above it.
assert.ok(!t.includes(LOCAL_NOTE));
// Bitwarden with leftovers here, and Bitwarden locked with some here: the same.
- assert.deepEqual(buttons(m.confirm(BW_LEFTOVER)), ['Move 2 saved passwords to Bitwarden first', 'Keep asking']);
- assert.deepEqual(buttons(m.confirm(BW_LOCKED)), ['Move 3 saved passwords to Bitwarden first', 'Keep asking']);
+ assert.deepEqual(buttons(m.confirm(BW_LEFTOVER)), ['Move 2 saved passwords to Bitwarden first', 'Cancel']);
+ assert.deepEqual(buttons(m.confirm(BW_LOCKED)), ['Move 3 saved passwords to Bitwarden first', 'Cancel']);
});
test('confirm with nothing here: "off" is offered, with the sentence for that store', () => {
const b = m.confirm(BW);
- assert.deepEqual(buttons(b), ['Keep asking', 'Turn approvals off']);
+ assert.deepEqual(buttons(b), ['Cancel', 'Turn off approvals']);
assert.ok(text(b).includes(BW_NOTE));
assert.ok(!text(b).includes(LOCAL_NOTE));
const l = m.confirm(LOCAL0);
- assert.deepEqual(buttons(l), ['Keep asking', 'Turn approvals off']);
+ assert.deepEqual(buttons(l), ['Cancel', 'Turn off approvals']);
assert.ok(text(l).includes(LOCAL_NOTE), 'nothing saved yet, and saving here will be refused');
});
@@ -209,20 +209,20 @@ test('confirm while the store is still loading: "off" waits; with no store info
const html = m.confirm(null);
assert.match(text(html), /Checking saved passwords…|Checking saved passwords\.\.\./);
assert.match(html, /<button[^>]*disabled=""[^>]*>[\s\S]*Checking saved passwords/);
- assert.deepEqual(buttons(m.confirm(undefined)), ['Keep asking', 'Turn approvals off']);
+ assert.deepEqual(buttons(m.confirm(undefined)), ['Cancel', 'Turn off approvals']);
const failed = m.confirm(undefined, { passwords: { status: null, problem: 'error', reload() {}, set() {} } });
- assert.deepEqual(buttons(failed), ['Keep asking', 'Turn approvals off'], 'store unreadable: the server\'s 409 is the backstop');
+ assert.deepEqual(buttons(failed), ['Cancel', 'Turn off approvals'], 'store unreadable: the server\'s 409 is the backstop');
});
test('space and bot settings use it: move first with passwords here, off with none', () => {
assert.match(text(m.spaceSetting({ initialConfirm: true, initialPasswords: LOCAL3 })), /Move 3 saved passwords to Bitwarden first/);
- assert.doesNotMatch(text(m.spaceSetting({ initialConfirm: true, initialPasswords: LOCAL3 })), /Turn approvals off/);
+ assert.ok(!buttons(m.spaceSetting({ initialConfirm: true, initialPasswords: LOCAL3 })).includes('Turn off approvals'));
const state = { kwant_id: 'k1', approvals: 'inherit', approvals_effective: 'ask', space_approvals: 'ask' };
const bot = m.botSetting({ initial: state, initialPending: 'off', initialPasswords: LOCAL3 });
assert.match(text(bot), /Let Dev run everything without approval\?/);
assert.match(text(bot), /Move 3 saved passwords to Bitwarden first/);
- assert.doesNotMatch(text(bot), /Turn approvals off/);
- assert.match(text(m.botSetting({ initial: state, initialPending: 'off', initialPasswords: BW })), /Turn approvals off/);
+ assert.ok(!buttons(bot).includes('Turn off approvals'));
+ assert.ok(buttons(m.botSetting({ initial: state, initialPending: 'off', initialPasswords: BW })).includes('Turn off approvals'));
});
test('move first: connect when there is no Bitwarden, unlock when it is locked, both in place', () => {
diff --git a/frontend/tests/approvalsOff.test.mjs b/frontend/tests/approvalsOff.test.mjs
index d1489229..6565214e 100644
--- a/frontend/tests/approvalsOff.test.mjs
+++ b/frontend/tests/approvalsOff.test.mjs
@@ -121,25 +121,30 @@ test('space control: Ask is the default and checked, Don\'t ask explains itself,
const t = text(html);
assert.match(html, /role="radiogroup" aria-label="Approvals in Work"/);
assert.match(t, /Ask before running commands \(default\)/);
- assert.match(t, /Don't ask Bots run everything without approval\./);
+ assert.match(t, /Don't ask Bots act without asking, including sending, deleting, publishing and signing in\. Payments still ask you\./);
+ assert.doesNotMatch(html, /data-approvals-off-hint/, 'no standing hint while asking');
assert.match(html, /checked="" value="ask"/);
assert.doesNotMatch(html, /checked="" value="off"/);
assert.doesNotMatch(html, /alertdialog/);
assert.doesNotMatch(t, /Approvals off/, 'no marker while asking');
});
-test('space control: the confirm says plainly what off means, and Keep asking is the safe default focus', () => {
+test('space control: the confirm says plainly what off means, and Cancel is the safe default focus', () => {
const html = m.spaceSetting({ initialConfirm: true, initialPasswords: { store: 'local', locked: false, local_count: 0, bitwarden: null, approvals_off: false, exposed: false } });
const t = text(html);
assert.match(html, /role="alertdialog"/);
assert.match(t, /Turn off approvals for every bot in Work\?/);
- assert.match(t, /Shell commands run without asking you\./);
- assert.match(t, /written or deleted anywhere/);
- assert.match(t, /Tools \(MCP servers, browser, web\) run without asking\./);
- assert.match(t, /No approval cards appear\. Everything that runs is still recorded\./);
+ // Oleks (2026-10-27): off is off, but the risks are said first; only payments still ask.
+ assert.match(t, /Bots can send messages and emails, delete files or data, publish, and sign in to your accounts without asking you\./);
+ assert.match(t, /Shell commands, file writes anywhere the computer allows, and tools \(MCP servers, browser, web\) run without a card\./);
+ assert.match(t, /Payments still ask you first, though a payment made by filling in a card form on a website may not be caught\./);
+ assert.match(t, /Everything that runs is still recorded\./);
+ assert.match(t, /For bots with access to money or your accounts, keep approvals on or choose “Ask only when risky”\./);
+ assert.match(t, /any bot that can run commands could read passwords saved on this server/, 'the saved-passwords sentence for this store');
+ assert.doesNotMatch(html, /data-approvals-off-hint/, 'the hint waits until it is really off');
assert.match(t, /Bots can't change this\./);
- assert.deepEqual(buttons(html).slice(-2), ['Keep asking', 'Turn approvals off']);
- assert.match(html, /<button type="button"[^>]*autofocus=""[^>]*>Keep asking/i);
+ assert.deepEqual(buttons(html).slice(-2), ['Cancel', 'Turn off approvals']);
+ assert.match(html, /<button type="button"[^>]*autofocus=""[^>]*>Cancel/i);
});
test('space control when off: Don\'t ask is checked, the marker shows, and bots that still ask are named', () => {
@@ -148,6 +153,32 @@ test('space control when off: Don\'t ask is checked, the marker shows, and bots
assert.match(html, /checked="" value="off"/);
assert.match(t, /Approvals off/);
assert.match(t, /Still asks, set on the bot: Reviewer\./);
+ assert.match(html, /data-approvals-off-hint/);
+ assert.match(t, /Approvals are off: bots act without asking, including deletions, publishing and sign-ins\. Payments still ask you\./);
+});
+
+test('the switch: only a change that newly turns approvals off needs the confirm', () => {
+ assert.equal(m.needsOffConfirm('ask', 'off'), true);
+ assert.equal(m.needsOffConfirm('smart', 'off'), true);
+ assert.equal(m.needsOffConfirm('off', 'off'), false, 'already off (a bot moving to "Same as space" with the space off)');
+ assert.equal(m.needsOffConfirm('off', 'ask'), false, 'turning approvals on saves at once');
+ assert.equal(m.needsOffConfirm('ask', 'smart'), false);
+ // A bot choosing "Same as space" while the space is off is turning off: it confirms.
+ assert.equal(m.needsOffConfirm('ask', m.effectiveApprovals('inherit', 'off')), true);
+});
+
+test('bot override: the confirm while a choice waits, the hint once it is off, none while asking', () => {
+ const asking = { kwant_id: 'k1', approvals: 'ask', approvals_effective: 'ask', space_approvals: 'ask' };
+ const pending = m.botSetting({ initial: asking, initialPending: 'off', initialPasswords: { store: 'local', locked: false, local_count: 0, bitwarden: null, approvals_off: false, exposed: false } });
+ assert.match(pending, /role="alertdialog"/);
+ assert.match(text(pending), /Let Dev run everything without approval\?/);
+ assert.match(text(pending), /Payments still ask you first/);
+ assert.deepEqual(buttons(pending).slice(-2), ['Cancel', 'Turn off approvals']);
+ assert.doesNotMatch(pending, /data-approvals-off-hint/);
+ assert.doesNotMatch(m.botSetting({ initial: asking }), /data-approvals-off-hint/);
+ const off = m.botSetting({ initial: { ...asking, approvals: 'off', approvals_effective: 'off' } });
+ assert.match(off, /data-approvals-off-hint/);
+ assert.match(text(off), /Approvals are off: bots act without asking/);
});
// ---------------------------------------------------------------- the bot override