fix(recall): skip pre-recall recovery on reroll reuse

This commit is contained in:
opencode
2026-05-15 19:17:30 +00:00
parent 06e92cda7c
commit a5c4e12a76
2 changed files with 37 additions and 21 deletions

View File

@@ -313,6 +313,7 @@ writePersistedRecallToUserMessage(rerollChat, 0, validRecord);
let retrieveCalled = false;
let rerollEnsureVectorReadyCalled = false;
let rerollRecoverHistoryCalled = false;
const rerollStatusLabels = [];
const rerollRuntime = {
getIsRecalling: () => false,
@@ -325,7 +326,10 @@ const rerollRuntime = {
}),
isGraphReadableForRecall: () => true,
isGraphMetadataWriteAllowed: () => true,
recoverHistoryIfNeeded: async () => true,
recoverHistoryIfNeeded: async () => {
rerollRecoverHistoryCalled = true;
return true;
},
getContext: () => ({ chat: rerollChat, chatId: "chat-reroll" }),
nextRecallRunSequence: () => 1,
beginStageAbortController: () => ({ signal: { aborted: false } }),
@@ -435,6 +439,11 @@ assert.equal(
false,
"persisted reroll reuse should not even prepare vectors before reusing the user-floor record",
);
assert.equal(
rerollRecoverHistoryCalled,
false,
"persisted reroll reuse should not trigger pre-recall history recovery",
);
assert.equal(
rerollStatusLabels.includes("召回中"),
false,
@@ -599,6 +608,7 @@ assert.equal(
console.log(" ✓ runRecallController does not reuse unbound record for active input");
rerollRecoverHistoryCalled = false;
const activeInputBoundChat = [
{ is_user: true, mes: "主动新输入绑定记录也不应复用" },
{ is_user: false, mes: "上一条回复。", is_system: false },
@@ -642,6 +652,11 @@ assert.equal(
true,
"active send-intent input should not reuse even a bound target user-floor record",
);
assert.equal(
rerollRecoverHistoryCalled,
true,
"active send-intent input should still run normal pre-recall history recovery before fresh recall",
);
assert.equal(
activeInputBoundResult.injectionText,
"新召回:主动新输入绑定记录也不应复用",