← Back to Pull requests

fix(assistant): keep background turn ids admissible and gate Branch on them #6232

Closed
unknown closed this pull request without merging on Oct 22, 2026 09:32 UTC
View on GitHub
unknown unknown commented on Oct 22, 2026 06:11 UTC
Author

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 with Invalid sourceTurnId.

#6199 hid Branch for personal-assistant sessions. This PR fixes the protocol mismatch itself and covers the other sessions that can contain these turns.

  • Mint dash-separated IDs. Caller-supplied text (external connector message IDs, the model's batch messageId) is hashed rather than embedded.

  • Keep recognizing legacy colon-form data: pending: activations and assistant-input: input receipts already in transcripts or state keep working. No data migration.

  • Desktop turn footer: disable Branch, with an explanation, on any turn whose ID the Host would reject. Strings added for zh-CN, zh-TW and en.
  • 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 current origin/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 test suite, 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

  • New background turns get dash-separated IDs. Existing transcripts keep colon-form IDs, which remain readable. Branch is disabled for them with an explanation.

  • New tooltip string in zh-CN, zh-TW and en.
  • AI use

  • No generative tool made a substantive contribution

  • Generative tooling made a substantive contribution
  • 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-By trailer, but no Generated-by trailer. The repository template asks for one, so a maintainer may want that added before merge.

    Checklist

  • Tests cover the change and fail without it (see Verification)

  • Lint, format, typecheck and the affected suites pass locally (lint and format pass; typecheck has the pre-existing errors listed above)
  • Does this PR entail a change in behavior?

  • Yes — described under Summary above

  • No
  • 🤖 Generated with Claude Code

    Diff: 469 lines (+351 / -118) across 5 files Reviewer: liugddx Review duration: 201m
    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
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.7% (MEDIUM) · Higher = larger blast radius
    45.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18% · Safe to merge
    18%
    Repository