Skip to content

feat(plugins): add safe exact-session message delivery seam - #83661

Closed
Sahil-SS9 wants to merge 0 commit into
NousResearch:mainfrom
Sahil-SS9:feat/hermes-peer-delivery-seam-v1
Closed

Sahil-SS9 wants to merge 0 commit into
NousResearch:mainfrom
Sahil-SS9:feat/hermes-peer-delivery-seam-v1

Conversation

@Sahil-SS9

Copy link
Copy Markdown

Summary

Adds a small, generic host-owned delivery seam so standalone plugins can route conversational input to the correct live Hermes session without accessing private host queues or interrupting active tools.

This is the Hermes core prerequisite for the standalone Hermes Walkie Talkie plugin and for local cross-session messaging requested in #81885. The transport and product-specific peer logic remain outside this repository.

ctx.inject_message(
    content,
    role="user",
    *,
    mode="queue",
    target_session=None,
) -> bool

What changes

  • Extends PluginContext.inject_message() additively with mode and target_session.
  • Adds host-owned routing for CLI, TUI/Desktop and gateway sessions.
  • Makes queue the safe default: idle sessions start a turn; busy sessions receive the message at the next safe boundary.
  • Preserves explicit steer and legacy interrupt modes where supported.
  • Adds the on_session_open lifecycle event for live, addressable sessions before their first model turn.
  • Adds exact session context to opt-in plugin slash-command handlers while preserving legacy one-argument handlers.
  • Makes host-open notification idempotent and releases its identity when the session closes.
  • Documents the public contracts and surface behaviour.

No new core model tool is added. The external peer transport remains a standalone plugin.

Safety properties

  • Injected text is conversational input only.
  • It cannot invoke slash commands, execute bang-shell input, attach local files, select resume entries, approve tools, or answer protected confirmation prompts.
  • queue never interrupts an active tool.
  • Unknown, closed, rotated or unauthorised exact-session targets fail closed.
  • Gateway injection is disabled per plugin unless plugins.entries.<id>.allow_gateway_injection: true is configured.
  • Gateway delivery reuses the existing authorised route; it does not fabricate a platform route.

Compatibility

Verification

Verified from a clean worktree based directly on NousResearch/main at 2cdb30a474d76cca9eb61714d889c18f493aa7fc:

  • Focused core injection, lifecycle, gateway and TUI regression matrix: 605 passed.
  • Standalone real-process E2E against this clean core transplant: 16 passed.
  • Cross-surface CLI/TUI/gateway import and routing matrix under the Hermes environment: 4 passed, no skips.
  • py_compile on all changed runtime modules: passed.
  • ruff check on all changed Python files: passed.
  • git diff --check: passed.
  • Six commits ahead of upstream; all commits attributed to Sahil-SS9 <218421507+Sahil-SS9@users.noreply.github.com>.

Scope boundary

This draft contains only the generic V1 host seam, tests and documentation. Groups, broadcasts, structured request/reply workflows, native Windows transport, operational metrics and the full Desktop collaboration UI are planned as a separately tested V1.1 enhancement and are not part of this PR.

@Sahil-SS9

Copy link
Copy Markdown
Author

V1.1 follow-up checklist — explicitly out of scope for this V1 PR

The current draft is intentionally limited to the generic safe-delivery and exact-session lifecycle seam. The following work will be built and tested in separate successor worktrees, then proposed separately after V1 is validated:

  • Add stable profile-level agent_id alongside session peer_id and process instance_id
  • Add persistent group CRUD using stable agent membership
  • Add bounded broadcasts with deterministic per-recipient child messages and aggregate receipts
  • Add structured request/reply workflows with persisted state transitions, progress, cancellation, expiry and idempotent retries
  • Add parent/child workflow aggregation for group requests
  • Add local operational metrics, status, health, stale-peer detection and doctor output without outbound telemetry
  • Extract a backend-neutral local transport contract while preserving the V1 AF_UNIX path
  • Add secure native Windows 10/11 named-pipe transport with SID/DACL ownership checks
  • Add a Hermes Desktop disk plugin with Peers, Groups, Inbox, Requests and Health views
  • Add namespaced Desktop REST/event APIs with profile isolation and polling fallback
  • Run real two-process and two-Hermes E2E matrices on Linux, macOS and native Windows
  • Complete independent exact-SHA review before publishing a separate V1.1 branch/PR

Standalone V1 implementation: https://github.com/Sahil-SS9/hermes-walkie-talkie

The V1.1 changes will not be added to this PR branch. The core successor worktree will be stacked from this draft PR head for development only, then rebased/transplanted onto upstream main after V1 lands.

@alt-glitch alt-glitch added type/feature New feature or request comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery comp/tui Terminal UI (ui-tui/ + tui_gateway/) comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have needs-decision Awaiting maintainer decision before any implementation sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Aug 11, 2026
@Sahil-SS9

Copy link
Copy Markdown
Author

Walkie Talkie V1.1 — Security Review Complete + Fixes Applied

The standalone V1.1 branch has been pushed and a PR opened: Sahil-SS9/hermes-walkie-talkie#1

Security review (direct, by KENSEI)

Two findings identified and fixed:

SEC-R1 — Sender identity spoofing (MEDIUM)
PeerRuntimeManager.send() accepted envelopes with arbitrary sender identities. Fixed: sender is now authenticated against registered peers; unregistered senders rejected with INVALID; registered senders have identity overridden from the bound peer record.

SEC-R2 — Boundary marker injection (LOW-MEDIUM)
peer_message_marker/peer_request_marker did not sanitise content or sender names. Fixed: sender names stripped of newlines and boundary tags; content/summary boundary tags neutralised with zero-width space insertion.

Verification at 0d5d02c

  • 763 tests passed, 25 skipped (native Windows)
  • Coverage 92.7%
  • ruff/ty clean, git diff --check clean
  • hermes verify ok:true
  • Deterministic verifier: 13/14 PASS, PARTIAL exit 2
  • Post-gate cleanliness: porcelain empty

Core PR status

This core PR (#83661) remains the V1 delivery seam — the minimal core transplant that enables the plugin. The V1.1 features (groups, broadcasts, requests, Dashboard) live entirely in the standalone repo and do not require additional core changes.

@Sahil-SS9
Sahil-SS9 force-pushed the feat/hermes-peer-delivery-seam-v1 branch from 2a853f8 to bc3e972 Compare August 13, 2026 11:07
@Sahil-SS9 Sahil-SS9 closed this Aug 13, 2026
@Sahil-SS9
Sahil-SS9 force-pushed the feat/hermes-peer-delivery-seam-v1 branch from bc3e972 to fa83af3 Compare August 13, 2026 12:11
Sahil-SS9 pushed a commit to Sahil-SS9/hermes-agent that referenced this pull request Aug 13, 2026
… main

Ports the peer-delivery seam (PR NousResearch#83661) as a delta over current upstream
main, which already absorbed the simpler inject_message API:

- mode=queue/steer/interrupt with queue as safe default: busy sessions
  never have their active tool interrupted
- non_control inert-control guarantee (H-107): injected text can never
  reach slash-command or shell dispatch
- on_session_open lifecycle hook + notify_session_open + host-owned
  injection router registry (tui + gateway)
- old_session_id threaded through on_session_reset for idempotent
  session-open release
- per-plugin allow_gateway_injection config grant, fail closed

Co-authored-by: Sahil Saghir <sahil@hydraskale.com>
@teknium1
teknium1 temporarily deployed to trusted-automation August 13, 2026 12:19 — with GitHub Actions Inactive

This branch was previously deployed

4 inactive deployments
gh-image — fa83af3f Deployed Aug 13, 2026 by frizikk via Publish inline E2E evidence #15613
trusted-automation — fa83af3f Deployed Aug 13, 2026 by teknium1 via check-freshness #478
container-publish — fa83af3f Deployed Aug 13, 2026 by teknium1 via merge #5944
github-pages — fa83af3f Deployed Aug 13, 2026 by teknium1 via deploy-docs #1717
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins comp/tui Terminal UI (ui-tui/ + tui_gateway/) needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.