← NEWS DESK
analysis

OpenClaw Main Rebuilds Long Responses Session Continuity

Merged fixes preserve OpenAI Responses compaction state across restarts, rewrites and cloud-worker handoffs, while cron maintenance now archives pruned transcripts. Long sessions need an explicit upgrade and test plan.

Independent operator analysis for people running OpenClaw in production · Editorial standards

OpenClaw has merged a chain of fixes for a subtle long-session failure: OpenAI Responses can compact history into an opaque provider-owned checkpoint, but continuing safely requires that checkpoint, its provenance and the chronological suffix to survive every local boundary.

Earlier behaviour could produce a plausible answer from an incomplete suffix after compaction, restart or cloud handoff. That is worse than an explicit failure when an agent is making consequential decisions, because the user may not realise context has vanished.

The changes discussed here are on main, not necessarily in an installed release.

Compaction state becomes first-class session state

PR #120457 captures the provider’s encrypted compaction output, persists it and replays only a compatible newest item. Compatibility is fenced by provider, API, model, endpoint, session and authentication identity. The opaque state is kept out of chat history and diagnostics while crossing the internal transcript and worker boundaries that need it.

That separation is important. Provider replay data is operational state, not user-visible conversation content. Exposing ciphertext in ordinary transcripts would add noise and leakage risk; dropping it would silently degrade continuity.

Follow-up fixes close two plausible-answer traps

The first implementation uncovered two additional failures. PR #120729 preserves a tool result whose matching call moved inside the compacted prefix, and builds rejection fallback from untouched full history rather than an already-pruned suffix.

PR #120786 handles the inverse problem: replay state that should no longer survive. If a transcript is compacted locally, reset, truncated or branch-rewritten, an old provider checkpoint may describe a prefix that no longer exists. The fix invalidates that exact checkpoint at rewrite boundaries while preserving unrelated replay policy.

Interpretation: continuity requires both retention and deletion. Keeping all hidden provider state forever is no safer than dropping all of it; the state must remain attached to the exact route and transcript prefix that gave it meaning.

Cloud-worker handoff now fails visibly

PR #120803 treats the newest replay owner and its complete suffix as one handoff unit. Windowing pins that unit when it fits. If it cannot be represented within the existing worker protocol ceiling, OpenClaw stops with a local-retry instruction rather than handing a context-blind suffix to the worker.

Ciphertext is not truncated to make the frame fit. Replay created after handoff must also fit persistence or the terminal fails explicitly.

That is a deliberate availability trade: a visible stop is preferable to a successful-looking turn whose context was unknowingly amputated.

Cron maintenance gets the same continuity principle

A separate merged repair, PR #119511, fixes openclaw tasks maintenance --apply hard-deleting stale cron-run transcript rows without writing the normal .deleted archive first. The command still prunes the live rows, but now leaves a recoverable cold copy under the archive-retention policy.

This matters particularly for operators who use automation transcripts as an audit trail. cron.sessionRetention: false did not protect the affected rows from that maintenance sweep.

Operator guidance

When a release containing these fixes reaches your channel:

  • test long embedded Responses sessions with harmless markers before and after server compaction;
  • restart the Gateway and verify the same markers remain attributable to the same session;
  • exercise one tool call that crosses the compaction boundary;
  • reset or branch-rewrite a test session and prove old replay state is not reused;
  • if using cloud workers, test both a normal handoff and an intentionally oversized replay case, expecting a visible local-retry outcome;
  • run tasks-maintenance preview first, then apply against disposable cron sessions and verify a retained archive exists before relying on it.

Do not place secrets in continuity markers. A unique synthetic phrase is enough to prove context survival.

Long-context tests can also be expensive. The upstream PR explicitly warns that large OpenAI requests and priority processing can multiply costs. Bound the test and monitor token usage rather than reproducing the largest upstream proof.

Bottom line

The merged work turns Responses compaction from invisible transport trivia into properly owned session state. The key improvement is not “longer context”; it is honest continuity—preserve compatible history, invalidate stale history and fail visibly when a worker handoff cannot carry it.

THE RECEIPTS

Claims should survive the click.

Primary links used for this article are listed openly. If the evidence changes, the verification date changes with it.
  1. 01PR #120457: preserve long Responses sessions after server compaction
  2. 02PR #120729: preserve Responses history after compaction
  3. 03PR #120786: prevent stale replay after context rewrites
  4. 04PR #120803: preserve long Responses sessions across cloud handoff
  5. 05PR #119511: archive cron-run transcripts pruned by maintenance

THE OPERATOR BRIEF

One useful email when the signal earns it.

Release impact, security changes and repository intelligence. No daily sludge.