Skip to content

fix: make compaction reinjection opt-in#85960

Merged
BunsDev merged 4 commits into
mainfrom
meow/henry-ux-orchestration-fixes
May 25, 2026
Merged

fix: make compaction reinjection opt-in#85960
BunsDev merged 4 commits into
mainfrom
meow/henry-ux-orchestration-fixes

Conversation

@BunsDev

@BunsDev BunsDev commented May 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make post-compaction AGENTS.md section reinjection opt-in via agents.defaults.compaction.postCompactionSections
  • carry that opt-in through post-compaction context and compaction-safeguard summary suffix paths, including the effective run workspace for AGENTS.md reads
  • keep explicit default section lists working, including legacy Every Session / Safety fallback only for opted-in configs
  • improve collapsed Control UI tool rows so summary text wraps/readably colors in light/dark themes, connector-copy string args are display-cleaned and bounded, and expanded details preserve raw input/output
  • update config help/docs and changelog

Fixes #45488.
Fixes #45649.
Supersedes #67090.

Verification

Final pushed head: 96101664f07a3a43f06311bf987b63fbdbe25f08, rebased on origin/main at 3dd0e8ed6a7cafdd2b4bf46114b417d758409f1b.

Final-base proof after the last rebase/autosquash:

  • pnpm exec oxfmt --check --threads=1 <changed files> -> passed
  • OPENCLAW_OXLINT_SKIP_PREPARE=1 node scripts/run-oxlint.mjs <changed ts/mjs files> -> passed
  • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo -> passed
  • git diff --check origin/main...HEAD && git diff --check -> passed
  • node 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 skipped
  • node scripts/run-vitest.mjs src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts -t "reads opted-in post-compaction context" -> 1 passed, 38 skipped
  • node scripts/run-vitest.mjs test/scripts/test-projects.test.ts -t "allows explicit split Vitest config targets" -> 1 passed, 86 skipped
  • node 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 passed
  • AUTOREVIEW_AUTO_TESTS=0 .agents/skills/autoreview/scripts/autoreview --mode branch -> clean, no accepted/actionable findings

Broader 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 passed
  • node scripts/run-vitest.mjs test/scripts/test-projects.test.ts -> 1 file, 87 passed
  • node 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 passed

Broad 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.yml does not contain a Testbox step
  • node scripts/crabbox-wrapper.mjs run --shell -- "pnpm check:changed" fell back to AWS and failed because this environment has no usable AWS credentials/IMDS access

Real 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:changed was not completed because both configured Crabbox remote providers were blocked by environment/provider setup as described above.

Copilot AI review requested due to automatic review settings May 24, 2026 06:46
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: M maintainer Maintainer-authored PR labels May 24, 2026
@clawsweeper

clawsweeper Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

PR Surface
Source +29, Tests +236, Docs +5. Total +270 across 21 files.

View PR surface stats
Area Files Added Removed Net
Source 9 85 56 +29
Tests 8 262 26 +236
Docs 4 9 4 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 21 356 86 +270

Summary
The PR makes AGENTS.md post-compaction reinjection require an explicit agents.defaults.compaction.postCompactionSections array, threads that policy through the safeguard summary path, updates docs/config help/tests/changelog, and improves collapsed Control UI tool-row wrapping and summary text.

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
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster
Patch quality: 🦐 gold shrimp
Summary: The proof signal is strong, but patch readiness is limited by the compatibility-sensitive compaction default change that still needs maintainer approval.

Rank-up moves:

  • Get explicit maintainer approval for the unset-config default flip, or preserve legacy unset behavior and add a clear opt-out path.
  • Complete or replace the broad changed-gate proof before landing if maintainers require full changed-surface validation.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
Sufficient (terminal): The PR body includes after-fix terminal verification plus browser computed-style proof for the Control UI CSS path, with the broad changed-gate gap disclosed.

Mantis proof suggestion
The Control UI collapsed tool-row readability change is visible browser behavior where a short visual proof would add useful maintainer confidence. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

visual task: verify collapsed Control UI tool rows wrap readable summary text in light and dark themes while expanded raw tool details remain unchanged.

Risk before merge

  • Existing users with no agents.defaults.compaction.postCompactionSections value will stop receiving post-compaction AGENTS.md reinjection after upgrade, which may remove project guidance they currently rely on.
  • The session-state tradeoff needs maintainer approval: reducing duplicated project context also changes which instructions are carried into future compacted sessions.
  • The PR body discloses that full pnpm check:changed did not complete because the configured remote proof providers were blocked, so broad gate coverage remains a merge-time proof gap.

Maintainer options:

  1. Approve the default flip
    Maintainers can accept that absent config now disables reinjection as the intended fix for duplicated project context, with the docs/tests making the opt-in path explicit.
  2. Keep unset configs compatible
    Revise the patch so existing unset configs retain their current behavior while an explicit setting disables or changes post-compaction reinjection.
  3. Pause for compaction policy
    Pause this PR until maintainers decide whether the linked session-bloat issue should be fixed by a breaking default change or a compatibility-preserving migration/opt-out path.

Next step before merge
The remaining blocker is a maintainer compatibility/session-state decision for a protected maintainer PR, not a safe automated repair lane.

Security
Cleared: The diff changes config/session behavior, docs, tests, and UI rendering but does not add dependencies, workflow execution, secret handling, or downloaded code paths.

Review findings

  • [P1] Preserve unset-config upgrade behavior — src/auto-reply/reply/post-compaction-context.ts:98-99
Review details

Best 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:

  • P2: The PR addresses bounded session-context and Control UI readability bugs with real upgrade impact but no core outage.
  • merge-risk: 🚨 compatibility: The patch changes the meaning of an absent public config key for existing installations.
  • merge-risk: 🚨 session-state: The changed compaction behavior affects which project instructions are carried into future agent session context.
  • rating: 🦐 gold shrimp: Current PR rating is 🦐 gold shrimp because proof is 🦞 diamond lobster, patch quality is 🦐 gold shrimp, and The proof signal is strong, but patch readiness is limited by the compatibility-sensitive compaction default change that still needs maintainer approval.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The PR body includes after-fix terminal verification plus browser computed-style proof for the Control UI CSS path, with the broad changed-gate gap disclosed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal verification plus browser computed-style proof for the Control UI CSS path, with the broad changed-gate gap disclosed.

Full review comments:

  • [P1] Preserve unset-config upgrade behavior — src/auto-reply/reply/post-compaction-context.ts:98-99
    This changes absent agents.defaults.compaction.postCompactionSections from the current default reinjection path to no reinjection. Existing users who never set the key can silently lose post-compaction AGENTS.md guidance, so this needs explicit maintainer approval for the breaking policy or a compatibility-preserving opt-out/migration path before merge.
    Confidence: 0.88

Overall correctness: patch is incorrect
Overall confidence: 0.86

What I checked:

  • Current main default behavior: Current main treats an absent agents.defaults.compaction.postCompactionSections as DEFAULT_POST_COMPACTION_SECTIONS, so unset configs still reinject the default AGENTS.md sections after compaction. (src/auto-reply/reply/post-compaction-context.ts:99, 5be62e779b2e)
  • Current main safeguard suffix behavior: Current main's compaction safeguard appends workspace-critical-rules by calling readWorkspaceContextForSummary() in both provider and LLM suffix assembly paths without a config gate. (src/agents/pi-hooks/compaction-safeguard.ts:984, 5be62e779b2e)
  • Documented current config contract: Current main docs and exported config comments say unset postCompactionSections defaults to ["Session Startup", "Red Lines"] and [] disables reinjection. Public docs: docs/gateway/config-agents.md. (docs/gateway/config-agents.md:681, 5be62e779b2e)
  • PR behavior change: The PR diff changes the same path to return null unless postCompactionSections is an explicit non-empty array and passes that setting into the safeguard runtime. (src/auto-reply/reply/post-compaction-context.ts:98, f79b9619cf19)
  • PR proof and status context: The PR body includes final-head format, lint, targeted Vitest, focused-suite, autoreview, and browser computed-style proof; the live PR metadata shows authorAssociation MEMBER and the protected maintainer label. (f79b9619cf19)
  • Linked issue discussion: The linked session-bloat discussion explicitly suggested making section parsing opt-in, while the linked UI issue/comments identify the collapsed tool row's contrast, truncation, smaller text, and stray with wording as the user-visible problem.

Likely related people:

  • efe-arv: Commit 03b9aba added configurable post-compaction context sections and the unset-config default contract that this PR changes. (role: introduced config behavior; confidence: high; commits: 03b9abab8486; files: src/auto-reply/reply/post-compaction-context.ts, src/config/types.agent-defaults.ts, src/config/schema.help.ts)
  • BunsDev: Git history maps BunsDev to Val Alexander, who authored prior merged dashboard-v2/tool-card work on the affected Control UI rendering and CSS paths, beyond this PR. (role: Control UI feature-history owner; confidence: high; commits: f76a3c5225bb, ca414735b9ee, df72ca1ecec7; files: ui/src/styles/chat/tool-cards.css, ui/src/ui/chat/grouped-render.ts, ui/src/ui/chat/tool-cards.ts)
  • 康熙: Commit 35a3e1b added the original post-compaction workspace context injection path that later became configurable. (role: introduced behavior; confidence: medium; commits: 35a3e1b788d6; files: src/auto-reply/reply/post-compaction-context.ts)
  • Peter Steinberger: Current-main blame in this checkout points the active compaction and tool-card lines to a recent broad main snapshot commit, which is useful routing context but weak feature ownership proof. (role: recent line carrier; confidence: low; commits: b972ac194042; files: src/auto-reply/reply/post-compaction-context.ts, src/agents/pi-hooks/compaction-safeguard.ts, ui/src/styles/chat/tool-cards.css)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 5be62e779b2e.

@BunsDev
BunsDev force-pushed the meow/henry-ux-orchestration-fixes branch from f442b46 to 128dcae Compare May 24, 2026 06:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.postCompactionSections is 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.

Comment thread src/auto-reply/reply/post-compaction-context.test.ts Outdated
Comment thread ui/src/styles/chat/tool-cards.test.ts
@BunsDev BunsDev self-assigned this May 24, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels May 24, 2026
@clawsweeper

clawsweeper Bot commented May 24, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress.

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.
What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

Copilot AI commented May 24, 2026

Copy link
Copy Markdown
Contributor

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:

  • https://api.github.com/repos/openclaw/openclaw/pulls/85960/reviews/4351931932
    • Triggering command: /usr/bin/gh gh api repos/openclaw/openclaw/pulls/85960/reviews/4351931932 git conf�� get --local k/_temp/ghcca-node/node/bin/node user.email (http block)
  • https://api.github.com/repos/openclaw/openclaw/pulls/85960/reviews/4351931932/comments
    • Triggering command: /usr/bin/gh gh api repos/openclaw/openclaw/pulls/85960/reviews/4351931932/comments --paginate conf�� ck.js || npm run build --local k/openclaw/openclaw/node_modules/.bin/sh user.email (http block)

If you need me to access, download, or install something from one of these locations, you can either:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels May 24, 2026
@BunsDev
BunsDev force-pushed the meow/henry-ux-orchestration-fixes branch from 29bdd4b to 3b1434e Compare May 24, 2026 10:05
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label May 24, 2026
@BunsDev
BunsDev force-pushed the meow/henry-ux-orchestration-fixes branch from 3b1434e to f6b521b Compare May 24, 2026 10:13
@BunsDev
BunsDev force-pushed the meow/henry-ux-orchestration-fixes branch from 6c3f819 to 425b2e2 Compare May 24, 2026 12:52
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels May 24, 2026
@BunsDev
BunsDev force-pushed the meow/henry-ux-orchestration-fixes branch from 425b2e2 to 735d43f Compare May 24, 2026 13:15
@BunsDev
BunsDev force-pushed the meow/henry-ux-orchestration-fixes branch from 735d43f to f79b961 Compare May 24, 2026 13:19
@BunsDev
BunsDev force-pushed the meow/henry-ux-orchestration-fixes branch from f79b961 to 9610166 Compare May 25, 2026 05:53
@BunsDev
BunsDev merged commit ab910f8 into main May 25, 2026
114 of 116 checks passed
@BunsDev
BunsDev deleted the meow/henry-ux-orchestration-fixes branch May 25, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Tool bubble is unreadable in v2 UI [Bug]: #18049 introduces session bloat

3 participants