omi
omi copied to clipboard
Desktop agent runtime: chat and task execution fail with 'cannot start a transaction within a transaction'
Summary
On the desktop macOS app (v0.11.543), the local agent runtime fails on its first operation, which breaks both chat and task execution (they share the same agent runtime). The two user-visible symptoms are one underlying bug.
Symptoms
- Chat ("Ask Omi"): sending any message returns
Something went wrong. Please try again. - Task execution ("Execute this task"): fails with
cannot start a transaction within a transaction.
App log:
AgentRuntimeProcess: agent error (raw): cannot start a transaction within a transaction
Failed to get AI response: Something went wrong. Please try again.
It fires on the very first agent operation (e.g. Apple Notes synthesis on startup), so the agent is effectively unusable.
Root cause
In desktop/macos/agent/src/runtime:
kernel.tswithTransactionbumps atransactionDepthcounter but still callsstore.withTransaction(work)on every nested call — the counter only defers subscriber-event notifications, it does not prevent nested DB transactions.sqlite-store.tsrunTransactionis therefore the only nesting guard, and it relies ondb.isTransactionbefore issuingBEGIN IMMEDIATE. In the bundled runtime that flag does not reliably report an open transaction, so a nested call issues a secondBEGIN IMMEDIATE→ SQLite rejects it.
The kernel nests withTransaction heavily, so nearly every agent op hits it.
Fix
Track transaction depth inside SqliteAgentStore so nested calls reuse the outer transaction instead of trusting db.isTransaction.
Fix PR: BasedHardware/omi#8443 (includes a regression test and local end-to-end verification).