fix(reply): let preflight compaction use compaction timeout#95590
fix(reply): let preflight compaction use compaction timeout#95590yu-xin-c wants to merge 3 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 8:31 AM ET / 12:31 UTC. Summary PR surface: Source +64, Tests +194. Total +258 across 4 files. Reproducibility: yes. at source level: origin/main and v2026.6.10 still pass replyOperation.abortSignal into required preflight compaction, and compactWithSafetyTimeout races external aborts before the configured timeout. I did not run the reporter's exact slow vLLM/Qwen backend. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one canonical cancellation-signal fix with this filtered-signal contract after maintainer review, and keep the optional preflight config gate as a separate decision. Do we have a high-confidence way to reproduce the issue? Yes at source level: origin/main and v2026.6.10 still pass replyOperation.abortSignal into required preflight compaction, and compactWithSafetyTimeout races external aborts before the configured timeout. I did not run the reporter's exact slow vLLM/Qwen backend. Is this the best way to solve the issue? Yes, the revised filtered-signal shape is the best fix I found for this PR's scope: it ignores only lifecycle TimeoutError while preserving explicit and upstream non-timeout cancellation. The optional preflight config gate should remain a separate maintainer decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e4763b0631bf. Label changesLabel justifications:
Evidence reviewedPR surface: Source +64, Tests +194. Total +258 across 4 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
…law#95553) Adds a user-facing config gate to disable preflight (budget-triggered) compaction. When compaction.preflight.enabled === false, the pre-turn threshold check in runPreflightCompactionIfNeeded short-circuits to the existing session entry, so subsequent turns fall through to overflow recovery (which already honors compaction.timeoutSeconds with a 15min budget). The check is '=== false' against the literal value, so an unset key preserves the existing default-on behavior — the fix is strictly additive and does not change shipped behavior for any current user. This complements the four open PRs (openclaw#95561, openclaw#95563, openclaw#95580, openclaw#95590) that are all working on the abortSignal source for the preflight path. None of those PRs addresses the user-facing config dimension that the issue explicitly requests. Changes: - src/config/types.agent-defaults.ts: new AgentCompactionPreflightConfig type with optional enabled boolean - src/config/zod-schema.agent-defaults.ts: zod schema with strict mode - src/config/schema.help.ts + schema.labels.ts: help text + label - src/auto-reply/reply/agent-runner-memory.ts: 6-line early return in runPreflightCompactionIfNeeded, placed after isHeartbeat/isCli and before codex runtime so the gate is the only OpenClaw-specific path affected - src/auto-reply/reply/agent-runner-memory.test.ts: 1 new test (skips preflight compaction when enabled === false) using the same test fixture pattern as adjacent tests - scripts/repro/issue-95553-preflight-disabled-gate.mts: standalone real-environment proof that exercises the production gate Refs openclaw#95553
2e201ff to
7aa7246
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
7aa7246 to
0607489
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
What Problem This Solves
Fixes #95553. Required preflight compaction could inherit the outer reply-operation abort signal, so a short reply lifecycle timeout could cancel compaction before the configured compaction timeout had a chance to govern the required preflight work.
Why This Change Was Made
This keeps required preflight compaction bounded by the compaction layer while still preserving real cancellation.
ReplyOperationexposes an explicit cancellation signal for user stop and restart cancellation, and required preflight compaction now receives a scoped preflight abort signal that:TimeoutErroraborts so the compaction timeout owns slow required compaction;The patch is intentionally narrow: normal reply runs still use the existing operation abort signal, while required preflight compaction uses the filtered signal because it already has its own safety timeout.
User Impact
When a reply needs preflight compaction, users should see compaction complete or fail according to
compaction.timeoutSeconds, instead of being prematurely canceled by the reply lifecycle timeout path. If the user explicitly stops the run, an RPC abort arrives, or the run is restarted, the preflight compaction still cancels promptly instead of waiting for the compaction timeout.This PR is split out from #95563 to keep the P1 behavior fix reviewable on its own.
Evidence
node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner-memory.test.ts src/auto-reply/reply/reply-run-registry.test.ts src/agents/embedded-agent-runner.compaction-safety-timeout.test.tspassed after rebasing ontoorigin/main: 2 auto-reply files / 68 tests and 1 agents file / 22 tests.corepack pnpm tsgo:corepassed after rebasing ontoorigin/main.git diff --checkpassed.node --import tsxinvoked the productionrunPreflightCompactionIfNeededpath with a realReplyOperation, a slow compaction seam, a simulated lifecycleTimeoutError, and a realabortByUser()explicit cancellation. Redacted terminal output:Known remaining proof gap: I still have not added logs from the reporter's exact slow vLLM/Qwen backend. The new proof above exercises the production preflight entry and reply cancellation contract with a slow compaction seam, plus focused regression tests and typecheck.