Repository navigation
fix(server): workflow failure reasons no longer end in a broken character - #41808
Conversation
…cter Workflow error text, unreadable wait signal errors, and paused or failed details cut at 2,000 units could end in a lone surrogate when an emoji straddled the limit. Those cuts now stop one unit earlier.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
The store test covers the stored step and run details, and the text() test covers the string and cause paths that every other site reuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EvidenceRan the real server and CLI on Linux with fresh isolated databases and workflows enabled on both commits. Loaded the same failing workflow, started it with key
Reproduction driver · Workflow seed Not shown:
|
Problem
Workflow failure reasons and unreadable wait-signal details are cut at 2,000 UTF-16 code units with
.slice(0, 2000)intext()andwaitClaimed(apps/server/src/workflows/workflow.ts) and again when persistingrunPausedandstepEnded(apps/server/src/workflows/WorkflowStore.ts). When unit 2,000 falls inside an emoji or other non-BMP character—either in the original error or afterStepFailed's${step}:prefix or the wait-error prefix shifts it across the boundary—the cut leaves a lone high surrogate. SQLite replaces that lone surrogate with U+FFFD (\ufffd) inworkflow_runs.detailandworkflow_steps.detail, whiletext()and theworkflow.run_pausedmilestone event carry the lone surrogate directly.Change
Added
detailCutinapps/server/src/workflows/WorkflowStore.tsusing the sharedsplitsSurrogatePairhelper from@t3tools/shared/assistantCitationsto stop at 1,999 units when unit 2,000 would split a surrogate pair. UseddetailCutat all five workflow failure-reason cut sites:runPausedandstepEndedinWorkflowStore.ts, andtext()(string and error/cause branches) and the wait-step unreadable-signal detail inworkflow.ts. Existing 2,000-unit limits, short strings, and cuts between whole characters are unchanged.Scope
A small, focused fix for an obvious bug, sibling to #41723 (
stepResultinWorkflowStore.ts), #41629 (WorktreeSetupTracker.ts), and #41669 (ProjectCloneTracker.ts). Limited to workflow failure reasons; other cuts such as run and reference titles are untouched. Includes a standalone repro below, so it needs no issue.Verification
Three new regression tests across
apps/server/src/workflows/WorkflowStore.test.ts(runPausedpersisteddetailand milestonereason, plusstepEndedpersisteddetail) andapps/server/src/workflows/Workflows.test.ts(text()string/error/cause cuts and wait-step unreadable-signaldetail). Withworkflow.tsandWorkflowStore.tsfrom base85aaef42d4, all three fail; on headbaf455a5a6, both files pass.vp run check:changed upstream/mainpasses (format, lint, knip 2/2, graphql, typecheck across 3 packages, and 43 tests across 3 files).Repro: save as
build/repro.shand runbash build/repro.sh <label>on each commit from a checkout with dependencies installed andjq(no account or provider needed)Setup: macOS, Node 26.13.1, real
t3 servewith fresh isolated state on each run. The step error places one 🚀 at unit 1,999 ofstep.detail(text()/stepEnded) and another at unit 1,999 ofrun.detailafter thework:prefix (runPaused). The base run usedworkflow.tsandWorkflowStore.tsfrom85aaef42d4.85aaef42d4(base):baf455a5a6(fix):Not checked: web and mobile workflow views (they render the stored
detailfields and are not changed), Linux and Windows (pure UTF-16 string slicing with no platform-specific paths). The fix guards UTF-16 surrogate pairs; a multi-code-point grapheme cluster can still be split at a code-point boundary.Gemini 4 Neon via T3 Code