Skip to content

Commit 992126e

Browse files
authored
refactor(sessions): drop the Sqlite infix from session-accessor exports (#121536)
* refactor(sessions): drop the Sqlite infix from session-accessor exports The storage-neutral seam completed its file->SQLite swap on 2026-07-27; the Sqlite-infixed export names and their X-as-Y rename blocks were the fossil of that migration, giving every accessor operation two greppable names. Rename ~148 exports to their canonical names at the definition sites, delete the message-cut facade (its conflict->failed mask had one consumer, which already handles conflict), collapse the remaining pure delegates, and keep honest SQLite-mechanics names (scope resolution, canonical repair, in-transaction primitives, storage-row types). The main barrel's exported surface is byte-identical. Net -203 production LOC. Part 2 of the session-accessor dual-layer collapse (part 1: #121316). * fix: repair main-breaking lint/type/test failures blocking PR CI Three breakages landed on main that push CI's changed-scope never runs: a caught-error cause missing in the release-validation script and two type errors in the package-acceptance test (direct commit 1f591bb), and a memory-host regression where fs-safe 0.5.4 (#121508) started throwing FsSafeError("not-file") for extra-path reads whose parent chain hits a regular file, breaking the missing-file empty-text contract that rejection unchanged. Item 4 repairs managed-image action E2E narrowing from bad30d5 (#77017). Item 5's chat-message mock repair was superseded upstream by 750d0dc, whose broader fetch typing and explicit download capture preserve the same contract. Item 6 restores #121258's cursor token contract after #77017 hard-coded pointer. Item 7's managed-image thumbnail-path repair was superseded upstream by 750d0dc, which preserves the same contract in main's reorganized URL structure. Item 8 records #121600's explicit command-bearing lifecycle classification. Item 9's cron assertion repair was superseded upstream by 3cd034f, whose exact diagnostic rewrite includes the same redacted alert contract. Item 10 forwards fs-safe 0.5.4 bigint lstat options through the snapshot mock. Item 11 refreshes release-matrix test ownership after 1f591bb. Item 12 awaits f3e1efe's setup-admission settlement in direct session tests. Item 13's media FileStore-key repair was superseded upstream by cf432ec, which fixes the same Windows root cause at the owner boundary. Item 14 regenerates Swift approval reviewer fields added by 9935ca3.
1 parent 8327504 commit 992126e

88 files changed

Lines changed: 1272 additions & 1438 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/.generated/plugin-sdk-api-baseline.jsonl‎

Lines changed: 70 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎scripts/lib/export-name-collision-baseline.json‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@
115115
"src/sessions/classify-session-kind.ts"
116116
]
117117
},
118+
{
119+
"name": "cleanupSessionLifecycleArtifacts",
120+
"files": [
121+
"src/config/sessions/session-accessor.sqlite-lifecycle.ts",
122+
"src/plugin-sdk/session-store-runtime.ts"
123+
],
124+
"sdk": true
125+
},
118126
{
119127
"name": "clearPluginRegistryLoadCache",
120128
"files": [
@@ -748,6 +756,14 @@
748756
"src/commands/gateway-status/helpers.ts"
749757
]
750758
},
759+
{
760+
"name": "patchSessionEntry",
761+
"files": [
762+
"src/config/sessions/session-accessor.sqlite-entry.ts",
763+
"src/plugin-sdk/session-store-runtime.ts"
764+
],
765+
"sdk": true
766+
},
751767
{
752768
"name": "pathExists",
753769
"files": [
@@ -830,6 +846,14 @@
830846
],
831847
"sdk": true
832848
},
849+
{
850+
"name": "readSessionUpdatedAt",
851+
"files": [
852+
"src/config/sessions/session-accessor.sqlite-entry.ts",
853+
"src/plugin-sdk/session-store-runtime.ts"
854+
],
855+
"sdk": true
856+
},
833857
{
834858
"name": "recordHookInstall",
835859
"files": [
@@ -1200,6 +1224,14 @@
12001224
"src/plugins/update-installed.ts"
12011225
]
12021226
},
1227+
{
1228+
"name": "upsertSessionEntry",
1229+
"files": [
1230+
"src/config/sessions/session-accessor.sqlite-entry.ts",
1231+
"src/plugin-sdk/session-store-runtime.ts"
1232+
],
1233+
"sdk": true
1234+
},
12031235
{
12041236
"name": "VERSION",
12051237
"files": [

‎scripts/lib/session-accessor-debt-baseline.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"src/agents/subagents/announce/subagent-announce.test-support.ts": 2,
77
"src/agents/tools/transcripts-tool.ts": 2,
88
"src/auto-reply/reply/commands-session-store.ts": 2,
9-
"src/config/sessions/session-accessor.entry.ts": 2
9+
"src/config/sessions/session-accessor.entry.ts": 1
1010
},
1111
"sessionAccessorWrite": {
1212
"src/agents/subagents/spawn/subagent-spawn.test-helpers.ts": 1,
@@ -22,7 +22,6 @@
2222
"src/agents/embedded-agent-runner/compaction-hooks.ts": 2,
2323
"src/agents/embedded-agent-runner/thinking-replay-repair.ts": 2,
2424
"src/agents/embedded-agent-runner/tool-result-truncation.ts": 2,
25-
"src/config/sessions/session-accessor.sqlite-events.ts": 3,
26-
"src/config/sessions/session-accessor.transcript.ts": 2
25+
"src/config/sessions/session-accessor.sqlite-events.ts": 3
2726
}
2827
}

‎scripts/sqlite-session-entry-cache-lifetime-proof.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const importSource = async (relativePath: string) =>
2727
const { upsertSessionEntry } = (await importSource(
2828
"src/config/sessions/session-accessor.js",
2929
)) as SessionAccessorModule;
30-
const { readSqliteSessionEntryCache } = (await importSource(
30+
const { readSessionEntryCache } = (await importSource(
3131
"src/config/sessions/session-accessor.sqlite-entry-cache.js",
3232
)) as EntryCacheModule;
3333
const {
@@ -87,7 +87,7 @@ try {
8787

8888
for (const scope of readOnlyScopes) {
8989
const result = withOpenClawAgentDatabaseReadOnly((database) => {
90-
const snapshot = readSqliteSessionEntryCache(database, { cache: true });
90+
const snapshot = readSessionEntryCache(database, { cache: true });
9191
assert.deepEqual(snapshot.keys, [scope.sessionKey]);
9292
readOnlyConnectionRefs.push(new WeakRef(database.db));
9393
return snapshot.keys.length;
@@ -112,7 +112,7 @@ try {
112112
updatedAt: index + 1,
113113
});
114114
const database = openOpenClawAgentDatabase(scope);
115-
const snapshot = readSqliteSessionEntryCache(database, { cache: true });
115+
const snapshot = readSessionEntryCache(database, { cache: true });
116116
assert.deepEqual(snapshot.keys, [scope.sessionKey]);
117117
lruConnectionRefs.push(new WeakRef(database.db));
118118
lruPaths.push(database.path);
@@ -149,7 +149,7 @@ try {
149149
database: "real-node-sqlite",
150150
read_only_lifecycle: "withOpenClawAgentDatabaseReadOnly",
151151
writable_lifecycle: "openOpenClawAgentDatabase LRU",
152-
cache: "readSqliteSessionEntryCache",
152+
cache: "readSessionEntryCache",
153153
},
154154
read_only_entry_count: readOnlyEntryCount,
155155
read_only_payload_bytes_per_entry: readOnlyPayloadBytes,

‎src/agents/embedded-agent-runner/run/attempt-dispatch-preparation.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fs from "node:fs/promises";
22
import { resolveStorePath } from "../../../config/sessions.js";
3-
import { resolveSessionTranscriptRuntimeReadTarget } from "../../../config/sessions/session-accessor.js";
3+
import { resolveSessionTranscriptRuntimeTarget } from "../../../config/sessions/session-accessor.js";
44
import type { resolveContextEngine } from "../../../context-engine/registry.js";
55
import { attachModelProviderRuntimePluginHandle } from "../../../plugins/provider-hook-runtime.js";
66
import { createTrajectoryRuntimeRecorder } from "../../../trajectory/runtime.js";
@@ -120,7 +120,7 @@ export async function prepareAndDispatchEmbeddedRunAttempt(input: {
120120
const resolvedTranscriptTarget =
121121
reusableSessionTarget ??
122122
(resolvedSessionKey
123-
? await resolveSessionTranscriptRuntimeReadTarget({
123+
? await resolveSessionTranscriptRuntimeTarget({
124124
agentId: workspaceResolution.agentId,
125125
sessionId: sessionPromptState.sessionId,
126126
sessionKey: resolvedSessionKey,

‎src/agents/embedded-agent-runner/run/attempt-transcript-helpers.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { resolveStorePath } from "../../../config/sessions/paths.js";
33
import {
44
loadSessionEntry,
55
loadTranscriptEvents,
6-
resolveSessionTranscriptRuntimeReadTarget,
6+
resolveSessionTranscriptRuntimeTarget,
77
updateSessionEntry,
88
} from "../../../config/sessions/session-accessor.js";
99
import { resolveQuotaSuspensionEntryMaintenance } from "../../../config/sessions/store-maintenance.js";
@@ -148,7 +148,7 @@ export async function resolveAttemptTrajectorySessionFile(params: {
148148
return params.sessionFile;
149149
}
150150
return (
151-
await resolveSessionTranscriptRuntimeReadTarget({
151+
await resolveSessionTranscriptRuntimeTarget({
152152
agentId: params.agentId,
153153
sessionId: params.sessionId,
154154
sessionKey: params.sessionKey,

‎src/agents/embedded-agent-runner/transcript-runtime-state.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type {
22
SessionTranscriptRuntimeScope,
33
SessionTranscriptRuntimeTarget,
44
} from "../../config/sessions/session-accessor.js";
5-
import { resolveSessionTranscriptRuntimeReadTarget } from "../../config/sessions/session-accessor.js";
5+
import { resolveSessionTranscriptRuntimeTarget } from "../../config/sessions/session-accessor.js";
66

77
export type RuntimeTranscriptScope = SessionTranscriptRuntimeScope;
88
type RuntimeTranscriptTarget = SessionTranscriptRuntimeTarget;
@@ -14,5 +14,5 @@ type RuntimeTranscriptTarget = SessionTranscriptRuntimeTarget;
1414
export async function resolveRuntimeTranscriptReadTarget(
1515
scope: RuntimeTranscriptScope,
1616
): Promise<RuntimeTranscriptTarget> {
17-
return await resolveSessionTranscriptRuntimeReadTarget(scope);
17+
return await resolveSessionTranscriptRuntimeTarget(scope);
1818
}

‎src/auto-reply/reply/agent-runner-memory.test.ts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
readTranscriptStatsSync,
1414
upsertSessionEntry,
1515
} from "../../config/sessions/session-accessor.js";
16-
import { replaceSqliteTranscriptEvents } from "../../config/sessions/session-accessor.sqlite-transcript-write.js";
16+
import { replaceTranscriptEvents } from "../../config/sessions/session-accessor.sqlite-transcript-write.js";
1717
import { resolveSessionStorePathForScope } from "../../config/sessions/session-store-path.js";
1818
import {
1919
clearMemoryPluginState,
@@ -126,7 +126,7 @@ function loadMainSessionEntry(storePath: string): SessionEntry {
126126

127127
async function writeTestSessionTranscript(params: {
128128
rootDir: string;
129-
events: Parameters<typeof replaceSqliteTranscriptEvents>[1];
129+
events: Parameters<typeof replaceTranscriptEvents>[1];
130130
sessionKey?: string;
131131
sessionId?: string;
132132
}): Promise<void> {
@@ -139,7 +139,7 @@ async function writeTestSessionTranscript(params: {
139139
storePath: path.join(params.rootDir, "sessions.json"),
140140
};
141141
await upsertSessionEntry(scope, { sessionId, updatedAt: 10 });
142-
await replaceSqliteTranscriptEvents(scope, params.events);
142+
await replaceTranscriptEvents(scope, params.events);
143143
}
144144

145145
type RefreshQueuedFollowupSessionParams = {
@@ -560,7 +560,7 @@ describe("runMemoryFlushIfNeeded", () => {
560560
const sessionKey = "agent:main:main";
561561
const scope = { agentId: "main", sessionId: "session", sessionKey, storePath };
562562
await upsertSessionEntry(scope, { sessionId: "session", updatedAt: 10 });
563-
await replaceSqliteTranscriptEvents(scope, [
563+
await replaceTranscriptEvents(scope, [
564564
{
565565
type: "message",
566566
message: { role: "user", content: "Research this", __openclaw: { senderIsOwner: true } },
@@ -3209,7 +3209,7 @@ describe("runMemoryFlushIfNeeded", () => {
32093209
const sessionKey = "agent:main:main";
32103210
const scope = { agentId: "main", sessionId: "session", sessionKey, storePath };
32113211
await upsertSessionEntry(scope, { sessionId: "session", updatedAt: 10 });
3212-
await replaceSqliteTranscriptEvents(scope, [
3212+
await replaceTranscriptEvents(scope, [
32133213
{ message: { role: "user", content: "x".repeat(256) }, type: "message" },
32143214
]);
32153215
expect(readTranscriptStatsSync(scope).sizeBytes).toBeGreaterThan(10);
@@ -3269,7 +3269,7 @@ describe("runMemoryFlushIfNeeded", () => {
32693269
const sessionKey = "agent:main:main";
32703270
const scope = { agentId: "main", sessionId: "session", sessionKey, storePath };
32713271
await upsertSessionEntry(scope, { sessionId: "session", updatedAt: 10 });
3272-
await replaceSqliteTranscriptEvents(scope, [
3272+
await replaceTranscriptEvents(scope, [
32733273
{ message: { role: "user", content: "small" }, type: "message" },
32743274
]);
32753275
expect(readTranscriptStatsSync(scope).sizeBytes).toBeLessThan(10 * 1024);
@@ -3330,7 +3330,7 @@ describe("runMemoryFlushIfNeeded", () => {
33303330
const sessionKey = "agent:main:main";
33313331
const scope = { agentId: "main", sessionId: "session", sessionKey, storePath };
33323332
await upsertSessionEntry(scope, { sessionId: "session", updatedAt: 10 });
3333-
await replaceSqliteTranscriptEvents(scope, [
3333+
await replaceTranscriptEvents(scope, [
33343334
{ message: { role: "user", content: "x".repeat(256) }, type: "message" },
33353335
]);
33363336
expect(readTranscriptStatsSync(scope).sizeBytes).toBeGreaterThan(10);
@@ -3402,7 +3402,7 @@ describe("runMemoryFlushIfNeeded", () => {
34023402
const sessionKey = "agent:main:main";
34033403
const scope = { agentId: "main", sessionId: "session", sessionKey, storePath };
34043404
await upsertSessionEntry(scope, { sessionId: "session", updatedAt: 10 });
3405-
await replaceSqliteTranscriptEvents(scope, [
3405+
await replaceTranscriptEvents(scope, [
34063406
{ message: { role: "user", content: "x".repeat(256) }, type: "message" },
34073407
]);
34083408
expect(readTranscriptStatsSync(scope).sizeBytes).toBeGreaterThan(10);
@@ -3577,7 +3577,7 @@ describe("runMemoryFlushIfNeeded", () => {
35773577
parentId = id;
35783578
return event;
35793579
});
3580-
await replaceSqliteTranscriptEvents(scope, [
3580+
await replaceTranscriptEvents(scope, [
35813581
activeRoot,
35823582
...abandonedBranch,
35833583
{
@@ -3624,7 +3624,7 @@ describe("runMemoryFlushIfNeeded", () => {
36243624
const sessionKey = "agent:main:main";
36253625
const scope = { agentId: "main", sessionId: "session", sessionKey, storePath };
36263626
await upsertSessionEntry(scope, { sessionId: "session", updatedAt: 10 });
3627-
await replaceSqliteTranscriptEvents(scope, [
3627+
await replaceTranscriptEvents(scope, [
36283628
{ message: { role: "user", content: "x".repeat(256) }, type: "message" },
36293629
]);
36303630
const sessionEntry: SessionEntry = {

‎src/auto-reply/reply/session-fork.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
loadTranscriptEvents,
99
replaceSessionEntry,
1010
} from "../../config/sessions/session-accessor.js";
11-
import { replaceSqliteTranscriptEvents } from "../../config/sessions/session-accessor.sqlite-transcript-write.js";
11+
import { replaceTranscriptEvents } from "../../config/sessions/session-accessor.sqlite-transcript-write.js";
1212
import type { InternalSessionEntry } from "../../config/sessions/types.js";
1313
import type { OpenClawConfig } from "../../config/types.openclaw.js";
1414
import {
@@ -120,7 +120,7 @@ describe("forkSessionEntryFromParent", () => {
120120
updatedAt: 10,
121121
},
122122
);
123-
await replaceSqliteTranscriptEvents(
123+
await replaceTranscriptEvents(
124124
{
125125
agentId: "main",
126126
sessionId: "parent-session",
@@ -290,7 +290,7 @@ describe("forkSessionEntryFromParent", () => {
290290
totalTokensFresh: false,
291291
updatedAt: 1,
292292
};
293-
await replaceSqliteTranscriptEvents(
293+
await replaceTranscriptEvents(
294294
{
295295
agentId: "main",
296296
sessionId: parentEntry.sessionId,
@@ -334,7 +334,7 @@ describe("forkSessionEntryFromParent", () => {
334334
totalTokensFresh: false,
335335
updatedAt: 1,
336336
};
337-
await replaceSqliteTranscriptEvents(
337+
await replaceTranscriptEvents(
338338
{
339339
agentId: "main",
340340
sessionId: parentEntry.sessionId,
@@ -387,7 +387,7 @@ describe("forkSessionEntryFromParent", () => {
387387
totalTokensFresh: false,
388388
updatedAt: 1,
389389
};
390-
await replaceSqliteTranscriptEvents(
390+
await replaceTranscriptEvents(
391391
{
392392
agentId: "main",
393393
sessionId: parentEntry.sessionId,
@@ -469,7 +469,7 @@ describe("forkSessionEntryFromParent", () => {
469469
totalTokensFresh: false,
470470
updatedAt: 1,
471471
};
472-
await replaceSqliteTranscriptEvents(
472+
await replaceTranscriptEvents(
473473
{
474474
agentId: "main",
475475
sessionId: parentEntry.sessionId,

‎src/commands/agent.worktree-race.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { prepareAgentCommandExecution } from "../agents/command/prepare.js";
1010
import { ensureAgentWorkspace } from "../agents/workspace.js";
1111
import { getRegistryWorktree } from "../agents/worktrees/registry.js";
1212
import { managedWorktrees } from "../agents/worktrees/service.js";
13-
import { upsertSqliteSessionEntry } from "../config/sessions/session-accessor.sqlite-entry.js";
13+
import { upsertSessionEntry } from "../config/sessions/session-accessor.sqlite-entry.js";
1414
import { clearSessionStoreCacheForTest } from "../config/sessions/store-writer-state.js";
1515
import type { OpenClawConfig } from "../config/types.openclaw.js";
1616
import { closeOpenClawStateDatabaseForTest } from "../state/openclaw-state-db.js";
@@ -74,7 +74,7 @@ async function seedSession(
7474
spawnedCwd: string,
7575
worktree?: { id: string; branch: string; repoRoot: string },
7676
): Promise<void> {
77-
await upsertSqliteSessionEntry(
77+
await upsertSessionEntry(
7878
{ agentId: "main", sessionKey, storePath },
7979
{
8080
sessionId: "session-worktree-race",

0 commit comments

Comments
 (0)