Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR prevents the heartbeat preview’s 2,000-unit cap from splitting a UTF-16 surrogate pair. Example: A converted command automation outputs 1,999 copies of s followed by 😀tail.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a reachable diagnostic-text defect still present on current main with a minimal, correct change; no actionable findings remain. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherReceipt-owned automation completions enter the legacy heartbeat diagnostic projection; its bounded preview is stored in memory and exposed through the last-heartbeat RPC and system heartbeat last CLI. flowchart LR
A[Converted command automation] --> B[Cron completion]
B --> C[Heartbeat diagnostic projection]
C --> D[UTF16 safe truncation]
D --> E[Last heartbeat state]
E --> F[Gateway RPC and CLI]
Technical reviewBest possible solution: Merge the focused repair through the normal CI gates, retaining the existing preview owner and truncation helper. Do we have a high-confidence way to reproduce the issue? Source confirms the reachable unsafe cut, and the contributor’s shipped-CLI before/after trace demonstrates it; this read-only review executed no target code. Is this the best way to solve the issue? Reusing the existing helper at the projection that owns the cap is the smallest complete fix and preserves ordinary text, intact pairs, and absent summaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d7f0c039462a. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +1, Tests +25. Total +26 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 25, 2026, 8:44 PM ET / October 26, 2026, 00:44 UTC (Revision 3). |
|
Evidence boundary correction in the PR body: this projection is only fed by default-proactive automation completions ( |
|
Shipped-run evidence added to the body. The input is the receipt-owned automation produced by the shipped migration, not a synthetic event:
One boundary I now state explicitly in the body: agent-turn summaries cannot reproduce this because @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…review cap (openclaw#182776) Use UTF-16-safe truncation for receipt-owned automation heartbeat previews. Preserve the existing cap without splitting astral characters in command summaries. Co-authored-by: wangmiao0668000666 <[email protected]>
Related: #181741, #181742
What Problem This Solves
Converted command automations can leave a replacement character in heartbeat diagnostics when their summary crosses the 2,000 UTF-16-unit preview cap.
User Impact
Heartbeat previews keep astral characters whole while preserving the existing cap, ordinary text, and absent-summary behavior.
Why This Change Was Made
Use the existing surrogate-safe truncation helper at the diagnostic projection that owns the cap. Agent-turn summaries are already capped safely; converted command output can reach this projection without that earlier cap. No new configuration, state, or truncation policy is added.
Thanks to @wangmiao0668000666 for the fix and the isolated shipped-CLI reproduction. Contributor commits are preserved. Production +1 line (the existing helper import), tests +25 lines; there is no redundant nearby path to remove without broadening this two-line fix.
Evidence
Which completions reach the cut
The projection is fed only by receipt-owned converted/default automations:
refreshLegacyMonitorProjection()seeds its map fromreadHeartbeatSummarySnapshot()→readDefaultProactiveJobsAsync(src/infra/heartbeat-summary-snapshot.ts:36,src/gateway/server-cron.ts:350-370), andemitLegacyHeartbeatCronOutcomeis called only for those jobs onaction === "finished"(src/gateway/server-cron.ts:601-610). A plain user-created cron job never enters that path.Two producers can hand it a
summary:pickSummaryFromOutputalready caps the text at 2,000 units withtruncateUtf16Safe(src/cron/isolated-agent/helpers.ts:67-74), so an agent summary can never straddle the boundary. (My first attempt at an end-to-end run used the migrated agent-turn automation and produced a well-formed 1,999-unit preview on both base and head — a real control, but not a reproducer.)openclaw automations edit <id> --command …; command payloads are legal on the migratedsession:target persrc/cron/service/jobs-validation.ts:113).runCronCommandJobreturns the command output as the runsummary(src/gateway/server-cron.ts:443-464,src/cron/command-output-summary.ts), which is not pre-capped at 2,000. That summary is the input that reaches the cut.Evidence: shipped run against the same tree, one variable
Proof host, Node
v24.22.1, builtdist/entry.js, isolatedHOME/OPENCLAW_STATE_DIR, loopback Gateway on127.0.0.1:18961, no network, no model credentials, no installs.Setup, all through the shipped CLI: a config carrying legacy
agents.defaults.heartbeatis migrated byopenclaw doctor --fixinto the receipt-owned automation (automation-default:/tmp/hbstate/cron/jobs.json:main→{"phase":"complete","heartbeatEnabled":true}), the same automation is pointed at a command payload whose output is"s" * 1999 + U+1F600 + "tail"(2,005 UTF-16 units), the run is triggered withopenclaw automations run <id>, and the result is read back withopenclaw system heartbeat last --json.The changed production file is byte-identical to the PR base
b2754d0da28on the tree used for both builds (src/infra/heartbeat-events.tsmd598268327e415dec50be48e24a810db27), so the only difference on this projection's code path is this PR's patch. (The post-change build also carries an unrelatedplugins uninstallpreview patch from a separate worktree; it does not touchlast-heartbeat.)Before (
distbuilt from that tree, i.e. the base content of the changed file):After (same tree, this PR's production change applied, rebuilt
dist):The boundary-crossing emoji is dropped whole rather than half-written; the receipt row for that run shows
payload_kind: "command"for the samejobIdthe receipt names.Legal control (fixed build, same projection): a command output of
"s" * 1999 + "tail"(2,003 units, no astral character) still yieldsunits: 2000,loneSurrogates: 0,wellFormed: true, ending… s, t. The 2,000-unit cap itself is unchanged; only the pair boundary moves.Owning-boundary vitest against upstream main
b2754d0da28:Test Files 1 failed (1),Tests 1 failed | 10 passed (11); the only failure iskeeps an astral automation summary whole at the preview cap, and the reporter shows the received value ending in U+FFFD.Test Files 1 passed (1),Tests 11 passed (11)."s" * 1998 + U+1F600) is unchanged on base and head.Formatting:
node scripts/run-format.mts --check src/infra/heartbeat-events.ts src/infra/heartbeat-events.test.ts→All matched files use the correct format.Exact head SHA:
a015d7f89645fd66158711318982628097953295Not tested
The Control UI Debug page and
status --jsonwere not separately exercised; they consume the samelast-heartbeatRPC field that the shipped run above read. No other producer of this projection was found: agent-turn summaries are pre-capped safely, and the skip/defer summaries are short static strings.The shipped Gateway/CLI proof above is contributor evidence from the original patch. This lane reran the owning-boundary regression on the unchanged main owner and the exact repair. A new Gateway/Doctor migration run was not attempted because rebuilding and provisioning that path exceeds the targeted live-proof budget; the UI Debug page and status command were not separately live-tested.
Integrated current main (
b307533754a13be26e3d1b1cb78ae4956531ded0) with contributor commits intact. Both reviewed files are unchanged by integration. On final head2ea850617dcae85acc893a2c4d79808b3edc771e,node scripts/run-vitest.mjs src/infra/heartbeat-events.test.ts --maxWorkers=1passes all 11 cases in 3.85 seconds including the runner.Exact-head CI: run 40250393670 passed on
2ea850617dcae85acc893a2c4d79808b3edc771e; the CI watcher reports GREEN, with superseded cancelled checks excluded. ClawSweeper reviewed this exact head with no findings and sufficient live-output proof.