Repository navigation
Conversation
|
Thanks for the context here. I did a careful shell check against current Close as implemented: current main already contains a slightly broader ACP chunk-boundary fix from #78383, with regression coverage for the Korean/path streaming case and beta release provenance in v2026.5.9-beta.1. So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Keep the merged main implementation, which preserves streamed chunk boundaries while keeping the helper internal and testing the real ACP manager path. Do we have a high-confidence way to reproduce the issue? Yes. The original failure is source-reproducible from the old helper and the PR body includes live Discord before/after output; current main now covers the fixed behavior with an ACP manager regression test. Is this the best way to solve the issue? Yes. The current-main fix is the best direction because it addresses the same bug through the real manager path and avoids exporting an internal helper solely for tests. Security review: Security review cleared: The PR only changes string handling, tests, and changelog text; it does not alter secrets, permissions, network calls, dependencies, CI, or code execution surfaces. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 42b95a9eb1eb; fix evidence: release v2026.5.9-beta.1, commit fa445003b5eb. |
This comment was marked as low quality.
This comment was marked as low quality.
Token-streamed chunks (especially CJK output, paths, URLs, identifiers) may split mid-word, so leading/trailing whitespace on a chunk carries the inter-chunk word-boundary signal. The current appendBackgroundTaskProgressSummary trims each chunk via normalizeOptionalString and inserts a forced join space, which corrupts mid-word splits — e.g. ["디","렉","토","리"] renders as "디 렉 토 리" and ["/home/","user/","file.","txt"] as "/home/ user/ file. txt". Drop the trim and the forced join space; collapse only internal whitespace runs (newlines, tabs, multi-space) to a single space and keep the existing length cap. Cover the new behavior with focused unit tests (CJK one-char-per-chunk, path mid-segment, CamelCase mid-word, leading-/trailing-space, newline/tab collapse, length cap, empty-chunk no-op). Fixes openclaw#78312
80e1dc4 to
9813b29
Compare
Thanks — I double-checked this. The export was added only for the focused unit test, and I don’t see any external/runtime consumer of appendBackgroundTaskProgressSummary beyond manager.core.ts itself and the new test. It also isn’t re-exported from the barrel or exposed through the package exports, so this shouldn’t expand the public/runtime surface in practice. Happy to switch to a test-only shim if you’d prefer. |
Summary
appendBackgroundTaskProgressSummaryinsrc/acp/control-plane/manager.core.tstrims every streamed chunk vianormalizeOptionalStringand joins with a forced single space, so token-streamed output whose chunk boundaries fall mid-word (CJK, paths, URLs, identifiers) loses inter-chunk word boundaries. Plain English prose escapes because BPE-style tokenizers prefix word tokens with a leading space, which incidentally aligns with the forced-space behavior.normalizeText/trim call on the chunk and the forced join space; concatenate the chunk verbatim after collapsing only its internal whitespace runs (newlines, tabs, multi-space) to a single space. Existing length cap and…truncation marker are preserved. The helper is exported for direct unit testing. New focused unit-test file covers CJK one-char-per-chunk, path mid-segment, CamelCase mid-word, leading-/trailing-space, whitespace-run collapse, length cap, empty-chunk no-op, and successive empty-yielding chunks.taskProgressSummary/terminalSummaryshape, or any downstream consumer.resolveBackgroundTaskTerminalResultand the success-path terminal-summary handling addressed by [Bug] resolveBackgroundTaskTerminalResult returns empty terminalSummary; progressSummary truncated at 240 chars #74070 / PR fix(background-task): return progressSummary as terminalSummary; raise progress cap to 1200 #74103 are untouched — see "Scope vs [Bug] resolveBackgroundTaskTerminalResult returns empty terminalSummary; progressSummary truncated at 240 chars #74070 / fix(background-task): return progressSummary as terminalSummary; raise progress cap to 1200 #74103" below.Fixes #78312.
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
Behavior or issue addressed: when Codex via ACP streams Korean output that includes a workspace path, the auto-announced terminal summary in the parent Discord channel renders inter-chunk word boundaries with spurious spaces (
현재 작업 디 렉 토 리 는 / home / by kim 0119 / . open claw / workspace 입니다), losing both the CJK word grouping and the path separators. After the fix, the same announce renders the original text verbatim (현재 작업 디렉토리는 /home/bykim0119/.openclaw/workspace 입니다).Real environment tested: production OpenClaw 2026.4.21 install (
/usr/lib/node_modules/openclaw) on Ubuntu 24.04, Discord channel bound to a Hermes orchestrator agent, ACP backendacpx, child agentcodex(Codex CLI 0.121.0,gpt-5.3-codexvia ChatGPT Plus auth, ACP runtime spawned bysessions_spawn). The sameappendBackgroundTaskProgressSummarysource onmainat 2026.5.5 has the identical buggy code path, confirmed bygit show upstream/main:src/acp/control-plane/manager.core.ts | sed -n '99,109p'.Exact steps or command run after this patch:
src/acp/control-plane/manager.core.tschange to the installed bundled file/usr/lib/node_modules/openclaw/dist/manager-BPXdclo2.js(the chunk-whitespace portion only — the cap and terminalSummary fields were left at their current upstream values).sudo systemctl restart openclaw.sessions_spawn(runtime: "acp", agentId: "codex", task: "<Korean prompt asking Codex to print the absolute path of its current working directory>").doneannounce to land in the parent channel; captured the rendered text.pnpm test src/acp/control-plane/manager.background-task-progress.test.ts.Evidence after fix:
Live Discord rendering of the announce after the patch (run
7495ffdb→fec2c09cin OpenClaw's task-run log):Same announce before the patch (same prompt, same agent, same model):
Local unit-test output (10 deterministic cases including the live-mirroring CJK and path scenarios):
Existing manager test suite, run for regression coverage on the same change:
Observed result after fix: the live announce in Discord renders the Korean and the path verbatim, matching what Codex actually emitted; chunked unit-test inputs (CJK syllables, path segments, mid-word identifier, leading-/trailing-space chunks, whitespace-run chunks, empty chunks, oversized inputs) all produce the expected concatenation; existing AcpSessionManager test suite still passes unchanged.
What was not tested: I did not exercise the non-Codex ACP runtimes (e.g.
claude-code) end-to-end — the helper is generic and the unit tests cover the chunk surface, but live verification was only done against Codex viaacpx. I did not run the fullpnpm test/pnpm test:extensionssuites locally; I ranpnpm check:changed --base upstream/main --head HEADinstead, which is the smart-gate equivalent for the changed paths and passed (typecheck core + core test, oxlint core, import-cycle, runtime-sidecar-loaders, webhook/auth guards, oxfmt).Before evidence: same Korean prompt against the unpatched 2026.4.21 install:
Programmatic before-state from the buggy helper (deterministic, no ACP runtime needed):
Root Cause (if applicable)
normalizeTextisnormalizeOptionalStringfromsrc/shared/string-coerce.ts, which unconditionally.trim()s its input. That is the right contract for whole strings but wrong for streaming chunks: trimming strips the leading/trailing whitespace that carries the inter-chunk word-boundary signal. The downstream${current} ${normalizedChunk}template then re-inserts a single space at every join, which produces visible gaps inside what was originally a single word for any tokenizer that splits chunks mid-word (CJK syllables, path segments, CamelCase identifiers).appendBackgroundTaskProgressSummarywith chunked inputs; the only coverage was via end-to-endAcpSessionManagertests that use English-only single-chunk inputs, which incidentally hide this regression class because BPE leading-space tokens align with the forced-space behavior.Regression Test Plan (if applicable)
src/acp/control-plane/manager.background-task-progress.test.ts.AcpSessionManagertests inmanager.test.tscover the surrounding state machine but not the chunk-progress contract.User-visible / Behavior Changes
Parent-channel ACP background-task terminal summaries now render token-streamed text verbatim instead of with spurious inter-chunk spaces. No config or default changes. No change to summary length or truncation marker.
Diagram (if applicable)
Security Impact (required)
The change is a string-handling fix in a pure helper that processes already-received progress chunks. It cannot widen any trust boundary.
Repro + Verification
Environment
mainatcbaf999bd2for the patch (2026.5.5)gpt-5.3-codexvia Codex CLI 0.121.0, ChatGPT Plus authopenai-codex/gpt-5.4) → ACPacpx→ Codex childacp.backend: "acpx",acp.defaultAgent: "codex",acp.allowedAgents: ["codex"],acp.dispatch.enabled: true,~/.codex/config.tomlwithmodel = "gpt-5.3-codex"Steps
sessions_spawn(runtime: "acp", agentId: "codex", task: "<Korean prompt asking Codex to print the absolute path of its current working directory>")from the orchestrator agent.doneannounce in the parent channel.Expected
Actual (with this patch applied)
Evidence
The before/after announce text is included verbatim in the Real behavior proof section above. Unit-test output before the source change would fail at
expect(summary).toBe("디렉토리")(actual"디 렉 토 리"); after the change all 10 cases pass.Human Verification (required)
null/undefinedchunk (cast throughunknown), pure-whitespace chunks, single-character chunks, oversized chunk that triggers the cap and…truncation.pnpm test/pnpm test:extensionssuite (ranpnpm check:changedinstead, which is the smart-gate equivalent for the changed paths).Review Conversations
(No conversations yet at PR open time; will keep these in sync as bot reviews land.)
Compatibility / Migration
Risks and Mitigations
resolveBackgroundTaskTerminalResultalready does its own.trim()on the final summary before producing user-visible text, so this surface is normalized at the edge. Internal multi-line chunks are still collapsed to a single space line within the helper.Scope vs #74070 / PR #74103
Independent. PR #74103 raises the cap and surfaces progress as
terminalSummaryon success — both useful — but keeps the same trim-and-force-space pattern inappendBackgroundTaskProgressSummary, so the rendered output would still show디 렉 토 리even after #74103 lands. This PR is orthogonal and safe to merge in either order; if both land, the resulting helper retains both improvements (visible inter-word boundaries from this PR, larger cap and success-path terminal summary from #74103).