fix(desktop): route global remote profile REST calls - #47011
Conversation
|
One profile-scoping gap looks like it remains in global remote mode: this change forwards the active profile as For example, I think the fix needs to either make those OAuth provider routes carry profile scope through |
|
@OutThisLife fixed in the latest push. OAuth provider routes now accept/apply Also fixed the existing |
) * fix(desktop): route global remote profile REST calls * fix(dashboard): scope oauth provider routes by profile * test(tui): isolate notification poller queue (cherry picked from commit 0441b7f)
What does this PR do?
Fixes Desktop/global-remote profile-scoped REST forwarding.
The renderer already sends profile-scoped REST calls with
request.profile, including/api/model/infoafter a profile switch. Electron used that profile only to select a backend connection. In local pooled-backend mode that works because each profile backend is already scoped by its ownHERMES_HOME.In global remote/Docker mode, every profile resolves to the same remote backend, so forwarding
/api/model/infowithout?profile=<active profile>makes the backend read the default profile config. That leaves Desktop/dashboard model status showing the default profile model even after switching to another profile.This adds a small path helper that appends the active profile query only for global remote mode. Local pooled backends and explicit per-profile remote overrides keep the previous behavior.
Brooklyn also caught the matching backend gap for renderer OAuth routes. Those routes were already marked profile-scoped in
apps/desktop/src/hermes.ts, buthermes_cli/web_server.pyignoredprofile, so global remote OAuth status/start/disconnect flows could still read or write the default profile. This PR now carries OAuth provider routes through profile scope and stores the profile on pending OAuth sessions so delayed background token writes land in the profile that started the login.Related Issue
Related Discord support thread: https://discord.com/channels/1053877538025386074/1516276393732735006
Type of Change
Changes Made
apps/desktop/electron/connection-config.cjs: addpathWithGlobalRemoteProfile(...)for profile query forwarding in global remote mode.apps/desktop/electron/main.cjs: apply the helper before forwardinghermes:apiREST requests.hermes_cli/web_server.py: accept/applyprofileon OAuth provider routes and persist the session profile for delayed OAuth completion workers.hermes_cli/auth.py: key the short-lived Nous auth-status cache by auth-store path as well as mtime, so profile-scoped status reads do not share one process memo.tests/hermes_cli/test_web_oauth_dispatch.py: cover OAuth status profile scoping, OAuth start session profile persistence, and delayed Codex OAuth persistence inside the session profile.tests/hermes_cli/test_nous_auth_status_cache.py: cover cache separation across profile auth-store paths.tests/test_tui_gateway_server.py: isolate the notification poller queue in the failingtest (6)case so cross-test queue state cannot produce duplicate watch-match status emissions.apps/desktop/electron/connection-config.test.cjs: cover global remote append behavior and local/per-profile remote skip behavior.How to Test
iris, with differentmodel.defaultvalues.iris./api/model/infoare forwarded with?profile=irisand the footer/model status reflects the selected profile.Validation run:
node --test electron/connection-config.test.cjsfromapps/desktoppasses: 50 tests.python -m py_compile hermes_cli/auth.py hermes_cli/web_server.py tests/hermes_cli/test_web_oauth_dispatch.py tests/hermes_cli/test_nous_auth_status_cache.pypasses.scripts/run_tests.sh -j 4 tests/test_tui_gateway_server.pypasses: 273 tests.git diff --check -- <changed PR files>passes. A repo-widegit diff --checkstill reports unrelated local-onlyAGENTS.mdtrailing whitespace in this checkout.npm run test:desktop:platformsreached and passed the updatedconnection-config.test.cjscoverage, then failed in an unrelated existing shard:electron/windows-child-process.test.cjs/desktop background child processes opt into hidden Windows consoleswithAssertionError [ERR_ASSERTION]: missing call site: execFileSync(pyExe.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
Support report was reproduced from the code path rather than a local Desktop run: global remote mode dropped the renderer's
request.profilebefore forwarding REST calls to the backend.