mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 04:01:05 +00:00
fix: restore rebased main tsgo
This commit is contained in:
@@ -136,16 +136,19 @@ describe("runEmbeddedAttempt context injection", () => {
|
||||
|
||||
it("filters no-op heartbeat pairs before history limiting and context-engine assembly", async () => {
|
||||
hoisted.getDmHistoryLimitFromSessionKeyMock.mockReturnValue(1);
|
||||
hoisted.limitHistoryTurnsMock.mockImplementation(limitHistoryTurns);
|
||||
hoisted.limitHistoryTurnsMock.mockImplementation(
|
||||
(messages: unknown, limit: number | undefined) =>
|
||||
limitHistoryTurns(messages as AgentMessage[], limit),
|
||||
);
|
||||
const assemble = vi.fn(async ({ messages }: { messages: AgentMessage[] }) => ({
|
||||
messages,
|
||||
estimatedTokens: 1,
|
||||
}));
|
||||
const sessionMessages: AgentMessage[] = [
|
||||
{ role: "user", content: "real question", timestamp: 1 } as AgentMessage,
|
||||
{ role: "assistant", content: "real answer", timestamp: 2 } as AgentMessage,
|
||||
{ role: "user", content: HEARTBEAT_PROMPT, timestamp: 3 } as AgentMessage,
|
||||
{ role: "assistant", content: "HEARTBEAT_OK", timestamp: 4 } as AgentMessage,
|
||||
{ role: "user", content: "real question", timestamp: 1 } as unknown as AgentMessage,
|
||||
{ role: "assistant", content: "real answer", timestamp: 2 } as unknown as AgentMessage,
|
||||
{ role: "user", content: HEARTBEAT_PROMPT, timestamp: 3 } as unknown as AgentMessage,
|
||||
{ role: "assistant", content: "HEARTBEAT_OK", timestamp: 4 } as unknown as AgentMessage,
|
||||
];
|
||||
|
||||
await createContextEngineAttemptRunner({
|
||||
|
||||
@@ -1666,6 +1666,10 @@ export async function runEmbeddedAttempt(
|
||||
}
|
||||
const transcriptLeafId =
|
||||
(sessionManager.getLeafEntry() as { id?: string } | null | undefined)?.id ?? null;
|
||||
const heartbeatSummary =
|
||||
params.config && sessionAgentId
|
||||
? resolveHeartbeatSummaryForAgent(params.config, sessionAgentId)
|
||||
: undefined;
|
||||
|
||||
try {
|
||||
// Idempotent cleanup: prune old image blocks to limit context
|
||||
|
||||
Reference in New Issue
Block a user