Skip to content

fix(server): workflow step results no longer end in half an emoji - #41723

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
tiliakoos:fix/workflow-step-result-half-emoji
Nov 23, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
tiliakoos:fix/workflow-step-result-half-emoji

Conversation

@tiliakoos

Copy link
Copy Markdown
Contributor

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 --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)

vp run check:changed upstream/main passes (format, lint, knip, graphql, typecheck, tests).

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)
cli=$PWD/apps/server/src/bin.ts; t3() { node "$cli" "$@"; }
scratch=$PWD/build/repro-$1; rm -rf "$scratch"
export T3CODE_HOME=$scratch/state T3CODE_WORKFLOWS=$scratch/workflows
mkdir -p "$T3CODE_HOME/userdata" "$T3CODE_WORKFLOWS" "$scratch/project"
echo '{"workflowsEnabled":true}' > "$T3CODE_HOME/userdata/settings.json"
cat > "$T3CODE_WORKFLOWS/report.ts" <<'TS'
export default T3.workflow("report", {version: 1, payload: Schema.Struct({})},
  Effect.fn(function* () {
    yield* T3.step("write", {returns: Schema.String},
      Effect.succeed(`${"a".repeat(7998)}🚀 done`));
  }));
TS
tail='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())})'
node "$cli" serve --port 15346 --no-browser "$scratch/project" > "$scratch/server.log" 2>&1 & server=$!
trap 'kill "$server"' EXIT
ready=$T3CODE_HOME/userdata/server-runtime.json
for _ in $(seq 60); do [ -f "$ready" ] && break; sleep 1; done
[ -f "$ready" ] || { cat "$scratch/server.log"; exit 1; }
echo '$ rid=$(t3 workflow start report --key one --json | jq -r .run.runId)'
rid=$(t3 workflow start report --key one --json | jq -r .run.runId); sleep 2
echo '$ t3 workflow show "$rid"'
t3 workflow show "$rid" | sed "s/$rid/<runId>/"
echo '$ t3 workflow show "$rid" --json | node -e '"'$tail'"
t3 workflow show "$rid" --json | node -e "$tail"

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.

Mythos 5.2 via T3 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.
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • 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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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
Recent review info

Run configuration

Commits

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.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 23, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

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.

Before After
67c442a17e 1767946655
Before: result ends in D83D and closing text in FFFD After: both fields end at complete code points
Raw CLI JSON Raw CLI JSON

Images render diagnostics derived from captured CLI output and read-only SQLite queries. Reproduction driver, ACP replay agent, diagnostic renderer, and stored-row bytes plus sanitized server logs.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Nov 23, 2026
@juliusmarminge
juliusmarminge merged commit 3522621 into pingdotgg:main Nov 23, 2026
55 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Nov 23, 2026
@tiliakoos
tiliakoos deleted the fix/workflow-step-result-half-emoji branch November 23, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants