fix(assistant): keep background turn ids admissible and gate Branch on them #6232
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 469 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.368
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6232"
general
weight: 0.35
liugddx
Summary
Fixes #6231.
Refs #6188, #6199.
Background assistant turns (heartbeats, Matter wakes, task notifications, bot-delivered messages) were recorded with colon-separated turn IDs such as
initiative:<owner>. The Runtime Host admits a turn ID only as^[A-Za-z0-9_-]{1,128}$, so branching from one of those turns failed withInvalid sourceTurnId.#6199 hid Branch for
personal-assistantsessions. This PR fixes the protocol mismatch itself and covers the other sessions that can contain these turns.messageId) is hashed rather than embedded.pending:activations andassistant-input:input receipts already in transcripts or state keep working. No data migration.Root cause
Eight sites minted colon-form turn IDs in the assistant modules. The desktop enabled Branch from turn status alone and never checked the Host's ID rule.
Verification
Run on the branch base
f7fd46469. It merges cleanly onto currentorigin/main(2b0e4a25f), but I did not re-run the suites on that merge.| Check | Result |
|---|---|
| runtime-host: new tests,
assistant-bot,personal-assistant| 51/51 pass || runtime-host: assistant, matter, personal-assistant and composition files (254 tests) | 252 pass, 2 fail; both also fail on the untouched base (see below) |
| desktop: turn, footer, composer and transcript files (74 files) | 652/652 pass |
| desktop: footer branch-availability tests | 62/62 pass |
| pre-commit gates: Biome (staged), ASF headers, protocol epoch,
git diff --check| all pass || renderer typecheck (
tsconfig.renderer.json) | 0 errors || runtime-host typecheck | 6 errors, identical to the base |
| desktop main build | 28 errors, all in files this PR does not touch (computer-use, diagnostics, overlays) |
The two runtime-host failures predate this PR:
assistant Host fallback registers a task workspace usable by ordinary Session creation and binding: fails on the untouched base.production Host publishes and retires an implementation child patch: fails in the same full-set run on the untouched base; passes when run alone (3/3).Tests ran on Node 24.21.0. The assistant test loader does not support Node 26.
Not run: the full
npm testsuite, end-to-end tests, the packaged app, and a GUI check of Branch on background turns. Tests fail to import against the base (the helpers do not exist there), but I did not separately confirm them against the old behavior.Behavior change
AI use
Tool(s) and scope: Claude Code (Claude Sonnet 5.5) assisted with investigation, implementation, tests, verification and this description. The commits carry a
Co-Authored-Bytrailer, but noGenerated-bytrailer. The repository template asks for one, so a maintainer may want that added before merge.Checklist
Does this PR entail a change in behavior?
🤖 Generated with Claude Code