mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-12 01:31:08 +00:00
fix: prefer target entry for inline abort cutoff
This commit is contained in:
@@ -419,6 +419,43 @@ describe("handleInlineActions", () => {
|
||||
expect(handleCommandsMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("prefers the target session entry for inline /stop cutoff checks", async () => {
|
||||
const typing = createTypingController();
|
||||
const wrapperSessionEntry: SessionEntry = {
|
||||
sessionId: "wrapper-session",
|
||||
updatedAt: Date.now(),
|
||||
abortCutoffMessageSid: "40",
|
||||
abortedLastRun: true,
|
||||
};
|
||||
const targetSessionEntry: SessionEntry = {
|
||||
sessionId: "target-session",
|
||||
updatedAt: Date.now(),
|
||||
abortCutoffMessageSid: "42",
|
||||
abortedLastRun: true,
|
||||
};
|
||||
const ctx = buildTestCtx({
|
||||
Body: "old queued message",
|
||||
CommandBody: "old queued message",
|
||||
MessageSid: "41",
|
||||
});
|
||||
|
||||
await expectInlineActionSkipped({
|
||||
ctx,
|
||||
typing,
|
||||
cleanedBody: "old queued message",
|
||||
command: {
|
||||
rawBodyNormalized: "old queued message",
|
||||
commandBodyNormalized: "old queued message",
|
||||
},
|
||||
overrides: {
|
||||
sessionEntry: wrapperSessionEntry,
|
||||
sessionStore: {
|
||||
"s:main": targetSessionEntry,
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("rewrites Claude bundle markdown commands into a native agent prompt", async () => {
|
||||
const typing = createTypingController();
|
||||
handleCommandsMock.mockResolvedValue({ shouldContinue: false, reply: { text: "done" } });
|
||||
|
||||
@@ -297,8 +297,9 @@ export async function handleInlineActions(params: {
|
||||
};
|
||||
|
||||
const isStopLikeInbound = isAbortRequestText(command.rawBodyNormalized);
|
||||
if (!isStopLikeInbound && sessionEntry) {
|
||||
const cutoff = readAbortCutoffFromSessionEntry(sessionEntry);
|
||||
const targetSessionEntry = sessionStore?.[sessionKey] ?? sessionEntry;
|
||||
if (!isStopLikeInbound && targetSessionEntry) {
|
||||
const cutoff = readAbortCutoffFromSessionEntry(targetSessionEntry);
|
||||
const incoming = resolveAbortCutoffFromContext(ctx);
|
||||
const shouldSkip = cutoff
|
||||
? shouldSkipMessageByAbortCutoff({
|
||||
@@ -316,7 +317,7 @@ export async function handleInlineActions(params: {
|
||||
await (
|
||||
await import("./abort-cutoff.runtime.js")
|
||||
).clearAbortCutoffInSessionRuntime({
|
||||
sessionEntry,
|
||||
sessionEntry: targetSessionEntry,
|
||||
sessionStore,
|
||||
sessionKey,
|
||||
storePath,
|
||||
@@ -347,7 +348,6 @@ 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,
|
||||
|
||||
Reference in New Issue
Block a user