fix(tui): deliver kanban notify subscriptions to TUI/desktop sessions (salvage #66435) - #72177
Merged
Conversation
kanban_create auto-subscribes TUI/desktop sessions with platform="tui" and chat_id=HERMES_SESSION_KEY, and tools/kanban_tools.py documents that the TUI notification poller (tui_gateway/server.py) reads kanban_notify_subs and posts completion messages into the running session — but that reader was never implemented. The poller only watched process_registry completion events, and the gateway notifier skips "tui" rows because no such messaging adapter exists. Result: subscriptions accumulate with last_event_id=0 forever and no task event is ever delivered (18 subs, 29 terminal events, 0 deliveries in the report). Implement the missing delivery path in the TUI notification poller: - every 5s, claim unseen terminal events for this session's platform="tui" subscriptions via claim_unseen_events_for_sub — the same atomic cursor-claim the gateway notifier uses, so an event is delivered exactly once even with a gateway polling the same board DB - format events with the same wording as the gateway notifier (done/blocked/gave up/crashed/timed out/status; archived and unblocked are claimed but silent, so they can't wedge the cursor) - emit a status.update for user visibility, then chain an agent turn when the session is idle — mirroring process-completion handling; claimed events buffer in the session until it goes idle since the cursor (unlike the process queue) cannot re-queue - unsubscribe only at a truly final task status (done/archived), matching the gateway rule so respawned tasks keep notifying - multi-board: iterate boards, polling each resolved DB path once Fixes #59890
Covers the poller wiring above _collect_kanban_notifications, per the hermes-sweeper review: status.update emission, agent-turn dispatch via _run_prompt_submit when the session is idle, and the busy-session pending buffer that flushes once the session goes idle.
… override The sweeper review on #66435 flagged that the collector doesn't bind session["profile_home"]. That binding is intentionally unnecessary: the kanban board is shared across profiles by design — kanban_home() anchors on get_default_hermes_root(), which resolves the process env and ignores context-local profile overrides (see the kanban_db.py module docstring). Add a regression test that claims a subscription while a foreign-profile set_hermes_home_override() is active, proving delivery still works for non-launch-profile Desktop sessions.
Contributor
૮ >ﻌ< ა ci reviewran on 3ba02f9 ℹ️ InfoDesktop E2E visual evidence · View test artifacts · View job1 visual diff. inline evidence upload failed. Failed to upload diff-665a0833239e-onboarding-overlay-diff.png with gh image (exit code 1): Error uploading /home/runner/work/_temp/e2e-evidence/diff-665a0833239e-onboarding-overlay-diff.png: step 0 (get upload token): uploadToken not found on repo page — do you have write access to NousResearch/hermes-agent? (or, if NousResearch enforces SAML SSO, authorize at https://github.com/orgs/NousResearch/sso) |
Collaborator
This was referenced Jul 26, 2026
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
TUI/Desktop sessions now receive Kanban task notifications.
kanban_createauto-subscribes the calling session withplatform="tui"/chat_id=HERMES_SESSION_KEY, but no consumer ever read those rows back: the gateway notifier skips them (no "tui" messaging adapter) and the TUI notification poller only watched process completions — every subscription sat atlast_event_id=0forever.Salvage of #66435 (@cucurigoo's current-main cherry-pick of @falkoro's #60085) with authorship preserved, plus a follow-up regression test resolving the sweeper's profile-routing concern.
Fixes #59890 (TUI half; also covers duplicates #59960, #70791).
Changes
tui_gateway/server.py:_collect_kanban_notifications()claims unseen terminal events for this session'splatform="tui"subscriptions via the same atomicclaim_unseen_events_for_subcursor-claim the gateway notifier uses (no double delivery when a gateway polls the same board DB);_format_kanban_event_text()mirrors gateway wording;_notification_poller_looppolls every 5s, emitsstatus.update, buffers while busy, chains an agent turn when idle; unsubscribe only at done/archived — cherry-picked from fix(tui): deliver Kanban notifications to TUI sessions #66435, authored by @falkorotests/tui_gateway/test_kanban_notify_poller.py: 10 tests from the original PR (collector, formatting, poller wiring incl. busy→idle buffer) + 1 new test proving the collector reads the shared board correctly while a foreign-profileset_hermes_home_override()is activeOn the sweeper's profile_home concern (#66435 review)
The flagged binding is intentionally unnecessary: the kanban board is shared across profiles by design —
kanban_home()anchors onget_default_hermes_root(), which resolves the process env and deliberately ignores context-local profile overrides (see thehermes_cli/kanban_db.pymodule docstring: "Profiles intentionally collapse onto a shared board: it IS the cross-profile coordination primitive"). Verified empirically:kanban_db_path()returns the same path with and without a profile override active. The new regression test pins this behavior.Validation
tests/tui_gateway/test_kanban_notify_poller.pytests/tui_gateway/+ gateway notifier + kanban notify/tools suites (49 files)_maybe_auto_subscribe→block_task→ collector delivers ⏸ →complete_task→ collector delivers ✔ + unsubscribes → second poll empty