mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 18:18:28 +00:00
fix(agent): prevent session lock deadlock on timeout during compaction (#9855)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 64a28900f1
Co-authored-by: mverrilli <816450+mverrilli@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
@@ -480,7 +480,14 @@ export async function runEmbeddedPiAgent(
|
||||
enforceFinalTag: params.enforceFinalTag,
|
||||
});
|
||||
|
||||
const { aborted, promptError, timedOut, sessionIdUsed, lastAssistant } = attempt;
|
||||
const {
|
||||
aborted,
|
||||
promptError,
|
||||
timedOut,
|
||||
timedOutDuringCompaction,
|
||||
sessionIdUsed,
|
||||
lastAssistant,
|
||||
} = attempt;
|
||||
const lastAssistantUsage = normalizeUsage(lastAssistant?.usage as UsageLike);
|
||||
const attemptUsage = attempt.attemptUsage ?? lastAssistantUsage;
|
||||
mergeUsageIntoAccumulator(usageAccumulator, attemptUsage);
|
||||
@@ -801,7 +808,9 @@ export async function runEmbeddedPiAgent(
|
||||
}
|
||||
|
||||
// Treat timeout as potential rate limit (Antigravity hangs on rate limit)
|
||||
const shouldRotate = (!aborted && failoverFailure) || timedOut;
|
||||
// But exclude post-prompt compaction timeouts (model succeeded; no profile issue)
|
||||
const shouldRotate =
|
||||
(!aborted && failoverFailure) || (timedOut && !timedOutDuringCompaction);
|
||||
|
||||
if (shouldRotate) {
|
||||
if (lastProfileId) {
|
||||
|
||||
Reference in New Issue
Block a user