Skip to content

feat: auto-hide stale chat tabs after 12 h; macros Record always opens new tab#716

Merged
steve8708 merged 1 commit into
mainfrom
ai_main_58811965e0184adc8ba6
May 16, 2026
Merged

feat: auto-hide stale chat tabs after 12 h; macros Record always opens new tab#716
steve8708 merged 1 commit into
mainfrom
ai_main_58811965e0184adc8ba6

Conversation

@builder-io-integration
Copy link
Copy Markdown
Contributor

Summary

Two related changes to chat-tab lifecycle behavior.

1. Macros — Record button always opens a new chat tab

File: templates/macros/app/components/VoiceDictation.tsx

Previously, pressing the mic button and speaking sent the transcribed command to the currently active chat thread. Now it passes newTab: true to sendToAgent, so every voice invocation starts a fresh thread. This keeps macro voice runs isolated and prevents a long-running conversation from getting a raw voice-to-action transcript dumped into it.

2. General — Stale tabs hidden after 12 h of inactivity

File: packages/core/src/client/MultiTabAssistantChat.tsx

Before:

  • Only empty (0-message) tabs inactive for 4 hours were removed from the sidebar on load.

After:

  • Any tab inactive for 12 hours is removed from the sidebar on load.
  • The user is automatically dropped into a fresh empty tab.
  • Older conversations remain accessible via the History popover — nothing is deleted.

The isStale predicate inside the initialization effect was updated: the messageCount === 0 guard was removed and the threshold raised from 4 h to 12 h.

Changeset

A patch changeset for @agent-native/core is included as required by CI.

Testing

  • pnpm build in packages/core passes cleanly (TypeScript compilation).
  • No existing test files cover these specific behaviors; the changes are localised to two well-scoped call sites.

Behavior matrix

Scenario Before After
Voice command in Macros Sends to active tab Opens new tab, sends there
Load page after 12 h with active conversation Tab stays in sidebar Tab hidden, new empty tab opened; old thread in History
Load page after 6 h with active conversation Tab stays (4 h only hit empty tabs) Tab stays (< 12 h threshold)
Load page with empty tab after 5 h Tab removed (> 4 h + empty) Tab stays (< 12 h threshold)
Load page with empty tab after 13 h Tab removed Tab removed

…ys opens new tab

- Raise stale-tab threshold from 4 h to 12 h and remove the empty-only
  guard: any tab inactive >12 h is now hidden from the sidebar on load.
  The user lands in a fresh tab; older conversations stay in history.
- Macros VoiceDictation: pass newTab:true to sendToAgent so each voice
  command always opens its own chat thread instead of reusing the active one.
- Add changeset for @agent-native/core (patch).
@netlify
Copy link
Copy Markdown

netlify Bot commented May 16, 2026

Deploy Preview for agent-native-voice ready!

Name Link
🔨 Latest commit 13c8d2c
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-voice/deploys/6a088abbdf598b0008fdd005
😎 Deploy Preview https://deploy-preview-716--agent-native-voice.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 16, 2026

Deploy Preview for agent-native-meeting-notes ready!

Name Link
🔨 Latest commit 13c8d2c
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-meeting-notes/deploys/6a088abbc55f550008d3d4cf
😎 Deploy Preview https://deploy-preview-716--agent-native-meeting-notes.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 16, 2026

Deploy Preview for agent-native-scheduling ready!

Name Link
🔨 Latest commit 13c8d2c
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-scheduling/deploys/6a088abb9cae280008b27bf7
😎 Deploy Preview https://deploy-preview-716--agent-native-scheduling.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 16, 2026

Deploy Preview for agent-native-images ready!

Name Link
🔨 Latest commit 13c8d2c
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-images/deploys/6a088abb7fc4790008543452
😎 Deploy Preview https://deploy-preview-716--agent-native-images.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cloudflare-workers-and-pages

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 16, 2026

Deploy Preview for agent-native-design ready!

Name Link
🔨 Latest commit 13c8d2c
🔍 Latest deploy log https://app.netlify.com/projects/agent-native-design/deploys/6a088abb4fc28f0008bfec41
😎 Deploy Preview https://deploy-preview-716--agent-native-design.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cloudflare-workers-and-pages

This comment has been minimized.

@cloudflare-workers-and-pages

This comment has been minimized.

Copy link
Copy Markdown
Contributor Author

@builder-io-integration builder-io-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builder reviewed your changes and has a few items to flag 🟡

Review Details

Code Review Summary

This PR makes two targeted chat-tab lifecycle changes to @agent-native/core:

  1. Macros VoiceDictation.tsx — Voice command button now passes newTab: true to sendToAgent, ensuring each voice invocation opens a fresh thread instead of reusing the active tab.

  2. MultiTabAssistantChat.tsx — Stale tab cleanup logic updated from "empty-only tabs inactive >4 hours" to "any tab inactive >12 hours", aiming to automatically drop users into a fresh tab on page load if their active conversation is old.

Overall approach: The scope is narrow, the changeset is properly included, and the intent is clear. However, there is a medium-severity logic issue in the stale tab cleanup implementation that affects the stated behavior.

Key Finding:
🟡 Effect ordering bug — When the active thread is detected as stale (>12h), it's filtered from the sidebar by the initialization effect, but then immediately re-added by the active-thread effect in the same render cycle before the new thread takes effect. This means users do not get dropped into a clean empty tab as the PR description promises; instead, the stale tab momentarily reappears alongside the fresh one.

Browser testing: Will run after this review (PR touches UI code).


@steve8708 steve8708 merged commit 85d6554 into main May 16, 2026
35 checks passed
@steve8708 steve8708 deleted the ai_main_58811965e0184adc8ba6 branch May 16, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants