You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): workflow step results no longer end in half an emoji - #41723
A workflow step's result, and what an agent step said, are cut at 8,000 UTF-16 units before they are stored. When unit 8,000 falls inside an emoji or another character outside the BMP, the cut leaves half of it: t3 workflow show --json returns a step result ending \ud83d…, a lone surrogate, and what the agent said is stored ending \ufffd…, since SQLite replaces the lone surrogate. The web run feed and the mobile step card show the same stored values.
Change
stepResult in WorkflowStore.ts now makes both cuts through one small local helper that uses the shared splitsSurrogatePair and stops one unit earlier when the cut would split a pair. Text that fits, and cuts that fall between characters, are unchanged.
Scope
A small fix for an obvious bug, a sibling of #41629 (WorktreeSetupTracker.ts) and #41669 (ProjectCloneTracker.ts) at the workflow store's cut. It has a standalone repro below, so it needs no issue.
Verification
Two new cases in apps/server/src/workflows/WorkflowStore.test.ts, one per cut, each with 🚀 across unit 8,000. With WorkflowStore.ts from base 7872c23 both fail; on head 3029ff8 the file passes.
$ vp test run apps/server/src/workflows/WorkflowStore.test.ts # base source
× a long step result is cut without leaving half an emoji
× what a long agent step said is cut without leaving half an emoji
Tests 2 failed | 6 passed (8)
$ vp test run apps/server/src/workflows/WorkflowStore.test.ts # head
Tests 8 passed (8)
Repro: save as build/repro.sh and run bash build/repro.sh <label> on each commit from a checkout with dependencies installed and jq (no account or provider needed)
Setup: macOS, Node 26.13.1, real t3 serve with fresh isolated state on each run. The base run used WorkflowStore.ts from 7872c23, the only non-test file the fix changes. The last line of each run is the tail of the step's result as t3 workflow show --json returns it.
7872c23 (base):
$ rid=$(t3 workflow start report --key one --json | jq -r .run.runId)
$ t3 workflow show "$rid"
<runId> completed report report one
completed step write
$ t3 workflow show "$rid" --json | node -e 'let s="";process.stdin.on("data",(d)=>(s+=d)).on("end",()=>{const r=JSON.parse(s).steps[0].result;console.log(JSON.stringify(r.slice(-4)),"well-formed:",r.isWellFormed())})'
"aa\ud83d…" well-formed: false
3029ff8 (fix):
$ rid=$(t3 workflow start report --key one --json | jq -r .run.runId)
$ t3 workflow show "$rid"
<runId> completed report report one
completed step write
$ t3 workflow show "$rid" --json | node -e 'let s="";process.stdin.on("data",(d)=>(s+=d)).on("end",()=>{const r=JSON.parse(s).steps[0].result;console.log(JSON.stringify(r.slice(-4)),"well-formed:",r.isWellFormed())})'
"aaa…" well-formed: true
Not checked: an agent step's said in a running server, which needs a provider; its cut is covered by the second test. The web and mobile views were not opened; they render the stored text and are not changed. Linux and Windows: the fix is string handling with no platform-specific code.
A step result or agent reply cut at 8,000 units could end in a lone surrogate
when the cut fell inside a surrogate pair. The cut now stops one unit earlier.
Reviewing files that changed from the base of the PR and between 3029ff8 and 1767946.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Workflow step results and agent replies now use an 8,000-code-unit truncation helper that avoids splitting surrogate pairs. Tests cover emoji at the truncation boundary.
Changes: Workflow result truncation
Layer / File(s)
Summary
Truncation and boundary tests apps/server/src/workflows/WorkflowStore.ts, apps/server/src/workflows/WorkflowStore.test.ts
The store uses a helper that adjusts the cutoff when it would split a surrogate pair. Tests cover long step results and agent replies with an emoji at the cutoff.
pingdotgg/t3code#39013: The issue describes step results being cut at about 8,000 characters. This change retains the cutoff and addresses splitting a surrogate pair at its boundary.
Suggested reviewers:juliusmarminge
Merge Risk: Minimal · previous review 3029f
This fixes workflow step results and agent replies so they no longer end in half an emoji when truncated. Text that fits within the limit is unchanged. The change is narrow and covered by new regression tests, so merge risk is minimal.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: step results no longer end in a split emoji. It follows the conventional commit form and matches the objectives, which describe a surrogate-pair fix in stepResult for …
Description check
The description covers the problem, change, scope, and verification sections from the template. It gives a clear bug description with reproduction output, names the related PRs, and lists the test res…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: step results no longer end in a split emoji. It follows the conventional commit form and matches the objectives, which describe a surrogate-pair fix in stepResult for both 8,000-unit cuts. It is specific and concise.
Full details: Description check
Explanation
The description covers the problem, change, scope, and verification sections from the template. It gives a clear bug description with reproduction output, names the related PRs, and lists the test results on base and head. It also states what was not checked. The template's required sections are all present with substantive content. The description omits the optional agent-model line requirement? It does include 'Mythos 5.2 via T3 Code' at the end, so the agent line is present. The description does not link an issue, but it explains why no issue is needed, as the template asks.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between b718326 and 3029ff8.
Files selected for processing: 2
apps/server/src/workflows/WorkflowStore.test.ts
apps/server/src/workflows/WorkflowStore.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Ran the real server and CLI on Linux / Node 26.13.1 using fresh isolated databases on both commits. The same workflow returns "a".repeat(7998) + "🚀 done" from a code step. A deterministic ACP agent submits typed output through MCP and streams "a".repeat(7999) + "🚀 done" as its closing text. Start with workflow start report --key one --json, then inspect workflow show <run> --json and stored SQLite bytes after completion.
Both runs completed. On base, result contains a lone high surrogate and said contains U+FFFD before the ellipsis. On head, neither field contains either defect. The full agent transcript contains the intact emoji on both sides.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
size:S10-29 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A workflow step's result, and what an agent step said, are cut at 8,000 UTF-16 units before they are stored. When unit 8,000 falls inside an emoji or another character outside the BMP, the cut leaves half of it:
t3 workflow show --jsonreturns a step result ending\ud83d…, a lone surrogate, and what the agent said is stored ending\ufffd…, since SQLite replaces the lone surrogate. The web run feed and the mobile step card show the same stored values.Change
stepResultinWorkflowStore.tsnow makes both cuts through one small local helper that uses the sharedsplitsSurrogatePairand stops one unit earlier when the cut would split a pair. Text that fits, and cuts that fall between characters, are unchanged.Scope
A small fix for an obvious bug, a sibling of #41629 (
WorktreeSetupTracker.ts) and #41669 (ProjectCloneTracker.ts) at the workflow store's cut. It has a standalone repro below, so it needs no issue.Verification
Two new cases in
apps/server/src/workflows/WorkflowStore.test.ts, one per cut, each with 🚀 across unit 8,000. WithWorkflowStore.tsfrom base7872c23both fail; on head3029ff8the file passes.vp run check:changed upstream/mainpasses (format, lint, knip, graphql, typecheck, tests).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 base run usedWorkflowStore.tsfrom7872c23, the only non-test file the fix changes. The last line of each run is the tail of the step's result ast3 workflow show --jsonreturns it.7872c23(base):3029ff8(fix):Not checked: an agent step's
saidin a running server, which needs a provider; its cut is covered by the second test. The web and mobile views were not opened; they render the stored text and are not changed. Linux and Windows: the fix is string handling with no platform-specific code.Mythos 5.2 via T3 Code