Skip to content

fix(desktop): echo skillRecommend in the remote settings reply - #824

Merged
huichen merged 4 commits into
mainfrom
fix/skill-reco-toggle
Sep 25, 2026
Merged

huichen merged 4 commits into
mainfrom
fix/skill-reco-toggle

Conversation

@huichen

@huichen huichen commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

fix(desktop): echo skillRecommend in the remote settings reply

A paired phone could not turn "智能技能推荐 / Skill recommendations" off: the
switch flipped back on as soon as the write returned.

update_desktop_settings accepted the field and the store persisted it, but
reply_settings never echoed skillRecommend, so the snapshot the phone
renders did not contain it. The phone reads that snapshot after every write and
falls back to ?? true when a field is absent (the fallback exists for desktops
that predate the toggle), so every read looked like "on" no matter what was
stored — the value was saved, just never reported.

Echo the field, and make the bridge test patch every writable field so
assert_eq!(updated["data"], patch) fails if the reply ever drops one again.
The screenshot mock now reports it too, so the harness exercises the real path
instead of the older-desktop fallback.

Root cause

parse_settings_patch (the remote write surface) and UpdateAppSettingsInput
both gained skill_recommend in #798, but the reply builder that returns the
snapshot to the phone was not updated:

json!({
    "autoUpgradeSkills": settings.auto_upgrade_skills,
    "autoTitleFirstTurn": settings.auto_title_first_turn,
    "autoConnectRemote": settings.auto_connect_remote,
    // "skillRecommend" was missing here
    "hiddenModels": settings.hidden_models,
})

The phone discards the write reply and re-reads via get_desktop_settings
(SettingsScreen.changeSettings → resource.reload()), so the missing field —
not a failed write — is what made the toggle look stuck on.

Verification

  • cargo test --manifest-path desktop/src-tauri/Cargo.toml — 1296 passed.
  • Confirmed the new assertion fails without the fix (left: Null, right: true
    at the defaults assertion in desktop_settings_management_is_shared_and_allowlisted).
  • cargo fmt --check, cargo clippy --all-targets, and clippy --no-default-features --all-targets on desktop/src-tauri: clean.
  • npm run typecheck + eslint in mobile/ for the mock change: clean.

Note for whoever captures screenshots

The mobile harness mock (mobile/shot/mock/RemoteContext.tsx) had the same
omission, which is why a capture never showed the problem. It now reports
skillRecommend, so the harness can show the toggle off.

A paired phone could not turn "智能技能推荐 / Skill recommendations" off: the
switch flipped back on as soon as the write returned.

`update_desktop_settings` accepted the field and the store persisted it, but
`reply_settings` never echoed `skillRecommend`, so the snapshot the phone
renders did not contain it. The phone reads that snapshot after every write and
falls back to `?? true` when a field is absent (the fallback exists for desktops
that predate the toggle), so every read looked like "on" no matter what was
stored - the value was saved, just never reported.

Echo the field, and make the bridge test patch every writable field so
`assert_eq!(updated["data"], patch)` fails if the reply ever drops one again.
The screenshot mock now reports it too, so the harness exercises the real path
instead of the older-desktop fallback.
@huichen
huichen enabled auto-merge (squash) September 25, 2026 09:34
@huichen
huichen merged commit 0cefbfb into main Sep 25, 2026
12 checks passed
@huichen
huichen deleted the fix/skill-reco-toggle branch September 25, 2026 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant