Commit Graph

26 Commits

Author SHA1 Message Date
Teknium
f5900bf66e fix: a chat whose launch API key changed says so and names /new, not /retry
A local session never sends a different key than it started with (#139615).
When the config.yaml secret on its route changes and the backend restarts,
every turn and model pick on that chat is refused with
launch_credentials_unavailable. That policy is unchanged. The copy was the bug:

- Turn (every surface): the refusal escaped TurnRunner.run_sync as an
  exception into the generic agent-error handler, so the reply read
  "Something went wrong ... launch_credentials_unavailable (...). Use /retry
  to try again" plus a false "Some actions may already have run" notice.
  /retry can never succeed here. run_sync now settles it like the gone-folder
  refusal: a failed, never-run turn (api_calls 0) whose text says the key the
  chat started with changed, that /retry fails the same way, and that /new
  starts a chat on the current key; stamped failure_reason
  launch_credentials_unavailable, failure_retryable false. The generic handler
  path (a refusal raised later in the turn) uses the same copy and stamp.
- agent/error_surface maps the code to the gateway layer (no Switch provider).
- Desktop: an error card for the code (Start new session, no Retry), and the
  model-menu/model-option toast (#143133) shows the card's sentence with a
  Start new session button instead of the raw code.
- TUI: describeRpcError rewrites the bare code (model pick refusal) to the
  same remedy.
- Classic CLI: refusal_text (/compress, /worktree) and a refused /model print
  the remedy instead of the bare code; --api-key on resume that does not match
  now says a session never switches keys and to start a new one.

Copy: gateway.errors.launch_credentials_unavailable in all 17 locales,
userMessages.rpc.launchCredentialsChanged in all TUI catalogs, the Desktop
card in all 9 catalogs carrying error codes. The over-cap de/es/fr/ja/zh
Desktop catalogs move their refusal card rows into <lang>_error_codes.ts
siblings (the ru shape), so each shrinks while gaining the entry.

Refs #143133 (its raw toast; the reporter's trigger without a config change is not root-caused here)
2026-10-24 11:47:35 -07:00
Teknium
c00f999ba4 Merge origin/main into window-plans
Resolves the desktop i18n conflicts: main moved en/ru errorCodes into
en_error_codes.ts / ru_error_codes.ts, so usage_window moves there; ar/ja/zh/
zh-hant keep both usage_window and main's workspace_unavailable. _keys.desktop.json
regenerated.
2026-10-22 12:53:41 -07:00
Teknium
2c27f97cb5 fix: a chat whose working folder is gone says so instead of "model request failed"
A local session freezes its working directory; the owner's readiness gate
(policy_scope) refuses any turn whose frozen cwd no longer exists, by design.
But TurnRunner.run_sync let that RuntimeStoreError('workspace_unavailable')
escape as a raw exception into the generic agent-error handler, so every
surface showed an unexplained failure: the classic CLI printed "The model
request failed. Run /model ... / Details: Something went wrong", the
transcript gained a false "Some actions may already have run" row, and the
gateway logged a traceback per message. A classic `hermes -w` session whose
clean tree quit removed (or any folder deleted by hand) became a chat where
every message failed with no hint why.

run_sync now catches only that refusal on scope entry and settles the turn as
a failed, never-run result (api_calls 0) with its own copy naming the missing
folder and the way out (recreate it, `/worktree new` in the CLI, Move to
project in Desktop), stamped failure_reason workspace_unavailable /
failure_retryable false: the same shape the model-resolution failure path
uses. The refusal carries field=cwd, detail=<path> so other paths that
surface it name the folder too. agent/error_surface maps the code to the
gateway layer (no "Switch provider"), and Desktop gets its own error-card
copy with Retry + Start new chat.

Copy lands in all 17 gateway catalogs and the 9 Desktop catalogs carrying
error codes. The over-cap Desktop catalogs offset the growth by moving their
error-card tables into topical siblings (<lang>_error_layers.ts as en already
does, en/ru_error_codes.ts).
2026-10-22 10:55:52 -07:00
rob-maron
6adca16a77 Merge branch 'NousResearch:main' into window-plans 2026-10-21 23:07:58 -04:00
Siddharth Balyan
22fc809869 feat(data-use): route connector results that need no-training to qualifying Nous endpoints
The tool gateway now tags execute results with dataUse.requires (no_training,
zero_retention). Hermes keeps that as `data_use` metadata on the tool message
(content unchanged; a batch carries the union), persists it inside the existing
display_metadata column (no migration; /branch, resume and compaction copies
keep it), and strips it from every provider request. The Nous profile reads the
union over the outgoing messages and sends provider.data_collection=deny (+ zdr
for zero_retention) on both the chat-completions and Anthropic Messages paths;
no other provider sees it. A 403 data_policy_denied classifies as its own
non-retryable reason with no fallback and copy that tells the user to switch
model, compress, or start a new session.
2026-10-21 15:46:19 +05:30
rob-maron
15307dece7 Usage-window plan support 2026-10-20 21:04:30 -04:00
kshitijk4poor
7e9eb8d9a3 fix(gateway): stamp a host-side resolution failure as a gateway-layer error
The reply for a host-side resolution failure was stamped failure_reason
"unknown". "unknown" falls through error_surface's layer table to the provider
layer, so Desktop offered "Switch provider" for a deleted CA bundle.

Add a "host_error" site code on the gateway layer. It stays retryable=False: the
known trigger fails the same way on every unchanged retry until the gateway is
restarted, which is what the error-surface retryable flag describes.
test_site_failure_codes_never_collapse_to_unknown now covers it too.
2026-10-17 14:46:41 +05:30
unsupportedpastels
85b85f1367 fix(cli): reconnect the classic CLI after a gateway restart
After `hermes gateway restart` (or an idle exit or crash), the interactive
classic CLI never re-attached. GatewayConnection kept its finished loop thread,
so start() returned early and every later call raised "Gateway disconnected",
even once another client had started a new gateway. The CLI then reported
each prompt as "The model request failed. Run /model to switch...".

- GatewayConnection dials again on the next call once the gateway has hung
  up. connect_gateway starts a gateway when none is running. The redial
  resumes every session the viewer had open before it counts as ready, so no
  frame of the new connection is missed. A failed redial is retried on the
  next call; close() and a failed first connect stay final.
- Each connect bumps `epoch`, and a connection's loss is tagged with it. A
  turn ignores a loss from an earlier epoch (lost_before), so a prompt that
  reconnected and was accepted is never reported as "outcome unknown". That
  report would invite the user to resend accepted work. A turn that was
  running when the gateway went away is still reported as unknown and is
  never resent.
- A lost gateway is the `gateway_connection` site failure: the CLI shows the
  transport error as written instead of the model-failure copy, and the
  error surface puts it on the gateway layer (no "Switch provider").
- `chat -q` whose turn a restart drain interrupted still exits 130, but now
  says so on stderr with the drain's reason instead of exiting silently.

Refs #134889
2026-10-14 20:05:34 -04:00
Adolan
77b727551b fix(desktop): open the rejected provider's key from Update API key 2026-09-29 19:31:49 -05:00
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
Adolan
cb8473e446 fix(error-surface): name the provider by its display label on every error card 2026-09-27 13:19:41 -05:00
teknium1
7c2b81d320 chore: merge origin/main (resolve apps/desktop/src/components/assistant-ui/thread/assistant-message.tsx, website/docs/user-guide/desktop.md) 2026-09-19 10:54:43 -07:00
teknium1
1fc8887c6e fix(desktop): the error card names a WAF block and the User-Agent fix instead of 'retry in a moment'
upstream_blocked had no ERROR_CODE_KEYS entry or errorCodes copy, so the Desktop card fell
back to the provider-layer 'retry' body — wrong for a block a retry can never heal. Same
guidance as the CLI/TUI copy: set a User-Agent via the provider's extra_headers, or switch
provider. Other locales carry no errorCodes table and fall back to en. The Python fallback
set agent/error_surface.py::_NON_RETRYABLE_REASONS learns the reason too.
2026-09-19 09:57:21 -07:00
teknium1
645e9298b6 feat(error-surface): 429 error card shows when the usage limit resets
A "HTTP 429: The usage limit has been reached" turn offered only Retry and
never said when a retry would work, so users guessed or babysat the app
(#98852). The provider already tells us: Retry-After / resets_at /
retry_after are parsed into the turn's error context (extract_api_error_context)
and honoured by the backoff, but the datum died there.

- agent/turn_recovery.py::_stamp_limit_reset: both terminal paths
  (max_retries_exhausted_result, nonretryable_client_error_result) stamp
  failure_resets_at (epoch s) on the failed result and append one plain line
  ("Limit resets at 14:05 (in 1h 00m).") to final_response, which every text
  surface (CLI, Ink TUI, messaging gateway) renders.
- agent/error_surface.py: result path forwards failure_resets_at as
  surface.resets_at; the exception path derives it from the same context.
- tui_gateway/contracts/events.py::ErrorSurface.resets_at + regenerated
  apps/shared gateway-contract outputs.
- apps/desktop lib/error-surface.ts: parse resets_at -> resetsAt,
  formatLimitReset("HH:mm (in 1h 05m)", null once passed), diagnostics line;
  the error card renders "Limit resets at …" next to Retry (i18n copy in every
  full locale).
- Docs: website/docs/user-guide/desktop.md error-card section.

Informational only: no scheduled or automatic retry is added — firing a turn
unattended on a subscription is the maintainer's call (#98872, #103048).
2026-09-19 01:34:01 -07:00
kshitijk4poor
564687b113 fix(nous): classify the desktop's escaped-exception card with the request credential
build_error_surface_from_exception classified without the credential, so an anonymous
session's gate refusal that escaped the turn loop read as a retryable rate limit. Thread
api_key from the TUI gateway's terminal-error path. Provider-gate the named welcome-host
400 like the 403 branch, and drop the provider conjunct the anonymous gate already implies.
2026-09-17 12:28:25 +05:30
Robin Fernandes
16def7b8cc fix(free-tier): the desktop renders a free-tier refusal as its own card, not an OAuth re-login
A welcome-tier 403 classifies as auth_permanent, so the desktop's error
surface mapped it to "Your Nous Portal sign-in expired" with a Nous Portal
re-login button — the chat sentence never reached the user. Terminal results
on the free route now carry a structured free_tier block (kind + the chat
sentence); agent/error_surface.py turns it into a free_tier_<kind> code on
the provider layer with the sentence as `message`. The desktop gives those
codes their own titles, shows the backend sentence as the body, and offers
"Sign in with a Nous account" (the free-tier dialog) instead of the OAuth
re-login, with Retry only where a later send can succeed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 20:44:42 +05:30
teknium1
23036e20a6 fix(ux): plain-language, actionable user-facing messages (core)
Squashed integration of the user-facing message audit for this surface set.
Full per-finding receipts: /tmp/ux-audit/lanes/*-receipt.md (campaign artifacts).
2026-09-15 04:12:13 -07:00
Teknium
97ca90f184 fix(desktop): expired OAuth grant shows a one-click 'Sign in again' instead of a retryable Provider error
A rejected OAuth token (HTTP 401 'User not found' from Nous Portal, Codex,
xAI…) reached the desktop error card as 'Provider error' with Retry as the
first action, which just replays the same dead credential.

Backend: nonretryable_client_error_result dropped failure_reason /
failure_retryable, so error_surface classified every non-retryable 4xx as a
retryable provider failure. It now stamps the classifier verdict like the
max-retries path, and auth-layer descriptors carry auth_kind
(oauth|api_key, derived from the provider catalog tab) + provider_label.

Desktop: an auth/oauth surface renders 'Authentication error', explains that
the <provider> sign-in expired/was revoked, and offers 'Sign in to <provider>
again' which launches that provider's existing onboarding OAuth flow scoped
to the failed session's gateway profile. Retry stays as the follow-up click.
Re-login to the provider already in use keeps the current model instead of
swapping in the recommended default.
2026-09-09 16:30:24 -07:00
Teknium
2776813df3 compat(plugins): temporary import-path shims for external plugins — ONE commit, revert on schedule
The Sep 2026 decomposition (PR #102117) makes internal import paths a non-API: names now live in
the focused modules that define them. This commit is the ONLY thing keeping the old paths alive,
so external plugins have time to update. It is deliberately a single, unsquashed commit:

    git revert <this sha>

removes every shim, stub and manifest at once on the announced date. Nothing in-tree may depend on
these pointers: scripts/check_compat_pointers.py (wired into lint.yml) fails CI if it does.

What it adds (see COMPAT_MANIFEST.md, compat_manifest.json):
- 332 facade modules get one delimited `PLUGIN-COMPAT` block appended at the end of the file
- 1,172 moved names resolved lazily via a module `__getattr__` (PEP 562) — never a top-level import,
  so no import cycles; facades that already had `__getattr__` get a chained one
- 592 third-party/stdlib names the old modules used to expose, with their original import statements
- 266 public definitions that had been deleted as unused, restored byte-for-byte from the pre-decomposition
  tree (+40 private helpers and 16 imports pulled in only because a restored definition needs them)
- 3 deleted modules recreated as re-export stubs (gateway/startup_watchdog, hermes_cli/observability/
  relay_runtime, tools/environments/modal_utils)
- private names (`_x`) get no pointer: they were never API (3,792 skipped)

Verified: all 335 touched modules import under a fresh HERMES_HOME and every manifest name resolves;
the lint reports zero in-tree uses; ruff clean; targeted suites unchanged.
2026-09-03 17:13:22 -07:00
Teknium
53db597201 simplify(compat): hermes_state — drop 81 re-exports + 3 registry aliases + 3 shims, repoint 45 callers + 60 test files
hermes_state.py: delete every '# noqa: F401 (re-exported...)' import block (hermes_state_common/errors/guard/
readpool/sessions/fts/dbfile/wal/repair/registry + agent.context_compressor _DB_PERSISTED_MARKER_KEY); keep
only the names hermes_state.py itself uses, without noqa.
hermes_state_registry.py: drop get_shared_session_db/release_shared_session_db/close_shared_session_dbs
aliases; every caller (gateway/, tools/, tui_gateway/, cron/, mcp_serve, run_agent, tests) now imports
acquire/release/close_all/release_or_close from hermes_state_registry.
hermes_state_titles.py: drop set_auto_title_if_empty shim (title_generator keeps its getattr fallback).
Re-remove shim-only names restored by 34abf954bd: latest_user_message_row_id (tests call
latest_message_row_id(key, role='user'); role-targeting assertions kept) and get_session_activity (tests
build the snapshot via agent.session_activity.build_activity_snapshot over db.get_session(sid)).
hermes_state_wal._log_once resolves its dedupe sets as module globals instead of via hermes_state;
hermes_state_repair helpers call module globals directly (tests patch hermes_state_repair.<name>).
Frozen updater surface untouched (update_cmd_maint imports only SessionDB from hermes_state).
2026-09-03 13:46:50 -07:00
Teknium
ae2953ef01 refactor(agent/display,error_surface,i18n): final guard-ladder collapse 2026-09-02 19:32:53 -07:00
Teknium
b2876bcba4 refactor(agent/display,error_surface): flatten preview/label/status-phrase branches, dict-build surface descriptors 2026-09-02 19:21:47 -07:00
Teknium
282688e37e refactor(agent/error_surface,i18n): fold layer resolution into helper, collapse guard ladders (strings untouched) 2026-09-02 18:34:22 -07:00
Teknium
6a88ec4eb3 refactor(agent/adapters): simplify azure identity, response guards, error surface, retry utils (-603 LOC)
Drop dead read_error_body_or_default / LAYER_RUNTIME; inline single-use
_build_default_credential/_safe_close; compact incident narratives to their
invariants in the guards. Byte-cap and deadline semantics of
read_streaming_error_body verified identical.
2026-09-02 13:29:47 -07:00
Teknium
334bcbac93 fix(desktop): error card honors the classifier's retry verdict + failing-session identity (review feedback)
Addresses @helix4u's review on #91493:
- conversation_loop now stamps failure_retryable (the real ClassifiedError
  verdict) next to failure_reason; error_surface prefers it and only falls
  back to the reason set for older results. Fallback set corrected to match
  classify_api_error (auth, format_error, billing_unverified now
  non-retryable).
- The descriptor carries the failing session's provider/model captured at
  classification time; Copy error details prefers them over the foreground
  composer atoms.
- Open logs is labeled 'Open Desktop logs' on remote/cloud connections —
  the local folder holds transport logs, not the remote runtime's.
- API-exception module allowlist widened to botocore/boto3/google/grpc/
  requests/aiohttp so other adapter SDKs don't misclassify as gateway.
2026-08-21 15:24:03 -07:00
Teknium
98f6fc549a feat(desktop): failed turns name the failing layer with recovery actions
Turn errors now carry a structured {layer, code, retryable} descriptor
(agent/error_surface.py) built from the same classifier the retry loop
uses. The tui_gateway stamps it on terminal error frames, retained
failed-turn snapshots, and resume replay; the Desktop error card renders
the layer title (provider / endpoint / streaming / auth / billing /
gateway / runtime / disk) plus matched actions: Retry, Switch provider,
Open logs, Copy diagnostics.

Older backends that omit the descriptor keep today's behavior (generic
title, string-sniff fallbacks) — the field is advisory on both sides.
2026-08-21 15:24:03 -07:00