Commit Graph

594 Commits

Author SHA1 Message Date
Teknium
7bc3f14933 fix(nous): a hanging mirror costs 2 s, and an API-key-only profile keeps its background refresh
- The R2 mirror is now asked with a 2 s timeout (or the caller's, if shorter) before
  the Portal fallback. Before, a mirror that hung rather than refused used the
  caller's whole 5 s budget first, doubling the worst-case uncached picker wait.
- The gateway's catalog refresh also counts a NOUS_API_KEY (read via get_secret, so
  profile-scoped) as a Nous account, so env-key setups keep their warm cache.
2026-10-27 16:03:08 -07:00
Robin Fernandes
943a972ca7 fix(nous): read Portal recommendations from the R2 mirror; gateway refreshes them only for Nous accounts
The gateway's model-catalog watcher force-fetched the Portal's
/api/nous/recommended-models every 20 minutes on every install, whether or
not the profile had a Nous account, and always from the default Portal.
Nothing outside a Nous account reads that payload.

- refresh_catalogs() refreshes the recommendations only when the profile
  holds a non-guest providers.nous login or pooled nous credential, and
  for the Portal it signed in to.
- fetch_nous_recommended_models() reads the copy each Portal publishes to
  R2 at https://web-assets.nousresearch.com/dynamic/<portal host>/api/nous/recommended-models
  instead of the Portal origin, and falls back to the Portal itself when
  the mirror has no copy (404) or fails. A loopback (dev) Portal is asked
  directly. Disk cache keys are unchanged.
2026-10-27 16:03:08 -07:00
Teknium
76f2fdb794 fix(cache): a rotated key, token or same-size edit is never served stale from a file cache
Every cache keyed on a file's stat signature had the bug the config caches had: a same-size
in-place rewrite in one coarse timestamp tick keeps mtime, ctime, size and inode, so the older
parse was served for the rest of the process. Move the helper to utils.file_cache_version
(file_signature + content digest while the file is under 2 s old; always_digest for signatures
compared much later, where the racy digest going empty would read as a change) and key every
cache that can hold a secret, token, pairing/allowlist, route or config on it:

- auth.py: global auth-store memo, Nous auth-status memo (was mtime only)
- gateway/pairing.py approved-users cache (a revocation kept access)
- run_profile_reconcile: served-profile signature (always_digest: a false change reconnects
  adapters) and the hook-consent signature
- webhook dynamic routes (route HMAC secrets), Feishu comment pairing/rules cache (mtime only)
- MCP OAuth tokens-file reload check (mtime only; always_digest: a reload tears the session down)
- config parse-failure record (always_digest), named-custom-provider memo, model aliases,
  gateway.standalone memo, profile model read, MoA preset, agent raw config,
  tui_gateway raw config cache, onboarding due stamp, free-tier inventory stamp,
  provider model-list credential fingerprint, git safe.directory key, skills prompt
  manifest

config_cache_version takes its stat through config_version, so its errors and seams are unchanged.
Left alone: the tool-definition cache key and the platform manifest stamp (a safe worker must
never open config.yaml or a plugin file; the MoA preset cache is skipped in one instead) and the
CLI MCP watcher seed (pinned to file_signature by a main test).
2026-10-27 12:57:09 -07:00
Teknium
8d359c7824 fix(models): a plugin profile's static_models stay with the home that registered it
sync_plugin_provider_catalog copied every profile's static_models into the process-wide
_PROVIDER_MODELS with setdefault: the first served home won forever, so a second home that
registers the same provider name with other models defaulted to the first home's model, and a
home without the plugin listed (and could switch to) a provider it does not have.

Nothing is copied any more. static_catalog(provider) answers from the built-in row, else from the
bound home's profile at lookup time; static_catalog_providers() lists built-ins plus this home's
plugin rows. The catalog readers (defaults, detection, pickers, setup) use them.
2026-10-26 00:32:11 -07:00
Teknium
35ac640464 refactor(providers): move the Copilot catalog into the copilot plugins behind generic catalog hooks
hermes_cli/models.py no longer carries any Copilot code (2977 -> ~2640 lines): the live /models
catalog + caches, context windows, id normalization + alias table, reasoning-effort helpers,
catalog-token fallbacks and editor headers move to plugins/model-providers/copilot/catalog.py;
the copilot-acp session memo moves to plugins/model-providers/copilot-acp/catalog.py. The curated
copilot / copilot-acp rows leave models_catalog_static.py.

Core reaches them through generic ProviderProfile seams (providers/base.py, I2-cat block):
- picker_catalog(force_refresh): a provider-owned picker catalog, tried in the slot of a built-in
  _PROVIDER_CATALOG_FETCHERS row (presence = a live source, so the static tail stays a placeholder)
- static_models: curated ids registered as the provider's core static-catalog row
  (sync_plugin_provider_catalog), so detection/defaults/validation keep seeing them
- probe_models(base_url, api_key, timeout): probe_api_models asks the host's profile
  (profile_for_host, metadata hosts included) before the generic HTTP probe; the dead
  api.githubcopilot.com header branch behind the old early return is gone
- invalidate_catalog_cache(): /model --refresh drops provider-owned memos
- catalog_credential_files: credential files folded into every cached catalog's fingerprint
  (same slot/order as before, so fingerprints are byte-identical)

Plugin callers import from .catalog; tests re-targeted (patch.object on the plugin modules),
plugin-only test files moved under tests/plugins/model_providers/.
2026-10-25 19:34:35 -07:00
Teknium
a4a992645b refactor(providers): one memoized endpoint->profile lookup; drop duplicated api_mode helpers
- 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).
2026-10-25 19:00:01 -07:00
Teknium
ae3ae6ede7 chore(copilot): health ratchet for moved credential code
Waive BLE001/S110 on catch-alls moved verbatim from core; keep models.py at its line cap.
2026-10-25 18:06:13 -07:00
Teknium
2e30ce41c9 refactor(copilot): move credential logic behind generic ProviderProfile seams
GitHub->Copilot token exchange (hermes_cli/copilot_auth.py) moves into the
in-tree copilot plugin (plugins/model-providers/copilot/credentials.py), and
core's Copilot credential branches become generic profile hooks the plugin
fills: resolve_api_key_secret, runtime_base_url, prepare_pool_entry,
seed_pool_credentials, remove_credential_source, refresh_runtime_credentials,
is_stale_credential_error, request_rejection_hint, external_auth_evidence and
the ambient_credentials field. Behaviour-preserving (gh auth token fallback kept).
2026-10-25 18:04:13 -07:00
Teknium
68e4c2b31a fix(startup): build version-bearing User-Agents when a request is built, not at import
Every CLI start imports all provider plugins (hermes_cli.config lists their env vars), and
fireworks/gmi/xai/router/kimi/opencode plus auth_constants, models, model_catalog,
auxiliary_client, gemini_native_adapter, web_server_messaging, slack, yuanbao and perplexity
built a `<product>/<release>` string at module level. In a source checkout the release comes
from the 7-call git provenance walk (`git tag --merged HEAD` alone is ~0.35 s in a large
clone), so `hermes sessions list` paid it for headers it never sends.

Provider profiles take a LazyHeaders mapping (resolved on first read by the client builders,
which already copy with dict()); core modules call version_info.hermes_user_agent() where the
request is built. Header values are unchanged.
2026-10-25 17:50:59 -07:00
Teknium
7354412817 test(models): drive catalog backoff expiry through the clock
Greptile "Expiry test replaces the deadline": the expiry check zeroed
FETCH_RETRY_DELAY_SECONDS and forced a second failure, so it never proved a
plain call retries once the original window ends. Advance time.monotonic past
the window and call get_catalog() unforced instead.
2026-10-24 19:23:51 -07:00
rob-maron
0e29e8a25a fix tests 2026-10-20 22:18:49 -04:00
rob-maron
15307dece7 Usage-window plan support 2026-10-20 21:04:30 -04:00
Maciej Lisiewski
40158fa616 fix: address pr comments pt1 2026-10-15 22:25:22 +02:00
Maciej Lisiewski
619b6b7a84 fix(models): provider catalog cache writes re-read under a lock
cached_provider_model_ids and cached_fetch_api_models loaded the cache,
fetched live, then saved that pre-fetch snapshot unlocked, so a slower
prefetch worker, SWR thread or other process dropped rows written
meanwhile and the picker fell back to curated lists. _store_cache_entry
now always re-reads under the thread lock plus a cross-process flock.

Drop the prefetch worker's compensating update_provider_cache_entry
re-persist: it re-stamped rows the canonical path deliberately leaves
untouched (stale catalog served on a failed fetch looked fresh for a TTL),
stripped the curated-fallback flag, and keyed ollama as "custom".
2026-10-15 22:12:28 +02:00
Robin Fernandes
ea45ec3936 feat(free-tier): connectors and managed tools use a connectors-only guest token
A free-tier guest who only uses connectors or managed tools no longer meets
the free-inference browser challenge. The connectors-side resolver
(resolve_nous_access_token: tool gateway, NAS connector routes, account
reads) serves whichever guest token is live (an inference one covers it) and
otherwise mints with purpose "connectors" (hermes-portal#1516), which NAS
never challenges. An inference token is minted, inside run_with_challenge,
only when the free model is called.

The connectors-only token is stored in providers.nous.connectors_token, next
to the existing inference slot, so auth.json written by current releases
loads unchanged. Which slot a token fills is read from its JWT scope claim,
so a NAS that predates #1516 (it ignores purpose and returns an inference
token, or answers 428) keeps working through today's challenge path.

Two non-chat paths no longer mint inference for a guest behind its back:
the auth keepalive skips a guest (its tokens are minted on demand, matching
the start-time guard), and the Nous model catalog and pricing reads run as
background callers, so they fall back to the curated list instead of opening
a browser challenge.
2026-10-13 00:29:04 +05:30
Max Yang
0e161737d2 fix(opencode-go): route Claude models to the Messages wire (#134848)
opencode-go's catalog carries claude-haiku-5-5, but the Go entry of _OPENCODE_API_MODE_PREFIXES had no claude- prefix, so it fell through to chat_completions and the relay rejected it with HTTP 400 ModelProtocolUnsupported (non-retryable, so the turn died on its first call). Route claude-* on Go to anthropic_messages, matching Zen. Regression asserts folded into the existing Go api-mode table test.

Fixes #134844

Co-authored-by: Mark S. <274530371+unsupportedpastels@users.noreply.github.com>
2026-10-12 14:06:06 -04:00
Maciej Lisiewski
2ff58849f4 ci: ruff UP037 fixes 2026-10-09 17:34:38 +02:00
kshitijk4poor
ad12263a5e refactor(models): name the two canonical-endpoint sources; comment says what the code does
Review follow-up on the TokenHub relay fix. The comment claimed the registry
endpoint counts only "when the profile leaves it empty"; the code (correctly)
counts both, and no provider has two different non-empty URLs. The set is now
built from two named values instead of an inline hanging comprehension.

Considered and not taken: reusing agent_init._provider_default_routes. It also
counts the other Moonshot region and Gemini's OpenAI-compat path as canonical,
which would turn a kimi-coding user pinned to the other region's host from a
relay probe into native discovery. That is a behaviour change for a separate PR.
2026-10-08 00:18:12 +05:30
kshitijk4poor
dd7ee86004 fix(models): TokenHub's saved endpoint is not a relay, so /model keeps the curated Hy list
#134320 gave tencent-tokenhub a profile whose base_url is empty (its auth registry row owns
the endpoint). _configured_relay_base_url decides "relay or canonical" from the profile's
base_url only, so a model.base_url that `hermes model` saved as TokenHub's normal endpoint
read as a relay: the picker probed {endpoint}/models and a successful reply replaced the
curated Hy list, dropping curated previews the live list lacks. Before #134320 the profile
lookup failed and the curated list stood.

The canonical endpoint is now the profile's OR the registry row's inference_base_url, both
through normalize_route_base_url. A different path on the same host is still a relay.
Reported by the review bot on #134320.
2026-10-08 00:18:12 +05:30
Teknium
d0b2715a33 feat(providers): pre-release profiles stay off discovery until signed in
ProviderProfile gains `hidden` and `listed()`. A hidden profile is left
out of every surface that offers providers (the hermes model / setup
lists, /model and the TUI inventory, the provider catalog behind the
dashboard accounts tab, the hermes auth add picker) until the user signs
in by name and its credential pool holds a row. Resolution by name is
never gated, so --provider, model.provider and `hermes auth add <name>`
keep working.

This replaces the PR's global _HIDDEN_GATES registry plus a per-provider
enable function, which returned True unconditionally and showed the
provider to every user.
2026-10-05 23:33:41 -07:00
Ben Barclay
8e015f483f feat(providers): add Solstice as a secret-launch OAuth inference provider
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.
2026-10-05 23:33:41 -07:00
Steve Dalonzo
d22e515644 fix(nous): retain positive-price models with rounded full discounts 2026-10-05 16:41:47 -05:00
Steve Dalonzo
1daf6eb077 fix(nous): apply the on-sale union in the post-login picker too
The sign-in / re-auth picker (_pick_nous_model_after_login) built its own
paid list and skipped union_with_nous_on_sale_models, so a discounted model
the curated list and paidRecommendedModels omit never showed there. Apply
it after the paid recommendation union and before policy narrowing, as the
other two pickers do.

Also keep image/video generation rows out of the on-sale union: the Nous
pricing fetch flags them with the chat-catalog rule from 296ec08dcf.
2026-10-05 16:41:47 -05:00
Steve Dalonzo
d31a2cc684 fix(nous): list on-sale models in the paid-tier picker
A Nous sale exists only in the live /v1/models pricing.original. The paid
picker unions the curated manifest with the Portal's paidRecommendedModels,
so a model missing from both never appears even while it is the deepest
discount on the gateway (inception/mercury-2.5 at -80%); sale chrome only
badged rows that were already listed.

Paid-tier Nous pickers (hermes model and the GUI/in-chat picker) now append
every discounted, tool-capable, non-free row from the cached catalog,
deepest discount first, before org policy narrows the list. Free tier is
unchanged (freeRecommendedModels). The Nous pricing fetch marks rows whose
supported_parameters omit tools so the union can skip them.
2026-10-05 16:41:47 -05:00
heyclos
92ad572740 fix(desktop): skip Anthropic frontier tiers in silent default picker
Rebase onto current main and rework the recommended-default fix per
maintainer feedback on #51493 (teknium1 + DavidMetcalfe).

Premise of the original Opus-only filter rotted: current Nous curated
list leads with anthropic/claude-fable-5, then Opus. An Opus-only filter
would leave Fable selected and fail to establish cost-safe onboarding.

Current main already routes get_recommended_default_model through
pick_silent_default_model for both nous and non-nous providers, but the
helper still fell through to model_ids[0] when the catalog-labeled
preferred default wasn't present in the (Portal-augmented) list. That is
the remaining billing hole.

Changes:
- Add _is_anthropic_frontier_tier covering Opus + Fable, anchored on the
  claude- prefix so community/distill slugs like qwopus3.6-27b-coder are
  rejected and future releases (claude-opus-5-0, claude-fable-6) keep
  matching without code changes.
- Harden pick_silent_default_model fallback:
  preferred catalog label -> first non-frontier entry -> model_ids[0] -> empty.
  Single shared policy used by both nous and openrouter callsites.
- Replace brittle Opus-first endpoint assumptions with:
  parametrized opus_first / fable_first_main / override_beats_ordering,
  falls_back_when_all_frontier, empty-list edge case, and unit coverage
  for the frontier predicate.

web_server.py needs no further change -- it already consumes
pick_silent_default_model. Hardening the helper covers every consumer.

Fixes #51491
2026-10-05 16:41:28 -05:00
kshitijk4poor
db68ebd223 fix(models): keep Daybreak and gpt-5.6-cyber on the Priority speed tier
Maintainer decision on the FASTTIER review: drop the "Daybreak/cyber aliases
offer no speed tiers" rule this stack introduced. It flipped
model_supports_fast_mode to False for gpt-daybreak-* and gpt-5.6-cyber, which
also hid /fast and the Desktop Fast option for models that accepted Priority
before. Restore the pre-stack predicate verbatim, make the kept invariant
assert Daybreak is fast-but-not-ultrafast (the proxy route stays the no-speed
case) and remove the Daybreak sentences from the speed docs.
2026-10-04 02:12:57 +05:30
kshitijk4poor
91586d448c refactor(tui_gateway): keep the session.create tier parse out of the oversized handler module
methods_session.py is already past 2000 lines, so the exact-tier parse that
#130990 grew in place moves with the rest of the composer overrides into
methods_session_model_guard.py (the session.create param gate), and the
strict "unknown word is an error, normal words pin ''" rule becomes
agent.fast_mode.parse_exact_service_tier next to the tier word table it
reads. The Daybreak/cyber exclusion folds into _is_openai_fast_model's
single return so hermes_cli/models.py does not grow.

Drops the PR's unused contextlib import in prompt_turn.py (no use was
added with it).

Co-authored-by: FroRaut <79215537+Froraut@users.noreply.github.com>
2026-10-04 02:12:57 +05:30
FroRaut
3778021382 feat(desktop): exact subscription speed tiers (Standard / Fast / Ultrafast)
Ultrafast collapsed into ordinary Fast across the stack: the catalog only
reported `fast`, presets and drafts stored a boolean, session.create took
only `fast`, and Settings had a single Fast switch, so an Ultrafast default
read as Fast and a new chat could lose it.

- Inventory reports `ultrafast` per model from the same route-aware
  resolver that builds the request; Daybreak aliases offer no accelerated
  speed (their priority request is ignored).
- session.create accepts an exact `service_tier` that wins over the legacy
  `fast` flag; unknown tiers are rejected.
- Desktop keeps the exact tier through presets, draft creation, session
  options and labels; an unsupported remembered tier falls back to
  Standard, and failed edits reconcile to the confirmed state.
- Settings → Model → Main model offers one Speed choice (Standard / Fast /
  Ultrafast) on models that support Ultrafast; others keep the Fast switch.

Split out of #129251 (which keeps Daybreak).

(cherry picked from commit 4e332fb850c989ef9f34bd70aaca174042beecc6)
2026-10-04 02:12:57 +05:30
Brooklyn Nicholson
7cb4aa783f fix(models): merge StepFun Step Plan live list with curated catalog on the picker path
Follow-up to #131892. The live+static merge landed in curated_models_for_provider,
which has no production callers on main: every real picker surface (CLI/Desktop/
Telegram /model, hermes model) resolves through provider_model_ids, whose stepfun
fetcher (_api_key_provider_live) returned the live Step Plan list unmerged — so a
working Step Plan API still hid step-3.7-flash (#41147).

Apply the merge where the stepfun live catalog is fetched, following
_anthropic_catalog's _merge_unique pattern: a new _stepfun_catalog fetcher merges
live rows first with the curated floor (deduped via _model_dedup_key), and a declined
probe (no creds / failure) still falls through to the generic profile path whose
merge_profile_catalog already serves the curated placeholder. The setup wizard's
_model_flow_stepfun now offers the same merged list via provider_model_ids. The
redundant dead-path merge in curated_models_for_provider is removed; its stepfun
test keeps passing because the merge now flows through provider_model_ids.

Fixes #41147
2026-10-02 21:43:17 -05:00
liuhao1024
37bd0843c3 fix(cli): add step-3.7-flash to StepFun picker by merging live and static catalogs
The StepFun Step Plan API only returns 2 models (step-3.5-flash,
step-3.5-flash-2603), but step-3.7-flash is available via the Standard
API. When the configured base_url points to Step Plan, the live fetch
overwrites the static catalog and step-3.7-flash disappears from the
/model picker.

Fix: add step-3.7-flash to _PROVIDER_MODELS["stepfun"] and merge live
API results with the static catalog in curated_models_for_provider()
so all known models appear regardless of which API endpoint is used.

Fixes #41147
2026-10-02 20:24:37 -05:00
kshitijk4poor
b7200efef0 docs(models): get_codex_model_ids documents its fallback return 2026-10-02 13:34:54 +05:30
kshitijk4poor
7793c19660 refactor(models): one fallback marker for every catalog fetcher
get_codex_model_ids returns CuratedFallbackModels directly instead of a
second codex-only marker that _codex_catalog re-wrapped; the class moves to
the static catalog leaf so codex_models can use it. The catalog identity
normalizes its route with normalize_route_base_url like every other route
key.
2026-10-02 13:34:54 +05:30
AhmetArif0
ba2a38e771 fix(models): mark the Anthropic curated fallback as a placeholder
_anthropic_catalog() returned the curated list as a plain list when the live
/v1/models fetch failed, so a transient outage on a proxy base_url was cached
with the full 1h TTL as if it were the account's/proxy's real catalog, and
neither a same-credentials restart nor Refresh Models could shake it before the
TTL lapsed. Wrap the fallback return in CuratedFallbackModels, the placeholder
type #107391 introduced for the same class of bug.

Salvaged from #121248 (the Anthropic half; the Codex half lands via the
typed-fallback commit before this one).
2026-10-02 13:34:54 +05:30
FroRaut
3fbace2e76 fix(models): keep account-gated Codex rows when discovery falls back
A failed ChatGPT Codex catalog fetch returned the static offline hints as if
they were the account's catalog, so the picker cached them and dropped
account-gated rows such as GPT-6 Astra until the cache expired. The hints are
now typed (CodexFallbackModels) and cached as short-lived curated fallback
rows that never replace a verified account fetch, and the catalog cache key
includes the resolved route, not only the ChatGPT principal.
2026-10-02 13:34:54 +05:30
Victor Kyriazakos
60ce574905 fix(fast): send service_tier on the openai-api route and accept operator OpenAI tiers
Treat openai-api as the first-party api.openai.com route in _fast_mode_route_supported. This closes the route gate introduced by c7e2e0b779 while preserving the existing host check, so proxies and aggregators remain excluded. The shared service_tier parser already accepts operator literals, including ultrafast, and the existing static and bounded-mode paths thread the selected literal through request_overrides.
2026-09-30 14:23:51 -04:00
kshitijk4poor
bdde674296 feat(fast): /fast ultrafast for GPT-6 Astra, priced at the served tier
OpenAI's Ultrafast service tier (service_tier="ultrafast") is broadly
available for GPT-6 Astra in the API and Codex (Pro 500 / Enterprise),
billed at 6x Standard. GPT-6.1 Sol Ultrafast is announced as coming soon.

- One tier table: agent.fast_mode.parse_service_tier / STATIC_TIERS now
  back the CLI, gateway and TUI config loaders (three hand-copied parsers).
- resolve_fast_mode_overrides(tier="ultrafast") sends the tier only for
  Ultrafast models on api.openai.com / chatgpt.com; anything else gets
  nothing rather than a silent swap to another paid tier.
- /fast ultrafast on CLI, gateway (typed + picker when supported) and TUI;
  static-tier attach sites pass the tier through.
- Pricing: the response's SERVED service_tier is folded into usage (Codex
  stream assembler keeps it); served ultrafast prices from a published
  6x row (272K whole-request tier included). A request asking for
  Ultrafast but served at default bills at Standard.
- i18n: 4 new keys in all 17 locales; option lists mention ultrafast.
2026-09-29 23:54:34 +05:30
Teknium
a5bd246865 Old pre-decomposition import paths are gone: plugin compat layer removed on schedule (#126164)
* refactor(plugins): remove the Sep 2026 decomposition compat layer on schedule

The PLUGIN-COMPAT layer (2776813df3 + d63e380324 + 0a5164cebe) kept pre-#102117 import paths
alive for external plugins until 2026-09-14. That window closed two weeks ago; since then the loader
has already been skipping plugins that use the old paths. This removes the layer itself:

- 328 appended `PLUGIN-COMPAT` blocks (lazy `__getattr__` pointer tables, re-exported third-party
  names, restored dead definitions) and the three re-export stub modules
  (gateway/startup_watchdog, hermes_cli/observability/relay_runtime, tools/environments/modal_utils)
- COMPAT_MANIFEST.md, compat_manifest.json, scripts/check_compat_pointers.py and its lint step
- the reporting surfaces: CLI banner notice, `hermes plugins compat`, the `hermes doctor` section,
  the post-update notice, the Desktop one-time dialog, the loader's pre-import skip and the
  `plugins.allow_deprecated_imports` escape hatch

An external plugin that still imports an old path now fails to load with its ImportError as the
reason in `hermes plugins list`, the same path as any broken plugin.

hermes_cli/plugin_compat.py stays as three inert stubs (compat_report, removal_in_effect,
summary_lines): an already-running pre-removal `hermes update` lazy-imports them after the checkout
swap (tests/compat/old_updater_surface.json).

In-tree fallout, both already dead: hermes_cli/setup.py::_check_espeak_ng (no callers; its
`shutil` came from a compat block) and gateway/config.py::SessionResetPolicy ("retained solely for
the scheduled plugin-compat window"). Two test_run_agent patches targeted the removed
`run_agent.handle_function_call` pointer; they now patch `model_tools.handle_function_call`, the
seam production reads, like every sibling test in that file.

* chore: retrigger CI (zero-job startup_failure phantom)

* test: drop resolution allowlist rows for the two deleted which() sites

hermes_cli/setup.py::_check_espeak_ng (dead) and tools/skillevaluator_scan.py::scanner_available
(a restored definition inside a PLUGIN-COMPAT block) no longer exist; the stale-row gate requires
their allowlist entries go with them.
2026-09-28 10:21:41 -07:00
kshitijk4poor
d24aadfdd1 refactor(copilot): one GitHub effort clamp for the profile and main agent
Follow-up to the #103857 salvage. The Copilot provider profile and the
main-agent GitHub reasoning path each carried the same clamp-then-medium
fallback. Both now call hermes_cli.models.clamp_github_reasoning_effort.

The offline Astra tests move next to the other Copilot effort tests, along
with a check that a structured catalog entry still wins. The main-agent
clamp now has a test pinning max/ultra -> high on the GPT-5 ladder. The
transport test no longer writes config.yaml. The two effort comments now
say the same thing.
2026-09-26 22:21:47 +05:30
kshitijk4poor
e991bfe24a fix(copilot): offline Astra effort fallback matches the exact Astra slugs
Follow-up to the #103857 salvage. The Copilot pattern fallback now uses
is_astra_model (the shared exact set) instead of a gpt-6-astra prefix, so
speed-tier or unknown suffixes such as gpt-6-astra-pro stay off the Astra
ladder, matching every other Astra gate. Also drops the stale
'"max" is gpt-5.6-only' comment in the auxiliary Responses builder.
2026-09-26 22:21:47 +05:30
Jash Lee
7a597324a1 fix(copilot): preserve Astra reasoning effort
(cherry picked from commit 108f20c553852246deb0ce86fd5474d5d7992dc1)
2026-09-26 22:21:47 +05:30
kshitijk4poor
48ac94872a fix(models): canonical-URL check covers OpenRouter and equivalent spellings
Follow-up to the #123592 salvage. The canonical endpoint now comes from the
provider profile, which also covers OpenRouter (absent from PROVIDER_REGISTRY),
so pinning https://openrouter.ai/api/v1 keeps the native catalog too. Both
sides go through normalize_route_base_url, the helper the rest of the route
comparisons use, so scheme/host case and default ports no longer read as a
relay. The provider is normalized once.
2026-09-26 22:15:19 +05:30
tarkilhk
6e74191b87 fix(models): preserve native discovery for canonical provider URLs
(cherry picked from commit dbbe9a98e238d7c01177d0d3ac205deaa94e4675)
2026-09-26 22:15:19 +05:30
Austin Pickett
4661892752 Merge remote-tracking branch 'origin/main' into austin/fix/121347-base-url-resolution
# Conflicts:
#	hermes_cli/models.py
2026-09-25 13:20:26 -04:00
brooklyn!
296ec08dcf fix(models): keep generation models out of chat
Chat catalogs and the session switch treated image and video generation
models as chat. Exclude them by the capability type and name shape the
catalog already publishes, reject selecting one as the session model, and
do not restore a primary already known to be non-chat. Desktop shows the
fallback switch in the transcript.
2026-09-25 12:07:32 -05:00
Austin Pickett
6926997f05 fix(providers): make a configured relay terminal for catalog egress; refuse a foreign Anthropic endpoint
Addresses two P1 review findings on #121614.

1. `provider_model_ids`: a failed or empty relay probe fell through to the
   canonical per-provider fetcher, sending the provider credential to exactly
   the vendor host the user routed away from — recreating #121387 on the
   failure path. A configured `model.base_url` relay is now TERMINAL for live
   catalog egress and degrades to the local curated list instead. The curated
   tail is extracted as `_static_catalog` and shared by both paths.

   Fetchers that already resolve `model.base_url` themselves and degrade
   locally (`_anthropic_catalog`, `_custom_catalog`, `_openai_catalog`, the
   simple api-key fetchers) are excluded from interception via
   `_RELAY_AWARE_CATALOG_FETCHERS` — they already satisfy the invariant and
   produce a better-merged catalog.

2. `_try_anthropic`: an `explicit_base_url` that failed
   `_is_anthropic_compatible_host` was silently dropped, leaving `base_url` at
   the ambient/canonical host and continuing with the explicit credential —
   a silent retarget of authority, not the refusal the PR body claimed. It now
   returns unavailable before client construction.

Regressions: an egress-sentinel test pins that no vendor fetcher, profile
catalog or models.dev merge is reached after a relay 404/hang; the Anthropic
test now asserts no client and zero SDK builder calls.
2026-09-25 12:56:32 -04:00
Austin Pickett
0cc91bb396 Merge remote-tracking branch 'origin/main' into austin/fix/121347-base-url-resolution 2026-09-25 12:50:14 -04:00
kshitijk4poor
e87f673faa fix(codex): send catalog/image credentials only to their own route
Follow-up to the two contributor commits for #121486. The picker, the
image plugin and the auxiliary Codex client still composed a pooled
gateway key with a base re-read from ambient state (HERMES_CODEX_BASE_URL
or the chatgpt.com default), so a model.base_url-only gateway (env unset)
still sent its key to chatgpt.com.

- auth_codex: resolve_codex_runtime_credentials reports the host a pooled
  credential actually routes to (runtime_provider._pool_entry_mode_and_url:
  env > model.base_url while the row is canonical > row URL) instead of the
  ambient default; get_codex_auth_status carries the same bound base_url.
- picker: get_codex_model_ids(access_token, base_url=) now receives the base
  resolved with the token from hermes_cli/models.py, the CLI default-model
  swap (self.base_url) and the `hermes model` Codex flow.
- aux/image: _resolve_codex_credential_and_base() returns (token, base) from
  one pool selection; the image plugin, _build_codex_client and the raw
  Codex client use it (profile-scoped override from #121497 still wins).
- model_metadata: the non-JWT refusal now applies only when the target is
  chatgpt.com; a gateway key may probe its own gateway's /models.

Adversarial regressions: model.base_url with env unset, env/route mismatch,
opaque + JWT gateway keys, pool-selected credential, pool row with its own
gateway URL, direct-ChatGPT positive control.

Addresses @andrexibiza's review on #121508.
2026-09-25 21:27:06 +05:30
Austin Pickett
5af33f8375 Merge remote-tracking branch 'origin/main' into austin/fix/121347-base-url-resolution 2026-09-25 09:09:44 -04:00
ahisblessed
9d7536d803 fix(cli): probe model.base_url in the model picker catalog (#121387)
provider_model_ids() probed the provider's canonical host even when
model.base_url pointed the configured provider at a relay or proxy, so
the picker listed the vendor's models and sent the listing request to a
host the user never chose. Discovery now probes the same endpoint
inference uses, and any probe failure falls through to the canonical
fetchers unchanged.

Fixes #121387
2026-09-24 09:40:09 -04:00
ethernet
16652eea18 Merge remote-tracking branch 'origin/main' into ethie/pm-clean
# Conflicts:
#	gateway/config.py
#	gateway/config_loader.py
#	gateway/readiness.py
#	hermes_cli/managed_scope.py
#	hermes_cli/plugin_python_deps.py
#	hermes_cli/plugins_cmd.py
#	hermes_cli/update_cmd_maint.py
#	plugin-catalog/hindsight.yaml
#	plugins/plugin_loader.py
#	providers/__init__.py
#	scripts/run_tests.sh
#	tests/gateway/test_control_socket_windows_live.py
#	tests/gateway/test_gateway_streaming_nested_config.py
#	tests/hermes_cli/test_doctor.py
#	tests/hermes_cli/test_plan_reconciliation_windows_live.py
#	tests/hermes_cli/test_update_apply_shallow_count.py
#	tests/hermes_cli/test_update_concurrent_quarantine.py
#	tests/hermes_cli/test_update_shim_self_lock.py
#	tests/hermes_cli/test_verify_console_scripts.py
#	tests/tools/test_lazy_deps.py
#	tests/tui_gateway/test_subprocess_encoding.py
#	tools/lazy_deps.py
2026-09-23 15:26:34 -04:00