fix(desktop): deliver cron results to source session - #68468
Conversation
teknium1
left a comment
There was a problem hiding this comment.
Thanks for preserving the focused SessionDB delivery approach from #60923. The underlying Desktop/WebUI cron-origin problem still exists on current main: tools/cronjob_tools.py:285-308 requires platform/chat context that tui_gateway/server.py:2825-2830 does not bind for local sessions, and cron/scheduler.py:1132-1138 / 1537-1575 still routes such origins through gateway Platform(...) dispatch.
Problems
tui_gateway/server.py:2325setssession_id=session_keyunconditionally. Current main intentionally prefersagent.session_idintui_gateway/server.py:2807-2829and re-anchors the durable key after compression intui_gateway/server.py:4367-4445. Preserve that newer identity handling when adding the local delivery origin.
Suggested changes
- Salvage the local-session routing and observed-message delivery, but layer Desktop/WebUI platform/chat fields onto current
_set_session_contextwithout replacing its session-id selection. - Adapt the Desktop hydration work to current
sessions.changedsynchronization (tui_gateway/server.py:3060-3123) rather than restoring the older polling-only assumptions.
Automated hermes-sweeper review.
| return set_session_vars( | ||
| platform=source if local_session_origin else "", | ||
| session_key=session_key, | ||
| session_id=session_key, |
There was a problem hiding this comment.
Current main deliberately prefers agent.session_id here when present (tui_gateway/server.py:2807-2829) and later re-anchors session_key after compression. Please retain that identity derivation while adding the Desktop/WebUI origin fields; unconditionally using session_key would regress the current compression-safe path.
What does this PR do?
Routes unattended cron results back to the durable Desktop/WebUI conversation that created the job instead of falling through to the configured messaging home channel. Desktop now captures its stored session key as the local delivery origin while keeping the ephemeral UI window id separate. Local delivery follows compression continuations, rejects cross-surface session ids, merges observed cron messages into live gateway history, and polls the selected stored transcript so the open Desktop window sees the result.
This preserves and credits Enhe’s two commits from #60923, then generalizes the WebUI session-store delivery path to Desktop.
Related issues
Type of change
Validation
pytest tests/cron/test_scheduler.py -q— 237 passedpytest tests/test_tui_gateway_server.py -q— 384 passedruff checkon changed Python filesgit diff --checkTested on macOS arm64.