fix(channels): skip route updates without session creation

This commit is contained in:
Peter Steinberger
2026-04-27 21:00:43 +01:00
parent d32903c283
commit 0c305596a2
3 changed files with 24 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Channels/sessions: skip last-route writes when inbound session recording explicitly disables creation, so plugin-owned guarded inbound paths cannot create route-only phantom sessions. Carries forward #73009. Thanks @jzakirov.
- Channels/Telegram: skip the optional webhook-info API call during polling-mode status checks and startup bot-label probes so long-polling setups avoid an unnecessary Telegram round trip. Carries forward #72990. Thanks @danielgruneberg.
- CLI/message: load only the selected channel plugin for targeted `openclaw message` actions, and fall back to configured channel plugins when the channel must be inferred, so scripted sends avoid full bundled plugin registry scans. Fixes #73006. Thanks @jasonftl.
- CLI/models: keep route-first `models status --json` stdout reserved for the JSON payload by routing auth-profile and startup diagnostics to stderr. Fixes #72962. Thanks @vishutdhar.

View File

@@ -132,4 +132,26 @@ describe("recordInboundSession", () => {
senderRecipient: "9999",
});
});
it("skips last-route updates when session creation is disabled", async () => {
await recordInboundSession({
storePath: "/tmp/openclaw-session-store.json",
sessionKey: "agent:main:demo-channel:1234:thread:42",
ctx,
createIfMissing: false,
updateLastRoute: {
sessionKey: "agent:main:main",
channel: "demo-channel",
to: "demo-channel:1234",
},
onRecordError: vi.fn(),
});
expect(recordSessionMetaFromInboundMock).toHaveBeenCalledWith(
expect.objectContaining({
createIfMissing: false,
}),
);
expect(updateLastRouteMock).not.toHaveBeenCalled();
});
});

View File

@@ -51,7 +51,7 @@ export async function recordInboundSession(params: {
.catch(params.onRecordError);
const update = params.updateLastRoute;
if (!update) {
if (!update || createIfMissing === false) {
return;
}
if (shouldSkipPinnedMainDmRouteUpdate(update.mainDmOwnerPin)) {