Skip to content

fix(compaction): wire aggregate retry timeout through compaction.timeoutSeconds#94490

Closed
LZY3538 wants to merge 1 commit into
openclaw:mainfrom
LZY3538:fix/compaction-aggregate-timeout
Closed

fix(compaction): wire aggregate retry timeout through compaction.timeoutSeconds#94490
LZY3538 wants to merge 1 commit into
openclaw:mainfrom
LZY3538:fix/compaction-aggregate-timeout

Conversation

@LZY3538

@LZY3538 LZY3538 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #94391: the hardcoded COMPACTION_RETRY_AGGREGATE_TIMEOUT_MS (60s) fires before compaction model calls complete on large sessions (~200K tokens, ~143-187s observed), discarding valid provider results and triggering self-compounding retry storms.

Changes

In src/agents/embedded-agent-runner/run/attempt.ts:

  • Removed the hardcoded COMPACTION_RETRY_AGGREGATE_TIMEOUT_MS = 60_000 local constant
  • The aggregate timeout now uses the already-resolved compactionTimeoutMs from agents.defaults.compaction.timeoutSeconds (shipped default 180s)

Real behavior proof

  • Behavior addressed: Compaction aggregate retry wait hardcoded at 60s abandons valid provider results on large sessions. Observed: anthropic/claude-sonnet-4-6 compaction calls take 143-187s on ~200K-token sessions, yet the outer wait fires at exactly 60s, discarding the result.
  • Real environment tested: Linux Node 24, full repository checkout
  • Exact steps or command run after this patch:
    $ node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/compaction-retry-aggregate-timeout.test.ts --run
  • Evidence after fix:
    ✓ src/agents/embedded-agent-runner/run/compaction-retry-aggregate-timeout.test.ts (8 tests) 8 passed
    
    All 8 compaction retry aggregate timeout tests pass. The compactionTimeoutMs variable (default 180s) is accessible in scope at the aggregate wait site. With the shipped default of 180s, all three observed failure cases (143s, 174s, 187s) would have completed successfully within the timeout. No remaining references to the removed COMPACTION_RETRY_AGGREGATE_TIMEOUT_MS constant.
  • Observed result after fix: Aggregate timeout matches the inner model-call safety timeout, preventing the mismatch where the model call completes successfully (aborted=False) but the outer wait abandons it.
  • What was not tested: Live 200K-token session with anthropic/claude-sonnet-4-6 (requires a running Gateway with large session and API access)

Related

🤖 Generated with Claude Code

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 18, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 18, 2026
…outSeconds

The hardcoded COMPACTION_RETRY_AGGREGATE_TIMEOUT_MS (60s) fires before
compaction model calls complete on large sessions (~200K tokens, ~143-187s),
discarding valid provider results and triggering self-compounding retry storms.

Replace the hardcoded 60s constant with the already-resolved
compactionTimeoutMs from agents.defaults.compaction.timeoutSeconds
(shipped default 180s), which already governs the inner model-call safety
wrapper. Operators who have raised timeoutSeconds get the fix for free.

Fixes openclaw#94391

Co-Authored-By: Claude <[email protected]>
@LZY3538
LZY3538 force-pushed the fix/compaction-aggregate-timeout branch from 3e07186 to ec18ffa Compare June 18, 2026 08:39
@vincentkoc

Copy link
Copy Markdown
Member

Thanks @LZY3538 for the focused fix here. I am closing this as superseded by #94413 because both PRs target the same #94391 root cause: wiring the aggregate compaction retry wait away from the hardcoded 60s path and into the compaction timeout behavior.

Canonical path: #94413
This PR: #94490

I am keeping the canonical thread open there so review, validation, and follow-up stay in one place. Clownfish will preserve attribution/credit from this source PR in the cleanup record, and if this branch has a different reproduction path or still matters after the canonical fix path lands, please reply and we can reopen or split it back out.

@vincentkoc vincentkoc closed this Jun 18, 2026
@vincentkoc vincentkoc added the clownfish Tracked by Clownfish automation label Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clownfish Tracked by Clownfish automation size: XS triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI.

Projects

None yet

2 participants