Skip to content
FunCoding

Migrate synchronous SQLite APIs

Replace deprecated synchronous SQLite SDK calls before the December 31, 2026 compatibility cutoff

Migrate synchronous SQLite SDK calls to the awaited or prepared replacements below. The final compatibility day is December 31, 2026 (2026-12-31). Removal ships in the first January 2027 stable release, without a Plugin SDK major version. This deprecation release retains the listed contracts; it does not remove them. See the removal timeline for the release and shipped-surface gates.

Start with the families your plugin uses. For direct Async replacements, keep the arguments and await the result. Factories that return adapters or prepared readers may remain synchronous: await the operations on the returned object as described below. A Promise-returning wrapper around a native database callback still runs that callback on the caller's thread; migrate the callback contract, not just its call site.

These changes preserve stored data, schemas, retention, and update behavior. Await a write before reading its result or publishing an external effect. Never retry a failed awaited operation through a deprecated synchronous path. Bundled plugins target the current host and do not need older-host fallbacks. External plugins should declare the host version that supplies the capabilities they use.

Session reads and inbound envelopes

Use session-store-runtime for session readers and channel-inbound for prepared envelope construction. The same method mapping applies to api.runtime.agent.session and channel runtime aliases.

// Before
const entry = api.runtime.agent.session.getSessionEntry(target);
// After
const entry = await api.runtime.agent.session.getSessionEntryAsync(target);
BeforeAfter
getSessionEntryawait getSessionEntryAsync(...)
getConversationSessionawait getConversationSessionAsync(...)
listSessionEntriesawait listSessionEntriesAsync(...)
loadCombinedSessionStoreForGatewayawait loadCombinedSessionStoreForGatewayAsync(...) from session-transcript-hit
readAmbientTranscriptWatermarkawait readAmbientTranscriptWatermarkAsync(...)
readSessionUpdatedAtawait readSessionUpdatedAtAsync(...)
resolveTranscriptSessionKeyBySessionIdawait resolveTranscriptSessionKeyBySessionIdAsync(...)
loadTranscriptEventsSyncawait loadTranscriptEvents(...)
readTranscriptStatsSyncawait readTranscriptStatsAsync(...)
readTranscriptStatsBatchReadOnlySyncawait readTranscriptStatsBatchReadOnlyAsync(...)
statSessionEntrySyncawait statSessionEntry(...)
readAcpSessionEntryawait readAcpSessionEntryAsync(...)
AcpSessionManager.resolveSessionawait manager.resolveSessionAsync(...)
createChannelInboundEnvelopeBuilderawait createChannelInboundEnvelopeBuilderAsync(...)
resolveChannelInboundRouteEnveloperesolveAgentRoute(...), then await createChannelInboundEnvelopeBuilderAsync({ cfg, route })
resolveInboundSessionEnvelopeContextawait resolveInboundSessionEnvelopeContextAsync(...)
createInboundEnvelopeBuilderawait createChannelInboundEnvelopeBuilderAsync({ cfg, route })
resolveInboundRouteEnvelopeBuilderresolveAgentRoute(...), then await createChannelInboundEnvelopeBuilderAsync({ cfg, route })
resolveInboundRouteEnvelopeBuilderWithRuntimeRuntime routing.resolveAgentRoute(...), then await createChannelInboundEnvelopeBuilderAsync({ cfg, route })
dispatchInboundDirectDmWithRuntimeawait dispatchInboundDirectDm(...)

The historical transcript-key resolver includes retained session_windows after a session resets. getSessionEntryByIdAsync(...).sessionKey is not a replacement for historical lookup. See the exact historical lookup contract.

Prepare the envelope builder once per inbound message. It returns a synchronous formatter yielding the body string; the older generic builder returned { storePath, body }. If the caller still needs a store path, resolve it from the same configured store and route through runtime.channel.session.resolveStorePath. For custom formatting, await readSessionUpdatedAtAsync once and pass that timestamp into the formatter instead of retaining a database-reading callback.

listSessionEntriesAsync returns a read-only metadata projection, not detached snapshots such as saved skill prompts. It does not take the synchronous listing's readOnly, snapshot-hydration, or source-capture options. Use getSessionEntryAsync for a full public entry. Keep authorization for transcript or metadata disclosure at the existing effect boundary. Memory statistics and archive readers remain on their existing documented or local subpaths; this migration does not make private host facades public.

For entry writes, replace opaque callbacks with owner preparation or an already-prepared patch:

BeforeAfter
patchSessionEntry({ update, ...target })await prepareSessionEntryPatch({ prepare, ...target }), or await applySessionEntryPatch({ patch, ...target })
updateSessionStoreEntryprepareSessionEntryPatch / applySessionEntryPatch
updateLastRoute with assertCommitAllowedawait updateLastRouteWithAuthority(...)
upsertSessionUpstreamLinkawait upsertSessionUpstreamLinkAsync(...)
deleteSessionUpstreamLinkawait deleteSessionUpstreamLinkAsync(...)
Initialization owner's prepare().link(...)Await prepare(), then await prepared.linkAsync(...)
// Before: a callback depends on the stored entry.
await patchSessionEntry({ ...target, update: choosePatch });
// After: preparation happens outside the transaction; the owner detects conflicts.
await prepareSessionEntryPatch({ ...target, prepare: choosePatch });

See entry patch conflicts and authority when translating transaction-local callback behavior.

Auth profiles and provider readiness

Use the public provider-auth surface for profile stores and writes. Bundled plugins also use the private provider-auth-runtime surface for profile metadata and agent-sessions for AuthStorage and ModelRegistry. Existing agent-runtime and runtime modelAuth aliases follow the same mapping; prefer the focused public subpath when one exists.

// Before
const auth = AuthStorage.forAgent(agentDir, config);
auth.set(providerId, credential);
// After
const auth = await AuthStorage.forAgentAsync(agentDir, config);
await auth.setAsync(providerId, credential);
BeforeAfter
ensureAuthProfileStoreawait ensureAuthProfileStoreAsync(...)
ensureAuthProfileStoreForLocalUpdateawait ensureAuthProfileStoreForLocalUpdateAsync(...)
upsertAuthProfileawait upsertAuthProfileAsync(...)
upsertApiKeyProfileawait upsertApiKeyProfileAsync(...)
isProviderApiKeyConfiguredawait isProviderApiKeyConfiguredAsync(...)
isProviderAuthProfileConfiguredawait isProviderAuthProfileConfiguredAsync(...)
listUsableProviderAuthProfileIdsawait listUsableProviderAuthProfileIdsAsync(...)
resolveProviderAuthProfileMetadataawait resolveProviderAuthProfileMetadataAsync(...)
loadAuthProfileStoreWithoutExternalProfilesawait loadAuthProfileStoreWithoutExternalProfilesAsync(...)
loadAuthProfileStoreForRuntimeawait loadAuthProfileStoreForRuntimeAsync(...)
loadAuthProfileStoreForSecretsRuntimeawait loadAuthProfileStoreForRuntimeAsync(agentDir, { ...options, readOnly: true, allowKeychainPrompt: false })
saveAuthProfileStoreawait updateAuthProfileStoreWithLock(...) from provider-auth; mutate the current store under its owner
findPersistedAuthProfileCredentialawait findPersistedAuthProfileCredentialAsync(...)
resolvePersistedAuthProfileOwnerAgentDirawait resolvePersistedAuthProfileOwnerAgentDirAsync(...)
resolveAuthStorePathForDisplayRetire physical database-path displays; display provider/profile identifiers instead. No public async path replacement.
replaceRuntimeAuthProfileStoreSnapshotsawait replaceRuntimeAuthProfileStoreSnapshotsAsync(...)
AuthStorage.create(authPath)await AuthStorage.forAgentAsync(agentDir) using the path's owning agent directory
AuthStorage.forAgentawait AuthStorage.forAgentAsync(...)
AuthStorage.reloadawait auth.reloadAsync(...)
AuthStorage.setawait auth.setAsync(...)
AuthStorage.removeawait auth.removeAsync(...)
AuthStorage.logoutawait auth.logoutAsync(...)
ModelRegistry.createawait ModelRegistry.createAsync(...), or SQL-free ModelRegistry.fromCapturedSources(...) when sources are already prepared
ModelRegistry.refreshawait registry.refreshAsync(...)
ModelRegistry.unregisterProviderawait registry.unregisterProviderAsync(...)
resolveModelAuthModeawait resolveModelAuthModeAsync(...)
formatModelsAvailableHeaderawait formatModelsAvailableHeaderAsync(...)
resolveCapabilityModelCandidatesawait resolveCapabilityModelCandidatesAsync(...)
resolveConfiguredCapabilityProviderawait resolveConfiguredCapabilityProviderAsync(...)
resolveConfiguredRealtimeVoiceProviderawait resolveConfiguredRealtimeVoiceProviderAsync(...)
getTtsProviderawait getTtsProviderAsync(...)
isTtsProviderConfiguredawait isTtsProviderConfiguredAsync(...)
resolveExplicitTtsOverridesawait resolveExplicitTtsOverridesAsync(...)
Runtime webSearch.listProvidersawait webSearch.listProvidersAsync(...)
api.runtime.agent.resolveCliBackendDispatchEligibilityawait api.runtime.agent.resolveCliBackendDispatchEligibilityAsync(...)

Harnesses should consume the host-prepared params.authStorage. AuthStorage get, list, and has remain synchronous reads of its prepared view; login and getApiKey already return promises. Do not replace a newer whole auth store with a previously loaded snapshot: use updateAuthProfileStoreWithLock for owner-backed mutation.

Physical database-path displays are retired after 2026-12-31. External plugins should display provider/profile identifiers; there is no public async API for the selected database path. The private bundled-plugin helper AuthStorage.resolvePathForDisplayAsync preserves agent-local-versus-shared database selection, including locators for profiles that do not exist yet. Metadata helpers return profile/account identities and are not path substitutes.

Provider readiness hooks add an awaited callback:

BeforeAfter
ImageGenerationProvider.isConfiguredisConfiguredAsync
MusicGenerationProvider.isConfiguredisConfiguredAsync
VideoGenerationProvider.isConfiguredisConfiguredAsync
SpeechProviderPlugin.isConfiguredisConfiguredAsync
RealtimeTranscriptionProviderPlugin.isConfiguredisConfiguredAsync
RealtimeVoiceProviderPlugin.isConfiguredisConfiguredAsync
RealtimeVoiceProviderPlugin.resolveConfigresolveConfigAsync
InternalRealtimeVoiceProviderApi.isBrowserSessionConfiguredisBrowserSessionConfiguredAsync
InternalRealtimeVoiceProviderApi.isGatewayRelayConfiguredisGatewayRelayConfiguredAsync
InternalRealtimeVoiceProviderApi.resolveBrowserSessionCapabilitiesresolveBrowserSessionCapabilitiesAsync
// Before
isConfigured: (context) => isProviderApiKeyConfigured(context),
// After
// Preserve synchronous SDK callers through 2026-12-31.
isConfigured: (context) => isProviderApiKeyConfigured(context),
isConfiguredAsync: async (context) => await isProviderApiKeyConfiguredAsync(context),

Use the hook's existing context and provider-specific inputs. The host awaits readiness and prefers the async hook; a failed async hook is not retried through the legacy one. A readiness result does not authorize later credential use. Keep the synchronous hooks required by the provider type through 2026-12-31. Bundled providers also retain synchronous hooks to support callers of the public synchronous SDK APIs until that date; ordinary runtime callers use async hooks. See auth and availability details.

Approval routing and command authorization

Direct resolvers return promises. Factories whose names end in Async below still return adapters synchronously; their routing and eligibility callbacks return promises and the host awaits them.

// Before
const auth = resolveCommandAuthorization(input);
// After
const auth = await resolveCommandAuthorizationAsync(input);

// Factory migration: construction itself stays synchronous.
const adapter = createChannelApprovalNativeRuntimeAdapterAsync(options);
BeforeAfter
readChannelAllowFromStoreSyncawait readChannelAllowFromStore(...)
loadExecApprovalsawait loadExecApprovalsReadOnlyAsync(...)
readExecApprovalsSnapshotawait readExecApprovalsSnapshotAsync(...)
resolveCommandAuthorizationawait resolveCommandAuthorizationAsync(...)
resolveStoredModelOverrideawait resolveStoredModelOverrideAsync(...)
resolveCommandArgMenuawait resolveCommandArgMenuAsync(...)
createApproverRestrictedNativeApprovalCapabilitycreateApproverRestrictedNativeApprovalCapabilityAsync
createChannelApprovalNativeRuntimeAdaptercreateChannelApprovalNativeRuntimeAdapterAsync
createLazyChannelApprovalNativeRuntimeAdaptercreateLazyChannelApprovalNativeRuntimeAdapterAsync
createNativeApprovalChannelRouteGatescreateNativeApprovalChannelRouteGatesAsync
createChannelNativeOriginTargetResolvercreateChannelNativeOriginTargetResolverAsync
createChannelExecApprovalProfilecreateChannelExecApprovalProfileAsync
createApproverRestrictedNativeApprovalCapabilityFromForwardingRoutescreateApproverRestrictedNativeApprovalCapabilityFromForwardingRoutesAsync
createChannelApproverDmTargetResolvercreateChannelApproverDmTargetResolverAsync
createNativeApprovalForwardingFallbackSuppressorcreateNativeApprovalForwardingFallbackSuppressorAsync
resolveExecApprovalSessionTargetawait resolveExecApprovalSessionTargetAsync(...)
resolveApprovalRequestSessionTargetawait resolveApprovalRequestSessionTargetAsync(...)
resolveApprovalRequestOriginTargetawait resolveApprovalRequestOriginTargetAsync(...)
resolveApprovalRequestAccountIdawait resolveApprovalRequestAccountIdAsync(...)
resolveApprovalRequestChannelAccountIdawait resolveApprovalRequestChannelAccountIdAsync(...)
doesApprovalRequestMatchChannelAccountawait doesApprovalRequestMatchChannelAccountAsync(...)
doesApprovalRequestSelectChannelAccountawait doesApprovalRequestSelectChannelAccountAsync(...)

If one operation needs several routing decisions, prepare resolveApprovalRequestSessionDeliveryAsync once and pass its sessionDelivery to the helpers. Keep current approval, command execution, and delivery authority at their effect boundaries. See approval routing and import paths.

Conversation and native session bindings

Create current-host managers with createAccountScopedConversationBindingManagerV2 and register custom adapters with registerSessionBindingAdapterV2. The V2 manager factory remains synchronous and returns an async-only receiver.

// Before
const manager = createAccountScopedConversationBindingManager(options);
const binding = manager.getByConversationId(conversationId);
// After
const manager = createAccountScopedConversationBindingManagerV2(options);
const binding = await manager.getByConversationIdAsync(conversationId);
BeforeAfter
createAccountScopedConversationBindingManagercreateAccountScopedConversationBindingManagerV2
iMessage createIMessageConversationBindingManagercreateIMessageConversationBindingManagerV2; await the same receiver methods below
Manager getByConversationId, listBySessionKeyAwait getByConversationIdAsync, listBySessionKeyAsync
Manager bindConversation, touchConversationAwait bindConversationAsync, touchConversationAsync
Manager unbindConversation, unbindBySessionKeyAwait unbindConversationAsync, unbindBySessionKeyAsync
registerSessionBindingAdapter / SessionBindingAdapterregisterSessionBindingAdapterV2 / SessionBindingAdapterV2
Service or adapter touchtouchAsync
Service or adapter resolveByConversationresolveByConversationAsync
Service or adapter listBySessionlistBySessionAsync
Adapter inspectByConversationinspectByConversationAsync
inspectSessionBindingByConversationawait inspectSessionBindingByConversationAsync(...)
inspectConversationBindingawait inspectConversationBindingAsync(...)
resolveRuntimeConversationBindingRouteawait resolveRuntimeConversationBindingRouteAsync(...)
ChannelConversationBindingSupport.setIdleTimeoutBySessionKey and runtime threadBindings.setIdleTimeoutBySessionKeysetIdleTimeoutBySessionKeyAsync
ChannelConversationBindingSupport.setMaxAgeBySessionKey and runtime threadBindings.setMaxAgeBySessionKeysetMaxAgeBySessionKeyAsync
setThreadBindingIdleTimeoutBySessionKeyawait setThreadBindingIdleTimeoutBySessionKeyAsync(...)
setThreadBindingMaxAgeBySessionKeyawait setThreadBindingMaxAgeBySessionKeyAsync(...)
setTelegramThreadBindingIdleTimeoutBySessionKeyawait setTelegramThreadBindingIdleTimeoutBySessionKeyAsync(...)
setTelegramThreadBindingMaxAgeBySessionKeyawait setTelegramThreadBindingMaxAgeBySessionKeyAsync(...)
setMatrixThreadBindingIdleTimeoutBySessionKeyawait setMatrixThreadBindingIdleTimeoutBySessionKeyAsync(...)
setMatrixThreadBindingMaxAgeBySessionKeyawait setMatrixThreadBindingMaxAgeBySessionKeyAsync(...)

Channel-specific setter names remain on their existing local channel surfaces. They do not create new cross-plugin imports. Custom adapters own their storage and must implement the V2 asynchronous and current-owner contracts.

Native harnesses must migrate ownership, not just rename a getter:

BeforeAfter
captureNativeSessionGenerationAuthorityAwait retainNativeSessionGenerationAuthority and release its capture
prepareNativeSessionGenerationAuthorityAwait retainNativeSessionGenerationAuthority and release its capture
createNativeSessionBindingAuthorityRetain prepared lineage, or use createNativeSessionBindingScope
combineNativeSessionBindingAuthoritycombinePreparedNativeSessionBindingAuthority
resolveNativeSessionBindingAwait resolvePreparedNativeSessionBinding and release its capture
reclaimNativeSessionGenerationPrepare authority, then await reclaimNativeSessionGenerationWithAuthority(...)
NativeSessionGenerationOperationsNativeSessionGenerationOperationsV2
createNativeSessionBindingLifecyclecreateNativeSessionBindingLifecycleV2
NativeSessionBindingStateStoreNativeSessionBindingStateStoreV2
resolveNativeSessionBindingWithAuthorityAwait resolvePreparedNativeSessionBinding and release its capture
AgentHarness.resolveSessionRuntimeOwnershipresolveSessionRuntimeOwnershipAsync

For new harness code, follow native session lineage: await resolvePreparedNativeSessionBinding or retainNativeSessionGenerationAuthority, consume the owned capture, and call release() in finally. Keep the owner alive through effects and terminal cleanup. A cold or invalidated cached binding cannot substitute for current owner authority.

Keyed state

Use api.runtime.state.openKeyedStoreV2, or the lazy createPluginStateKeyedStoreV2 factory from plugin-state-store-runtime when providing an explicit plugin owner. These factories return immediately; their methods perform the worker operations.

// Before
const store = api.runtime.state.openSyncKeyedStore(options);
store.register("item", value);
const stored = store.lookup("item");
// After
const store = api.runtime.state.openKeyedStoreV2(options);
await store.register("item", value);
const stored = await store.lookup("item");
BeforeAfter
openSyncKeyedStore, createPluginStateSyncKeyedStoreopenKeyedStoreV2, createPluginStateKeyedStoreV2
Sync register, registerIfAbsentAwait V2 register, registerIfAbsent
Sync lookup, lookupManyAwait V2 lookup, lookupMany
Sync consume, deleteAwait V2 consume, delete
Sync entries, count, clearAwait V2 entries, count, clear
Sync update, deleteIfV2 observe plus compareAndApply, or an owner-defined worker createOperation
V1 openKeyedStore / createPluginStateKeyedStore receiver update, deleteIfOpen V2 and replace the callback with observe / compareAndApply, or createOperation

V1 callback methods already return promises, but their opaque JavaScript callbacks still execute in a native host transaction. Do not replace an atomic update with an unconditional lookup and write:

// Before
await legacyStore.update("counter", (value) => (value ?? 0) + 1);
// After
const observed = await store.observe("counter");
const result = await store.compareAndApply("counter", observed.comparison, {
  operation: "update",
  action: "set",
  value: (observed.value ?? 0) + 1,
});
if (result.status === "conflict") {
  // Recompute from a new observation or report the conflict to the caller.
}

For deleteIf, evaluate the predicate from an observation, then conditionally apply { operation: "delete", action: "delete" } with that observation's comparison. A conflict means no requested mutation committed. Do not replay an unknown write or a callback with external side effects. See keyed-state migration for multi-key conditions and worker operations. Ordinary V1 data-only methods are not the callback removal target.

SessionManager, extension persistence, and replay

Use agent-sessions for manager APIs. Every persistence method below must settle before reading the resulting view or publishing a dependent effect.

// Before
const manager = SessionManager.open(target);
const id = manager.appendCustomEntry("checkpoint", { stage: "ready" });
// After
const manager = await SessionManager.openAsync(target);
const id = await manager.appendCustomEntryAsync("checkpoint", { stage: "ready" });
BeforeAfter
SessionManager.openawait SessionManager.openAsync(...)
SessionManager.openBoundedawait SessionManager.openBoundedAsync(...)
SessionManager.openDetachedBoundedawait SessionManager.openDetachedBoundedAsync(...)
SessionManager.openModelContextawait SessionManager.openModelContextAsync(...)
SessionManager.readSessionContextawait SessionManager.readSessionContextAsync(...)
setSessionTargetawait manager.setSessionTargetAsync(...)
reloadPersistedTranscriptawait manager.reloadPersistedTranscriptAsync(...)
SessionManager.appendMessageToTranscriptawait SessionManager.appendMessageToTranscriptAsync(...)
appendMessageawait manager.appendMessageAsync(...)
appendMessageWithTranscriptAnchorawait manager.appendMessageWithTranscriptAnchorAsync(...)
appendCompactionawait manager.appendCompactionAsync(...)
appendResetBoundaryawait manager.appendResetBoundaryAsync(...)
appendCustomEntryawait manager.appendCustomEntryAsync(...)
appendSessionInfoawait manager.appendSessionInfoAsync(...)
appendCustomMessageEntryawait manager.appendCustomMessageEntryAsync(...)
appendLeafControlawait manager.appendLeafControlAsync(...)
appendLabelChangeawait manager.appendLabelChangeAsync(...)
branchawait manager.branchAsync(...)
branchWithSummaryawait manager.branchWithSummaryAsync(...)
persistawait manager.persistAsync(...)
removeTrailingEntriesawait manager.removeTrailingEntriesAsync(...)
prepareTranscriptRewriteawait manager.prepareTranscriptRewriteAsync(...); await its commit(...) too
resolveCurrentTurnEntryId({ includeOmittedCustomMessages: true })Await full SessionManager.openAsync(target) hydration, then call the loaded-view resolveCurrentTurnEntryId()
ExtensionAPI.appendEntryawait api.appendEntryAsync(...)
ExtensionAPI.setSessionNameawait api.setSessionNameAsync(...)
ExtensionAPI.setLabelawait api.setLabelAsync(...)
AgentSession.setSessionNameawait session.setSessionNameAsync(...)
ProviderPlugin.sanitizeReplayHistorysanitizeReplayHistoryAsync
ProviderReplaySessionState.appendCustomEntryV2 appendCustomEntryAsync
ProviderReplaySessionState, ProviderSanitizeReplayHistoryContextProviderReplaySessionStateV2, ProviderSanitizeReplayHistoryContextV2
sanitizeGoogleGeminiReplayHistoryawait sanitizeGoogleGeminiReplayHistoryAsync(...), or the provider-local awaited replay hook
SessionPendingInputReceipt.completeawait receipt.completeAsync(...)
UserTurnTranscriptRecorder.completeProcessingawait recorder.completeProcessingAsync(...)

Use ExtensionActionsV2, ExtensionRuntimeV2, and bindCoreAsync to supply awaited extension actions. The original action/runtime types and bindCore are not removed merely because they can host legacy actions. SQL-free prepared view getters, inMemory(), and fromEntries() remain synchronous. See session persistence and provider replay for completion semantics and types.

Transcript write callbacks, readers, and catalogs

BeforeAfter
withSessionTranscriptWriteLockawait withSessionTranscriptWrite(...)
withCodexSessionTranscriptMirrorWriteLockawait withCodexSessionTranscriptMirrorWrite(...)
Lock append or appendSessionTranscriptMessageByIdentity / appendSessionTranscriptMessageByIdentityStrict option prepareMessageAfterIdempotencyCheckpreparation.prepareMessage, which may return a promise
Those appends' beforeFreshMessageCommit optionpreparation.source using the host-owned source assertion
loadArchivedSessionsawait loadArchivedSessionsAsync(...)
resolveMemorySessionTargetsawait resolveMemorySessionTargetsAsync(...)
loadMemorySessionMetadataawait loadMemorySessionMetadataAsync(...), or loadMemorySessionMetadataBatchAsync for a batch
MemorySearchManager.statusAwait manager.statusAsync(...); use readMemorySearchManagerStatus for legacy manager types
readSessionTranscriptCatalogTitleawait readSessionTranscriptCatalogTitleAsync(...)
createSessionCatalogSourceActorProjectorawait prepareSessionCatalogSourceActorProjector(...)
createSessionCatalogGitHubLinkerawait prepareSessionCatalogGitHubLinker(...)
validateCodexSessionTranscriptReadAdmissionUse createCodexSessionContextReader with the captured admission
validateCodexSessionTranscriptContextVersionUse createCodexSessionContextReader with a prepared current source
readCodexSessionContextAwait the reader returned by createCodexSessionContextReader
// Before
await withSessionTranscriptWriteLock(target, async (writer) => {
  await writer.appendMessage({ message, prepareMessageAfterIdempotencyCheck: prepareSync });
});
// After
await withSessionTranscriptWrite(target, async (writer) => {
  await writer.appendMessage({
    message,
    preparation: { prepareMessage: prepareAsync, source: sourceAuthority },
  });
});

Preparation runs after duplicate detection and outside the database transaction. Return undefined to suppress a fresh append; a duplicate keeps its stored bytes and skips preparation. Keep externally visible side effects out of preparation. The new write scope does not promise the old callback's native transaction view or roll back already committed appends. See locked transcript preparation.

For Codex context reads, the supplied owner retains the captured admission, source validation, and cleanup for the whole read. Do not add separate validator calls before invoking its reader:

// Before
const context = readCodexSessionContext(target, projectContext, admission);
// After: use the owner prepared for this transcript read.
const readContext = createCodexSessionContextReader(owner);
const context = await readContext(target, projectContext);

Memory manager implementations should provide statusAsync for storage-backed diagnostics. It remains optional on the legacy manager interface. Consumers that accept third-party managers can await readMemorySearchManagerStatus(manager); the helper selects statusAsync when available and otherwise uses the retained status contract. An async failure is not retried synchronously. The built-in synchronous status() warns once per calling plugin and method, including the replacement and January 2027 removal window. The retained fallback for third-party managers remains available through 2026-12-31; implementing statusAsync avoids synchronous storage reads and prepares the manager for removal of that fallback in the first January 2027 stable release.

Reply, observer, and harness preparation

BeforeAfter
sessionObserver.handleEventawait sessionObserver.handleEventAsync(...)
sessionObserver.getCompanionSnapshotawait sessionObserver.getCompanionSnapshotAsync(...)
sessionObserver.disposeawait sessionObserver.disposeAsync()
Reply-dispatch shouldSendToolSummaries, shouldSendFullToolDetailsAwait shouldSendToolSummariesAsync(), shouldSendFullToolDetailsAsync()
onVerboseProgressVisibilityonVerboseProgressVisibilityAsync; await its visibility getter
tryDispatchAcpReplyHook input booleans shouldSendToolSummaries, shouldSendFullToolDetailsPass shouldSendToolSummariesAsync and shouldSendFullToolDetailsAsync predicates
GetReplyOptions.onAgentRunStartonPreparedAgentRunStart with required transcriptStart facts (or null)
resolveEntryResetFreshnessawait resolveEntryResetFreshnessAsync(...)
runAgentEndSideEffectsawait runAgentEndSideEffectsAsync(...)
Attempt replyOperation.bindToolAuthoritySnapshotawait replyOperation.bindToolAuthoritySnapshotAsync(...)
Attempt replyOperation.projectToolAuthorityFingerprintawait replyOperation.projectToolAuthorityFingerprintAsync(...)
Attempt replyOperation.bindToolAuthorityRouteawait replyOperation.bindToolAuthorityRouteAsync(...)
ReplyToolAuthoritySnapshot.fingerprint, projectAwait fingerprintAsync, projectAsync
ReplyBackendMessageInjectionV2.queueMessagequeueMessageAsync with the supplied preparation object
ReplyBackendMessageInjectionV2.claimPendingUserInputAnswerclaimPendingUserInputAnswerAsync with the supplied preparation object
ReplyBackendMessageInjectionV2.cancelPendingUserInputcancelPendingUserInputAsync with the supplied preparation object
Question-dispatcher authority.assertCurrent as the database-reading preparation stepAwait authority.assertCurrentAsync, retaining the SQL-free assertCurrent at the effect
buildWatchedSessionsHarnessContextawait prepareWatchedSessionsHarnessContext(...)
listSkillCommandsForAgents, listSkillCommandsForWorkspaceAwait listSkillCommandsForAgentsAsync, listSkillCommandsForWorkspaceAsync
createToolSurface, createOpenClawCodingToolsAwait createToolSurfaceAsync, createOpenClawCodingToolsAsync
createAgentHarnessToolSurfaceRuntimeawait createAgentHarnessToolSurfaceRuntimeAsync(...); returned compactTools and cleanup remain synchronous
getOpenRouterModelCapabilitiesawait loadOpenRouterModelCapabilities(modelId), then SQL-free getLoadedOpenRouterModelCapabilities(modelId)
// Before
sessionObserver.handleEvent(event);
// After
await sessionObserver.handleEventAsync(event);

onPreparedAgentRunStart must still return completion ownership synchronously; prepare transcript facts before invoking it. Awaited policy preparation is not permission to execute or disclose later. Preserve the host's current authority immediately before the effect. See reply authority and observer visibility.

Account services, runtime config, workspace, and TTS

BeforeAfter
modelAccountConnectService.listLinks, link, unlink, list, select, status, cancelAwait listLinksAsync, linkAsync, unlinkAsync, listAsync, selectAsync, statusAsync, cancelAsync
GitHub OAuth cancelAuthorization, retireProfileAwait cancelAuthorizationAsync, retireProfileAsync
Personal GitHub cancelAuthorization, disconnectAwait cancelAuthorizationAsync, disconnectAsync
getRuntimeConfig on runtime-config-snapshot / memory-core-host-runtime-corePrepared readRuntimeConfig(); for cold preparation, await captureRuntimeConfigAsyncReader()()
resolveCronStorePathawait resolveCronStorePathAsync(...)
OpenClawPluginNodeHostCommandContext.acquireManagedWorkspaceawait context.acquireManagedWorkspaceAsync(...); release the lease in finally
ensureAgentWorkspace.beforePersistentApplyAwait owner preparation before the call and use the SQL-free guard.assertHost at the effect
Unprepared resolveTtsPrefsPathawait resolveTtsPrefsPathAsync(...), or pass preparedTtsPreferences
Unprepared buildTtsSystemPromptHintawait api.runtime.tts.buildSystemPromptHintAsync(...)
// Before
const hint = buildTtsSystemPromptHint(config, agentId);
// After
const prepareHint = api.runtime.tts.buildSystemPromptHintAsync;
if (!prepareHint) {
  throw new Error("Update OpenClaw to use async TTS prompt preparation.");
}
const hint = await prepareHint(config, agentId);

Bundled plugins can call private prepareTtsPreferences once per turn and pass that result to the supported prepared overloads. Those SQL-free synchronous overloads are not deprecated. External plugins use the public runtime method above. See the public TTS preparation recipe.

Debug proxy capture and raw SQLite

BeforeAfter
DebugProxyCaptureStore, getDebugProxyCaptureStore, acquireDebugProxyCaptureStoreawait acquireDebugProxyCaptureStoreAsync(...); await methods on lease.store
closeDebugProxyCaptureStoreawait lease.release() in finally
DebugProxyCaptureReader, createDebugProxyCaptureReaderAsyncDebugProxyCaptureReader, createDebugProxyCaptureReaderAsync; factory stays synchronous, reads are awaited
initializeDebugProxyCaptureawait initializeDebugProxyCaptureAsync(...)
captureHttpExchangeawait captureHttpExchangeAsync(...)
captureWsEvent, capture context captureWsEventawait captureWsEventAsync(...)
finalizeDebugProxyCaptureawait finalizeDebugProxyCaptureAsync(...)
// Before
const store = acquireDebugProxyCaptureStore(options);
// After
const lease = await acquireDebugProxyCaptureStoreAsync(options);
try {
  // Await capture operations on lease.store.
} finally {
  await lease.release();
}

The following sqlite-runtime operations have no mechanical async SQL wrapper. Use openOpenClawAgentSqliteWorkerStoreV2 and serializable owner commands for ordinary runtime storage. Move the native implementation into the paired worker backend using sqlite-worker-runtime:

BeforeAfter
Writable openNodeSqliteDatabase, openOpenClawAgentDatabase, borrowOpenClawAgentDatabaseWorker store acquisition, preparation, and data-only commands
openOpenClawAgentSqliteWorkerStore with a native database publication sourceAwait openOpenClawAgentSqliteWorkerStoreV2 with retained V2 authority
withOpenClawAgentDatabaseAsync, withOpenClawAgentDatabaseWrite, runOpenClawAgentWriteAdmissionAwait V2 worker-store commands; do not pass native host callbacks
runSqliteImmediateTransaction, runSqliteImmediateTransactionSyncTransaction inside the worker backend
executeSqliteQuerySync, executeSqliteQueryTakeFirstSync, iterateSqliteQuerySync, prepareSqliteQuerySync, getNodeSqliteKyselyWorker-local primitives; expose a data-only operation to the host
// Before: awaiting admission does not move this callback off the host.
await withOpenClawAgentDatabaseWrite(options, ({ db }) => updateRows(db, input));
// After: updateRows and its transaction belong to the paired worker backend.
await store.execute({ type: "updateRows", input }, owner.assertCurrent);

Preserve explicit read-only inspection, offline Doctor/CLI maintenance custody, and supported worker-local primitives. Do not treat them as permission for writable native handles in Gateway handlers. See worker store construction, cleanup, and missing-store semantics.

Verify the migration

Exercise one read after an awaited in-process write for each migrated owner. For conditional state updates, prove that a competing write produces a conflict instead of being lost. Check callback completion and release resources in finally. Confirm that the migrated flow emits no synchronous SQLite deprecation warning and that errors propagate without a legacy retry.

This guide covers the synchronous SQLite removal window. Unrelated aliases, active compatibility records, prepared SQL-free overloads, and private/internal implementation kernels retain their own contracts. Removing the public adapters in January does not authorize removing live security checks or changing stored data.

Worker statement diagnostics

For a plugin-owned native SQLite connection in a worker, call observeSqliteConnection(db) from openclaw/plugin-sdk/sqlite-worker-runtime once when opening it. It returns the same connection and attaches the shared statement observer, including native prepared statements and Kysely queries. Labeled transaction diagnostics can then separate statement execution from other callback work. This does not change database admission or ownership.