Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b5aec57
refactor(tauri): update development scripts and configuration for CEF…
senamakel Apr 18, 2026
e37ddf3
refactor(release): enhance macOS signing script for nested frameworks…
senamakel Apr 18, 2026
6a2a69f
feat(orchestrator): add current_time tool and enhance agent capabilities
senamakel Apr 18, 2026
86fe30e
feat(gmail): implement post-processing for Gmail responses to convert…
senamakel Apr 18, 2026
95ea9d6
refactor(gmail): improve HTML to markdown conversion and tool result …
senamakel Apr 18, 2026
3e66a76
feat(thread): implement thread title generation from user and assista…
senamakel Apr 18, 2026
22ffdf7
feat(conversations): add thread title update functionality
senamakel Apr 18, 2026
96b0227
feat(docs): add comprehensive agent and subagent tool flow documentation
senamakel Apr 18, 2026
5fb289b
feat(subagent): implement extraction tool and handoff cache for overs…
senamakel Apr 18, 2026
ad1c399
feat(conversations): enhance message bubble rendering and timeline en…
senamakel Apr 18, 2026
34fd6c5
feat(subagent): enforce restrictions on sub-agent spawning tools
senamakel Apr 18, 2026
198da7d
feat(conversations): add ToolTimelineBlock component and enhance time…
senamakel Apr 18, 2026
b8f7495
refactor(conversations): streamline component imports and enhance for…
senamakel Apr 18, 2026
9e70107
fix: satisfy pre-push lint on fix/tauri
senamakel Apr 18, 2026
45a04e7
fix(chat): refresh usage counters after responses
senamakel Apr 18, 2026
d7661dd
refactor(ChatRuntimeProvider): remove redundant import of requestUsag…
senamakel Apr 18, 2026
37140cf
fix(chat): satisfy pre-push checks
senamakel Apr 18, 2026
d0a7c5d
refactor(conversations): improve error handling and remove unused tit…
senamakel Apr 18, 2026
d0a024e
refactor(conversations): improve formatting of title redaction and st…
senamakel Apr 18, 2026
99c8b08
refactor(tokenjuice): sort fact parts for improved formatting in inli…
senamakel Apr 18, 2026
4a7eaaf
fix: address remaining CodeRabbit review comments
senamakel Apr 18, 2026
d3b98cc
refactor: streamline error handling and improve code readability
senamakel Apr 18, 2026
94f74e0
refactor: improve code formatting and structure
senamakel Apr 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(chat): satisfy pre-push checks
  • Loading branch information
senamakel committed Apr 18, 2026
commit 37140cf1f51f426de327697bd6b7d957027a8ad4
73 changes: 37 additions & 36 deletions app/src/providers/ChatRuntimeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import debug from 'debug';
import { useEffect, useRef } from 'react';
import { useCallback, useEffect, useRef } from 'react';

import { requestUsageRefresh } from '../hooks/usageRefresh';
import {
Expand Down Expand Up @@ -124,46 +124,47 @@ const ChatRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
return (hash >>> 0).toString(36);
};

const resolveVisibleThreadForProactive = async (
incomingThreadId: string
): Promise<string | null> => {
if (!incomingThreadId.startsWith('proactive:')) {
return incomingThreadId;
}
const resolveVisibleThreadForProactive = useCallback(
async (incomingThreadId: string): Promise<string | null> => {
if (!incomingThreadId.startsWith('proactive:')) {
return incomingThreadId;
}

const state = store.getState().thread;
const targetFromState =
state.selectedThreadId ?? state.activeThreadId ?? state.threads[0]?.id ?? null;
if (targetFromState) {
return targetFromState;
}
const state = store.getState().thread;
const targetFromState =
state.selectedThreadId ?? state.activeThreadId ?? state.threads[0]?.id ?? null;
if (targetFromState) {
return targetFromState;
}

if (proactiveThreadCreationPromiseRef.current) {
return proactiveThreadCreationPromiseRef.current;
}
if (proactiveThreadCreationPromiseRef.current) {
return proactiveThreadCreationPromiseRef.current;
}

const createPromise: Promise<string | null> = (async () => {
try {
const newThread = await dispatch(createNewThread()).unwrap();
dispatch(setSelectedThread(newThread.id));
return newThread.id;
} catch (error) {
rtLog('proactive_thread_create_failed', {
err: error instanceof Error ? error.message : String(error),
});
return null;
} finally {
proactiveThreadCreationPromiseRef.current = null;
}
})();
proactiveThreadCreationPromiseRef.current = createPromise;

const createPromise: Promise<string | null> = (async () => {
try {
const newThread = await dispatch(createNewThread()).unwrap();
dispatch(setSelectedThread(newThread.id));
return newThread.id;
} catch (error) {
rtLog('proactive_thread_create_failed', {
err: error instanceof Error ? error.message : String(error),
});
return null;
return await createPromise;
} finally {
proactiveThreadCreationPromiseRef.current = null;
// no-op: cleared in createPromise.finally
}
})();
proactiveThreadCreationPromiseRef.current = createPromise;

try {
return await createPromise;
} finally {
// no-op: cleared in createPromise.finally
}
};
},
[dispatch]
);

useEffect(() => {
if (socketStatus !== 'connected') return;
Expand Down Expand Up @@ -585,7 +586,7 @@ const ChatRuntimeProvider = ({ children }: { children: React.ReactNode }) => {
rtLog('unsubscribe_chat_events');
cleanup();
};
}, [dispatch, socketStatus]);
}, [dispatch, resolveVisibleThreadForProactive, socketStatus]);

return <>{children}</>;
};
Expand Down
Loading