Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/chat-tab-stale-12h-macros-newtab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@agent-native/core": patch
---

Auto-hide sidebar tabs after 12 h of inactivity (previously 4 h, empty-only). Any tab inactive for more than 12 hours is now removed from the sidebar on load and the user is dropped into a fresh tab; older threads remain accessible via History.
14 changes: 5 additions & 9 deletions packages/core/src/client/MultiTabAssistantChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1133,17 +1133,13 @@ export function MultiTabAssistantChat({
const threadIds = new Set(threads.map((t) => t.id));
const threadMap = new Map(threads.map((t) => [t.id, t]));

// Auto-close only empty tabs inactive for more than 4 hours. Non-empty
// conversations should survive refresh even if they are old; otherwise the
// chat appears to disappear even though it still exists in history.
const STALE_THRESHOLD_MS = 4 * 60 * 60 * 1000;
// Hide tabs that have had no activity for more than 12 hours. Stale tabs
// are removed from the sidebar on load but remain accessible via history.
const STALE_THRESHOLD_MS = 12 * 60 * 60 * 1000;
const now = Date.now();
const isStale = (id: string) => {
const thread = threadMap.get(id);
return thread
? thread.messageCount === 0 &&
now - thread.updatedAt > STALE_THRESHOLD_MS
: false;
return thread ? now - thread.updatedAt > STALE_THRESHOLD_MS : false;
};

// If the active thread is a sub-agent, switch to its parent or the most recent main thread
Expand All @@ -1159,7 +1155,7 @@ export function MultiTabAssistantChat({
}

setOpenTabIds((prev) => {
// Filter out tabs that no longer exist, sub-agent tabs, or stale tabs (>4h inactive)
// Filter out tabs that no longer exist, sub-agent tabs, or stale tabs (>12h inactive)
const valid = prev.filter(
(id) => threadIds.has(id) && !parentMap[id] && !isStale(id),
);
Expand Down
5 changes: 3 additions & 2 deletions templates/macros/app/components/VoiceDictation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ export function VoiceDictation({ currentDate }: VoiceDictationProps) {
(text: string) => {
setState("processing");
try {
// Open the agent sidebar now that the voice message is captured
// Open the agent sidebar now that the voice message is captured.
// Always open a fresh chat tab so each voice command gets its own thread.
window.dispatchEvent(new Event("agent-panel:open"));
sendToAgent({ message: text, submit: true });
sendToAgent({ message: text, submit: true, newTab: true });
// Timeout fallback: if sidebar is closed or event never fires,
// don't leave the mic stuck in processing forever
setTimeout(() => {
Expand Down
Loading