mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(agents): report recovered compaction runs as completed
This commit is contained in:
@@ -97,6 +97,19 @@ describe("cleanupEmbeddedAttemptSessionPhase", () => {
|
||||
expect(input.emitDiagnosticRunCompleted).toHaveBeenCalledWith("completed", null, undefined);
|
||||
});
|
||||
|
||||
it("keeps compaction timeout observations abort-like only for cleanup", async () => {
|
||||
const input = createInput();
|
||||
const readState = input.readState;
|
||||
input.readState = () => ({ ...readState(), timedOutDuringCompaction: true });
|
||||
|
||||
await cleanupEmbeddedAttemptSessionPhase(input as never);
|
||||
|
||||
expect(hoisted.cleanupEmbeddedAttemptResources).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ aborted: true }),
|
||||
);
|
||||
expect(input.emitDiagnosticRunCompleted).toHaveBeenCalledWith("completed", null, undefined);
|
||||
});
|
||||
|
||||
it("emits the before-agent blocked status and owner", async () => {
|
||||
const input = createInput({
|
||||
readState: () => ({
|
||||
|
||||
@@ -175,6 +175,8 @@ export async function cleanupEmbeddedAttemptSessionPhase(
|
||||
const finalState = input.readState();
|
||||
const cleanupFailure = cleanupError;
|
||||
const beforeAgentRunBlocked = finalState.beforeAgentRunBlockedBy !== undefined;
|
||||
const diagnosticTerminalAborted =
|
||||
finalState.aborted || finalState.timedOut || finalState.idleTimedOut;
|
||||
input.emitDiagnosticRunCompleted?.(
|
||||
cleanupFailure
|
||||
? "error"
|
||||
@@ -182,10 +184,7 @@ export async function cleanupEmbeddedAttemptSessionPhase(
|
||||
? "blocked"
|
||||
: finalState.promptError
|
||||
? "error"
|
||||
: finalState.aborted ||
|
||||
finalState.timedOut ||
|
||||
finalState.idleTimedOut ||
|
||||
finalState.timedOutDuringCompaction
|
||||
: diagnosticTerminalAborted
|
||||
? "aborted"
|
||||
: "completed",
|
||||
cleanupFailure ?? finalState.promptError,
|
||||
|
||||
Reference in New Issue
Block a user