Repository navigation
Conversation
`setup dsh`, `setup dsh --remove`, `doctor dsh` and `config agent dsh` accept any DSH profile name; profiles other than desktop register through the DSH CLI the way Web does, and doctor checks the selected profile instead of web. The Client settings record each DSH home's profile and command: the default ~/.dsh keeps the top-level fields of hosts.dsh, and every other home gets a record under hosts.dsh.homes keyed by its resolved path. Setup, doctor and removal use the record of the home DSH_HOME selects, so connecting an application's own DSH home no longer replaces the user's ~/.dsh connection. Removal drops only its home's record; the shared endpoint goes with the last one. A record without homes stays the default home's. Doctor without agent names checks DSH only when the selected home has a record, and removal keeps a checkout that a profile in any saved home still links to.
hidb4ai
left a comment
There was a problem hiding this comment.
Reviewed the per-home target persistence, profile validation, removal boundaries, and documented compatibility edge. Actual DSH CLI setup/doctor/removal across two isolated homes passed against a running Server, including continued operation after removing the other home. No actionable defect found. This does not qualify the separate Lody application integration.
|
The affected modules are Core. @hidb4ai, please coordinate follow-up. Core: @hidb4ai @frf12 @Fengzdadi @beatenevo. Please coordinate the review of the affected changes. |
| plugin, run, inspect = setup_boundary | ||
| inspect.return_value = {"memoryProtocol": "atomic-artifact-v1"} | ||
| monkeypatch.setattr(dsh_pet, "read_dsh_settings", inspect) | ||
| monkeypatch.setenv("HOME", str(tmp_path)) |
There was a problem hiding this comment.
[P2] Isolate the default DSH home on Windows
On Windows, Path.home() ignores HOME, so clearing DSH_HOME here makes test_default_and_provider_homes_keep_separate_connections rewrite the real user's DSH registration, Skill, and credential. Mock Path.home() or also redirect USERPROFILE in this fixture and the analogous client_config fixture in tests/test_setup_remove.py to keep writes inside the temporary home.
Which issue or RFC does this PR close?
No PowerContext issue tracks this. LodyAI/Lody#3460 proposes PowerContext as a Lody memory provider. Lody runs DSH with its own
DSH_HOME(<Lody data>/dsh/providers/<provider id>) and the profilelody-acp, so the provider can connect DSH only ifpowercontext setup dshaccepts that profile and keeps that home's connection apart from the user's~/.dsh. This builds onsetup --remove(#2889).Rationale for this change
powercontext setup dshaccepts only thewebanddesktopprofiles, and doctor's DSH check always inspectsweb. An application that runs DSH under its own profile can't be connected.The Client settings keep one
hosts.dshrecord with one profile and no DSH home. Setting up DSH under anotherDSH_HOMEreplaces the user's~/.dshrecord. Doctor and removal then read the wrong profile for each home. Removing PowerContext from one home also drops the other home's saved connection.What changes are included in this PR?
setup dsh,setup dsh --remove,doctor dsh, andconfig agent dshaccept any DSH profile name..,_, and-. A case variant ofdesktopis rejected.desktopregister through the DSH CLI the same way Web does: with thedshon PATH, or with--dsh-command.dsh --profile <profile> --dump-configand names the profile it checked, instead of always checkingweb.--profilewith bothdshandkimi-codeselected still exits with code 2 before any write. Before, no value was valid for both agents. Nowfullwould be a valid DSH profile name, so the combination is rejected explicitly.hosts.dsh.~/.dshkeeps the top-levelprofileanddsh_commandfields, the format that earlier releases write and read.hosts.dsh.homes["<resolved absolute path>"] = {"profile", "dsh_command"}.allow_insecure_httpstay shared at the top level, because the DSH plugin reads them without knowing its home.$DSH_HOME/powercontext/credentials.json,$DSH_HOME/skills/...).config agentuse the record of the home thatDSH_HOMEselects (~/.dshwhen unset).powercontext doctorwithout agent names includes DSH only when the selected home has a record. Another home's connection therefore doesn't show up as a failed~/.dshcheck.hosts.dshrecord withouthomesis the default home's. That includes a record that has only the Server URL, from releases before profile selection.profile: "web"at the top level, which is what the record already meant. Removing the other home later then can't treat the default home's connection as unused.hosts.dshrecords.hosts.dshshape and the compatibility rule.develop/interfaces.mdare updated.webordesktop; the CLI has no such prompt.Are there any user-facing changes?
Yes.
--profilefor DSH accepts any valid profile name, and DSH can be connected in several homes at once.hosts.dshgains an optionalhomesobject. Older releases ignore it and keep reading the default home's top-level fields.DSH_HOMEpointed somewhere other than~/.dshis now read as the default home's. With thatDSH_HOMEset, doctor and removal no longer find it untilpowercontext setup dshruns again with thatDSH_HOMEand the same--profile, plus--dsh-commandif the original setup used one. Without--profile, setup recordswebfor a home that has no record, so a home set up asdesktopor a custom profile needs the flag. The docs say this. The old record also stays the default home's, so even after that rerun a plainpowercontext doctorwithoutDSH_HOMEstill checks DSH in~/.dsh.result.removedentry reads<clients.json> hosts.dsh record for DSH home <home>instead of<clients.json> hosts.dsh.Follow-up, out of scope here: which
dshregisters the plugin in Lody's home. Lody's DSH has no stable path to pass as--dsh-command. Lody also holds a provider-home lock that an externaldsh plugincall doesn't take. Until that is settled, setup in Lody's home needs adshon PATH that can manage that home.How was this change tested?
New tests, all through the CLI. Each fails on master at
edd90eb85and passes here; the revert check ran the new tests against master'ssrc:tests/test_dsh_profiles.py::test_custom_profile_in_another_dsh_home_sets_up_checks_and_removes: setup, doctor, and removal oflody-acpunder a Lody-styleDSH_HOME. The default home stays untouched, and a saved-connection doctor withoutDSH_HOMEleaves DSH out.tests/test_dsh_profiles.py::test_default_and_provider_homes_keep_separate_connections:~/.dsh(web) and a provider home (lody-acp). Neither setup overwrites the other's record or credential. Doctor in each home checks its own profile. Removing the provider home leaves the user's record, credential, and registration.tests/test_dsh_profiles.py::test_a_record_without_a_home_stays_the_default_home_connection[profile-without-home|endpoint-only]: an existing record without a home survives removal, setup, and removal in another home, and stays the default home's.tests/test_setup_remove.py::test_dsh_remove_keeps_a_checkout_that_another_dsh_home_links_into.Updated tests:
tests/test_setup_remove.py: the DSH removal tests save a record without a home, so they now run in the default home (HOMEundertmp_path, hometmp_path/.dsh).--profile mobilebecame--profile ../webas the invalid name.tests/test_cli_kimi_code.py: the combineddsh+kimi-code--profilerejection asserts the new message. One stub stops reading.valuefrom the profile, which is now a plain string.Commands, all offline (
UV_OFFLINE=1 UV_NO_SYNC=1):make check: passed.pytest tests/test_setup_remove.py tests/test_dsh_cli.py tests/test_dsh_profiles.py tests/test_dsh_transport.py tests/test_system_cli.py: 245 passed, 141 skipped (Windows-only cases and native DSH tests that needDSH_TEST_EXECUTABLE).The 33 top-level test files that mention DSH, the Client settings, or
--profile, run normally and again withGITHUB_ACTIONS=true: 1415 passed, 147 skipped in each run.pytest $(grep -lE 'dsh|clients\.json|client_config|--profile' tests/*.py)On a merge with master at
0b60e52ac, the five files above: 245 passed, 141 skipped.Not run:
DSH_TEST_EXECUTABLE.make unit-testandtox.AI usage statement
Claude Code (Claude Opus 5.5) wrote the change, the tests, the docs and this description, and ran the checks listed above. Another Claude Code session (Claude Opus 5.5) reviewed the change before the PR was opened, once for the implementation and once for users and the documented contract, checked this description's claims, reran
make checkon the branch, and ran the five focused test files on a merge with master0b60e52ac.