Skip to content

Studio: keep server chats visible when legacy IndexedDB stalls - #9446

Merged
wasimysaid merged 1 commit into
unslothai:mainfrom
oobabooga:fix/chat-legacy-indexeddb-hotfix
Aug 21, 2026
Merged

wasimysaid merged 1 commit into
unslothai:mainfrom
oobabooga:fix/chat-legacy-indexeddb-hotfix

Conversation

@oobabooga

Copy link
Copy Markdown
Member

Follow-up to #9113.

Problem

The complete Linux AppImage bundles WebKitGTK 2.50.4 but reuses Studio's existing WebView profile. A profile last written by WebKitGTK 2.52.3 can leave the legacy chat IndexedDB open permanently pending under the bundled runtime.

Current chats have lived in studio.db since #5272, but Studio still consults IndexedDB for legacy migration and fallback. When that open stalls, the sidebar never displays the intact server-backed history.

In the reproduced profile, the legacy database contained zero chat records. Moving it aside removed the stalled open and allowed the chats in studio.db to appear.

Fix

  • Bound legacy IndexedDB operations to one second and stop consulting the store for the rest of the session after a timeout or rejection.
  • Start the server thread listing concurrently so the legacy open cannot prevent the authoritative request.
  • Keep database enumeration on a separate bound because its failure does not prove the store itself is unreadable.
  • Preserve the existing migration ledger and readable legacy-only fallback without deleting or rewriting the WebView profile.

Verification

  • Reproduced the empty sidebar with the affected profile under bundled WebKitGTK 2.50.4; the same studio.db showed its chats with a fresh profile.
  • In a controlled source A/B with permanently pending IndexedDB, origin/main timed out while the fix returned the server chat after the one-second bound.
  • Focused regression tests: 3 passed, including stalled delete, clear, and export paths.
  • Frontend suite: 4,237 passed.
  • TypeScript typecheck, ESLint, and git diff --check passed.

@oobabooga

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 7a01842e86

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@wasimysaid

Copy link
Copy Markdown
Collaborator

Deterministic UI evidence: stalled legacy IndexedDB

Before/after chat sidebar with a pending legacy IndexedDB open

Refs: merge base 20c015f292685c9dbf1e4cea92bf69a0792a6ca6 → PR head 7a01842e860ae675d462d3794551e45f06990ced

Two isolated exact-SHA Studio installs were built and photographed at the same 1366×768 viewport. In both browser contexts, the legacy IndexedDB open request was held permanently pending and the same deterministic server-backed thread was available.

After the same 3-second interval:

BEFORE AFTER
pending IndexedDB opens 1 1
/api/chat/threads requests 0 2
server thread visible no yes

The merge base leaves Recents blank because it never starts the authoritative server read. The PR head reaches the server immediately, bounds the legacy wait, and renders Recovered server chat.

Limitation: this is a deterministic browser-level pending-IDB fixture, not the reporter's byte-for-byte WebKitGTK profile. It directly exercises the real built sidebar and the stuck-open behavior the PR changes.

@wasimysaid
wasimysaid merged commit 5a85104 into unslothai:main Aug 21, 2026
26 of 31 checks passed
danielhanchen added a commit to Imagineer99/unsloth that referenced this pull request Sep 24, 2026
…e check (unslothai#11763)

* Pin the legacy store outcome in the failed-delete data settings check

The failed-delete check asserted that the Clear chats confirmation closes
when the backend refuses the clear. The app closes it only when the legacy
IndexedDB clear succeeds: with both stores failed, clearStoredChats throws
and the confirmation stays open, armed for a retry, by design since unslothai#7029.

Which of the two happens is decided by the legacy store gate (unslothai#9446). Any
legacy read slower than 1 s shuts it for the life of the page, after which
a clear reports the legacy store as failed. Firefox on the Windows runner
occasionally crosses that line, and the check then fails at line 216 with
the confirmation still on screen. Seen on main at 288b1a3 and on unslothai#11730
and a87d180, with Chromium passing in the same job.

The fixture now refuses legacy writes on request, so the check drives the
outcome it asserts instead of inheriting whatever the gate did earlier: the
clear settles, the confirmation is still open with its action and switch
re-enabled, no chat is lost, and Cancel closes it with no further delete.
It is pinned to the confirmation by its switch, not `.last`, which slides
onto Settings once the confirmation goes.

* Record the dialogs still mounted when the data settings check fails

A Firefox run on the Windows runner failed in reset() with one hidden
dialog left 5 s after closing Settings, and the only evidence was a blank
screenshot. The report now lists every [role=dialog] still in the DOM with
its data-state, display, opacity and running animations, so the next
occurrence says whether an exit animation held the dialog or something else
kept it mounted.
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…e check (unslothai#11763)

* Pin the legacy store outcome in the failed-delete data settings check

The failed-delete check asserted that the Clear chats confirmation closes
when the backend refuses the clear. The app closes it only when the legacy
IndexedDB clear succeeds: with both stores failed, clearStoredChats throws
and the confirmation stays open, armed for a retry, by design since unslothai#7029.

Which of the two happens is decided by the legacy store gate (unslothai#9446). Any
legacy read slower than 1 s shuts it for the life of the page, after which
a clear reports the legacy store as failed. Firefox on the Windows runner
occasionally crosses that line, and the check then fails at line 216 with
the confirmation still on screen. Seen on main at 288b1a3 and on unslothai#11730
and a87d180, with Chromium passing in the same job.

The fixture now refuses legacy writes on request, so the check drives the
outcome it asserts instead of inheriting whatever the gate did earlier: the
clear settles, the confirmation is still open with its action and switch
re-enabled, no chat is lost, and Cancel closes it with no further delete.
It is pinned to the confirmation by its switch, not `.last`, which slides
onto Settings once the confirmation goes.

* Record the dialogs still mounted when the data settings check fails

A Firefox run on the Windows runner failed in reset() with one hidden
dialog left 5 s after closing Settings, and the only evidence was a blank
screenshot. The report now lists every [role=dialog] still in the DOM with
its data-state, display, opacity and running animations, so the next
occurrence says whether an exit animation held the dialog or something else
kept it mounted.
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