Skip to content

fix(text): bound compactText for tiny caps - #576

Merged
steipete merged 5 commits into
openclaw:mainfrom
anagnorisis2peripeteia:fix/string-helper-bounds
Jul 19, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
anagnorisis2peripeteia:fix/string-helper-bounds

Conversation

@anagnorisis2peripeteia

@anagnorisis2peripeteia anagnorisis2peripeteia commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • make compactText(value, maxLength) obey its maximum length for caps smaller than the three-character ellipsis
  • add focused boundary regression coverage for caps 0, 1, 2, 3, 4, 16, and 17
  • narrow the original mixed helper patch to the independently reproducible issue

Proof

Built output on Node 26.5.0:

cap  output                 length
0    ""                     0
1    "a"                    1
2    "ab"                   2
3    "..."                  3
4    "a..."                 4
16   "abcdefghijklm..."     16
17   "abcdef ... uvwxyz"    17
  • focused regression: 1 passed, 0 failed
  • AutoReview: clean, no accepted or actionable findings
  • local full check reached 1,353 passing tests; four unchanged environment-sensitive failures reproduce outside this diff because this macOS host lacks GNU timeout and the runtime packaging test does not resolve the compiler service under this local setup
  • hosted exact-head CI is the merge gate

Thanks @anagnorisis2peripeteia for the report, original fix, and boundary tests.

Closes #573.

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Jul 15, 2026
@clawsweeper

clawsweeper Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 18, 2026, 10:23 PM ET / July 19, 2026, 02:23 UTC.

Summary
The branch makes compactText(value, maxLength) stay within tiny caps and adds focused boundary regression coverage.

Reproducibility: yes. from source and the PR’s focused terminal proof: the previous small-cap branch appended a three-character ellipsis even when the cap was 0, 1, or 2. The supplied regression directly exercises the affected helper boundary.

Review metrics: 1 noteworthy metric.

  • Patch scope: 2 files affected; 25 added, 1 removed. The final patch is narrowly limited to one formatter guard and its focused regression test.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Risk before merge

  • [P1] The supplied exact-head check state still has pnpm check and Actions analysis in progress, so merge should refresh required checks on the current head.

Maintainer options:

  1. Decide the mitigation before merge
    Land the isolated tiny-cap guard and its regression coverage once the exact-head required checks complete successfully.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] No mechanical repair remains; let the exact-head checks complete and route the normal merge decision to the likely area contributor.

Security
Cleared: The final diff changes only local string truncation behavior and a unit test; it adds no dependencies, workflow changes, permissions, secrets handling, or execution surface.

Review details

Best possible solution:

Land the isolated tiny-cap guard and its regression coverage once the exact-head required checks complete successfully.

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

Yes, from source and the PR’s focused terminal proof: the previous small-cap branch appended a three-character ellipsis even when the cap was 0, 1, or 2. The supplied regression directly exercises the affected helper boundary.

Is this the best way to solve the issue?

Yes. Returning a plain prefix when an ellipsis cannot fit preserves the documented cap invariant without introducing new configuration or changing normal truncation behavior.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • remove merge-risk: 🚨 security-boundary: Current PR review selected no merge-risk labels.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P3: This fixes a bounded internal formatting edge case with low user-facing blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster 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 contains after-fix Node 26.5.0 terminal output for the changed helper, showing all demonstrated outputs remain within their requested caps, alongside a passing focused regression.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body contains after-fix Node 26.5.0 terminal output for the changed helper, showing all demonstrated outputs remain within their requested caps, alongside a passing focused regression.
Evidence reviewed

What I checked:

Likely related people:

  • steipete: Authored the final scope-narrowing commit and renamed the PR to the compact-text-only change, making them the clearest routing contact for the current branch direction. (role: recent area contributor; confidence: medium; commits: 2078564ff665, b7f479af1a74; files: src/repair/text-utils.ts)
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.

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.
Review history (5 earlier review cycles)
  • reviewed 2026-07-15T08:21:39.768Z sha a3faecc :: needs changes before merge. :: [P1] Keep malformed bot identities out of the trusted actor set
  • reviewed 2026-07-16T03:08:59.940Z sha f378710 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-16T21:44:28.791Z sha f378710 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-18T09:34:13.907Z sha f378710 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-19T00:30:19.028Z sha f378710 :: needs maintainer review before merge. :: none

Four internal string helpers violated their invariants on inputs outside their
current call sites (all callers pass safe values, so these are latent, surfaced
by property-testing with einsiedlerkrebs):

- trimMiddle: maxLength < 120 made `edge` negative — slices read the wrong ends
  (`slice(-0)` returns the whole string) and the "truncated N" count exceeded the
  input length. Fall back to a simple head truncation.
- compactText: maxLength <= 2 returned the bare "..." (length 3), overflowing the
  cap. Drop the ellipsis when there is no room for it.
- slug: the length slice ran after the trailing-dash trim, so slicing on a "-"
  boundary re-introduced a trailing dash — not idempotent. Re-trim post-slice.
- normalizeGitHubActor: stripped only one trailing [bot], leaving a residual on a
  doubled suffix — not idempotent. Strip all trailing [bot].

Adds regression + unregression tests for each.

Closes openclaw#571
Closes openclaw#572
Closes openclaw#573
Closes openclaw#574
@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@brokemac79

Copy link
Copy Markdown
Contributor

Thanks for the contribution. We are reviewing this together with #571, #572, #573, and #574.

The recent stability incident means we are deliberately holding non-incident changes for careful maintainer review while we confirm the recovered review/publication path remains stable. The small helper fixes look separable, but the actor-normalisation portion needs deliberate checking against the mutation-authorisation boundary before we decide how to proceed.

We will return with a concrete maintainer decision; no further branch changes are requested at present.

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@anagnorisis2peripeteia

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 17, 2026
@brokemac79

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@anagnorisis2peripeteia
anagnorisis2peripeteia marked this pull request as draft July 19, 2026 00:27
@anagnorisis2peripeteia
anagnorisis2peripeteia marked this pull request as ready for review July 19, 2026 00:28
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jul 19, 2026
@steipete steipete changed the title fix(text): harden string helpers against small/degenerate inputs fix(text): bound compactText for tiny caps Jul 19, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. merge-risk: 🚨 security-boundary 🚨 Merging this PR could weaken sandboxing, authorization, credentials, or sensitive data. labels Jul 19, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@steipete
steipete merged commit f8d5393 into openclaw:main Jul 19, 2026
13 checks passed
@anagnorisis2peripeteia
anagnorisis2peripeteia deleted the fix/string-helper-bounds branch September 9, 2026 00:36
azaj01 pushed a commit to azaj01/clawsweeper that referenced this pull request Sep 21, 2026
* fix(text): harden string helpers against small/degenerate inputs

Four internal string helpers violated their invariants on inputs outside their
current call sites (all callers pass safe values, so these are latent, surfaced
by property-testing with einsiedlerkrebs):

- trimMiddle: maxLength < 120 made `edge` negative — slices read the wrong ends
  (`slice(-0)` returns the whole string) and the "truncated N" count exceeded the
  input length. Fall back to a simple head truncation.
- compactText: maxLength <= 2 returned the bare "..." (length 3), overflowing the
  cap. Drop the ellipsis when there is no room for it.
- slug: the length slice ran after the trailing-dash trim, so slicing on a "-"
  boundary re-introduced a trailing dash — not idempotent. Re-trim post-slice.
- normalizeGitHubActor: stripped only one trailing [bot], leaving a residual on a
  doubled suffix — not idempotent. Strip all trailing [bot].

Adds regression + unregression tests for each.

Closes openclaw#571
Closes openclaw#572
Closes openclaw#573
Closes openclaw#574

* test(repair): keep mutation actor matching fail-closed

* test(text): pin helper boundary semantics

* fix(text): narrow hardening to compact text bounds

Co-authored-by: Cameron Beeley <[email protected]>

---------

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

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compactText: overflows maxLength for small caps (returns bare '...')

3 participants