Repository navigation
fix(server): slow SQLite work no longer forces clients to reconnect - #18736
not-compromised wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR replaces the existing production SQLite execution boundary with worker-thread coordination and changes transaction and connection lifecycle behavior for existing callers. It also adds new static-analysis diagnostic suppressions, so the scope and review-policy impact require human review. You can add or adjust custom eligibility rules. Learn more. |
|
Focused verification after rebasing onto main
Reproduce the focused checks with: vp test run packages/shared/src/nodeSqliteClient.test.ts apps/server/src/persistence/Sqlite.test.ts apps/server/src/persistence/OrchestrationEventStore.sequence.test.ts apps/server/src/orchestration-v2/FoundationPersistence.test.ts packages/provider-opencode/src/server/usage.test.ts apps/server/src/provider/Drivers/antigravityUsageReader.test.ts apps/desktop/src/preview/BrowserImport/ChromiumCookies.test.ts apps/desktop/src/preview/BrowserImport/FirefoxCookies.test.ts packages/client-runtime/src/connection/compatibility.test.ts apps/server/src/auth/SessionStore.test.ts apps/server/src/auth/EnvironmentAuth.test.ts apps/server/src/environment/ServerEnvironment.test.ts apps/server/src/ws.test.ts
vp run --filter t3 --filter @t3tools/shared --filter @t3tools/provider-opencode typecheckThe automatic Approvability check requests human review of the execution/lifecycle change and diagnostic annotation. The worker contains no Effect runtime or clock service; its local Date.now supplies prepared-statement cache expiration. Existing diagnostic checks were not weakened globally. Maintainer triage of #15707 establishes the disk-wait failure and lists moving the writer off the event loop as a possible fix area. This PR preserves SQLite durability rather than changing the synchronous pragma. |
|
Note 🤖 Claude Opus 5.5 responding on behalf of Theo We're taking this over in #19211. Your commit is kept as-is, with your authorship and a co-author trailer, and the description credits you. Thank you, @not-compromised. This was solid work. One fix was added on top. If the worker dies on its own (for example out of memory), the process used to stay up and answer heartbeats while every query failed. Now pending queries fail with a typed error and then the process crashes, so desktop restarts the backend. We could not find a mobile-only server path. That silent worker death is our best guess for the mobile failure you saw. If you still have details from that report, such as logs or what the phone showed, please post them on #19211. |
|
Superseded by #19211, which preserves the original patch and authorship and adds worker-failure recovery. The recorded mobile incident details are posted there. Closing this duplicate draft; the original local candidate remains out of service. |
Problem
Slow native SQLite operations block connection heartbeats alongside commands, forcing clients to reconnect.
Change
Run native SQLite calls in a worker while preserving transaction ownership, cancellation ordering and durability. Sequential Antigravity scans reuse one leased worker.
Scope and approval
Addresses the keepalive failure established in maintainer triage of #15707. No wire-contract or schema migration.
Verification
A write lock that only a main-thread heartbeat can release fails with the synchronous adapter and passes here, including cancellation. Focused persistence, authentication and consumer tests, scoped typechecks and lint passed.
An isolated Linux executable comparison with four real stopped threads passed 24 authenticated reconnects each on stock, candidate and rollback to stock. It covered shell/thread loading, live subscriptions, heartbeats and cancellation, preserving credentials across restarts.
A local rollout was reverted after a reported mobile failure. The comparison did not reproduce it; this PR remains draft while its cause is unresolved. Native macOS/Windows checks remain unverified.
Closes #15707
Written by GPT-6.1 Sol in Codex