Skip to content

Startup database restore pins the window but never sets the gRPC routing database #3058

Closed

Description

@malibio

Problem

On launch, databaseStore.load() (packages/desktop-app/src/lib/stores/database.svelte.ts) picks a database: the tray-requested one, then the remembered one, then the daemon default. It calls pin_window_database and activateProSync with that id, but never set_active_database. The only set_active_database call is in switchTo(), and nothing on the Rust side sets it at startup either.

So when the restored database is not the daemon default (a remembered selection, or a tray pick), the window pin and the switcher show database X, while GrpcClient.active_database_id stays None. Node, import, embeddings, agent-session and local-agent requests go out with no x-ns-database-id header and reach the daemon's default database. The node-event watcher also watches the default database. This lasts until the user switches databases by hand.

Repro

  1. Register two databases, A (default) and B.
  2. Switch to B, then quit and relaunch.
  3. The switcher shows B, but reads and writes go to A.

Suggested fix

Have load() also invoke set_active_database(resolved), or merge "pin window" and "set routing database" into one command so the two can't drift apart.

Found while reviewing PR #3056. Import progress still arrives in this state, because an unrouted (None) event goes to the focused window.

Activity

  1. malibio commented on Sep 26, 2026

    @malibio
    CollaboratorAuthor

    Frontend: 5355 passed (273 files)

  2. self-assigned this
    on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions