Skip to content

fix(reply): reset sessions after all-model timeout failures#485

Open
BingqingLyu wants to merge 2 commits into
mainfrom
fork-pr-43529-codex-fix-timeout-session-reset
Open

fix(reply): reset sessions after all-model timeout failures#485
BingqingLyu wants to merge 2 commits into
mainfrom
fork-pr-43529-codex-fix-timeout-session-reset

Conversation

@BingqingLyu

@BingqingLyu BingqingLyu commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Problem

When every model in the fallback chain times out, runReplyAgent currently leaves the conversation on the same session and returns a generic failure. The next user message then retries the same bloated or stuck session and can keep looping indefinitely.

Fixes openclaw#20910.

What this changes

  • detect timeout failures in the embedded fallback runner
  • reset the session before replying so the next retry starts from a fresh transcript
  • return a user-facing retry message after the reset succeeds
  • add focused coverage for the timeout-reset path

Why here

runReplyAgent already auto-recovers from compaction failures and role-order corruption by rotating the session. Timeout-driven session death spirals are the same class of failure: retrying on the same session is usually the wrong thing to do.

Testing

  • pnpm exec vitest run --config vitest.unit.config.ts src/auto-reply/reply/agent-runner.runreplyagent.test.ts

nono11875 and others added 2 commits March 12, 2026 18:19
…P errors

Address review feedback from automated reviewers:

- Skip session reset on heartbeat turns — background pings should not
  discard conversation history (isHeartbeat guard).
- Let transient HTTP errors (502/504/521) retry before considering a
  session reset — move the timeout check after the retry block and add
  !isTransientHttp guard to avoid consuming retryable errors.
- Add test: heartbeat timeout does not reset session.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-reset session when all models time out (session bloat death spiral)

2 participants