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.
JavaScript agent-collaborationagent-harnessagent-orchestrationagent-teamagent-workflowai-assistantai-automationai-employeeai-productivityai-teamai-workflowautonomous-agentsclaude-code-guiclaude-coworkdesktop-agentlocal-firstmulti-agentmulti-agent-systemself-evolving-agentstask-automation
fix(chat): honor user history scroll during search jump
BlueSkyID6669d8874b50f53
diff --git a/src/renderer/modules/conversation.js b/src/renderer/modules/conversation.jsindex 2f92af48..c23ba040 100644--- a/src/renderer/modules/conversation.js+++ b/src/renderer/modules/conversation.js@@ -7486,13 +7486,13 @@ function _setEarlierHistoryLoaderState(row, state, error = '') {row.textContent = '';}-function _maybeAutoLoadEarlierHistory(container) {+function _maybeAutoLoadEarlierHistory(container, userGesture = false) {if (!container || Number(container.scrollTop || 0) > HISTORY_AUTO_LOAD_THRESHOLD) {const row = container?.querySelector?.('.chat-history-load-earlier');if (row?.dataset.state === 'error') _setEarlierHistoryLoaderState(row, 'idle');return;}- if (_isProgrammaticStickyScroll(container)) return;+ if (!userGesture && _isProgrammaticStickyScroll(container)) return;const row = container.querySelector('.chat-history-load-earlier');if (!row || row.dataset.state === 'loading' || row.dataset.state === 'error') return;const cursor = _historyNextCursor(row.dataset.cursor);@@ -7509,9 +7509,9 @@ function _bindAutoLoadEarlierHistory(container) {// event. Listen for the user's continued upward intent so short pages can// still advance without a button.container.addEventListener('wheel', (event) => {- if (Number(event?.deltaY || 0) < 0) _maybeAutoLoadEarlierHistory(container);+ if (Number(event?.deltaY || 0) < 0) _maybeAutoLoadEarlierHistory(container, true);}, { passive: true });- container.addEventListener('touchmove', () => _maybeAutoLoadEarlierHistory(container), { passive: true });+ container.addEventListener('touchmove', () => _maybeAutoLoadEarlierHistory(container, true), { passive: true });}function _setLoadEarlierHistory(container, cid, nextCursor) {diff --git a/test/renderer/conversation-history-auto-load.test.ts b/test/renderer/conversation-history-auto-load.test.tsindex 76371637..af1dd557 100644--- a/test/renderer/conversation-history-auto-load.test.ts+++ b/test/renderer/conversation-history-auto-load.test.ts@@ -85,6 +85,46 @@ describe('conversation history auto-load', () => {expect(calls).toBe(0);});+ it('loads older history on user gestures during the search jump scroll grace', () => {+ const listeners: Record<string, (event?: { deltaY?: number }) => void> = {};+ const calls: Array<[string, number]> = [];+ const row = { dataset: { state: 'idle', cursor: '120', cid: 'c1' } };+ const container = {+ scrollTop: 0,+ querySelector: () => row,+ addEventListener: (name: string, listener: (event?: { deltaY?: number }) => void) => {+ listeners[name] = listener;+ },+ };+ const context: any = {+ Number,+ String,+ currentCid: 'c1',+ HISTORY_AUTO_LOAD_THRESHOLD: 48,+ _isProgrammaticStickyScroll: () => true,+ _loadOlderConversationHistory: (cid: string, cursor: number) => {+ calls.push([cid, cursor]);+ },+ _setEarlierHistoryLoaderState: () => {},+ };+ vm.createContext(context);+ vm.runInContext([+ extractFunction('_historyNextCursor'),+ extractFunction('_maybeAutoLoadEarlierHistory'),+ extractFunction('_bindAutoLoadEarlierHistory'),+ ].join('\n'), context);++ context._bindAutoLoadEarlierHistory(container);+ listeners.scroll();+ expect(calls).toEqual([]);+ listeners.wheel({ deltaY: 1 });+ expect(calls).toEqual([]);+ listeners.wheel({ deltaY: -1 });+ expect(calls).toEqual([['c1', 120]]);+ listeners.touchmove();+ expect(calls).toEqual([['c1', 120], ['c1', 120]]);+ });+it('keeps the previous reading anchor after prepending older content', () => {const context: any = { Number, Math };vm.createContext(context);