Skip to content

feat(providers): external-process providers as standalone model-provider plugins (core half of #105863) - #117451

Merged
teknium1 merged 4 commits into
mainfrom
hermes/hermes-a998ec6f
Sep 20, 2026
Merged

teknium1 merged 4 commits into
mainfrom
hermes/hermes-a998ec6f

Conversation

@teknium1

@teknium1 teknium1 commented Sep 20, 2026 •

Copy link
Copy Markdown
Collaborator

External-process (CLI-driven) model providers can now ship as standalone kind: model-provider plugins: core carries the generic seams from #105863, and the Claude Subscription DirectSDK provider itself moves to its own repository.

Splits #105863 as agreed: this PR is the core half (no bundled plugin); the provider lives at https://github.com/NousResearch/hermes-plugin-claude-subscription-directsdk.

Changes

Dropped from the PR: the bespoke _model_flow_external_process and hard-coded hermes_cli/main.py paths (main's _model_flow_plugin_provider already covers them) and the bundled plugin directory.

Validation

Check Result
tests/hermes_cli tests/agent tests/tui_gateway tests/tools tests/providers tests/plugins (rebased head) see CI; local run: only host-environmental reds (test_dashboard_auth_gate exit 75 / test_execution_flag_detection /var/tmp fixture) which fail identically on pristine origin/main
Curated-floor fix A/B tests/tui_gateway/test_external_process_picker.py red on base (models == set()), green with the fix
Doctor A/B hermes plugins doctor <provider plugin> --ci: base ERROR: Plugin registration failed: no register() function; head OK … provider(s): claude-subscription-directsdk-experimental
Installer A/B hermes plugins install file://<repo> with manifest_version: 2: base requires manifest_version 2, but this installer only supports up to 1; head installs
Standalone plugin E2E (temp HOME/HERMES_HOME, real hermes plugins install → discovery → list_available_providers → model.options → hermes model) registered as external_process; 15/15 plugin tests green against this head
Live, real Claude Code 2.1.278, not installed (no claude on PATH) plugin load: one warning; setup_status.available=False with the npm hint; discover_models=None; pickers list the pinned catalog; a request raises ClaudeCodeMissing with the install hint (no Popen traceback); hermes model writes no config
Live, Claude Code 2.1.278 installed, logged out (fresh CLAUDE_CONFIG_DIR) setup_status {available: True, logged_in: False} in 0.8 s via claude auth status; hermes model prints ✗ Claude Code is installed but not logged in. Run claude auth login… and writes no config
Logged-in path not exercised here (requires a subscription login on this host); covered by the plugin's fake-CLI setup tests and the original PR's live qualification

Root cause of the split: #105863 mixed reusable host seams with a vendor-specific subscription transport; plugins/AGENTS.md keeps such transports out of tree.

Infographic

infographic

@teknium1
teknium1 force-pushed the hermes/hermes-a998ec6f branch from 3445163 to d1d97b4 Compare September 20, 2026 19:28
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 5ed9504 — fix(plugins): share the loader's SUPPORTED_MANIFEST_VERSION

debug info

CI timings

CI timings · View report · View job

Wall time 4m54s vs 5m46s (-15.0%). 5 job(s) slower, 7 faster, 2 unchanged.

  • OS-specific tests / Windows-only tests: -17.0s
  • OS-specific tests / macOS-only tests: -11.0s
  • Python lints / Windows footguns (blocking): -8.0s
  • Docs Site / docs-site-checks: -3.0s
  • Check no committed infographics / check-no-committed-infographics: -3.0s

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/desktop Electron desktop app (apps/desktop/*) comp/plugins Plugin system and bundled plugins tool/delegate Subagent delegation area/auth Authentication, OAuth, credential pools needs-decision Awaiting maintainer decision before any implementation labels Sep 20, 2026
@teknium1
teknium1 force-pushed the hermes/hermes-a998ec6f branch 4 times, most recently from a7e2467 to 6632688 Compare September 20, 2026 20:58
teknium1 added a commit that referenced this pull request Sep 20, 2026
…ename

The parent polls ready.exists() and then json.loads the file, but the child wrote the record in
place, so the file was visible (and empty) the instant it was opened; on a loaded windows-latest
runner that read raced the dump and every parametrized case could die with
JSONDecodeError: Expecting value (seen on #117451's Windows-only lane, legacy-models case).
Write to <ready>.tmp and os.replace it into place, so exists() implies a complete record.
teknium1 added a commit that referenced this pull request Sep 20, 2026
… relay test

Both failed once and passed on retry in a CI run of #117451; each is a real race in the test
harness, reproduced deterministically here and green after the fix under the same simulation.

test_gateway.py: tests that fake is_windows() send the reaper through
_windows_scheduled_task_state, which spawns pwsh whenever one is on PATH (GitHub's ubuntu
runners ship it). On a loaded runner that spawn outlives its 10 s timeout and subprocess.run
kills it through the test's globally patched os.kill, so a foreign PID lands in killed_pids
(assert [(29408, SIGKILL)] == []). A module autouse fixture stands the probe in with None;
the one test of the probe itself undoes it. Repro: a fake `pwsh` that sleeps 15 s on PATH.

test_zombie_process_cleanup.py: the 0.1 s child cap could elapse before the executor's worker
thread had opened the child's turn, turning "late result after timeout" into "child never
started" (assert child_started.is_set()). The settle event the cap rides on now waits for the
child to start before honouring the timeout. Repro: a 0.3 s sleep in the worker before fn().
teknium1 added a commit that referenced this pull request Sep 20, 2026
…ename

The parent polls ready.exists() and then json.loads the file, but the child wrote the record in
place, so the file was visible (and empty) the instant it was opened; on a loaded windows-latest
runner that read raced the dump and every parametrized case could die with
JSONDecodeError: Expecting value (seen on #117451's Windows-only lane, legacy-models case).
Write to <ready>.tmp and os.replace it into place, so exists() implies a complete record.
teknium1 and others added 4 commits September 20, 2026 14:23
…el-provider plugins (from #105863)

The provider-agnostic half of PR #105863, so a CLI-driven subscription provider can ship as a
standalone `kind: model-provider` plugin instead of a bundled one:

- ProviderProfile: `native_reasoning_details_type`, `model_aliases`, `get_model_context_length`,
  `get_usage_cost`, `setup_status`, `discover_models` hooks (all default None / no-op).
- Chat Completions transport: provider-native `reasoning_details` carriers follow only their
  declaring profile; standard records still replay on OpenRouter-style routes, strict routes
  drop the field wholesale (#70233). Relay/stream accumulate `delta.reasoning_details` verbatim.
- `hermes model`: the generic plugin flow gates an external-process row on the CLI's own login
  status (inline `login_command` on a TTY), offers `discover_models()` rows with per-row notes,
  and never writes config when the executable is missing.
- `/model` and the pickers: process providers list their live catalog merged with the pinned
  one, declared aliases/ids resolve inside the provider, and validation accepts a listed id
  without probing `process://`.
- Delegation keeps the selected external-process provider and protocol for the child.
- Model metadata / usage pricing consult the profile's bound and cost hooks first.
- Desktop: `[1m]` renders as a "1M" tag and hyphenated Anthropic versions read "Haiku 4.5".

The bespoke `_model_flow_external_process` and hard-coded `hermes_cli/main.py` paths from the
PR were dropped in favour of main's `_model_flow_plugin_provider`.

Co-authored-by: unsupportedpastels <unsupportedpastels@users.noreply.github.com>
… pinned models in the GUI picker

model.options (Desktop/TUI) reads catalogs non-blocking from the disk cache; a cold cache falls
back to the curated dict, which was built from _PROVIDER_MODELS only, so any plugin provider
rendered an empty model list on first open. Seed the curated floor from the profile's
fallback_models. Red on base via tests/tui_gateway/test_external_process_picker.py.
Doctor pushed every plugin through PluginManager._load_plugin, which demands register(ctx);
model-provider plugins register a ProviderProfile at import through providers/ discovery (the
manager skips the kind on purpose), so every valid provider plugin failed with
'no register() function' while 'hermes plugins validate' passed it. Route the kind through
providers._import_plugin_dir, report the registered profiles, and restore the live registry
and module state afterwards.

Same diagnosis and shape as PR #86160 by @oliver-mee (Aug 14), which reached it first; this
version imports through providers._import_plugin_dir (the real discovery loader) instead of
the PluginManager namespace. Credit: #86160.

Co-authored-by: Oliver Mee <102673257+oliver-mee@users.noreply.github.com>
…installer (#85879)

The installer carried a private manifest-version cap of 1 while the runtime loader (and the
docs) accept manifest_version 2, so 'hermes plugins install' refused every v2 plugin the loader
happily loads. Read the shared constant instead. The alignment landed once in e834ee8 and
was reverted by the follow-up 5bad3d5.

Salvaged from PR #85893 by @webdevtodayjason; rebased onto the decomposed plugins_cmd.py.
@teknium1
teknium1 force-pushed the hermes/hermes-a998ec6f branch from 6632688 to 5ed9504 Compare September 20, 2026 21:23
@teknium1
teknium1 merged commit 118984d into main Sep 20, 2026
34 checks passed
@teknium1
teknium1 deleted the hermes/hermes-a998ec6f branch September 20, 2026 21:29
teknium1 added a commit that referenced this pull request Sep 20, 2026
…dels)

The provider extracted from #105863 lives at
NousResearch/hermes-plugin-claude-subscription-directsdk; this pins fa920cbb so
`hermes plugins install claude-subscription-directsdk` resolves through the
reviewed catalog (sidecar, pinned checkout, no "unreviewed source" warning)
instead of tracking the repo's main. It needs the external-process provider
seams from #117451, hence requires_hermes >=0.21.4 (the first release carrying
them). POSIX-only: the transport uses process groups.
KineticGamesStudio added a commit to KineticGamesStudio/hermes-agent-1 that referenced this pull request Sep 22, 2026
…r registering

`hermes plugins doctor` judged a `kind: model-provider` plugin by asking "did a
ProviderProfile register at import?". Model-provider discovery
(`providers._import_plugin_dir`) logs an import exception into a warning and drops the
module, so a plugin that registers its profile and *then* raises — e.g. one that
constructs a Hermes internals dataclass with a field the current release removed — left
its profile behind and doctor printed:

    OK: runtime discovery, manifest parsing, import, and registration passed

while startup discovery was in fact discarding the plugin. The consequence is not
cosmetic: because the module is popped from `sys.modules`, that profile's own
`create_client` cannot import its client any more
(`ModuleNotFoundError: No module named '_hermes_user_provider_<hash>_<name>'`), so Hermes
falls back to the standard OpenAI client and every turn dies on an SDK signature error
(`Completions.create() got an unexpected keyword argument 'reasoning_config'`), with the
real cause visible only as a warning in the log.

`_import_plugin_dir(..., strict=True)` re-raises after the same `sys.modules` cleanup;
`_load_model_provider` passes it and turns the exception into a load error. Discovery
keeps the swallowing default, so no other caller changes.

Verified against a real out-of-tree plugin that broke exactly this way:
- before: doctor `OK` with `provider(s): devin`, failure only in the log;
- after: doctor `ERROR: import raised TypeError: ... unexpected keyword argument 'keyless'`,
  while the repaired plugin still reports OK.

tests/hermes_cli/test_plugin_dev.py: a plugin that registers and then raises must not
report OK, and the registry must be left untouched.

Follows NousResearch#117451 (118984d), which put doctors model-provider validation on the real discovery loader (providers._import_plugin_dir, registry restored afterwards). This closes the remaining gap in that same call: the loader still swallowed an import that raises after registering, so doctor reported OK for a plugin that discovery was dropping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/desktop Electron desktop app (apps/desktop/*) comp/plugins Plugin system and bundled plugins needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have tool/delegate Subagent delegation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants