Skip to content

perf(tests): bound compaction identifier scans - #118422

Merged
steipete merged 2 commits into
mainfrom
codex/test-perf-compaction-regex
Aug 3, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/test-perf-compaction-regex

Conversation

@steipete

@steipete steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The compaction safeguard's opaque-identifier extractor could retry the greedy host/port alternative at every character of a very long non-identifier token. That made otherwise simple safeguard tests spend quadratic time scanning input.

Fix

Require the host/port alternative to start at an identifier token boundary. The regression fixture combines a 120 KB non-identifier token with valid hostname, path, IP, and dashed-host endpoints so the fast path and accepted endpoint forms stay covered.

Evidence

  • focused real time: 20.72s before, 9.97s after
  • Vitest duration: 17.89s before, 6.80s after
  • test bodies: 9.78s before, 1.80s after
  • rebased focused proof: 120 safeguard tests and 4 embedded-runner composition tests passed
  • final branch autoreview: clean, no accepted/actionable findings
  • production delta: +3/-1 lines; tests: +14 lines

No test sharding, concurrency, or coverage configuration changed.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Aug 3, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 11:43 PM ET / August 3, 2026, 03:43 UTC.

ClawSweeper review

What this changes

The branch makes opaque host/port identifier extraction start at a token boundary and adds a 120 KB regression case that preserves valid hostname, path, IP, and dashed-host endpoints.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this PR open for normal maintainer review. Current main still uses the unbounded host/port alternative, while this focused patch adds a token-boundary guard and regression coverage without changing configuration or public APIs.

Priority: P2
Reviewed head: 4f8aade81e25c1416b8803bff22c39253bca1d4f
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-consistent performance repair with direct timing evidence and a useful regression test; only normal protected-label review and exact-head CI remain.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body supplies after-fix focused wall-clock and Vitest timings plus a rebased focused-suite result; this is direct terminal-style evidence for the internal performance behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body supplies after-fix focused wall-clock and Vitest timings plus a rebased focused-suite result; this is direct terminal-style evidence for the internal performance behavior.
Evidence reviewed 7 items Current main lacks the bounded scan: Current main retains the host/port alternative without a left token-boundary condition, so the proposed behavior is not already implemented.
Patch applies the boundary at the owning extractor: The PR adds a negative lookbehind only to the host/port branch, leaving the existing hex, URL, path, Windows-path, and long-number alternatives intact.
Caller and audit boundary: The safeguard extracts identifiers from the ten most recent messages before it constructs and audits compaction summaries, so the repair is at the producer of the costly fact rather than a downstream workaround.
Findings None None.
Security None None.

How this fits together

The compaction safeguard extracts opaque identifiers from recent conversation messages before requesting a summary, then audits the returned summary for those identifiers. This extraction therefore affects both compaction latency and whether a safeguard retry is requested.

flowchart LR
  A[Recent conversation messages] --> B[Opaque identifier extraction]
  B --> C[Compaction summary request]
  C --> D[Generated summary]
  D --> E[Identifier quality audit]
  E --> F[Accept summary or retry]
Loading

Decision needed

Question Recommendation
Should this protected-label PR be accepted as the canonical performance repair once its exact merge result has green required checks? Approve after exact-head CI: Merge the narrow extractor fix once required checks validate the mergeable result against current main.

Why: The source and regression coverage support the repair, but the maintainer label requires an explicit human merge decision.

Before merge

  • Resolve merge risk (P1) - Required CI was still running at review time; merge should remain gated on the exact mergeable result rather than the timing claims alone.
  • Complete next step (P2) - The patch has no discrete repair finding; its protected maintainer label and in-progress exact-head CI require normal human merge review rather than a ClawSweeper repair lane.
Agent review details

Security

None.

PR surface

Source +2, Tests +14. Total +16 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 1 14 0 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 17 1 +16

Review metrics

Metric Value Why it matters
Production versus test LOC production +2, tests +14 The small production increase is directly justified by bounding a hot regex branch, while the test addition protects both performance and accepted identifier forms.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Merge the focused producer-side boundary guard once the exact merge result is green, retaining the new large-input regression and existing accepted endpoint forms.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Merge the focused producer-side boundary guard once the exact merge result is green, retaining the new large-input regression and existing accepted endpoint forms.

Do we have a high-confidence way to reproduce the issue?

Yes—source establishes that the unbounded host/port alternative can retry from every character of a long identifier-like token, and the PR supplies a focused 120 KB regression input. This read-only review did not execute the benchmark locally.

Is this the best way to solve the issue?

Yes—the token-boundary condition is the narrowest owner-side fix: it prevents repeated starts without adding caches, retries, configuration, or downstream suppression, and the test retains the supported endpoint forms.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against c3ea28af611a.

Labels

Label changes:

  • add P2: This is a concrete compaction-path performance bug with bounded scope and no demonstrated release-blocking failure.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix focused wall-clock and Vitest timings plus a rebased focused-suite result; this is direct terminal-style evidence for the internal performance behavior.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body supplies after-fix focused wall-clock and Vitest timings plus a rebased focused-suite result; this is direct terminal-style evidence for the internal performance behavior.

Label justifications:

  • P2: This is a concrete compaction-path performance bug with bounded scope and no demonstrated release-blocking failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body supplies after-fix focused wall-clock and Vitest timings plus a rebased focused-suite result; this is direct terminal-style evidence for the internal performance behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix focused wall-clock and Vitest timings plus a rebased focused-suite result; this is direct terminal-style evidence for the internal performance behavior.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: git blame attributes the current identifier extractor and summary-quality logic to the commit that introduced this compaction safeguard surface. (role: current feature introducer; confidence: high; commits: d93d07ac02ad; files: src/agents/agent-hooks/compaction-safeguard-quality.ts, src/agents/agent-hooks/compaction-safeguard.ts)
  • steipete: The PR’s two commits implement the focused extractor and regression update, and feature-history shortlog shows repeated contributions in the surrounding safeguard files. (role: recent area contributor; confidence: medium; commits: 2243b3192c0b, 4f8aade81e25; files: src/agents/agent-hooks/compaction-safeguard-quality.ts, src/agents/agent-hooks/compaction-safeguard.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Allow the required checks to complete against the exact mergeable result before deciding to merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete merged commit b58b205 into main Aug 3, 2026
126 of 132 checks passed
@steipete
steipete deleted the codex/test-perf-compaction-regex branch August 3, 2026 05:07
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* perf(tests): bound compaction identifier scans

* chore: keep release notes out of test PR

---------

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant