fix: make compaction reinjection opt-in#85960
Conversation
|
Codex review: found issues before merge. Latest ClawSweeper review: 2026-05-24 13:31 UTC / May 24, 2026, 9:31 AM ET. Workflow note: Future ClawSweeper reviews update this same comment in place. How this review workflow works
PR Surface View PR surface stats
Summary Reproducibility: yes. at source level. Current main reinjects default AGENTS.md sections when the config key is absent and keeps collapsed tool rows small, muted, nowrap, and ellipsized; I did not run a live browser capture in this read-only review. PR rating Rank-up moves:
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. Real behavior proof Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Land only after maintainers approve the unset-config default flip or revise the patch to keep upgrade compatibility while providing a clear opt-out/opt-in contract. Do we have a high-confidence way to reproduce the issue? Yes, at source level. Current main reinjects default AGENTS.md sections when the config key is absent and keeps collapsed tool rows small, muted, nowrap, and ellipsized; I did not run a live browser capture in this read-only review. Is this the best way to solve the issue? Unclear as a final product choice. The implementation coherently reduces duplicate context and improves collapsed tool rows, but the unset-config default flip needs explicit maintainer approval or a compatibility-preserving path. Label justifications:
Full review comments:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 5be62e779b2e. |
f442b46 to
128dcae
Compare
There was a problem hiding this comment.
Pull request overview
Makes post-compaction AGENTS.md section reinjection opt-in (avoiding default session bloat/magic heading behavior) and improves Control UI collapsed tool-row readability while preserving raw expanded tool I/O.
Changes:
- Disable post-compaction AGENTS.md section reinjection unless
agents.defaults.compaction.postCompactionSectionsis explicitly configured (legacy fallback only when explicitly opting into the default pair). - Improve collapsed tool summary rendering (trim/whitespace normalization, remove leading “with”) and update grouped tool-bubble labels/previews to match.
- Update Control UI tool-card CSS for wrapping/readability, plus add/adjust tests and docs/changelog to reflect the new behavior.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/ui/chat/tool-cards.ts | Adds collapsed-summary normalization helpers and applies them to collapsed tool-card headers. |
| ui/src/ui/chat/tool-cards.test.ts | Adds coverage ensuring collapsed summaries are cleaned while expanded/raw details remain unchanged. |
| ui/src/ui/chat/grouped-render.ts | Uses the new collapsed-summary helpers for tool-bubble labels and bounded previews. |
| ui/src/ui/chat/grouped-render.test.ts | Adds regression test ensuring collapsed connector-copy cleanup doesn’t alter expanded raw input. |
| ui/src/styles/chat/tool-cards.css | Adjusts collapsed tool summary layout to wrap and remain readable (light/dark). |
| ui/src/styles/chat/tool-cards.test.ts | Adds a lightweight CSS fixture test asserting key readability-related properties. |
| src/auto-reply/reply/post-compaction-context.ts | Makes reinjection opt-in and restricts legacy heading fallback to explicit default-pair configs. |
| src/auto-reply/reply/post-compaction-context.test.ts | Updates tests for opt-in behavior and preserves legacy fallback coverage when explicitly enabled. |
| src/config/types.agent-defaults.ts | Updates config typing docs to reflect opt-in semantics for post-compaction sections. |
| src/config/schema.help.ts | Updates config help copy to describe opt-in behavior, legacy fallback conditions, and duplication risk. |
| src/config/schema.help.quality.test.ts | Tightens expectations for the updated help copy. |
| docs/reference/token-use.md | Clarifies that post-compaction AGENTS.md excerpts are separate from bootstrap and require opt-in. |
| docs/reference/session-management-compaction.md | Documents opt-in behavior for post-compaction AGENTS.md section reinjection. |
| docs/gateway/config-agents.md | Updates config docs/example to reflect opt-in semantics and legacy fallback behavior. |
| CHANGELOG.md | Adds changelog entry covering both the UI readability fix and opt-in reinjection change. |
|
ClawSweeper PR egg 🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress. Hatch commandComment Hatchability rules:
What is this egg doing here?
|
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
29bdd4b to
3b1434e
Compare
3b1434e to
f6b521b
Compare
6c3f819 to
425b2e2
Compare
425b2e2 to
735d43f
Compare
735d43f to
f79b961
Compare
f79b961 to
9610166
Compare
Summary
agents.defaults.compaction.postCompactionSectionsEvery Session/Safetyfallback only for opted-in configsFixes #45488.
Fixes #45649.
Supersedes #67090.
Verification
Final pushed head:
96101664f07a3a43f06311bf987b63fbdbe25f08, rebased onorigin/mainat3dd0e8ed6a7cafdd2b4bf46114b417d758409f1b.Final-base proof after the last rebase/autosquash:
pnpm exec oxfmt --check --threads=1 <changed files>-> passedOPENCLAW_OXLINT_SKIP_PREPARE=1 node scripts/run-oxlint.mjs <changed ts/mjs files>-> passednode scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo-> passedgit diff --check origin/main...HEAD && git diff --check-> passednode scripts/run-vitest.mjs src/agents/pi-hooks/compaction-safeguard.test.ts src/agents/pi-embedded-runner/extensions.test.ts -t "workspace"-> 4 files, 10 passed, 188 skippednode scripts/run-vitest.mjs src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts -t "reads opted-in post-compaction context"-> 1 passed, 38 skippednode scripts/run-vitest.mjs test/scripts/test-projects.test.ts -t "allows explicit split Vitest config targets"-> 1 passed, 86 skippednode scripts/run-vitest.mjs ui/src/ui/chat/tool-cards.test.ts ui/src/ui/chat/tool-cards.node.test.ts ui/src/ui/chat/grouped-render.test.ts ui/src/styles/chat/tool-cards.test.ts-> 4 files, 59 passedAUTOREVIEW_AUTO_TESTS=0 .agents/skills/autoreview/scripts/autoreview --mode branch-> clean, no accepted/actionable findingsBroader focused suites run earlier on the same patch family before busy-main rebases:
node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts-> 1 file, 39 passednode scripts/run-vitest.mjs test/scripts/test-projects.test.ts-> 1 file, 87 passednode scripts/run-vitest.mjs src/auto-reply/reply/post-compaction-context.test.ts src/agents/pi-hooks/compaction-safeguard.test.ts src/config/zod-schema.post-compaction-guard.test.ts src/config/schema.help.quality.test.ts-> 5 files, 240 passedBroad changed gate was attempted but blocked by environment/provider setup:
node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --shell -- "pnpm check:changed"failed because.github/workflows/crabbox-hydrate.ymldoes not contain a Testbox stepnode scripts/crabbox-wrapper.mjs run --shell -- "pnpm check:changed"fell back to AWS and failed because this environment has no usable AWS credentials/IMDS accessReal behavior proof
Behavior addressed: Post-compaction AGENTS.md reinjection is disabled unless users explicitly configure
agents.defaults.compaction.postCompactionSections; both post-compaction context and compaction-safeguard summary suffix paths honor that policy and read AGENTS.md from the run workspace. Collapsed Control UI tool rows remain readable without hiding normal summaries behind CSS ellipses, while raw expanded tool input/output remains unchanged.Real environment tested: Local OpenClaw worktree on macOS with Node/Vitest.
Exact steps or command run after this patch: See the Verification section for exact Vitest, format, oxlint, typecheck, diff-check, and autoreview commands.
Evidence after fix: Unit tests cover unset config returning null, explicit
[]disabled, explicit default sections enabled with legacy fallback, custom sections, compaction-safeguard summary default-disabled behavior, explicit summary opt-in, run-workspace AGENTS.md reads, collapsed display cleanup, bounded raw string fallback, and raw expanded details preservation.Observed result after fix: Final-base static checks, targeted CI-regression tests, UI regression suite, and autoreview passed on
96101664f0.What was not tested: Full
pnpm check:changedwas not completed because both configured Crabbox remote providers were blocked by environment/provider setup as described above.