Skip to content

refactor: route supervisor workflow events through chat#501

Merged
shuxueshuxue merged 1 commit intomainfrom
refactor/workflow-supervisor-backend-notify
May 6, 2026
Merged

refactor: route supervisor workflow events through chat#501
shuxueshuxue merged 1 commit intomainfrom
refactor/workflow-supervisor-backend-notify

Conversation

@shuxueshuxue
Copy link
Copy Markdown
Collaborator

Summary

Routes supervisor workflow-originated events through the same Mycel backend chat delivery path as normal durable messages.

This removes the remaining content-bearing local terminal hint path from notify_supervisor. Terminal surface delivery remains only for explicit wake controls and backend notification hints.

Architecture Notes

  • notify_supervisor(group, message) now sends an addressed chat message to the supervisor user.
  • The sender is the logged-in owner account, not the supervisor itself. Current backend semantics skip sender notification and unread for self-sent messages, so supervisor self-send would not wake or read correctly.
  • enforce_caught_up=False is used only for this workflow-originated event path because it is a runtime workflow event, not a human/agent conversational send that should be blocked by read-before-send.
  • cel group ... supervisor wake still uses direct surface wake because that command is explicitly a wake control, not a durable chat message.

Verification

  • uv run ruff check .
  • uv run ruff format --check .
  • uv run pytest tests/test_group_chat_transport.py -q
  • uv run pytest -q -> 468 passed

Follow-up Boundary

This PR does not change backend message typing. The current public send API still records this as the backend's existing send-message type. If workflow message typing needs to become first-class, that should be a backend API primitive rather than CLI-side special casing.

@shuxueshuxue
Copy link
Copy Markdown
Collaborator Author

Additional YATU Evidence

Ran a real product-path YATU on the macmini in an isolated MYCEL_HOME using a fresh clone of this PR branch.

Artifact: ~/share/mycel-yatu/pr501-supervisor-backend-20260506033947/SUMMARY.md on macmini.

Flow covered:

  1. Started isolated Mycel daemon.
  2. Created real external supervisor/reviewer identities against https://mycel.nextmind.space.
  3. Created a real Mycel group chat.
  4. Spawned real Codex supervisor and reviewer sessions in tmux.
  5. Ran cel group start <group_id>.
  6. Daemon consumed the group-start signal and stored the supervisor event through backend chat.
  7. Supervisor inbox received backend chat notifications.
  8. Supervisor hook woke the Codex session; the supervisor ran cel read-message and continued workflow.

Key evidence:

  • home/daemon.log contains workflow supervisor chat stored [0d09bd98-48dd-4d2e-9a58-c8f5753a1bf4].
  • supervisor-read-last.out contains message seq 2 with <cel event="group_start" ...> from owner user.
  • The supervisor tmux capture shows hook metadata only, followed by the supervisor using cel read-message for real content.

The first harness assertion had a wrong log path ($MYCEL_HOME/state/daemon.log instead of $MYCEL_HOME/daemon.log), but the product path itself passed. The isolated daemon was stopped afterwards.

@shuxueshuxue shuxueshuxue merged commit 34e1385 into main May 6, 2026
5 checks passed
@shuxueshuxue shuxueshuxue deleted the refactor/workflow-supervisor-backend-notify branch May 6, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant