Skip to content

perf(text): prepare long replies faster at ASCII boundaries - #163573

Merged
obviyus merged 1 commit into
openclaw:mainfrom
boeingchoco:codex/perf-text-chunking
Oct 7, 2026
Merged

obviyus merged 1 commit into
openclaw:mainfrom
boeingchoco:codex/perf-text-chunking

Conversation

@boeingchoco

@boeingchoco boeingchoco commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Preparing long replies for channel delivery spends avoidable time checking character boundaries between ASCII characters.

User Impact

Long replies containing ASCII boundaries take less CPU time to split before channel delivery. Existing chunk contents and Unicode handling remain unchanged; there are no configuration or migration requirements. This measures reply preparation, not model generation or network latency. Unicode-heavy inputs have no demonstrated performance benefit.

Why This Change Was Made

findGraphemeChunkEnd creates a segment view over the full source for every cut. The shortcut accepts integer boundaries between two ASCII code units, excluding CRLF. Other boundaries use the existing Intl.Segmenter path, including the Bun surrogate workaround. Unicode grapheme rules support this boundary check.

Evidence

Candidate 7c8e2fcaf497fb4f210d093580ffe0875011a8b7, updated on October 4, 2026 against upstream main 6aefbb11f30aabb872e7fc379e4b97af7217903c. The final diff is one production file with 13 added lines. All earlier fixture repairs are incorporated from main. No test, dependency, schema, configuration, timeout, ignore, or CI changes remain in this PR.

Measured the actual src/auto-reply/chunk.ts:chunkText entrypoint on Linux x64, Node 26.10.0. These measurements used base a6b9da2bdeeeb5d666fe7434972acd84451af6fd; both compiled bundles differ only in grapheme.ts. The boundary owner and reply/Markdown callers are unchanged between that base and the refreshed base. Limit: 4,000 UTF-16 units; three warmups; nine alternating samples; median per invocation. All measured chunk arrays are identical.

Input UTF-16 units Before (ms) After (ms) Speedup
ASCII 16,000 0.114 0.074 1.53x
ASCII 100,000 2.131 1.176 1.81x
ASCII 1,000,000 497.413 261.636 1.90x
Mixed 16,000 0.214 0.160 1.34x
Mixed 100,000 14.292 8.357 1.71x
Mixed 1,000,000 118.770 29.076 4.08x
Unicode 16,000 0.041 0.041 1.01x
Unicode 100,000 0.525 0.550 0.95x
Unicode 1,000,000 19.064 26.642 0.72x

The 1,000,000-unit Unicode case was approximately 40% slower in this run, despite retaining segmentation. A separate fresh-process Unicode-only check with 20 warmups and nine alternating samples measured 100,000 units at 1.195 → 1.199 ms and 1,000,000 units at 221.399 → 168.896 ms, with identical output. The direction and magnitude vary between runs, so the Unicode slowdown in the full table is retained rather than treated as a stable estimate. No consistent Unicode improvement, whole-pipeline latency benefit, or cross-runtime performance gain is claimed. These are synthetic inputs; the largest cases are stress workloads.

  • Final-head GitHub CI: run 37196424676 succeeded on 7c8e2fcaf497fb4f210d093580ffe0875011a8b7: 134 successful jobs, 18 intentionally skipped, no failures. The PR rollup has 163 successful checks, no failures or pending checks; GitHub reports MERGEABLE / CLEAN.
  • Final-base verification: pnpm test src/infra/push-web.test.ts src/gateway/server-methods/sessions-mutations.owner.test.ts src/gateway/server-methods/chat.directive-tags.test.ts packages/normalization-core/src/grapheme.test.ts packages/normalization-core/src/utf16-slice.test.ts src/shared/text-chunking.test.ts packages/markdown-core/src/chunk-text.test.ts src/auto-reply/chunk.test.ts packages/markdown-core/src/render-aware-chunking.test.ts --maxWorkers=1 passed all 338 tests across nine files, 73.64 s runner wall. This exercises all previously failing files and the actual reply/Markdown boundary contracts on the final head.
  • Earlier exhaustive compatibility proof remains valid for the unchanged boundary owner and callers: 77,536 boundary comparisons and 18,000 real reply/Markdown/paragraph output comparisons passed, including small/fractional limits, combining marks, CRLF, emoji, malformed surrogates, and Unicode separators.
  • Independent Codex review: scoped-clean through P2. The final production patch is byte-for-byte identical to the reviewed patch; temporary fixture repairs were removed in favor of upstream owners.
  • Scoped type-aware lint, formatting, static ratchets, plugin boundaries, dependency/wrapper checks, dead-export scans and git diff --check passed. Earlier core production and related package/messaging type checks passed on the same production source. Temporary fixture repairs also passed canonical Gateway test types and existing full-file assertions. Locally, full build/full suite, all core-test type graphs, live channels and Bun/browser execution were not run for this update.
Earlier CI failures and upstream repairs

CI run 37188963185 tested the earlier head 79be485c2dfffa331bc85cc22ff1028945aae923 and failed two test jobs; those failures also made two aggregate gate entries red.

  • Web Push failed after a successful worker write because its table assertion used retained schema facts without admitting a read operation. The same failure reproduced on the unoptimized base. Main fixed this with runSqliteReadOperationSync in 8cabfb2814f.
  • Dashboard defaults failed when the fixture closed storage before asynchronous session-row publication settled. Main now waits for flushPendingSessionsChangedEvents before its durability probe in e95e11c6793. The intermittent hosted race did not reproduce deterministically; passing earlier replays alone were not treated as proof of a fix.
  • That same worker migration left the WebChat fixture connected only to its former synchronous reader. CI run 37193595981 and the original 29-file local manifest reproduced 13 failures in chat.directive-tags.test.ts. Main now connects both reader paths to the existing synthetic fixture and preserves activity checks in 6aefbb11f30.

Temporary fixture repairs passed the full WebChat file (132 tests), the full Gateway manifest (594 tests, 12 local skips) and independent P2 review. CI run 37194965968 succeeded on intermediate head 4899bdb7b296535a32edce22df66e580c9a6cc1b: 136 successful jobs, 17 skipped, no failures. While that run finished, the equivalent WebChat repair landed on main, causing a real merge conflict. Taking main's complete fixtures and removing the temporary repair commit resolves that conflict and returns the PR to its original optimization-only scope. The prior successful run is prior-head evidence; final-head CI remains a separate check.

Reproduce the benchmark

Save the following as bench-text-chunking.mjs outside the checkout, then run node /path/to/bench-text-chunking.mjs from the candidate checkout after installing its locked dependencies. Temporary bundles are removed by the script. The baseline source is read from the pinned Git commit.

import assert from 'node:assert/strict';
import { execFileSync } from 'node:child_process';
import { mkdtemp, readFile, rm } from 'node:fs/promises';
import { createRequire } from 'node:module';
import os from 'node:os';
import path from 'node:path';
import { pathToFileURL } from 'node:url';

// Run from the candidate checkout. Both bundles differ only in grapheme.ts.
const root = process.cwd();
const base = process.argv[2] ?? 'a6b9da2bdeeeb5d666fe7434972acd84451af6fd';
const sourcePath = 'packages/normalization-core/src/grapheme.ts';
const original = execFileSync('git', ['show', `${base}:${sourcePath}`], { cwd: root, encoding: 'utf8' });
const { build } = createRequire(pathToFileURL(path.join(root, 'package.json')))('esbuild');
const directory = await mkdtemp(path.join(os.tmpdir(), 'openclaw-chunk-bench-'));
const median = (values) => values.toSorted((a, b) => a - b)[Math.floor(values.length / 2)];

try {
  const modules = {};
  for (const version of ['before', 'after']) {
    const outfile = path.join(directory, `${version}.mjs`);
    await build({
      absWorkingDir: root,
      entryPoints: ['src/auto-reply/chunk.ts'],
      bundle: true,
      platform: 'node',
      format: 'esm',
      outfile,
      plugins: version === 'before' ? [{
        name: 'original-grapheme-owner',
        setup(builder) {
          builder.onLoad({ filter: /[/\\]grapheme\.ts$/ }, (args) =>
            args.path === path.join(root, sourcePath)
              ? { contents: original, loader: 'ts', resolveDir: path.dirname(args.path) }
              : undefined);
        },
      }] : [],
    });
    modules[version] = await import(pathToFileURL(outfile).href);
  }
  console.log(JSON.stringify({ node: process.version, platform: process.platform, architecture: process.arch, base,
    candidateSourceBytes: (await readFile(path.join(root, sourcePath))).length,
    entryPoint: 'src/auto-reply/chunk.ts:chunkText', limit: 4000, samples: 9 }));
  for (const [label, unit] of [
    ['ASCII', 'Long response text with spaces. '],
    ['Mixed', '반도체 AI report 😀 revenue growth with code. '],
    ['Unicode', '한글결합e\u0301👨‍👩‍👧‍👦。\u0301'],
  ]) {
    for (const length of [16000, 100000, 1000000]) {
      const text = unit.repeat(Math.ceil(length / unit.length)).slice(0, length);
      const expected = modules.before.chunkText(text, 4000);
      assert.deepEqual(modules.after.chunkText(text, 4000), expected);
      for (let warmup = 0; warmup < 3; warmup++) {
        modules.before.chunkText(text, 4000);
        modules.after.chunkText(text, 4000);
      }
      const batches = length === 16000 ? 20 : 1;
      const samples = { before: [], after: [] };
      for (let sample = 0; sample < 9; sample++) {
        for (const version of sample % 2 ? ['after', 'before'] : ['before', 'after']) {
          const start = performance.now();
          for (let batch = 0; batch < batches; batch++) modules[version].chunkText(text, 4000);
          samples[version].push((performance.now() - start) / batches);
        }
      }
      const beforeMs = median(samples.before);
      const afterMs = median(samples.after);
      console.log(JSON.stringify({ label, length, chunks: expected.length, beforeMs, afterMs,
        speedup: beforeMs / afterMs, percentSaved: 100 * (1 - afterMs / beforeMs),
        outputIdentical: true }));
    }
  }
} finally {
  await rm(directory, { recursive: true, force: true });
}

Maintainer-intent check: No overlap with Pash/Sarah changes; no commits by either author touch the changed grapheme owner on current main.

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 7:13 AM ET / 11:13 UTC (Revision 11).

ClawSweeper review

What this changes

The PR speeds long-reply preparation by skipping Unicode segmentation at safe ASCII boundaries while preserving existing chunk contents.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a useful, bounded performance improvement absent from current main and the latest release. The supplied production-entrypoint benchmark supports the claimed benefit; no actionable correctness or security finding remains.

Priority: P2
Reviewed head: 7c8e2fcaf497fb4f210d093580ffe0875011a8b7

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct optimization with strong scoped performance evidence and successful final-head CI.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied Node/Linux benchmark exercises the changed grapheme owner through the actual reply chunkText entrypoint, reports faster ASCII/mixed preparation and identical output, and remains applicable after verified source-identity checks. Unicode timings are explicitly inconclusive. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied Node/Linux benchmark exercises the changed grapheme owner through the actual reply chunkText entrypoint, reports faster ASCII/mixed preparation and identical output, and remains applicable after verified source-identity checks. Unicode timings are explicitly inconclusive. No stored-data contract changes.
Evidence reviewed 8 items Pinned introduced patch: The merge-base-to-head delta adds only the ASCII shortcut. It requires an integer boundary, checks both adjacent code units, excludes CRLF, and retains the existing Unicode and partial-cut paths.
Current-main necessity: Current main still segments every interior preferred cut; it does not contain the proposed ASCII shortcut. The relevant reply and Markdown callers otherwise match the candidate.
Latest-release comparison: The published stable release v2026.9.8 also lacks the ASCII shortcut and uses segmentation for interior cuts.
Findings None None.
Security None None.

How this fits together

OpenClaw splits outgoing replies into chunks that fit channel limits. A shared text-boundary owner keeps Unicode characters intact for plain-text and Markdown delivery.

flowchart TD
  A[Outgoing reply] --> B[Plain text or Markdown chunker]
  B --> C[Preferred cut and size limit]
  C --> D{Safe ASCII boundary?}
  D -->|Yes| E[Accept cut directly]
  D -->|No| F[Unicode segmentation]
  E --> G[Chunks for channel delivery]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +13. Total +13 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 13 0 +13
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 13 0 +13

Review metrics

None.

Technical review

Best possible solution:

Keep the optimization in the existing boundary owner, preserving Unicode fallback and limiting performance claims to the measured reply-preparation workloads.

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

Not applicable to a correctness bug; the body provides reproducible before/after measurements of the production reply chunker, which this read-only review did not execute.

Is this the best way to solve the issue?

Yes: the shortcut stays within the existing owner and preserves segmentation for every boundary outside its narrow ASCII condition.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7340738654fc.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This bounded optimization reduces reply-preparation CPU cost without changing configuration or visible message contents.
  • 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 (live_output): The supplied Node/Linux benchmark exercises the changed grapheme owner through the actual reply chunkText entrypoint, reports faster ASCII/mixed preparation and identical output, and remains applicable after verified source-identity checks. Unicode timings are explicitly inconclusive. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied Node/Linux benchmark exercises the changed grapheme owner through the actual reply chunkText entrypoint, reports faster ASCII/mixed preparation and identical output, and remains applicable after verified source-identity checks. Unicode timings are explicitly inconclusive. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced patch: The merge-base-to-head delta adds only the ASCII shortcut. It requires an integer boundary, checks both adjacent code units, excludes CRLF, and retains the existing Unicode and partial-cut paths. (packages/normalization-core/src/grapheme.ts:52, 7c8e2fcaf497)
  • Current-main necessity: Current main still segments every interior preferred cut; it does not contain the proposed ASCII shortcut. The relevant reply and Markdown callers otherwise match the candidate. (packages/normalization-core/src/grapheme.ts:52, 7340738654fc)
  • Latest-release comparison: The published stable release v2026.9.8 also lacks the ASCII shortcut and uses segmentation for interior cuts. (packages/normalization-core/src/grapheme.ts:34, fc23bc864e45)
  • Production behavior proof: The complete supplied PR body, captured under sourceRevision 4657da0ce44f82fdb5060fc9f4e73adae5fe5a71289cf7ff8ddc79ebe72f6bf0, reports Linux x64 Node 26.10.0 measurements through chunkText with a 4,000-unit limit and identical chunk arrays. ASCII samples improve 1.53–1.90x and mixed samples improve 1.34–4.08x. Unicode results vary between runs and support no consistent benefit. The benchmark code was inspected but not executed. (src/auto-reply/chunk.ts:291, 7c8e2fcaf497)
  • Benchmark applicability after refresh: GitHub content blob identities at benchmark baseline a6b9da2 match the refreshed base for grapheme.ts, auto-reply/chunk.ts, shared/text-chunking.ts, markdown-core/chunk-text.ts, and render-aware-chunking.ts. This independently supports reuse of the earlier measurements. (packages/normalization-core/src/grapheme.ts, 6aefbb11f30a)
  • Existing boundary coverage: Read the boundary tests covering CRLF, combining marks, Indic conjuncts, emoji, hard budgets, invalid preferences, and partial-cut policy, plus shared chunker tests covering ASCII and fractional limits. The body reports 338 final-head tests and extensive output comparisons; these supplement the production benchmark. No tests were run during this read-only review. (packages/normalization-core/src/utf16-slice.test.ts:69, 7c8e2fcaf497)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • etzelm: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-02T16:20:03.108Z sha 2c8fdfa769b2e4ce0a3d9c514d08aa3fd2eaf305 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-04T08:31:33.083Z sha 79be485c2dfffa331bc85cc22ff1028945aae923 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-04T09:12:08.326Z sha 79be485c2dfffa331bc85cc22ff1028945aae923 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-04T09:39:27.867Z sha 13c80e82b4014508891e37a922dd7d25f51ebacb :: needs changes before merge. :: none
  • reviewed 2026-10-04T09:47:32.528Z sha 2bfa777ce021b5722b1119262e61ebb3d03e2b2c :: needs changes before merge. :: none
  • reviewed 2026-10-04T09:58:22.831Z sha 486e8ecb80ce871d0efafa7c31458bd4dae679bb :: needs maintainer review before merge. :: none
  • reviewed 2026-10-04T10:24:10.027Z sha 4899bdb7b296535a32edce22df66e580c9a6cc1b :: needs maintainer review before merge. :: none
  • reviewed 2026-10-04T10:49:46.397Z sha 7c8e2fc :: needs maintainer review before merge. :: none

@boeingchoco
boeingchoco marked this pull request as ready for review October 2, 2026 16:14
Copilot AI balanced review requested due to automatic review settings October 2, 2026 16:14

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@boeingchoco
boeingchoco force-pushed the codex/perf-text-chunking branch 2 times, most recently from 79be485 to 13c80e8 Compare October 4, 2026 09:32
@boeingchoco boeingchoco changed the title improve: prepare long replies faster at ASCII boundaries perf(text): speed ASCII reply chunking and fix validation fixtures Oct 4, 2026
@boeingchoco
boeingchoco force-pushed the codex/perf-text-chunking branch from 13c80e8 to 2bfa777 Compare October 4, 2026 09:41
@boeingchoco boeingchoco changed the title perf(text): speed ASCII reply chunking and fix validation fixtures perf(text): speed ASCII reply chunking and stabilize dashboard fixture Oct 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Oct 4, 2026
@boeingchoco
boeingchoco force-pushed the codex/perf-text-chunking branch from 2bfa777 to 486e8ec Compare October 4, 2026 09:52
@boeingchoco boeingchoco changed the title perf(text): speed ASCII reply chunking and stabilize dashboard fixture perf(text): prepare long replies faster at ASCII boundaries Oct 4, 2026
@boeingchoco boeingchoco changed the title perf(text): prepare long replies faster at ASCII boundaries perf(text): speed ASCII reply chunking and align worker read fixture Oct 4, 2026
@boeingchoco
boeingchoco force-pushed the codex/perf-text-chunking branch from 4899bdb to 7c8e2fc Compare October 4, 2026 10:43
@boeingchoco boeingchoco changed the title perf(text): speed ASCII reply chunking and align worker read fixture perf(text): prepare long replies faster at ASCII boundaries Oct 4, 2026
@obviyus

obviyus commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Independent verification of 7c8e2fcaf497fb4f210d093580ffe0875011a8b7 against current main 22430f79c335c47b353b6f8ca761e5c85e28415a (secretless Docker, Linux arm64, Node 24.21.0):

  • Differential fuzz: 408,000 comparisons, zero mismatches, seeded with 163573 across 12,000 generated strings. Inputs mix ASCII, CRLF, ASCII plus combining marks, emoji ZWJ sequences, keycaps, regional indicators, surrogate pairs and lone surrogates. Start/budget/preference cases include zero, length, fractional values, NaN and Infinity, with both partial-cut policies.
  • Compiled and invoked the actual src/auto-reply/chunk.ts:chunkText entrypoint from each checkout. A 204,800-code-unit mostly-ASCII reply (204,941 UTF-8 bytes) produces 52 byte-identical chunks at limit 4,000. Unicode-heavy input (456,145 bytes) also produces 52 byte-identical chunks.
  • 25 warmups, 31 alternating samples, five calls/sample; timings below are milliseconds/call. Spread is p10–p90. The baseline and candidate used the same installed toolchain; no test/typecheck ran concurrently with this measurement.
Workload Base median (p10–p90) Candidate median (p10–p90) Result
Mostly ASCII 1.689 (1.334–4.226) 1.206 (1.032–2.197) 1.40× faster, 28.6% lower median
Unicode-heavy 0.771 (0.744–1.668) 0.772 (0.749–0.864) Effectively unchanged; 0.17% median difference, no measurable regression

This measures reply preparation, not model generation or network latency. Synthetic workload and shared-machine noise limit cross-runtime/general performance claims.

Existing grapheme, UTF-16 boundary and auto-reply chunk suites: 125 tests passed in three files, 17.59 s runner wall.

The two cancelled checks are metadata automation, not selected test shards: label and PR context and evidence, both cancelled during checkout. Their exact selected test-file lists are empty; no test replay is applicable. The current labels include proof: sufficient, size: XS, and ready-for-maintainer-review. No failed checks; openclaw/ci-gate is SUCCESS and ClawSweeper is ready on this exact SHA.

Canonical production typecheck pnpm tsgo (tsgo:core, tsconfig.core.json) passed in the same secretless container.

No merge of main is necessary: main has no intervening changes to the grapheme owner or chunk entrypoint since the PR merge base, and merge-tree is clean. No source edits or new push were needed, preserving the existing reviewed head and contributor credit.

No live gate is needed: this is a pure-function optimization, with no Gateway behavior change beyond speed.

@obviyus
obviyus merged commit 246c57a into openclaw:main Oct 7, 2026
213 of 215 checks passed
@obviyus

obviyus commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Landed. Thanks @boeingchoco! A differential fuzz (408k comparisons, mixed Unicode) found zero mismatches, the real chunkText path produced byte-identical chunks for a 200 KB reply, and mostly-ASCII chunking went from 1.69 ms to 1.21 ms median with no Unicode-heavy regression.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 7, 2026
…#163573)

Return the preferred chunk cut directly when both adjacent code units are ASCII (except CR LF), avoiding a full-source grapheme segmentation per cut when splitting long replies for channel delivery. Chunk contents are unchanged.

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

Labels

gateway Gateway runtime 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.

3 participants