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.

Steps: a human step nobody finished in time says so, not ✓ Done (28n) (#807)

Oleksandr Ivanchenko852dc35f489d
diff --git a/frontend/src/activity.ts b/frontend/src/activity.ts
index 143daf68..e18a8d0d 100644
--- a/frontend/src/activity.ts
+++ b/frontend/src/activity.ts
@@ -236,8 +236,20 @@ export function activitySummary(a: SavedActivity): string {
return parts.join(' · ');
}
+/** 28n: a human step nobody finished in time (server `timed_out`, kept in `outcome` by 28j). */
+const timedOutHumanStep = (s: ActivityStep) => s.kind === 'human_step' && s.outcome === 'timed_out';
+
+/**
+ * The status a step is drawn with (icon, chip). 28n: a human step nobody finished in time looks like an approval
+ * nobody answered (⏱, amber) instead of ✓ Done. `status` itself stays `ok`, so counts and follow-through are as before.
+ */
+export function shownStatus(s: ActivityStep): StepStatus {
+ return timedOutHumanStep(s) ? 'unanswered' : s.status;
+}
+
/** What a step's status reads as, for screen readers and the row's label. */
export function statusLabel(s: ActivityStep): string {
+ if (timedOutHumanStep(s)) return 'Not done in time';
switch (s.status) {
case 'running':
return s.kind === 'thinking' ? 'Thinking' : 'Running';
diff --git a/frontend/src/components/ActivityList.tsx b/frontend/src/components/ActivityList.tsx
index 3b65a227..80a1da91 100644
--- a/frontend/src/components/ActivityList.tsx
+++ b/frontend/src/components/ActivityList.tsx
@@ -8,6 +8,7 @@ import {
formatDuration,
isOpenStep,
plainTitle,
+ shownStatus,
statusLabel,
thinkingText,
} from '../activity';
@@ -31,7 +32,7 @@ const Title: React.FC<{ text: string }> = ({ text }) => (
const StatusIcon: React.FC<{ step: ActivityStep }> = ({ step }) => {
const label = statusLabel(step);
const icon = (() => {
- switch (step.status) {
+ switch (shownStatus(step)) {
case 'running':
return step.kind === 'thinking' ? (
<Brain size={13} className="text-info animate-pulse motion-reduce:animate-none" />
@@ -134,7 +135,8 @@ const StepRow: React.FC<{ step: ActivityStep; live?: LiveActivity; now: number;
// 26d: a step that failed or wasn't approved in time says so in words, not only by its icon, even when a later
// step worked. The icon's label already names it for screen readers, so the mark is hidden from them.
// The approval row keeps its icon only: the mark belongs on the command the person said no to.
- const mark = step.status === 'declined' && step.kind === 'approval' ? undefined : STEP_MARK[step.status];
+ const shown = shownStatus(step);
+ const mark = step.status === 'declined' && step.kind === 'approval' ? undefined : STEP_MARK[shown];
const head = (
<>
<StatusIcon step={step} />
@@ -142,7 +144,7 @@ const StepRow: React.FC<{ step: ActivityStep; live?: LiveActivity; now: number;
{step.kind === 'thinking' ? (running ? 'Thinking…' : 'Thought') : <Title text={readableStepTitle(step.title, step.outcome ?? step.status)} />}
</span>
{mark && (
- <span aria-hidden="true" data-step-mark={step.status} className={`flex-shrink-0 rounded border px-1 text-[10px] leading-4 font-medium ${mark}`}>
+ <span aria-hidden="true" data-step-mark={shown} className={`flex-shrink-0 rounded border px-1 text-[10px] leading-4 font-medium ${mark}`}>
{statusLabel(step)}
</span>
)}
diff --git a/frontend/tests/timedOutStepSaysSo.test.mjs b/frontend/tests/timedOutStepSaysSo.test.mjs
new file mode 100644
index 00000000..dd7a6214
--- /dev/null
+++ b/frontend/tests/timedOutStepSaysSo.test.mjs
@@ -0,0 +1,82 @@
+// 28n (autonomy/timed-out-step-says-so/brief.md): a human step nobody finished in time (server `timed_out`) gets the
+// unanswered look: the ⏱ amber icon, the amber chip and "Not done in time", not ✓ "Done". `status` stays `ok`.
+// Tests marked "fails on c561af2e" fail there.
+process.env.TZ = 'UTC';
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { loadBundled } from './bundle.mjs';
+
+globalThis.localStorage ??= { getItem: () => null, setItem: () => {}, removeItem: () => {} };
+
+const m = await loadBundled(`
+ import React from 'react';
+ import { renderToStaticMarkup } from 'react-dom/server.browser';
+ import { SavedActivityList } from './src/components/ActivityList';
+ export { parseActivityMeta, statusLabel, activitySummary } from './src/activity';
+ export const steps = (props) => renderToStaticMarkup(React.createElement(SavedActivityList, props));
+`);
+
+const T0 = '2026-11-17T18:00:00Z';
+const HS = 'Waiting for you: Solve the CAPTCHA on reviews.example.org in the browser panel.';
+const hs = (id, status) => ({ id, kind: 'human_step', status, title: HS, tool: 'ask_human', ref_id: `h-${id}`, started_at: T0, ended_at: T0, duration_ms: 600000 });
+const ap = (id, status) => ({ id, kind: 'approval', status, title: 'Waiting for your approval: Running a command', tool: 'Bash', started_at: T0, ended_at: T0 });
+const parse = (raw) => m.parseActivityMeta({ activity: { steps: raw, dropped: 0 } });
+
+/** The rendered <li> of step `id`, as HTML. */
+const row = (html, id) => {
+ const start = html.indexOf(`id="r1-steps-${id}"`);
+ assert.ok(start >= 0, `row ${id}`);
+ return html.slice(start, html.indexOf('</li>', start));
+};
+const look = (r) => ({
+ label: r.match(/role="img" aria-label="([^"]+)"/)?.[1],
+ mark: r.match(/data-step-mark="([^"]+)"/)?.[1] ?? null,
+ chip: r.match(/data-step-mark="[^"]+"[^>]*>([^<]+)</)?.[1] ?? null,
+ timer: /lucide-timer-off/.test(r),
+ check: /lucide-check/.test(r),
+ amberChip: /text-amber-300 border-amber-500\/30/.test(r),
+});
+
+test('a timed-out human step reads "Not done in time" (fails on c561af2e)', () => {
+ const [s] = parse([hs('t', 'timed_out')]).steps;
+ assert.equal(s.status, 'ok');
+ assert.equal(s.outcome, 'timed_out');
+ assert.equal(m.statusLabel(s), 'Not done in time');
+});
+
+test('Details: timed out gets the timer icon and the amber "Not done in time" chip (fails on c561af2e)', () => {
+ const a = parse([hs('s0', 'done'), hs('s1', 'resolved_auto'), hs('s2', 'declined'), hs('s3', 'timed_out'), hs('s4', 'stopped')]);
+ const html = m.steps({ activity: a, idBase: 'r1', defaultOpen: true });
+ const t = look(row(html, 's3'));
+ assert.deepEqual(t, { label: 'Not done in time', mark: 'unanswered', chip: 'Not done in time', timer: true, check: false, amberChip: true });
+});
+
+test('guard: done and resolved_auto keep ✓ Done, declined and stopped as before', () => {
+ const a = parse([hs('s0', 'done'), hs('s1', 'resolved_auto'), hs('s2', 'declined'), hs('s4', 'stopped')]);
+ const html = m.steps({ activity: a, idBase: 'r1', defaultOpen: true });
+ for (const id of ['s0', 's1']) {
+ const r = look(row(html, id));
+ assert.equal(r.label, 'Done', id);
+ assert.equal(r.check, true, id);
+ assert.equal(r.mark, null, id);
+ }
+ assert.equal(look(row(html, 's2')).label, 'You said no');
+ assert.equal(look(row(html, 's2')).chip, 'You said no');
+ assert.equal(look(row(html, 's4')).label, 'Stopped');
+ assert.equal(look(row(html, 's4')).mark, null);
+});
+
+test('guard: an unanswered approval is unchanged', () => {
+ const html = m.steps({ activity: parse([ap('a1', 'unanswered')]), idBase: 'r1', defaultOpen: true });
+ const r = look(row(html, 'a1'));
+ assert.equal(r.label, 'Not approved in time');
+ assert.equal(r.timer, true);
+ assert.equal(r.chip, 'Not approved in time');
+});
+
+test('guard: counts read `status`, so the summary is as before (no "didn\'t run" for a human step)', () => {
+ const a = parse([hs('t', 'timed_out')]);
+ assert.doesNotMatch(m.activitySummary(a), /didn’t run/);
+ const tool = parse([{ ...hs('x', 'timed_out'), kind: 'tool' }]);
+ assert.notEqual(m.statusLabel(tool.steps[0]), 'Not done in time');
+});