Repository navigation
fix(cron): preserve UTF-16 boundaries in exec tails - #104385
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 11, 2026, 6:15 AM ET / 10:15 UTC. Summary PR surface: Source 0, Tests +21. Total +21 across 2 files. Reproducibility: yes. from source with high confidence. On current main, Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Next step before merge
Security Review detailsBest possible solution: Land the shared-helper substitution and production-entry regression test while preserving the existing tail-first policy, diagnostic limits, redaction, schemas, and downstream consumers. Do we have a high-confidence way to reproduce the issue? Yes, from source with high confidence. On current main, Is this the best way to solve the issue? Yes. Reusing the repository’s surrogate-safe slicer at the canonical tail-construction boundary is the narrowest maintainable root-cause fix and avoids duplicating Unicode logic downstream. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5e8a534fadb9. Label changesLabel justifications:
Evidence reviewedPR surface: Source 0, Tests +21. Total +21 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
|
Merged via squash.
|
Summary
createCronRunDiagnosticsFromAgentResultsliceUtf16SafehelperWhat Problem This Solves
Cron failed-exec diagnostics retain the final 2,000 UTF-16 code units because the actionable error is usually at the end. The previous tail slice could begin between an emoji's surrogate halves, leaving a lone low surrogate in the persisted diagnostic summary and message.
User Impact
Long exec failures containing emoji or other astral characters at the truncation boundary can no longer produce malformed cron diagnostics in run logs and control surfaces.
Origin / follow-up
String.prototype.slice.Competition / linked PR analysis
A fresh competition scan of related open PR changed files and exact
tailTextreferences found no PR coveringsrc/cron/run-diagnostics.ts. The author's open PRs also do not overlap this path.Merge risk
src/cron/run-diagnostics.test.tstailTextused a raw UTF-16 code-unit slice whose start could land on a low surrogate.tailTextin the canonical cron diagnostic construction path is the source of truth for failed-exec tail retention; no downstream renderer, storage schema, or delivery path was changed.Real behavior proof
payloads[].details.aggregatedfrom the shipped exec tool result → ingestion/type checks increateCronRunDiagnosticsFromAgentResultandcreateCronRunDiagnosticsFromExecDetails→ string normalization bynormalizeOptionalString→ runtime failed-exec message →tailTexteffect → normalizedCronRunDiagnosticssummary and entry.sliceUtf16Safehelper; provider-specific constraints are not applicable.pnpm test src/cron/run-diagnostics.test.ts.Review findings addressed
N/A — new focused follow-up with no existing review findings.
Regression Test Plan
pnpm test src/cron/run-diagnostics.test.tsRisk / Compatibility
No API or schema changes. At a split surrogate boundary, the retained tail can be one code unit shorter than before so the output remains valid UTF-16.
What was not changed
No changes to cron scheduling, exec execution, diagnostic severity, redaction, storage schema, UI rendering, or delivery behavior.
Root Cause
The tail helper bounded text with a raw UTF-16 code-unit slice. When its start index pointed at the low half of a surrogate pair, the returned string began with an unpaired surrogate.