A scan slower than one mtime tick let a stamp read before it look settled
afterwards and get remembered over an install that landed mid-scan. The same-tick
test now drives a slow scan (red on the previous head), and layer_env freezes
time_ns so a paused runner cannot make the fresh stamps look settled.
The plugin-dir check compares the mtimes of plugins/ and plugins/model-providers/
against the stamps read at the last scan. A kernel without fine-grained
timestamps gives every directory change within one clock tick (~4 ms) the same
mtime, and FAT/HFS+ round to 1-2 s, so an install landing in the tick the last
scan read leaves the stamps equal: the new provider stayed "unknown" until some
later change to those dirs, TTL or not. This is the CI-only failure of
test_new_install_found_by_new_name_and_after_the_ttl (late-b and late-a are
installed microseconds apart; local 6.13+ kernels stamp a just-stat'ed dir
fine-grained, so it only reproduced on the runners).
A stamp still within one tick of the wall clock is now left unremembered, so
the next periodic check (once per TTL) scans again until the stamps settle;
settled stamps are trusted exactly as before, so the steady state still costs
one stat pair per TTL and no rescans.
missing_credentials_suffix runs while the "No usable credentials" AuthError is being built. A
raising hook (or a plugin host that is down) escaped as RuntimeError/PluginHostUnavailable, and
resolve_runtime_with_fallback walks only on AuthError, so the fallback chain stopped; a non-str
answer (a list from IPC) raised AttributeError the same way. The hook call is now a plugin
boundary: failure or a non-string answer drops the hint, logged once per provider with the
traceback, and the original AuthError (and the fallback walk) is kept.
R5 (r4-labs/CORE_GAPS.md): with no credential, every surface said only "No usable credentials
found for provider X" (runtime resolution adds the env-var list; CLI/Desktop readiness not even
that), and an ACP agent's auth-required error reached the user bare, so a plugin could not name its
own sign-in. Two generic seams, unset = today's text:
- ProviderProfile.missing_credentials_hint() -> str | None, appended by runtime resolution
(_api_key_provider_runtime) and both readiness checks (runtime_readiness, tui_gateway
methods_config) via runtime_readiness.missing_credentials_suffix.
- ACPClient.auth_required_hint (class attr, None) appended to a request's JSON-RPC error when its
code is ACP's auth-required (-32000).
Other users: any OAuth/device-code plugin provider; ACP CLIs with their own login (kimchi-acp).
R4 H5. provider_route_hooks._ask checked `key in _PURE_MEMO` and then re-read
`_PURE_MEMO[key]`; another thread's 512-entry clear() in between raised
KeyError, which route_answer swallowed, so that request went out without the
provider's headers. Read once with .get() into a local and return the local.
R4 H4. Registry ids with no profile (openai-api, xai-oauth, tencent-tokenplan) are looked up by
per-request route hooks, and every get_provider_profile miss forced a plugin-dir re-stat,
defeating the 1 s stamp TTL (2 plugin-dir stats per call on top of the config.yaml signature).
Each home layer remembers when a name's miss last forced a check; the same name forces again
only after the TTL. A NEW name still forces at once, so a provider installed while the process
runs is found on its first request; runtime registrations need no re-stat.
p_miss: route_answer(openai-api) os.stat/call 3.00 -> 1.00 (the remaining stat is the
config.yaml signature behind the named-custom-provider memo, the same edit signal load_config uses).
Test: tests/providers/test_profile_miss_ttl.py (no re-stat within TTL; new install found by new
name and after TTL; runtime registration found despite a cached miss); red on the base.
R4 P1-1 (hosts H1 / creds CR-1). A $HERMES_HOME model-provider plugin mirrors its
profile into the process-wide PROVIDER_REGISTRY, and the mirror never goes away. In a
process serving several profiles (multiplex gateway, Desktop serve), a profile WITHOUT
the plugin then saw the row: env auto-detect (whose ambient_credentials skip reads the
bound home's profiles) selected it from a stray token, and the generic env ladder
returned that raw token for the plugin's endpoint.
PROVIDER_REGISTRY is now a HomeScopedRegistry: plain dict storage, but every read
(get / [] / in / iteration / items) hides a plugin-mirrored row (and alias keys pointing
at it) whose provider has no profile in the bound home. One filter covers
canonical_registry_rows, registry_lookup, resolve_provider, _env_key_auto_detected,
resolve_api_key_provider_credentials, runtime resolution and setup_migration's
credential scan. Built-in rows cost one set lookup; mirrored rows ask
providers.names_without_profile (no discovery, no miss re-scan). _insert_row rebuilds
from the raw storage so rows hidden from the bound home survive a reorder.
Test: tests/providers/test_registry_home_scope.py, an A->B->A->B two-home E2E in one
process with a generic fake ambient-credential plugin (red on the base for the absence
case and setup detection).
Delete the in-tree model-provider plugins plugins/model-providers/copilot/
(provider `copilot`: Copilot API via the GitHub->Copilot token exchange) and
plugins/model-providers/copilot-acp/ (provider `copilot-acp`: Copilot CLI over
ACP). Both ship as ONE plugin, `github-copilot`, in
NousResearch/hermes-labs-plugins; the LEFT_CORE row added before this commit
installs it for every profile that routes through copilot/copilot-acp, and
every "unknown provider" surface names `hermes plugins install
github-copilot`. Core keeps no Copilot code: the generic seams the plugins
fill stay, and agent/copilot_acp_client.py stays as the deprecated alias the
kimchi-acp catalog plugin subclasses (agent.acp_client.ACPClient is the
public base). This commit is revertible on its own: reverting it restores the
bundled providers (the labs plugin stays inert on a core that bundles them).
Test files that only tested the plugins move to the labs plugin's tests:
tests/plugins/model_providers/test_copilot_acp_client.py
tests/plugins/model_providers/test_copilot_acp_deprecation.py
tests/plugins/model_providers/test_copilot_auth.py
tests/plugins/model_providers/test_copilot_catalog_oauth_fallback.py
tests/plugins/model_providers/test_copilot_context.py
tests/plugins/model_providers/test_copilot_custom_model_ids.py
tests/plugins/model_providers/test_copilot_hosts.py
tests/plugins/model_providers/test_copilot_pool_exchange.py
tests/plugins/model_providers/test_copilot_profile.py
tests/plugins/model_providers/test_copilot_refresh_notice.py
tests/plugins/model_providers/test_copilot_setup.py
tests/plugins/model_providers/test_copilot_token_exchange.py
tests/agent/test_copilot_initiator.py
tests/agent/test_copilot_native_vision_headers.py
tests/hermes_cli/test_copilot_in_model_list.py
tests/hermes_cli/test_copilot_model_api_mode.py
tests/hermes_cli/test_copilot_runtime_api_mode.py
tests/hermes_cli/test_copilot_runtime_api_mode_stale.py
tests/hermes_cli/test_model_switch_copilot_api_mode.py
tests/e2e/core/providers/test_native_copilot_acp.py
tests/e2e/core/providers/test_native_copilot_acp_errors.py
tests/e2e/core/providers/test_native_copilot_acp_streaming.py
tests/fakes/providers/copilot_acp.py
Copilot-behaviour cases extracted from generic test files (same move):
test_credential_pool (Copilot pool seeding / gh / env suppression),
test_reasoning_carriers (Copilot carriers), test_run_agent (Copilot gpt-5
reasoning, xhigh), test_run_agent_codex_responses (Copilot 401 refresh),
test_codex_transport (Copilot reasoning), test_auxiliary_main_first (vision
headers), test_private_credential_writers (JWT store row),
test_provider_client_seam (copilot-acp client), test_provider_wire_snapshot
+ its fixture (copilot / github-models cells), test_api_key_providers,
test_auth_commands, test_credential_pool_off_loop (exchange single-flight),
test_external_process_auth_status (Copilot CLI token stores),
test_external_process_provider_seam, test_model_cache_fallback_rows,
test_model_validation, test_models_relay_base_url (copilot row),
test_multiplex_cli_cache_scope, test_provider_catalog, test_cold_start_gil_stall.
Tests that used Copilot only as an example provider now use a fake
ProviderProfile (or another in-tree provider) with the same assertions:
test_auxiliary_client, test_auxiliary_named_custom_providers,
test_init_fallback_on_exhausted_pool, test_intent_ack_continuation,
test_models_dev, test_turn_retry_state, test_one_turn_route_publish,
test_mcp_catalog_env_boundary, test_plugin_provider_picker_residue,
test_delegate_external_provider, test_delegation_profile_route,
test_overlay_slug_resolution, test_installed_plugin_discovery, plus the
generic halves of test_run_agent_codex_responses, test_codex_transport,
test_api_key_providers, test_external_process_auth_status and
test_model_cache_fallback_rows.
- providers.profile_for_host is the single host->profile lookup (declared hostnames, exact or
subdomain), memoized per (hermes_home_key, host, metadata) and invalidated by a registry
generation counter bumped on every registration (process-wide or per-home layer).
- agent/provider_route_hooks.route_profiles = named profile, then profile_for_host(base_url);
replaces L1's every-profile scan, L2's conversation_loop._credential_refresh_profile host scan
and L3's agent/endpoint_profile.py + ProviderProfile.serves_endpoint (deleted).
- Copilot hostnames gain models.github.ai (the L3 Responses/reasoning gate host); per-site
differences (carriers, editor headers, initiator) stay in the plugin hooks keyed on base_url.
- Pure per-request hooks (request_headers, max_tokens_param) are memoized per argument set so a
plugins.isolation: host proxy pays one IPC call per request shape.
- hermes_cli/models.py: delete _should_use_copilot_responses_api / copilot_model_api_mode;
runtime_provider routes per-model providers through api_mode_for_model generically.
- credential_refresh_notice seam restores main's Copilot refresh status lines.
- auth._env_key_auto_detected: ambient-credential check reads list_providers once instead of a
per-pid get_provider_profile miss that walked the provider ladder (welcome_trial regression).
Generic seams (providers/base.py, lane L4 block):
- ProviderProfile.hostnames / metadata_hostnames: hosts a profile claims for URL->provider inference.
- providers.profile_for_host(url, *, metadata=False): lazy, per-home lookup over those claims
(exact host or subdomain, never substring).
- ProviderProfile.models_dev_id (declared; consumers follow).
- ProviderProfile.live_context_length(model, *, api_key, base_url): credentialed live catalog window,
consulted at the same step (after the persistent cache) the Copilot branch ran.
Core loses the Copilot rows in model_metadata._URL_TO_PROVIDER, the auxiliary pool/auth-refresh host
tables and the dead _STRICT_VISION_BACKENDS row (never reached: only nous and the auto-order providers
go through it). The in-tree copilot plugin claims githubcopilot.com (+ GitHub Models metadata hosts)
and answers live_context_length from its catalog; copilot-acp delegates to it.
FakeIdP can serve https with a throwaway CA (make_test_ca gains IP SANs) and bind a fixed
address, so the https-only rule is exercised for real; the fake browser runs in its own thread
like a real one. Folds the auth_commands routing test into the lifecycle test and the two re-pin
delta tests into one. New invariants, red on the PR head: errors reach the plugin without a
credential, a revoked grant keeps no tokens, uninstall drops the grant, unattended sign-in is
refused, http/loopback endpoints and Hermes-owned client variables fail validation.
- the resolver that returns the bearer is core-only (_plugin_oauth_spec),
like the _PROVIDERS resolvers; plugins go through
credentialed_provider_request
- a token endpoint answer counts only when it is 2xx: a redirect is a
failure, never a token
- `oauth:` given as a mapping fails instead of reading as undeclared
- an authorize or token URL with a fragment, a bad IPv6 literal or a bad
port is a validate problem instead of a crash
- plugin code is read as utf-8-sig when looking for the token URL
- tests: a refresh answered without a new refresh token keeps the old
one (Google does this), every field of the entry changes the
fingerprint, and the install notice command resolves a plugin whose
manifest name differs from its directory; the FakeIdP knob is now
token_answer, since it also answers 200
Refs #139077
A plugin that calls a third-party API with the user's own OAuth client
(Google, Microsoft, Notion) declares it under `oauth:` in plugin.yaml
instead of running the consent flow and keeping the refresh token itself.
- `hermes auth add|status|refresh|logout <plugin>:<id>` runs the PKCE
login of auth_oauth_pkce_plugin and keeps the grant in the active
profile's auth.json (section `plugin_oauth`, keyed by the plugin's key)
- `credentialed_provider_request(<id>, ...)` attaches the bearer for the
entry's declared hosts only (https, port 443) and refreshes the grant
under the auth-store lock; the calling plugin's own entry is resolved
before `_PROVIDERS`, so a later core provider of the same name cannot
take it over
- each grant stores a fingerprint of the entry it was made for: a plugin
version that changes the token URL, hosts, scopes or client variables
gets ProviderNotSignedIn until the user signs in again
- the client secret is read with get_secret right before each token POST
(OAuthPKCEConfig.token_request) and never sits in the frozen config
- grant-dead codes retire the grant; invalid_client, unauthorized_client
and invalid_scope surface as AuthError codes; a sign-in granted fewer
scopes than declared saves nothing
- `hermes plugins validate` checks the block and the declared variables
and warns when plugin code names the token URL; install/show notices
and the catalog re-pin consent delta list the entries
Refs #139077
The route check and id mapping had one consumer, the chat-completions
transport, yet lived in message_sanitization.py, a module already over 1k
lines. Move them next to the transport's other route predicates
(_model_consumes_thought_signature, _wire_reasoning_carriers) as private
helpers; message_sanitization.py is now untouched by this PR.
_sanitize_message takes a keyword-only `mistral_tool_ids` flag instead of
a one-implementation callable.
test_e2e_wiring's NIM case serves mistral-large-3, which the model-name
marker routes through the 9-character mapping, so it now asserts the
result id equals the mapped call id instead of the raw "call_1".
#134320 shipped lmstudio / tencent-tokenhub profiles with empty env_vars. The
provider-catalog e2e harness reads key vars from the profile only, so main's
`Python tests / e2e` went red (56 KeyError: '' errors + 2 switch failures);
#134385 restored the env vars. The PR's own e2e lane had been skipped by the
change classifier, which is how it merged green.
This invariant runs on the default test lane, which is never skipped: every
api_key profile backed by an api_key PROVIDER_REGISTRY row declares that row's
key variable first in env_vars. It fails on the pre-#134385 tree naming both
profiles and passes on main.
The whole provider now lives in plugins/model-providers/solstice/ on the
generic seams:
- auth.py: NAS config discovery plus the brokered exchange/refresh, given
to the generic PKCE flow as token_request. A refresh that NAS rejects
(it folds every Google failure into 502) is treated as a dead grant
needing re-login.
- transport.py: a GeminiNativeClient subclass on the
generateContentPerUserQuota methods with Bearer auth (~30 lines, where
the PR duplicated a 257-line adapter).
- __init__.py: a hidden profile (create_client, fallback models,
default_aux_model).
Removed from core: hermes_cli/solstice.py, agent/solstice_adapter.py, and
the provider's branches in main.py, auth_commands.py, models.py,
runtime_provider.py, model_setup_flows.py and agent_runtime_helpers.py.
The unused SOLSTICE_CLIENT_ID env read is gone too.
Per-user-quota OAuth inference for Hermes Agent, hidden by default until
public launch is cleared. Auth (OAuth2 + PKCE with the user's account) is
brokered by nous-account-service, which holds the confidential client secret;
inference goes direct to the per-user-quota endpoint.
Built fresh on current main; commit history carries only the codename.
Provider surface:
- plugins/model-providers/solstice/ — profile + hidden enable gate
- hermes_cli/solstice.py — PKCE loopback login, NAS-brokered config/exchange/
refresh, token store, quarantine; callback path unchanged
- agent/solstice_adapter.py — per-user-quota transport over the native
adapter's OpenAI-compatible facade
- providers/: _HIDDEN_GATES + register_hidden_provider_gate + a hidden filter
in list_providers (kept out of the picker/registry/doctor until enabled)
- wired into main.py (_PROVIDER_MODEL_FLOWS), auth_commands.py (_PROVIDER_ALIASES,
_OAUTH_ADD_SPECS, _is_known_provider allowlist), models.py (catalog fetcher),
runtime_provider.py (resolution rung), model_setup_flows.py, agent_runtime_helpers.py
Kept verbatim (the live wire contract, until the broker is renamed): the
inference host, the OAuth scope, the deployed broker routes, and the
registered redirect callback path.
The enable gate is unchanged (open item: gate on stored credentials).
Verified: 226 focused tests pass; runtime resolution, client construction
and auth-add all exercise the real paths.
Review follow-up on #120901: has_named_custom_provider walks the provider
registry (_shadowed_by_builtin -> resolve_provider, which formats an
AuthError for unregistered names) and loads config on every call — ~2.5ms
per miss, and this sits on the profile-miss path that
model_metadata._strip_provider_prefix reaches per model/prefix.
Memo per home keyed on the config file's file_signature — the same
invalidation signal load_config uses — so an edit re-arms the next lookup
and multiplex homes never borrow each other's answers (keyed by
hermes_home_key, resolved at call time).
Measured on this machine: raw helper 2.319 ms/call, memoized 0.005
ms/call (437x). Tests: 3 new contracts (memo hit, config-change
invalidation, home-key isolation); providers suite 69/69.
Fixes https://github.com/NousResearch/hermes-agent/issues/119681
When a custom provider was configured with a bare name (e.g. 'my-endpoint')
rather than the 'custom:' prefix ('custom:my-endpoint'), the
get_provider_profile() lookup returned None for reasoning_effort
resolution, causing the effort value to be silently dropped.
The existing fallback for 'custom:<name>' prefixed names (line 163) did
not cover bare named providers. Add an equivalent fallback: when no
profile is found for a bare name, check whether it is a configured
named custom provider via has_named_custom_provider() — if so, use the
'custom' profile so reasoning_effort is applied correctly.
has_named_custom_provider is imported inside the function (late import)
to avoid a module-level cycle with hermes_cli.runtime_provider_custom,
which imports from hermes_cli.providers.
Test: test_bare_named_custom_provider_gets_custom_profile (new)
- test_kanban_dashboard_plugin::test_dashboard_markdown_html_is_sanitized_before_render:
runs the real bundle's sanitizer and MarkdownBlock under node; script/event
handler/javascript: HTML never reaches dangerouslySetInnerHTML (security).
- test_meta_ai_profile::test_images_ride_user_turns_not_tool_results: vision on,
tool-message vision off, so screenshots never 400 in tool results (#101668).
- session-info.test.ts "rebuilt-runtime re-bind" (7 cases, replaces the regex
test tests/desktop/test_bots_chat_stream_rekey.py): the pane adopts a rebuilt
runtime id only when lineage matches and the old runtime is idle (#93942, #94417).
Change-detectors, tautologies, source-reading tests, redundant duplicates,
mock-echo tests and dead/unrunnable tests. Per-test rationale in the lane
ledger (category + reason for every removal).
Symptom: a model-provider plugin installed with `hermes plugins install`
(e.g. claude-subscription-directsdk) worked from a terminal but the Desktop
app failed every session build with "Unknown provider '<name>'".
Cause: `providers/__init__.py` scanned `$HERMES_HOME/plugins` exactly once
per process, under whichever profile home happened to be bound at the first
lookup, and the registry was global. The Desktop backend and the multiplex
gateway serve several profiles from one process, so any profile other than
the first-discovered one never saw its own plugins, and a plugin installed
while the process ran was invisible until a restart.
Change: bundled, pip and legacy providers stay process-wide; `$HERMES_HOME`
plugins load into a per-home layer keyed by `hermes_home_key()` at lookup
time (`get_provider_profile`, `list_providers`, `provider_source`). The
layer rescans when the plugin directories' mtimes change, so a fresh install
is found on the next lookup. The registration target is a ContextVar so two
turn threads scanning two homes cannot cross-register, and no lock is held
across plugin imports (a lock there could deadlock against a thread
mid-`import hermes_cli.auth`). Per-home module names let two profiles carry
the same plugin. `plugin_dev` reuses the module-name helper.
Live repro (tui_gateway `session.create` on a secondary profile whose config
selects a plugin installed only there): base -> agent_error "Unknown
provider 'fakeprov-b'"; fixed -> provider resolves and the build proceeds to
the plugin's own runtime check.
Branch semantics kept where main and PM disagree: update_cmd_deps.py,
constraints-termux.txt, the Electron update-api-check module and the
post-swap hand-off test stay deleted; the pending-fleet-restart catch-up
and the local_runtime tag/download ladder stay retired (PM owns engines).
Ported from main onto the branch's shape: profile_scoped_chore for the
auto-archive and plugin-update housekeeping chores, the local-runtime
cross-process boot lock and residency cap, the checkpoint tmp_pack sweep,
the cua daemon-liveness status probe, the remote-served Desktop update
flag (posix.sh / windows.ps1), sign-in for env-pinned remote gateways
(urlDisabled on RemoteSetupFields), the uvloop extra split (uvicorn
without [standard]), and the umask-scoping spawn test.
uv.lock regenerated with pm.build_env --lock-only; new utf-8 reads from
main switched to utf-8-sig (check-windows-footguns).
register_plugin_provider setdefault-ed aliases regardless of provenance, so a
$HERMES_HOME plugin alias colliding with an existing row kept resolving to the
old row while providers.get_provider_profile already followed the user profile;
override_registry_row left the display name untouched on a same-name
replacement. mirror_aliases applies the provider_source ownership rule that
e5e7fbcd27 introduced for endpoints.
Fixes#116668
Drop the duplicated _GRANT_DEAD_CODES frozenset and the relogin_required
plumbing: the pool's plugin recovery already treats exc.code in
hermes_cli.auth._OAUTH_GRANT_DEAD_CODES as terminal, so _token_http_error
imports that set late and just sets code=<json error>.
A spent refresh token returned HTTP 400 invalid_grant, and the helper mapped that to oauth_refresh_failed so the pool EXHAUSTED the row. Parse the JSON error and DEAD it. hermes auth add with an alias wrote the pool under the typed name, so status against the profile name looked logged out.
Two invariants: (1) the full add/status/refresh/logout lifecycle through the
real credential pool against an in-process IdP on 127.0.0.1 that checks the
S256 verifier and revokes refresh tokens on rotation, including peer-rotation
adoption and a forged-state callback that never reaches the token endpoint;
(2) a token_url off the authorize host allowlist is refused before any HTTP
request on both login and refresh, and a non-https endpoint is rejected.
(cherry picked from commit 0dcf2c7c22ceae2eb847dbda15fb2c6a65ae5c3d)
Two invariants per fix: the oauth plugin owns every hermes auth action through the real argparse
surface (and a handler-less oauth profile fails loud while openrouter never consults the seam);
the registry is complete after a mid-discovery auth import (subprocess) and a post-discovery
register_provider() is mirrored; plugin pool rows refresh through refresh_credential (hook-less
rows are returned unchanged) and unknown extra keys survive from_dict -> to_dict -> from_dict.
hermes_cli.auth imports hermes_cli.config at module top; config runs
provider-plugin discovery at import time (module-level provider imports +
_inject_profile_env_vars), so plugins can execute against a partially
initialized auth module during TUI startup — anything they try to
register/inspect on auth silently loses to fallback metadata.
Move the config import below ProviderConfig/PROVIDER_REGISTRY and document
the ordering contract. Regression test spawns a clean interpreter with a
probe plugin and asserts its registration lands (red before this fix,
green after).
hermes_cli.auth mirrors provider-plugin profiles into PROVIDER_REGISTRY
once, at import time, by iterating list_providers(). providers'
_discover_providers() sets its _discovered guard before importing the
plugin directories, so when a plugin's own imports pull hermes_cli.auth in
mid-discovery (e.g. a user plugin importing agent.credential_pool), the
import-time mirror sees a partial profile list and every plugin discovered
afterwards is dropped from the auth registry. resolve_provider() then
rejects those providers with "Unknown provider" even though
get_provider_profile() and resolve_provider_full() know them.
- auth.py: factor the mirror into idempotent sync_plugin_provider_registry()
(returns the number of newly mirrored profiles) and re-sync on a miss via
_registry_lookup() at the resolve_provider() gate, is_known_auth_provider(),
the get_auth_status() dispatch and the credential/status resolvers.
- providers/__init__.py: call back into hermes_cli.auth (through
sys.modules, never importing it, never raising) when discovery finishes
and on any post-discovery register_provider(), so direct
PROVIDER_REGISTRY readers stay correct too. Registrations *during*
discovery are deliberately not mirrored one by one.
- tests: subprocess end-to-end regression (sorted-first plugin imports
hermes_cli.auth, sorted-last plain plugin must still resolve) plus
in-process contract tests: partial snapshot reconciled at discovery end,
post-discovery registration mirrored, sync idempotent / never clobbers,
providers-side hook never imports hermes_cli.auth. All red on main.
Fixes#102123. Absorbs the in-process tests and never-raise hook shape
from #106361 (Finn763). Related: #21685, #69576, #94231.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AwbHcHDBh9vFRHSDj2W2FY
`/model <x>` onto copilot-acp validates through `models_validate._static_catalog`, which
reads `provider_model_ids` with no disk cache. After the session probe landed, every such
switch spawned `copilot --acp`, ran the handshake, and killed it (1-3 s; up to the 15 s
probe timeout when the CLI is installed but the session stalls). The GitHub-API tier that
path used before sat behind a 5-minute in-memory memo; the ACP tier now has the same memo,
and it remembers failures too so a broken CLI is not re-spawned per switch.
The probe itself moves to `CopilotACPProfile.fetch_models` — the slot that already said
"model listing is handled by the ACP subprocess" and returned None — so hermes_cli/models.py
no longer hand-builds `CopilotACPClient` kwargs that `profile.create_client` owns.
Discovery failures are logged at debug instead of swallowed.
Tests: the two picker wiring tests collapse into one parametrized contract; a new test
proves three consecutive switch validations pay one probe and a failed probe is not retried
(fails when the memo read is removed).
vertex, bedrock and copilot-acp each overrode ProviderProfile.fetch_models with an identical `return None`, and the overrides could not simply be deleted because the base implementation derives a URL from base_url and would GET e.g. bedrock-runtime.../models or acp://copilot/models. ProviderProfile now carries `supports_model_listing` (default True); the base fetch_models returns None before touching the network when it is False, and the three SDK/subprocess-backed profiles set it in their constructors instead of overriding. Separately, two catalog GETs still went through bare urllib.request.urlopen: commandcode's fetch_models and hermes_cli.models._fetch_ai_gateway_models (which sends the AI Gateway bearer). Both now use the redirect-safe open_credentialed_url path (_urlopen_model_catalog_request in models.py, also applied to the unauthenticated fetch_ai_gateway_models for consistency). This is a security behavior change: a cross-origin redirect from either endpoint no longer forwards the Authorization/attribution headers to the redirect target. The AI Gateway tests that patched the global urlopen are repointed at hermes_cli.models._urlopen_model_catalog_request (the seam tests/hermes_cli/test_models.py already uses), the commandcode test patches open_credentialed_url on the plugin module, and two invariant tests pin the no-network guard and the bearer routing.
Merge upstream b1f003e186 while preserving PM runtime ownership and
Python 3.14 worker startup, Windows signing, and macOS wait recovery.
Keep retired runtime modules deleted. Port upstream updater preflight
checks into the checkout strategy and preserve live build logging.
Carry checkpoint filename handling and process recovery into the current
module layout. Regenerate locks and adapt incoming platform test markers.
Focused Python and JavaScript tests, desktop and root-test typechecks,
conflict-path lint checks, lock validation, and retired-import checks pass.
The full test suite and packaged release builds were not run.
Apply the narrow registry fallback proposed in PR #68458 without unrelated case normalization or dead legacy flags. Preserve dedicated named profiles before using CustomProfile. This corrects existing reasoning loss only; per-model dialect configuration remains a product decision.
Co-authored-by: saotu <160758706+saotu@users.noreply.github.com>
Merge upstream 5e645791ac.
Retain the PM feature-flag owner and add upstream connection options.
Use the deny-only window-open policy while trusted external links keep
the existing IPC path. Keep both session-import and external-link copy.
Preserve captured timeout output when adding terminal yield handoff.
Quickstart tests patch the explicit upstream model-assignment owner.
Migrate incoming legacy OS markers to the branch's platforms gate.
Desktop renderer and Electron typechecks passed. Targeted Electron tests
passed (42 tests), Python conflict checks passed (26 tests, 3 skips),
and the plugin-compat import checker passed. CI owns the broad merge gate.
pytest-xdist is gone: run_tests.sh no longer dispatches on host, the
Windows xdist (--dist loadfile) arm is deleted, and pytest-xdist is
dropped from the dev extra (uv lock removes it + execnet). The
per-file subprocess runner (run_tests_parallel.py) is THE runner on
every host — the shape the CI linux lane already used.
- tests-os.yml: the macOS/Windows lanes now run scripts/run_tests.sh
like every other lane, passing the marker-narrowed file list via
--files and -m after --. The runner natively tolerates per-file
empty collections (exit 5, platform-gated file) and fails the run
when NOTHING collected — replacing the hand-rolled exit-5 branch.
- tests/gateway/conftest.py: the hasattr(config, 'workerinput')
controller-guard was xdist-only dead code; the file-locked cache
already handled the per-file model. Removed.
- tests/tools/test_browser_supervisor.py: the port came from xdist's
worker_id (fixed 9225 under per-file isolation — concurrent files
collide). Binds an ephemeral port instead (bind 0, read back).
- ~35 comment sites named xdist as the isolation mechanism; they now
describe the shared-process hazard they actually guard against
(bare pytest runs, same-file ordering) without naming a runner that
no longer exists.
Six slugs land in the nous and openrouter curated lists, above the gpt-5.6 line:
openai/gpt-6-astra{,-fast,-flex} and openai/gpt-6-astra-pro{,-fast,-flex}.
Nous Portal serves the tiers as distinct slugs (verified live: each echoes its id, service_tier
default/priority/flex, cost 1x/2x/0.5x). OpenRouter serves them as ENDPOINTS of the base model
(tags openai/fast, openai/flex) and silently routes an unknown suffix to the standard tier at
standard price, so the OpenRouter profile rewrites a tier slug to its base wire model and pins
provider.only to that tier's endpoints (OPENROUTER_ENDPOINT_PINS). The base slug is pinned to
openai/azure/azure-us so default routing never lands on a flex or fast endpoint.
Provider-agnostic metadata: one DEFAULT_CONTEXT_LENGTHS entry (gpt-6-astra: 1,050,000, live on
OpenRouter for both models; substring-matches -pro and the tier suffixes). Pricing is skipped:
both routes bill via official_models_api. Reasoning floor not added (no evidence of long thinks).
run_agent.py: delete the `# noqa: F401` re-export block (agent.process_bootstrap
OpenAI/_SafeWriter/_get_proxy_*, model_tools get_tool_definitions/
handle_function_call/check_toolset_requirements, FailoverReason,
_qwen_portal_headers/_routermint_headers, session_persistence names,
estimate_request_tokens_rough, ContextCompressor + friends, jittered_backoff,
prompt_builder names, message_sanitization names, tool_dispatch_helpers
names) — 41 names run_agent never used itself — and the `_STREAM_DIAG_HEADERS`
back-compat class alias (no in-tree reader). run_agent now imports only what
it uses (get_toolset_for_tool, is_local_endpoint, coalesce/uniquify tool-call
ids, cleanup_vm/get_active_env from terminal_tool_lifecycle).
agent/*: `_ra().X` late-binds that only reached a re-export now import the
defining module directly (agent_runtime_helpers -> process_bootstrap.OpenAI,
model_tools.handle_function_call, session_persistence._safe_session_filename_component;
agent_init -> model_tools.get_tool_definitions/check_toolset_requirements,
_lazy_headers("agent.client_lifecycle", ...) for qwen/routermint;
system_prompt -> agent.prompt_builder / model_tools directly, dropping its
own _ra() shim and the `_r` parameter threading). `_ra()` stays for
run_agent-resident names (logger, AIAgent, _hermes_home, _set_interrupt, ...).
toolsets.py: remove resolve_multiple_toolsets (shim-only, restored by
34abf954bd); tests/test_toolsets.py pins the same union behavior via
resolve_toolset over each name.
providers/__init__.py: drop the OMIT_TEMPERATURE re-export (no callers via the
package); ProviderProfile stays because __init__ uses it for annotations —
2 tests repointed to providers.base.
agent/iteration_budget.py: drop the "run_agent re-exports the class"
docstring pointer; 4 tests import IterationBudget from its home.
model_tools.py (arg_coercion names), agent/tool_executor.py, and
hermes_cli/cli_session_mixin.py repoints landed via a sibling commit on this
shared worktree.
Callers repointed: gateway/run.py, hermes_cli/cli_chat_turn_mixin.py,
hermes_cli/cli_tui_mixin.py, tui_gateway/session_workdir.py,
agent/transports/codex.py (one-line imports) + comment pointers in
tools/file_state.py, tools/schema_sanitizer.py, scripts/tool_search_livetest.py.
Tests: patch("run_agent.X") / monkeypatch.setattr(run_agent, "X") /
`from run_agent import X` -> defining module across 99 test files.