Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

fix(chat): keep pending admission from flashing the task board

BlueSkyID6666d1730a4c94c
diff --git a/src/renderer/modules/task-board.js b/src/renderer/modules/task-board.js
index b31781e9..3efe1d3e 100644
--- a/src/renderer/modules/task-board.js
+++ b/src/renderer/modules/task-board.js
@@ -80,12 +80,15 @@ function _taskBoardDropOrder(tasks, taskId, targetId, afterTarget) {
// remains visible because the board owns its run-anyway/cancel recovery.
// Initial admission is not actual waiting: the host marks newly created
// rows until its scheduler either starts them or confirms they must queue.
+// Exclude those rows from BOTH visibility gates: counting a pending send as
+// a second task flashes the board while the previous turn is settling.
// Pure decision function — renderer tests extract it.
function _taskBoardVisibility(liveRows) {
- const rows = Array.isArray(liveRows) ? liveRows : [];
+ const rows = (Array.isArray(liveRows) ? liveRows : []).filter((task) => (
+ task && !(task.status === 'queued' && task.admission_pending === true)
+ ));
const hasStandaloneControl = rows.some((task) => (
- task && (task.status === 'blocked'
- || (task.status === 'queued' && task.admission_pending !== true))
+ task.status === 'blocked' || task.status === 'queued'
));
return { visible: rows.length >= 2 || hasStandaloneControl };
}
diff --git a/test/renderer/task-board.test.ts b/test/renderer/task-board.test.ts
index 5b651811..1254a48c 100644
--- a/test/renderer/task-board.test.ts
+++ b/test/renderer/task-board.test.ts
@@ -554,7 +554,50 @@ describe('renderer task board › visibility (multi-task only, adjudicated 2026-
expect(runVisibility([{ ...pending[0], admission_pending: false }])).toEqual({ visible: true });
expect(runVisibility([{ ...pending[0], status: 'running' }])).toEqual({ visible: false });
expect(runVisibility([{ ...pending[0], status: 'blocked' }])).toEqual({ visible: true });
- expect(runVisibility([...pending, { task_id: 'other', status: 'running' }])).toEqual({ visible: true });
+ expect(runVisibility([...pending, { task_id: 'other', status: 'running' }])).toEqual({ visible: false });
+ });
+
+ it.each(['event', 'seed'])(
+ 'does not flash when a fresh send overlaps the prior turn settlement through %s', async (settlement) => {
+ const { context, panel, list, board } = boardHarness();
+ const prior = { task_id: 'prior', assignee: 'commander', status: 'running' };
+ const next = { task_id: 'next', assignee: 'commander', status: 'queued', admission_pending: true };
+ board.onEvent('c1', { task: prior });
+ expect(panel.style.display).toBe('none');
+ // The prior terminal can arrive after the new task's creation. No
+ // scheduler has confirmed waiting or a second execution at this point.
+ board.onEvent('c1', { task: next });
+ expect(panel.style.display).toBe('none');
+ expect(list.innerHTML).toBe('');
+ const done = { ...prior, status: 'done' };
+ if (settlement === 'event') board.onEvent('c1', { task: done });
+ else {
+ context.apiFetch = async () => ({ json: async () => ({ ok: true, tasks: [done, next] }) });
+ await board.sync('c1');
+ }
+ expect(panel.style.display).toBe('none');
+ board.onEvent('c1', { task: { ...next, status: 'running', admission_pending: undefined } });
+ expect(panel.style.display).toBe('none');
+ },
+ );
+
+ it('waits for admission facts across multiple fresh sends but exposes real concurrency and recovery', () => {
+ const { panel, list, board } = boardHarness();
+ const first = { task_id: 'first', assignee: 'commander', status: 'queued', admission_pending: true };
+ const second = { ...first, task_id: 'second', assignee: 'other' };
+ board.onEvent('c1', { task: first });
+ board.onEvent('c1', { task: second });
+ expect(panel.style.display).toBe('none');
+ board.onEvent('c1', { task: { ...first, status: 'running', admission_pending: undefined } });
+ expect(panel.style.display).toBe('none');
+ board.onEvent('c1', { task: { ...second, status: 'running', admission_pending: undefined } });
+ expect(panel.style.display).toBe('');
+ expect(list.innerHTML.match(/chat.task_status_running/g)).toHaveLength(2);
+ board.onEvent('c1', { task: { ...second, status: 'done', admission_pending: undefined } });
+ expect(panel.style.display).toBe('none');
+ board.onEvent('c1', { task: { task_id: 'blocked', assignee: 'other', status: 'blocked' } });
+ expect(panel.style.display).toBe('');
+ expect(list.innerHTML).toContain('data-act="task-run-anyway"');
});
it.each(['event-first', 'seed-first'])(
@@ -591,8 +634,10 @@ describe('renderer task board › visibility (multi-task only, adjudicated 2026-
// resurfaces, and its terminal rows cannot keep the panel visible.
const other = { task_id: 'second', assignee: 'commander', status: 'queued', admission_pending: true };
board.onEvent('c1', { type: 'task_created', task: other });
+ expect(panel.style.display).toBe('none');
+ board.onEvent('c1', { type: 'task_state', task: { ...other, admission_pending: undefined } });
expect(panel.style.display).toBe('');
- board.onEvent('c1', { type: 'task_state', task: { ...other, status: 'cancelled' } });
+ board.onEvent('c1', { type: 'task_state', task: { ...other, status: 'cancelled', admission_pending: undefined } });
expect(panel.style.display).toBe('none');
board.onEvent('c1', { type: 'task_state', task: { ...snapshot, status: 'done' } });
expect(panel.style.display).toBe('none');