fix(desktop): settle the Skill draft's preconditions before it sends #5565
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 537 lines diff across 6 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.376
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5565"
general
weight: 0.35
M4n5ter
Summary
skill-draft-lifecycle.spec.tsfails intermittently on most branches right now, includingmain. The assertion that times out is always the same one:That banner only renders when a send is rejected because the invoked Skill cannot resolve (
skill-invocation-feedback.tsshows it whenskillInvocation.failedis non-empty andloadedis empty). So the flake is not the banner — it is that the send sometimes succeeds instead of being rejected, because the rejection depends on a state the test has not settled yet.Two independent races sit between
window.maka.skills.setEnabled('workspace-only', false)and theEnterthat follows it:1. The composer's
/source is not refetched. The toggle goes through the raw bridge, not the Skills page, so it never runs the controller'srefreshSkills()— the only path that bumpsskillCatalogRevisionand causescomposer-mentions-providerto re-list invocables. Until Runtime's projection drops the Skill it is still invocable, the send resolves it, and the send succeeds.2. Picking the Skill leaves the
/menu open.composer.tsx'sonInputKeyDownswallowsEnterwhile the editable reportsaria-expanded === 'true', treating it as menu acceptance rather than a send. If Enter lands in that window the draft is never submitted at all and no banner can appear.The fix waits for both preconditions before pressing Enter: the editable back to
aria-expanded="false", and the Skill gone from the invocable projection. The second uses a newwaitForSkillNotInvocablehelper sitting beside the existingwaitForInvocableSkills, which already polls the same authoritative projection for the opposite transition.Why this is a test fix, not a product fix
The journeys here are about revision drafts surviving a rejected send. The product does reject a disabled Skill correctly once its projection has settled — the test simply asserted the outcome without waiting for the input to that outcome.
retries: 0is deliberate in this suite ("flakes should fail loudly"), so the answer is to remove the race rather than mask it.Verification
@maka/desktopbuilds; the two changed files typecheck and pass biome.aria-expandedcontract is real, not assumed:useTriggerMenuemitsaria-expanded: falseon the editable whenever triggers are configured and no menu is open.window.maka.skills.listInvocableprojection the fixture's existing readiness wait uses, so it converges on the same source of truth the composer reads.What I could not do: reproduce the failure locally. Electron will not launch in my environment (it fails with
The requested module 'electron' does not provide an export named 'app', and there is no display — CI usesxvfb-run), so the evidence above is a code-path reading plus the failure distribution across branches, not a local repro or a local green run.Evidence it is not this branch's change
The same spec fails the same way on branches unrelated to the provider removal, and on
mainitself:| branch | failing spec |
| --- | --- |
|
main(b48ae6c21) |skill-draft-lifecycle.ts:77/86/93||
feat/composer-steer-shortcut|skill-draft-lifecycle.ts:77/86/110/120||
perf/reasoning-shimmer-steps|skill-draft-lifecycle.ts:77/86/93||
feat/pricing-overrides-only|workhub-layout.ts:26/99|I did not run the suite. CI on this PR is the first real check of the fix, and it is the honest signal for whether both races are closed — if the banner still fails to appear, one of the two preconditions is not the whole story and I would want the next number rather than another retry.
AI use
Tool(s) and scope: Maka (DeepSeek V4.1 Flash) — traced the failing assertion to its renderer, identified the two unsynchronised preconditions, and wrote the waits.
Checklist
Does this PR entail a change in behavior?