Repository navigation
fix(tui_gateway): the change watcher also probes served sibling profiles for cron/platform edits - #114210
Open
EloquentBrush0x wants to merge 1 commit into
Conversation
…les for cron/platform edits _sessions_sig() already probes every served sibling profile home (_served_profile_homes) so a routed profile's Bot Chat refreshes on a state.db move, per its own comment: "a backend serving several profiles owns one store per profile, so every served sibling home is [probed]". cron.changed and platforms.changed never got the same treatment even though cron/jobs.json and gateway_state.json are just as much per-profile-home files (cron/jobs.py's own docstring: a named profile's jobs live at profiles/<name>/cron/jobs.json; gateway_state.json is written per profile_dir in hermes_cli/container_boot.py). In a desktop backend hosting 2+ named profiles, a secondary profile's cron edit or platform connect/disconnect never broadcast a change, only the launch profile's did. pet.changed and bot_relay.outbox.pending were left out of this pass: pet's payload function reads only the launch profile's own active pet (broadcasting a served profile's pet change would still hand every client the launch profile's pet, a data-correctness issue beyond a signature fix), and bot_relay's outbox root already collapses every named-profile home back to the shared launch root before probing it (get_profile_dir() always resolves under <default home>/profiles/, so _served_profile_homes entries fold to the same root _watcher_home() already covers there) — verified empirically before ruling it out rather than extending it redundantly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
9 of 12 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
change_watcher.py::_sessions_sig()already probes every served sibling profile home (_served_profile_homes) alongside the launch home, per its own comment: "a backend serving several profiles owns one store per profile, so every served sibling home is [probed]" — otherwise a routed profile's Bot Chat never refreshes (#99333).cron.changedandplatforms.changednever got the same treatment, even though the files they watch are just as much per-profile-home artifacts asstate.db:cron/jobs.py's own docstring: a named profile's jobs live at~/.hermes/profiles/<name>/cron/jobs.json.hermes_cli/container_boot.py:212writesgateway_state.jsonperprofile_dir.In a desktop backend hosting 2+ named profiles, a secondary profile's cron edit or platform connect/disconnect never broadcast a
.changedevent — only the launch profile's own file moves were ever seen.Changes
_home_and_siblings_mtime_ns(*parts), mirroring_sessions_sig()'s pattern of joining the same relative path under_watcher_home()and every entry of_served_profile_homes.cron.changedandplatforms.changednow use it instead of the launch-home-only_home_mtime_ns.Scope note — two watches deliberately left untouched
pet.changed: its payload function (_pet_changed_payload) reads only the launch profile's own active pet. Extending just the signature function to notice a served profile's pet change would broadcast an event to every client, but the payload would still describe the launch profile's pet — a data-correctness problem, not something a signature-only fix should paper over. Left out of scope.bot_relay.outbox.pending: verified this does not have the same gap before touching it.get_profile_dir()always resolves named profiles under<default home>/profiles/<name>(hermes_cli/profiles.py), and_bot_relay_outbox_sig()'s own root-collapsing logic (home.parent.parent if home.parent.name == "profiles" else home) already folds every such profile home back to the shared launch root that_watcher_home()covers. Adding_served_profile_homesthere would only re-probe the same directory. Confirmed by tracing_get_profiles_root()rather than assuming the pattern generalizes.Test plan
test_served_profile_cron_jobs_move_broadcasts_cron_changedandtest_served_profile_gateway_state_move_broadcasts_platforms_changed, mirroring the existingtest_served_profile_store_move_broadcasts_sessions_changedharness (realserver._profile_home()call, not a hand-inserted set entry).assert (...) in []); restored the fix, all 18 tests intest_change_watcher.pypass.ruff checkclean on both touched files.🤖 Generated with Claude Code