Skip to content

refactor(app): record /btw chats without waiting for the store to load - #53312

Merged
Brendonovich merged 1 commit into
v2from
btw-simplify-ask
Oct 5, 2026
Merged

Brendonovich merged 1 commit into
v2from
btw-simplify-ask

Conversation

@Brendonovich

Copy link
Copy Markdown
Member

Summary

Follow-up to #53270. /btw no longer waits for the session's store to load before recording a chat.

  • ask() pushes the chat and opens its tab immediately, in one batch, and starts the request. It replaces a Promise + createRoot + abort-signal + two createKeyed watchers that waited for store.ready().
  • This is safe because of existing host behaviour:
    • Persisted.update before load already queues, and the queue applies in the same batch that marks the store ready, so the chat lands over the stored value with no ready-but-missing gap.
    • saved(session) returns one stable handle per session for as long as its tab is open.
    • The panel already keeps a not-yet-loaded tab listed but hidden, so the tab isn't dropped before the chat arrives.
  • generate() now takes the question as a parameter instead of reading it back from the store, which may still be loading. Retry reads the stored question and passes it in.
  • Behaviour change: navigating away from the session (Home, another session) before its store loads now keeps the chat instead of cancelling it. Only closing the session's titlebar tab before load discards it, along with that session's store.
  • ask() is now synchronous, so it no longer holds the composer's submit lock.

Validation

  • /btw e2e keeper (btw-sidebar.spec.ts): 4 passed.
  • packages/app and packages/gui-extensions typechecks, lint:changed, and Prettier passed.
  • The queue-before-load store contract is already covered by the extension host component test (extension-host.spec.ts, an update before load applies once it loads). Native desktop was not exercised.

Writes before a session store loads already queue and land in the batch that marks it ready, and the panel keeps a not-yet-loaded tab hidden, so ask() records the chat and opens its tab at once instead of waiting through a reactive root. Navigating away before load now keeps the chat rather than cancelling it.
@Brendonovich
Brendonovich enabled auto-merge (squash) October 5, 2026 08:39
@Brendonovich
Brendonovich merged commit 2dfd08e into v2 Oct 5, 2026
11 checks passed
@Brendonovich
Brendonovich deleted the btw-simplify-ask branch October 5, 2026 08:53
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.

1 participant