Skip to content

fix: PGlite session stability + voice error handling#37

Merged
rogerchappel merged 3 commits into
mainfrom
fix/pglite-session-stability
Apr 2, 2026
Merged

fix: PGlite session stability + voice error handling#37
rogerchappel merged 3 commits into
mainfrom
fix/pglite-session-stability

Conversation

@rogerchappel
Copy link
Copy Markdown
Owner

Three targeted fixes for stability issues on multi-device setups:

Bug 1: PGlite Compaction Race Condition (b5237ad)

Added a WriteQueue class that serializes all PGlite query/exec/transaction calls through a sequential queue via Proxy. Prevents Another write batch or compaction is already active errors from concurrent gateway health/tick events.

Bug 2: Session Resume Across Devices (ae31248)

Reordered the chat history load waterfall: gateway (/api/chat/history) is now fetched as the authoritative source before falling back to PGlite DB. Gateway messages win on conflicts; local-only messages are merged in. localStorage is write-through cache only.

Bug 3: Voice Transcription Error UX (a7c2d8a)

Voice recorder and voice agent now show user-facing error messages instead of spamming console.error when the STT endpoint is unreachable. Added 5s timeout on STT probe. URLs were already relative.

Relates to TSK-390

rogerchappel and others added 3 commits April 3, 2026 09:15
PGlite is single-writer — concurrent DB writes from gateway health/tick
events cause "Another write batch or compaction is already active" errors.
Add a WriteQueue that serializes all PGlite operations (query, exec,
transaction) so only one runs at a time. The drizzle instance and schema
setup both use the queued client.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…load

Chat messages were stored in localStorage (per-device) and PGlite
(per-device instance), causing history to regress when switching devices.
Now the gateway's chat.history RPC is fetched first as the source of
truth, with local messages merged in (gateway wins on conflicts).
localStorage becomes a write-through cache, and the DB is a fallback
only when the gateway is unreachable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When accessing CrewCmd from a tablet/remote device via Tailscale, the
STT endpoint fetch would fail with "TypeError: Load failed" and spam
the console. Now both VoiceRecorder and VoiceAgent show visible error
messages instead. The STT probe also uses a 5s timeout to fail fast on
unreachable hosts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rogerchappel rogerchappel merged commit e9b429a into main Apr 2, 2026
1 check passed
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