fix(regression): preserve line pairing account context

This commit is contained in:
Tak Hoffman
2026-03-27 23:08:30 -05:00
parent d50526dddc
commit b9415ca24b
2 changed files with 36 additions and 0 deletions

View File

@@ -88,6 +88,41 @@ function createRuntime(): { runtime: PluginRuntime; mocks: LineRuntimeMocks } {
}
describe("linePlugin outbound.sendPayload", () => {
it("preserves resolved accountId when pairing notifications push directly", async () => {
const { runtime, mocks } = createRuntime();
setLineRuntime(runtime);
const cfg = {
channels: {
line: {
accounts: {
primary: {
channelAccessToken: "token-primary",
},
},
},
},
} as OpenClawConfig;
mocks.resolveLineAccount.mockReturnValue({
accountId: "primary",
channelAccessToken: "token-primary",
config: {},
});
await linePlugin.pairing!.notifyApproval!({
cfg,
id: "line:user:1",
});
expect(mocks.pushMessageLine).toHaveBeenCalledWith(
"line:user:1",
"OpenClaw: your access has been approved.",
{
accountId: "primary",
channelAccessToken: "token-primary",
},
);
});
it("sends flex message without dropping text", async () => {
const { runtime, mocks } = createRuntime();
setLineRuntime(runtime);

View File

@@ -291,6 +291,7 @@ export const linePlugin: ChannelPlugin<ResolvedLineAccount> = createChatChannelP
throw new Error("LINE channel access token not configured");
}
await line.pushMessageLine(id, message, {
accountId: account.accountId,
channelAccessToken: account.channelAccessToken,
});
},