Skip to content

bug(scheduler): nothing reads the scheduler's Redis events, so schedule_execution_* never reaches /ws/events or the UI socket #4813

Todo

Description

@webmixgamer

Summary

The standalone scheduler publishes schedule_execution_started, schedule_execution_completed and schedule_execution_skipped to the Redis pub/sub channel scheduler:events (SchedulerService._publish_event, nine call sites in src/scheduler/service.py). Nothing subscribes to that channel. The events never reach the UI WebSocket or the Trinity Connect stream (/ws/events), though the docs say the backend relays them.

Context

  • The embedded scheduler used to broadcast through manager.broadcast and filtered_manager.broadcast_filtered. Commit 22b8f6d76 (2026-02-11, "Consolidate scheduler into dedicated service") removed those callbacks from src/backend/main.py and left a note that the backend subscribes to the Redis channel. No subscriber was added, then or since: no commit has the string scheduler:events outside src/scheduler/, docker/scheduler/, the tests and the docs, and src/backend has never called pubsub().
  • On a running local instance PUBSUB NUMSUB scheduler:events answers 0, and there are no pattern subscriptions.
  • What still works: a scheduled run goes through the backend's task path, which broadcasts agent_activity (schedule_start / schedule_end), so scripts/trinity-listen.sh <agent> completed still fires on that event.
  • What nobody hears live: a skipped run (one a gate held back, for example). It has no backend activity, so the scheduler's event was its only live signal.
  • Docs that describe the relay:
    • docs/memory/feature-flows/scheduling.md: "The backend subscribes to the scheduler:events Redis channel and relays events to both WebSocket managers"
    • docs/memory/feature-flows/trinity-connect.md: lists schedule_execution_completed as a /ws/events event
    • docs/memory/feature-flows/scheduler-service.md, activity-stream.md, agent-network.md, webhook-triggers.md
    • the /ws/events docstring in src/backend/main.py
  • Found while reviewing fix(scheduler): a restart keeps following the runs that were in flight (#4410) #4807, whose restart recovery publishes the completion event again.

Acceptance Criteria

  • One of the two:
    • (a) the three events reach /ws/events and the UI socket through the event bus (Invariant Feature/process engine #10); or
    • (b) the publisher, the PUBLISH_EVENTS setting and the doc claims are removed, and the docs name the event a listener should use instead.
  • If (a): a test that goes from a scheduler event to a /ws/events client, including the per-agent filter (a listener gets no event for an agent it cannot open).
  • A skipped run is either visible live, or the docs say it is not.
  • The docs listed above match the code.

Technical Notes

  • PUBLISH_EVENTS=true is set in docker-compose.yml, docker-compose.prod.yml, docker-compose.hosted.yml and docker/scheduler/docker-compose.test.yml; src/scheduler/config.py reads it.
  • For (a): the scheduler cannot import the backend. The event bus is the Redis stream trinity:events (src/backend/services/event_bus.py). Writing to it from the scheduler means a second copy of the envelope format; an internal backend route keeps one writer.
  • /ws is unfiltered and /ws/events is filtered per agent (FilteredWebSocketManager), so the payload should carry identifiers only (feat: agent-reported structured reports via MCP + dashboard display #918).
  • No frontend code handles these event types today (src/frontend/src has no reference to them).

Activity

  1. added
    priority-p3
    type-bug
    theme-reliability
    status-ready
    on Nov 27, 2026
  2. webmixgamer commented on Nov 27, 2026

    @webmixgamer
    ContributorAuthor

    /claim

  3. added
    status-in-progress
    and removed
    status-ready
    on Nov 27, 2026
  4. github-actions commented on Nov 27, 2026

    @github-actions

    Claimed by @webmixgamer. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/4813-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #4813
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

priority-p3status-in-progresstheme-reliabilitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions