Skip to content

feat: let plugin slash commands opt into gateway context - #56782

Open
DoctaWasabi wants to merge 1 commit into
NousResearch:mainfrom
DoctaWasabi:hermes/g2-a2-plugin-command-dispatch-20260701
Open

DoctaWasabi wants to merge 1 commit into
NousResearch:mainfrom
DoctaWasabi:hermes/g2-a2-plugin-command-dispatch-20260701

Conversation

@DoctaWasabi

@DoctaWasabi DoctaWasabi commented Jul 2, 2026 •

Copy link
Copy Markdown

What does this PR do?

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

How to Test

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform:

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

  • This skill is broadly useful to most users (if bundled) — see Contributing Guide
  • SKILL.md follows the standard format (frontmatter, trigger conditions, steps, pitfalls)
  • No external dependencies that aren't already available (prefer stdlib, curl, existing Hermes tools)
  • I've tested the skill end-to-end: hermes --toolsets skills -q "Use the X skill to do Y"

Screenshots / Logs

@alt-glitch alt-glitch added type/feature New feature or request comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 2, 2026

@teknium1 teknium1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for extending the plugin slash-command surface. The gateway-context premise is valid: current hermes_cli/plugins.py:529-580 only exposes handler(raw_args).

Problems

  • The busy-session behavior is unreachable. The new gateway/run.py:8783 dispatcher is never reached for a normal active-session plugin command because gateway/platforms/base.py:4675-4731 queues it unless should_bypass_active_session() succeeds; hermes_cli/commands.py:389-409 only resolves built-in commands. The added tests call the private dispatcher directly rather than exercising adapter delivery.
  • The new busy-path dispatch is before the access gate. Current cold-path plugin dispatch gates recognized plugin commands at gateway/run.py:9770-9773; the running-agent gate at gateway/run.py:9353-9362 only recognizes built-in CommandDefs. A metadata-aware bypass must preserve the same authorization policy.
  • plugins/context_engine/__init__.py:216-262 has a parallel register_command() implementation that cannot accept or retain the new flags.

Suggested changes

  • Use one shared metadata-aware bypass predicate from the adapter through runner dispatch, gate it before invocation, and cover active delivery plus denied-user cases end to end.
  • Propagate the options through _EngineCollector and document the expanded public registration contract.

Automated hermes-sweeper review.

Comment thread gateway/run.py
@@ -8740,6 +8783,15 @@ async def _handle_message(self, event: MessageEvent) -> Optional[str]:
_evt_cmd = event.get_command()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dispatcher is not reached for normal busy-session plugin commands: BasePlatformAdapter.handle_message() queues an active-session event unless should_bypass_active_session(cmd) succeeds (gateway/platforms/base.py:4675-4731), and that predicate only uses built-in resolve_command() (hermes_cli/commands.py:389-409). Please wire a shared metadata-aware predicate into the adapter guard and add an adapter-level integration test.

Comment thread hermes_cli/plugins.py
active_session_bypass: bool = False,
wants_context: bool = False,
) -> None:
"""Register a slash command (e.g. ``/lcm``) available in CLI and gateway sessions.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This public registration option also needs to be accepted and stored by the context-engine collector (plugins/context_engine/__init__.py:216-262), which independently implements register_command() and directly constructs plugin-command metadata.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 15, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants