mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 17:51:22 +00:00
fix: prefer target entry for inline status
This commit is contained in:
@@ -241,12 +241,13 @@ export async function applyInlineDirectiveOverrides(params: {
|
||||
let statusReply: ReplyPayload | undefined;
|
||||
if (directives.hasStatusDirective && allowTextCommands && command.isAuthorizedSender) {
|
||||
const { buildStatusReply } = await loadCommandsStatus();
|
||||
const targetSessionEntry = sessionStore[sessionKey] ?? sessionEntry;
|
||||
statusReply = await buildStatusReply({
|
||||
cfg,
|
||||
command,
|
||||
sessionEntry,
|
||||
sessionEntry: targetSessionEntry,
|
||||
sessionKey,
|
||||
parentSessionKey: ctx.ParentSessionKey,
|
||||
parentSessionKey: targetSessionEntry?.parentSessionKey ?? ctx.ParentSessionKey,
|
||||
sessionScope,
|
||||
storePath,
|
||||
provider,
|
||||
|
||||
@@ -259,6 +259,56 @@ describe("handleInlineActions", () => {
|
||||
expect(handleCommandsMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("prefers the target session entry when routing inline status through the shared status builder", async () => {
|
||||
const typing = createTypingController();
|
||||
const ctx = buildTestCtx({
|
||||
Body: "/status",
|
||||
CommandBody: "/status",
|
||||
ParentSessionKey: "ctx-parent",
|
||||
});
|
||||
|
||||
const result = await handleInlineActions(
|
||||
createHandleInlineActionsInput({
|
||||
ctx,
|
||||
typing,
|
||||
cleanedBody: stripInlineStatus("/status").cleaned,
|
||||
command: {
|
||||
isAuthorizedSender: true,
|
||||
rawBodyNormalized: "/status",
|
||||
commandBodyNormalized: "/status",
|
||||
},
|
||||
overrides: {
|
||||
allowTextCommands: true,
|
||||
inlineStatusRequested: true,
|
||||
sessionEntry: {
|
||||
sessionId: "wrapper-session",
|
||||
updatedAt: Date.now(),
|
||||
parentSessionKey: "wrapper-parent",
|
||||
} as SessionEntry,
|
||||
sessionStore: {
|
||||
"s:main": {
|
||||
sessionId: "target-session",
|
||||
updatedAt: Date.now(),
|
||||
parentSessionKey: "target-parent",
|
||||
} as SessionEntry,
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(result).toEqual({ kind: "reply", reply: undefined });
|
||||
expect(buildStatusReplyMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
sessionEntry: expect.objectContaining({
|
||||
sessionId: "target-session",
|
||||
parentSessionKey: "target-parent",
|
||||
}),
|
||||
parentSessionKey: "target-parent",
|
||||
}),
|
||||
);
|
||||
expect(handleCommandsMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("does not continue into the agent after a mention-wrapped inline status-only turn", async () => {
|
||||
const typing = createTypingController();
|
||||
const ctx = buildTestCtx({
|
||||
|
||||
@@ -347,12 +347,13 @@ export async function handleInlineActions(params: {
|
||||
let didSendInlineStatus = false;
|
||||
if (handleInlineStatus) {
|
||||
const { buildStatusReply } = await import("./commands.runtime.js");
|
||||
const targetSessionEntry = sessionStore?.[sessionKey] ?? sessionEntry;
|
||||
const inlineStatusReply = await buildStatusReply({
|
||||
cfg,
|
||||
command,
|
||||
sessionEntry,
|
||||
sessionEntry: targetSessionEntry,
|
||||
sessionKey,
|
||||
parentSessionKey: ctx.ParentSessionKey,
|
||||
parentSessionKey: targetSessionEntry?.parentSessionKey ?? ctx.ParentSessionKey,
|
||||
sessionScope,
|
||||
storePath,
|
||||
provider,
|
||||
|
||||
Reference in New Issue
Block a user