OpenClaw’s 60-Second Preflight Compaction Bug Turns Token Governance Into Latency Tax

OpenClaw’s 60-Second Preflight Compaction Bug Turns Token Governance Into Latency Tax

OpenClaw issue #95553 is a reminder that token governance is not just counting. It is also timing. The bug report says OpenClaw’s preflight/budget compaction path is effectively capped at about 60 seconds by the reply-operation abort signal, even though the configured compaction timeout defaults to roughly 900 seconds. The result is a nasty kind of latency tax: large sessions can spend a doomed minute trying to compact, hold the session write lock, proceed un-compacted, and then fall into overflow recovery anyway.

The issue was opened on 2026-06-21T13:03:57Z against [email protected]. The reporter says the mechanism appears long-standing, with preflight-timeout logs observed as far back as 2026-05-22. This is not a cosmetic complaint about slow summarization. It is a report that two compaction paths obey different timeout authorities, and the shorter one wins at exactly the moment when the runtime most needs predictable budget behavior.

Two compaction paths, two operational realities

The report identifies overflow recovery, using trigger=overflow / timeout_recovery, as relying on resolveCompactionTimeoutMs(cfg) and effectively allowing the configured ~900 second window. The preflight/budget path, using trigger=budget / cli_budget, runs before a turn when totalTokens >= contextWindow - reserveTokensFloor - softThresholdTokens. It calls compactEmbeddedAgentSession({ trigger: "budget", abortSignal: replyOperation.abortSignal }), which apparently ties the operation to the roughly 60-second reply-operation abort instead of the compaction timeout.

The evidence is unusually concrete. The reporter observed 22 complete compactions ranging from 54 to 954 seconds, with a median of 278 seconds. They also observed 26 incomplete compactions, with 24 landing at exactly 60–61 seconds. That distribution does not look like random backend slowness. It looks like an abort boundary.

The reported environment is also the kind of setup where this matters: Linux aarch64 on NVIDIA GB10/Spark, Node v22.22.2, OpenClaw 2026.6.9, an openai-completions provider pointed at vLLM, compaction model vllm/qwen3.6-fp8-fast, context window 196,608, reserveTokensFloor=20,000, and softThresholdTokens=10,000. In other words, a serious local/hosted inference setup with a large context window and a compaction model that may need minutes, not seconds, to do useful work.

Latency tax is still downtime if every big turn pays it

The operational impact is worse than “preflight compaction fails.” A failed preflight attempt can add about a minute of overhead before the model even sees the next turn. Because it holds the session write lock, it can also create contention for other session activity. Since the session remains near-full after the abort, the next step may still hit overflow recovery. That means the platform can pay for both the failed preventative path and the emergency path. Congratulations: your cost-control mechanism is now a latency amplifier.

The issue also notes there is no specific configuration to extend or disable preflight compaction alone. Setting compaction.enabled=false disables overflow recovery too, while memoryFlush.enabled=false does not disable preflight. That is a configuration design smell. Operators need separate controls for budget preflight, overflow recovery, timeout windows, and model selection because those paths have different risk profiles. Preventative compaction can be skipped if it is too slow. Overflow recovery may be the only thing between a session and a failed turn.

This lands one day after PR #95327, which addressed a neighboring token-governance problem: CJK-heavy tool output could be overestimated enough to trigger false overflow. Together, the two reports define the real scope of context engineering. You need accurate estimates, but you also need correct timeout semantics. A perfect token estimator is not enough if the compaction attempt is killed by the wrong abort signal. A generous timeout is not enough if the runtime enters compaction based on inflated counts.

For engineering teams running OpenClaw, the immediate move is to inspect compaction logs by trigger type. Separate budget / cli_budget from overflow / timeout_recovery. Look for clusters around 60–61 seconds. Measure lock contention during preflight attempts. If your compaction model routinely needs several minutes, assume a 60-second preflight cap is a functional failure, not a performance quirk. Also document whether disabling compaction is acceptable in your environment; for many long-lived coding agents, it will not be.

The product-level fix should be boring and explicit: preflight compaction needs its own timeout policy, cancellation semantics, and operator knob. It should not inherit an unrelated reply-operation abort unless the user deliberately chooses that behavior. Token governance is supposed to keep long sessions usable and costs bounded. When the governance layer reliably adds a minute of failed work before the real recovery path begins, it has crossed from safety mechanism into tax collection.

The uncomfortable part is that this class of bug often hides behind “large sessions are slow.” They are, but slowness with a crisp 60-second cliff is not ordinary scale pain. It is a policy boundary wearing a performance costume. Engineers should resist normalizing that. If a compaction budget exists, the runtime should either honor it, expose why it did not, or let operators choose the tradeoff explicitly.

Sources: OpenClaw issue #95553, OpenClaw v2026.6.9 release notes, OpenClaw PR #95327, OpenClaw PR #91737