fix: clear replay lint regressions

This commit is contained in:
Shakker
2026-04-12 07:25:21 +01:00
committed by Shakker
parent b6faa69451
commit b484173efe
3 changed files with 5 additions and 10 deletions

View File

@@ -1243,8 +1243,7 @@ describe("sanitizeSessionHistory", () => {
message &&
typeof message === "object" &&
message.role === "assistant" &&
extractToolCallsFromAssistant(message as Extract<AgentMessage, { role: "assistant" }>)
.length > 0,
extractToolCallsFromAssistant(message).length > 0,
),
).toHaveLength(1);
expect(
@@ -1258,8 +1257,7 @@ describe("sanitizeSessionHistory", () => {
message &&
typeof message === "object" &&
message.role === "assistant" &&
extractToolCallsFromAssistant(message as Extract<AgentMessage, { role: "assistant" }>)
.length > 0,
extractToolCallsFromAssistant(message).length > 0,
),
).toHaveLength(1);
expect(

View File

@@ -354,9 +354,7 @@ function sanitizeReplayToolCallInputs(
message.content.some((block) => isThinkingLikeReplayBlock(block)) &&
message.content.some((block) => isReplayToolCallBlock(block))
) {
const replaySafeToolCalls = extractToolCallsFromAssistant(
message as Extract<AgentMessage, { role: "assistant" }>,
);
const replaySafeToolCalls = extractToolCallsFromAssistant(message);
if (
isReplaySafeThinkingTurn(message.content, allowedToolNames) &&
replaySafeToolCalls.every((toolCall) => !claimedReplaySafeToolCallIds.has(toolCall.id))
@@ -720,8 +718,7 @@ export function wrapStreamFnSanitizeMalformedToolCalls(
: sanitized.messages;
if (transcriptPolicy?.validateAnthropicTurns) {
nextMessages = sanitizeAnthropicReplayToolResults(nextMessages, {
disallowEmbeddedUserToolResultsForSignedThinkingReplay:
allowProviderOwnedThinkingReplay,
disallowEmbeddedUserToolResultsForSignedThinkingReplay: allowProviderOwnedThinkingReplay,
});
}
if (nextMessages === messages) {

View File

@@ -142,7 +142,7 @@ export function isRedactedSessionsSpawnAttachment(item: unknown): boolean {
if (!(SESSIONS_SPAWN_ATTACHMENT_METADATA_KEYS as readonly string[]).includes(key)) {
return false;
}
if (typeof attachment[key] !== "string" || (attachment[key] as string).trim().length === 0) {
if (typeof attachment[key] !== "string" || attachment[key].trim().length === 0) {
return false;
}
}