feat: add per-agent compaction overrides#88506
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 29, 2026, 5:41 PM ET / 21:41 UTC. Summary Reproducibility: yes. for the PR blockers: source inspection of the current PR head shows the missing contextPruning export/schema support, defaults-only cache-TTL read, and duplicate agentId key. I did not run tests because this review is read-only. Review metrics: 1 noteworthy metric.
Stored data model 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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land a refreshed implementation that exports shared per-agent compaction/contextPruning resolvers, updates strict schema/docs/baselines, preserves existing defaults, and proves fresh-install plus upgrade behavior at the exact head. Do we have a high-confidence way to reproduce the issue? Yes for the PR blockers: source inspection of the current PR head shows the missing contextPruning export/schema support, defaults-only cache-TTL read, and duplicate agentId key. I did not run tests because this review is read-only. Is this the best way to solve the issue? No. The direction is plausible, but this is not the best merge state until the schema/resolver blockers, duplicate key, branch conflict, exact-head proof, and maintainer config-contract review are addressed. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 15de9d881a84. Label changesLabel justifications:
Evidence reviewedWhat 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
Review history (1 earlier review cycle)
|
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Closing due to inactivity. |
Summary
Adds per-agent
compactionandcontextPruningoverrides so each configured agent can resolve maintenance/runtime behavior from its active agent scope instead of always inheriting every value fromagents.defaults.This is for multi-agent installations where main, channel/proxy, local/self-hosted, and Codex/app-server agents need different compaction, pruning, timeout, thinking-level, and transcript-maintenance behavior.
Linked Issues And Related Work
Closes #52732
Related: #52751, #69988, #19501, #15826, #43834, #6571, #6572, #30452, #57901, #58077, #59863, #60512, #80784, #82008
Problem / Root Cause
Before this change, per-agent compaction settings were either rejected by schema or only partially honored. Several runtime paths still read
agents.defaults.compaction/agents.defaults.contextPruningeven when the activeagents.list[]entry had its own settings.That weakened these setups:
agentIdpreserved across queued/direct compaction and maintenance pathscompaction.thinkingLevel, not the active run's normal thinking levelWhat Changed
agents.list[].compactionand per-agentcontextPruning.compactionandcontextPruningblocks overagents.defaults, so partial overrides inherit unspecified fields.sessionAgentIdthrough queued/direct compaction, CLI compaction, context-engine maintenance, Codex app-server lifecycle, embedded cache-TTL finalization, memory flush, transcript rotation, and follow-up/notice paths.compaction.modelbehavior separate from Codex/app-server native runtime selection.Reviewer Notes
The key invariant is:
That is why this PR explicitly passes
agentIdinto compaction and maintenance params instead of relying only on parsingsessionKey.Real behavior proof
cfc4ff41b9fc7ee1709ca0429e2bb3f4c342868a(feat(compaction): add per-agent compaction overrides), a final single-commit squash on top of forkmainat26913e60a42e84dd256a682c5239be57f346e244.f723ad186d7879d12c61562dd4c2dab3745b5ed3. The final squash preserves the intended branch content as one commit, but exact-head proof has not yet been rerun forcfc4ff41b9fc7ee1709ca0429e2bb3f4c342868a./home/kklouzal/openclaw-pr-83637, detached checkoutf723ad186d7879d12c61562dd4c2dab3745b5ed3, Nodev24.15.0, pnpm11.2.2, modelgithub-copilot/gpt-5-mini, clean proof config at/home/kklouzal/openclaw-pr-83637/.artifacts/proof-refresh-f723ad18-20260527T050453Z/model-home/openclaw.json, redacted artifacts at/home/kklouzal/openclaw-pr-83637/.artifacts/proof-refresh-f723ad18-20260527T050453Z/redacted.f723ad186d7879d12c61562dd4c2dab3745b5ed3, ranpnpm install --frozen-lockfile,pnpm build:strict-smoke, focused compaction Vitest coverage,tsgocore and core-test typechecks,git diff --check, a source-import compaction config proof, cleanopenclaw config validate,openclaw models status --probe --json,openclaw infer model run --local --model github-copilot/gpt-5-mini,OPENCLAW_LIVE_MODELS=github-copilot/gpt-5-mini node scripts/test-live.mjs src/agents/models.profiles.live.test.ts, andOPENCLAW_LIVE_GATEWAY_MODELS=github-copilot/gpt-5-mini node scripts/test-live.mjs src/gateway/gateway-models.profiles.live.test.ts.22files /779tests;build:strict-smoke,tsgocore,tsgocore-test, andgit diff --checkpassed; the compaction config proof returnedstatus: pass; clean config validation passed; direct model output returnedOPENCLAW_PR83637_F723AD18_OK; live direct model suite passed17tests; live gateway suite passed68tests.Redacted command summary and compaction proof
{ "pr": 83637, "head": "f723ad186d7879d12c61562dd4c2dab3745b5ed3", "host": "Nano-01", "artifact": "/home/kklouzal/openclaw-pr-83637/.artifacts/proof-refresh-f723ad18-20260527T050453Z", "commands": { "01-install": "0", "02-build-strict-smoke": "0", "03-config-validate": "1", "04-focused-compaction-tests": "0", "05-tsgo-core": "0", "06-tsgo-core-test": "0", "07-diff-check": "0", "08-compaction-config-proof": "0", "09-clean-config-validate": "0", "10-models-status": "0", "11-model-run": "0", "12-live-models": "0", "13-live-gateway-models": "0" }, "markers": { "model": true, "liveModels": true, "liveGateway": true, "compactionConfig": true } }{ "status": "pass", "head": "f723ad186d7879d12c61562dd4c2dab3745b5ed3", "default": { "timeoutMs": 90000, "think": "minimal", "target": { "provider": "github-copilot", "model": "gpt-5-mini" }, "floor": 20000, "settings": { "applied": { "didOverride": true, "compaction": { "reserveTokens": 20000, "keepRecentTokens": 1024 } }, "reserve": 20000, "keep": 1024 } }, "flat": { "timeoutMs": 61000, "think": "off", "target": { "provider": "openai", "model": "gpt-5.4-mini" }, "floor": 0, "settings": { "applied": { "didOverride": true, "compaction": { "reserveTokens": 2048, "keepRecentTokens": 512 } }, "reserve": 2048, "keep": 512 } }, "nested": { "timeoutMs": 122000, "think": "high", "target": { "provider": "github-copilot", "model": "gpt-5.4-mini", "authProfileId": "copilot-auth" }, "floor": 24000, "settings": { "applied": { "didOverride": true, "compaction": { "reserveTokens": 24000, "keepRecentTokens": 2048 } }, "reserve": 24000, "keep": 2048 } }, "smallWindow": { "applied": { "didOverride": true, "compaction": { "reserveTokens": 8384, "keepRecentTokens": 512 } }, "reserve": 8384, "keep": 512 }, "runtime": { "provider": "openai", "model": "gpt-5.4-mini", "thinkLevel": "off" } }timeoutMs=90000,think=minimal, andgithub-copilot/gpt-5-mini;flat-agentoverrode totimeoutMs=61000,think=off, provider/modelopenai/gpt-5.4-mini, and dropped the mismatched auth profile;nested-agentoverrode totimeoutMs=122000,think=high,github-copilot/gpt-5.4-mini, and retained the matching auth profile; small-context capping reduced reserve tokens to8384for a 16K context budget. Real direct and gateway model requests completed successfully after the patch.Validation
Acceptance commands requested by ClawSweeper:
Result:
Schema baseline:
Config docs baseline:
Note: this docs-baseline check initially caught stale committed hash drift. Regenerated
docs/.generated/config-baseline.sha256, committed it as04170e48eb01fc29f7f3acb1a830c5742b41c3ea, and reran the check successfully.Additional gate:
Final Merge/Polish Validation
After conflict cleanup, final branch polish, and latest main merge repair, the old branch line was pushed at
f239d594d22b56837bb371770898c30759e81515. That line was later rebased and squashed into the current formal PR headcfc4ff41b9fc7ee1709ca0429e2bb3f4c342868a.Final local gates on the prior pushed line:
Current Branch State
maincfc4ff41b9fc7ee1709ca0429e2bb3f4c342868amainat26913e60a42e84dd256a682c5239be57f346e244.git diff --stat origin/main...fork/feat/agent-compaction-overrides: 82 files changed, 3613 insertions, 398 deletions.git rev-list --left-right --count origin/main...fork/feat/agent-compaction-overrides:1 1because the branch is based on the pinned green fork-main commit one commit behind upstream.fork/main.git diff --check origin/main...fork/feat/agent-compaction-overrides: passed.