Skip to content

Commit 2e3b59b

Browse files
clawsweeper[bot]abnershangTakhoffman
authored
fix: guard QMD session stem fallback (#86482)
Summary: - This PR changes `resolveTranscriptStemToSessionKeys` to skip empty or missing `sessionId` values during QMD slug fallback, adds regression coverage, and adds a changelog entry. - PR surface: Source +1, Tests +17, Docs +1. Total +19 across 3 files. - Reproducibility: yes. from source inspection: current main reaches `normalizeQmdSessionStem(entry.sessionId) ... ad-only review, but the source PR includes a direct after-fix resolver probe for the same mixed-store case. Automerge notes: - PR branch already contained follow-up commit before automerge: fix: guard QMD session stem fallback - PR branch already contained follow-up commit before automerge: fix(clawsweeper): address review for automerge-openclaw-openclaw-8632… Validation: - ClawSweeper review passed for head 81478b0. - Required merge gates passed before the squash merge. Prepared head SHA: 81478b0 Review: #86482 (comment) Co-authored-by: abnershang <abner.shang@gmail.com> Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com> Co-authored-by: Abner Shang <75654486+abnershang@users.noreply.github.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: takhoffman Co-authored-by: takhoffman <781889+takhoffman@users.noreply.github.com>
1 parent 489e415 commit 2e3b59b

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Docs: https://docs.openclaw.ai
2323
- Media understanding: convert HEIC and HEIF images to JPEG before image description providers run so iPhone photos work in direct and configured image-description flows. (#86037)
2424
- Agents: release embedded-attempt session locks from outer teardown so post-prompt exceptions cannot wedge later requests behind `SessionWriteLockTimeoutError`. Fixes #86014. Thanks @openperf.
2525
- Discord/OpenAI voice: rotate Realtime sessions at provider max duration without logging the expected session-expiry event as an error.
26+
- Sessions: skip metadata-only entries during QMD-slugified session lookup so one incomplete row does not block transcript hit resolution. (#86327) Thanks @abnershang.
2627
- Agents/media: derive bundled plugin local-media trust from plugin tool metadata instead of importing the full plugin registry on subscription paths. (#84409) Thanks @samzong.
2728
- Image tool: keep config-backed custom-provider API keys usable for auto-discovered vision models, including deferred image-tool execution without env keys or auth profiles. (#85733)
2829
- Memory/local embeddings: run local GGUF embeddings in an isolated worker sidecar and degrade to configured fallback or keyword search on worker failure so native embedding crashes do not take down the Gateway. (#85348) Thanks @osolmaz.

src/plugin-sdk/session-transcript-hit.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,23 @@ describe("resolveTranscriptStemToSessionKeys", () => {
217217
).toEqual(["agent:main:s1"]);
218218
});
219219

220+
it("ignores store entries without session ids during QMD-slugified fallback", () => {
221+
const store: Record<string, SessionEntry> = {
222+
"agent:main:non-session": {
223+
updatedAt: 1,
224+
} as SessionEntry,
225+
"agent:main:s1": baseEntry({ sessionId: "foo_bar.v1" }),
226+
};
227+
228+
expect(
229+
resolveTranscriptStemToSessionKeys({
230+
store,
231+
stem: "foo-bar-v1",
232+
allowQmdSlugFallback: true,
233+
}),
234+
).toEqual(["agent:main:s1"]);
235+
});
236+
220237
it("does not use QMD-slugified fallback unless requested", () => {
221238
const store: Record<string, SessionEntry> = {
222239
"agent:main:s1": baseEntry({ sessionId: "foo_bar.v1" }),

src/plugin-sdk/session-transcript-hit.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ export function resolveTranscriptStemToSessionKeys(params: {
151151
continue;
152152
}
153153
}
154-
if (normalizeQmdSessionStem(entry.sessionId) === normalizedStem) {
154+
const entrySessionId = normalizeOptionalString(entry.sessionId);
155+
if (entrySessionId && normalizeQmdSessionStem(entrySessionId) === normalizedStem) {
155156
matches.push(sessionKey);
156157
}
157158
}

0 commit comments

Comments
 (0)