Commit Graph

440 Commits

Author SHA1 Message Date
Teknium
f00891f671 test(acp): restore core coverage of the public ACPClient on a generic fake agent
R4 review P2-6: moving the Copilot ACP provider out of core deleted the e2e
and unit tests that guarded the public agent.acp_client.ACPClient base
(permission never granted, fs reads confined to cwd + redacted, no agent
process outliving the CLI, per-session process reaping, tool-call round
trip, compaction, retry semantics, long-reasoning progress).

Re-home them in core against a vendor-neutral fake ACP agent
(tests/fakes/providers/fake_acp_agent.py) and a generic `fake-acp`
external_process user plugin written into the temp HERMES_HOME, with the
same assertions as the deleted tests. Known open gaps stay xfail behind
their existing KnownSymptom gates (#65788, #120550, #101507, #121290).

Red proof: breaking each invariant in agent/acp_client.py (auto-grant
permission, drop cwd confinement, drop redaction, no-op terminate, reap a
sibling's process, drop tool extraction, crash-as-timeout, ...) turns the
matching tests red.
2026-10-25 22:22:43 -07:00
Teknium
2f644f3fed Merge origin/main into copilot-seams/integration
Conflict: hermes_cli/env_loader.py import block. Kept the branch's
left_core_migration.profile_env_names import and main's ConfigBackend
switch (load_yaml_file_readonly no longer imported; _load_secrets_config
reads through config_backend.read_config_doc_readonly).

No main commit since 0c771d7a5b touches Copilot code; nothing to port.
2026-10-25 21:02:41 -07:00
Teknium
1da2eb42dc refactor!: remove GitHub Copilot from core (now the github-copilot labs plugin)
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.
2026-10-25 20:57:22 -07:00
Ben Barclay
550c7cfb62 test(e2e): count config reads at the file backend's parse seam 2026-10-25 18:54:09 -07:00
Teknium
36f7966f30 test(e2e-upgrade): build the pre-handoff updater env from the lock, overrides applied
The leg provisioned core's dependencies with pm.ensure_environment, which
re-resolves the bare [project].dependencies list without core's [tool.uv]
override-dependencies. Since Pillow moved to 13.0.0 over browser-harness's
exact pillow==12.3.0 pin (an override), that universal lock is
unsatisfiable. Export core's locked set and install it with
pm.build_requirements_environment(lock=uv.lock), which applies the lock's
overrides, plus the old tag's PyYAML requirement.

No production caller hands core's dependency list to ensure_environment;
plugin workspaces inherit [tool.uv]. Pillow 13.0.0, its override and
browser-harness 0.1.13 are unchanged.
2026-10-22 15:37:29 -07:00
Teknium
d815531ed7 test(e2e): Windows journey teardown frees the install even when the artifact copy fails
Review follow-up: deletion now sits in a finally around artifact collection,
so a full disk that breaks the copy cannot keep a whole install on the drive,
and the leak check step runs with if: always() so failed runs still name any
leftover install.
2026-10-22 15:34:08 -07:00
Teknium
071d0aa335 test(e2e): Windows update journeys delete their install at teardown
Machine.teardown copied the transcripts and logs out, then left the whole
fake profile behind: a full install (checkout, venv with every extra, PM
tools, caches) plus serve.git, all on the runner's only drive. With
test_damaged_checkout.py the suite reached 13 files / 15 machines and the
last journey ran the disk dry (run 39853224877: 92 MB free, the three
standard-user cells failed; the webapp dispatch hit 0 MB and failed 8).

Teardown now removes the profile and serve.git after the artifacts copy
(long-path prefix, read-only git objects via utils.rmtree_readonly, retry
while a killed process lets go); anything it cannot delete is named in
teardown-leftovers.txt, and a job step fails when a machine install
outlives its journey.
2026-10-22 15:34:08 -07:00
Teknium
31ad8adc63 test(e2e): damaged .git on Windows — paused gateway returns, installer repairs 2026-10-21 16:57:37 -07:00
Teknium
04cf0eb9a8 test(update): kill the frozen completion child on every exit path
A stopped child never exits by itself, so a probe that times out or raises
must still SIGKILL it, or it holds the checkout lock forever. Fold the two
cells into one body with the kill in a finally (Greptile on #142238).
2026-10-20 13:36:55 -07:00
Teknium
3ca0639e89 test(update): freeze the completion child so the killed-owner lock cells cannot race it
The killed-owner (d) and orphan-reader (e) cells SIGKILL `hermes update` while its
completion child runs, then check that the lock the child inherited still refuses a
second update. The child kept running its real work meanwhile, and on a fast CI runner it
finished and exited before the second update probed the lock, so the lock was free and
the update started (rc=0, child alive after: False): every dispatched e2e-upgrade (git)
run since 0319e113 failed this way, and one with no relevant diff passed.

SIGSTOP the child before killing the owner: it keeps its inherited fd, so the cell still
proves the product guarantee, but it can no longer exit first. With a 20 s pause before
the probe the old cell fails exactly as CI does and the new one passes.
2026-10-20 13:36:55 -07:00
Teknium
5d35c5ffff test(e2e): the tmux resize scrollback test follows the glyph CLI layout
The glyph layout became the classic CLI default (e2bb757eb) and this
release-only E2E kept asserting the old layout, so it went red on the
v0.22.3 release attempt:

- startup waited for "☤ fake-model │"; the glyph status line separates
  fields with "·". Wait for the model name.
- "one ❯ row" counted the glyph layout's sent-message rows too. Count
  the composer row only.
- the blank-run cap read the welcome banner's startup spacing, printed
  before any resize. Judge the transcript from the first question on.

The resize invariants are unchanged: every transcript word exactly once,
each question once, one composer row, at most 2 blank lines in a row.
2026-10-20 10:53:32 -07:00
unsupportedpastels
dc38e0bd8e fix(gateway): name an elevated gateway from its control pipe instead of OpenProcess
A non-elevated Desktop or CLI could never reach an elevated gateway on
Windows. The client half of the control-pipe identity check opened the
server PID with OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION), which a
filtered token cannot do on a High-integrity process, so every attach
failed with "cannot verify bootstrap peer process" and discovery
reported the generic `authorization`.

The client now also reads the pipe object itself through its own handle:
the owner and DACL (GetSecurityInfo) and the server's session
(GetNamedPipeServerSessionId), next to GetNamedPipeServerProcessId.
judge_pipe_server() decides from those facts and is pure, so it is unit
tested with the Win32 calls injected:

- server process readable: its token user must be this user, as before;
  a pipe owned by BUILTIN\Administrators (an elevated creator) seen from
  a non-elevated client is refused as `gateway_elevated`.
- server process unreadable: never attached. A pipe owned by this user
  or Administrators whose DACL grants exactly this user (the gateway's
  own private shape) is this user's gateway across the boundary and is
  refused with the existing classify_refused_owner() reason and
  refused_owner_remedy() wording; anything else stays the generic
  refusal.

The refusal is a PermissionError subclass carrying the reason code, and
discover_gateway_endpoint() reports it directly, so the name no longer
depends on a provable gateway.pid/gateway.lock record.

Refs #134889 (W9)
Refs #140762
Refs #140706

Co-authored-by: Casey <caseyrussell1976@gmail.com>
2026-10-18 01:12:29 -04:00
Teknium
8228756b89 test(e2e): new_machine's base_ref no longer shadows the machine root
The `base` keyword added to new_machine() for the W4 journey shadowed the
function's own `base` (the machine work root). Every Windows install/update
journey then staged `rev-parse <root>^{commit}` and errored at setup
(run 39053972652, all 11 files). The field and keyword are now `base_ref`.

Refs #134889 (W4)
Refs #140337
2026-10-17 11:33:15 -07:00
Teknium
457b49d8b1 test(e2e): upgrading a pre-runtime Windows install over its running gateway, elevated and not
New journey tests/e2e/core/windows_update/test_upgrade_over_old_gateway.py on the
native Windows install/update lane. It installs the release before the unified
gateway runtime merge (d04056d609, first parent of eb75627faf) with that
commit's own install.ps1, starts its gateway (holding gateway.lock), then runs
`hermes update` to this checkout's HEAD over it. It asserts the old gateway held
the lock, the update replaced it with a gateway serving the new commit,
`hermes gateway status` sees that gateway, and a turn replies through
FakeLLMServer. It runs two ways:

- elevated: the admin console installs, hosts and updates. Then the same user,
  not elevated, must be able to write gateway.lock and the gateway's state,
  see the gateway in status and, after the elevated gateway stops, start
  their own on that lock, get a reply and stop it.
- standard user: install, old gateway, update, status, turn and stop all run
  under a filtered token.

_tokens.py builds that token: CreateRestrictedToken with Administrators set
deny-only, LUA_TOKEN, Medium integrity, and owner plus default DACL set to
the user. Processes start through CreateProcessAsUserW. A whoami control
fails the journey if the token is still elevated or admin. _machine.py gains
`base=` (install an older commit, update to HEAD) and `as_user=` on
install/hermes/update/spawn_gateway/one_shot_turn.

Refs #134889 (W4)
Refs #140337
2026-10-17 11:33:15 -07:00
Teknium
ce53cae6ca test(e2e): fail, not skip, when the CI e2e lane has no tmux
The classic-CLI tmux suites (tests/e2e/core/cli_tmux/*, plus the Vertex
/bg CLI test) skipped whenever tmux was missing. In the release/dispatch
e2e job that would turn the lane green over zero coverage if the runner
image ever dropped tmux.

_classic.require_tmux() replaces the bare skipif markers in all four
files: it skips on a developer box, and fails when CI is set and
HERMES_E2E_REQUIRE_TUI=1 (which the e2e job in tests.yml already sets).
The e2e job gains an "Install tmux" step: it installs tmux only if absent
(the hosted image ships it: dispatch run 38982129242 on 2026-10-16 ran
test_resize_scrollback.py 1 passed, no skip) and prints `tmux -V`.

tests/ci/test_e2e_tmux_required.py pins the gate (fail in the CI lane,
skip otherwise), that no tmux suite keeps a bare skip, and that the e2e
job verifies tmux. 6 red before, green after. Through run_tests.sh with
tmux off PATH: CI+HERMES_E2E_REQUIRE_TUI=1 -> 3 failed; CI only -> 3
skipped.

Review finding by @unsupportedpastels on #140469
Refs #134889 (T24)
Refs #140337
2026-10-17 07:23:06 -07:00
Teknium
6b01039c09 test(e2e): pin the fresh-output rule and document the shared-uid SIGTERM trap
test_a_step_needs_output_produced_after_its_input pins that a step whose
transcript did not change (an empty /history after the markdown turn already
printed "LIVE01") finds no needle.

The harness docstring names the cause of the round-2 Docker failures: the CLI
catches SIGTERM and exits cleanly (status 0, "Goodbye!"), so an outside signal
looks like the CLI quitting on its own. The reviewer's container ran as uid
1000, the host user's uid, and strace in a reproduction recorded SIGTERM with
si_pid=0 (sent from outside the container's pid namespace) at the moment the
CLI died. The same 3-file run under a container-only uid passed 4/4 with no
external signal.

Review finding (independent review round 2)
Refs #134889 (T24)
Refs #140337
2026-10-17 07:20:31 -07:00
Teknium
48fb79f50b test(e2e): harden the classic-CLI E2Es: fresh-output steps, witness attestation, timeout-proof cleanup, Linux gate
Pane.submit/keys snapshot the scrollback before sending, and Pane.wait accepts a
needle only when it occurs more often than in that snapshot. An unchanged
transcript (an empty /history: "LIVE01" was already on screen from the markdown
turn) now fails its step instead of matching stale output. The `full=` switch is
gone; every wait is relative.

The witness sitecustomize emits a `startup` record (pid, ppid, argv) when it
loads. The harness records the pid of every CLI it spawns (each tmux pane's
process and each piped `chat -q`), and the live session asserts each of them,
plus the gateway daemon, attested before it reads "no agent/tool/state.db
event" as proof. A unit test pins that an uninstrumented CLI fails coverage.
Role detection keys on `gateway run`, not any argv word "gateway".

Cleanup survives a timeout: kill_home_processes() runs the graceful stop
(`gateway stop`) in try and the SIGTERM/SIGKILL sweep of this HERMES_HOME in
finally. The Vertex test reuses it, and FakeVertex.stop() sits in its own outer
finally, so a hung stop or tmux failure still kills the CLI and the fake server.

All three modules are marked platforms("linux"): process discovery reads /proc.

Failure messages now carry the CLI stderr and gateway/agent log tails.

Review finding (independent review round 2)
Refs #134889 (T24)
Refs #140337
2026-10-17 07:20:31 -07:00
Teknium
19f1211556 test(e2e): fold the classic-CLI live session with a per-process witness into E2E
The long dogfood session used on #106742 (dogfood/drive.py + a
sitecustomize witness) lived only as local tooling. Ported as one E2E
test: 50 steps through tool turns (terminal with the approval modal,
read/write/search files, memory), the clarify modal, delegation, a
background-process notice, a 22-command slash sweep, the /model picker,
/bg, /btw, /branch, /compress, Ctrl+C, /new, /quit, -c and a piped chat -q,
all against a loopback FakeLLMServer.

tests/e2e/core/cli_tmux/witness/sitecustomize.py (on PYTHONPATH only for
this test's children) records agent construction, tool dispatch and
sqlite writes per process, and the test asserts the one-gateway contract:
the CLI process builds no AIAgent, dispatches no tool and writes no
state.db row; the gateway does all three.

Left out on purpose: /debug (uploads), /reload-mcp (confirmation modal),
/voice (host audio probe), /diff (first-use runtime install in the fake
home), and /retry or /undo right after /goal (open flake, tracker item 5).
E2E: release/dispatch only.

Refs #134889 (T24)
Refs #140337
2026-10-17 07:20:31 -07:00
Teknium
5103b46700 test(e2e): wait on conditions, not the clock, in the classic-CLI tmux drivers
The code-health ratchet (HX013) flags wall-clock sleeps in tests. Drop
the sleeps that followed a condition wait (status bar, settle, reply
needle) and keep one named gap, Pane.paste_gap, with a reviewed allow:
the CLI reads an Enter landing within 50 ms of the last buffer change as
a pasted newline, so that gap is the behaviour under test.

Refs #134889 (T6, T24)
Refs #140337
2026-10-17 07:20:31 -07:00
Teknium
cfae1548a9 test(e2e): fold the 15-step classic-CLI main comparison into the E2E suite
The zero-spend main-vs-branch A/B used on #106742 lived only as local
tooling (cli-rewire/harness/ab_cli.py: tmux on two trees, normalized
screen diff, 15/15 self-check). With the rewire merged there is no second
tree to diff, so the port keeps the same scripted session and asserts per
step what main's capture showed, against the current checkout where the
gateway runs the agent, tools and session writes:

startup banner, Rich-rendered markdown in the reply box, the approval
modal and its "allowed once" record, read_file, /help, the /model picker,
/title, /usage, Ctrl+C interrupting without killing the CLI, /compress
report, the /quit exit summary, the -c resume recap, chat -q on a TTY and
piped. The state.db row the gateway wrote carries the title.

tests/e2e/core/cli_tmux/_classic.py is the shared tmux harness (private
-L socket, allowlisted env, loopback FakeLLMServer, exact-HERMES_HOME
reap). E2E: release/dispatch only (ci.yaml forces E2E lanes off on PRs).

Refs #134889 (T24)
Refs #140337
2026-10-17 07:20:30 -07:00
Teknium
4e45875984 test(e2e): Vertex /config and /bg through the classic CLI's gateway path
A real `hermes chat --cli` in a private tmux server with provider: vertex
and a synthetic service-account JSON, against the loopback FakeVertex
(OAuth token endpoint + Vertex OpenAI-compatible endpoint behind
HTTPS_PROXY with a test CA). No Google endpoint, no real credential.

- /config names the credential "Google OAuth (Vertex AI)" (main printed
  "Microsoft Entra ID") and displaying it mints no token.
- /bg runs in the gateway on the session's Vertex route: its request
  reaches Vertex with a bearer the token endpoint minted, the answer
  prints in the CLI, and the foreground transcript is untouched.

Runs with `-t file` like the sibling Vertex suites (the default toolset
trips the separately tracked #109115). E2E: release/dispatch only.

Refs #134889 (T6)
Refs #140337
2026-10-17 07:20:30 -07:00
Teknium
31f47ddc6b test(e2e): login-shell and standard-user probes hold on Blacksmith runners
The install/upgrade E2E lanes moved from GitHub-hosted runners to Blacksmith (3bcc2910ab,
764d1f322c) and their first runs there went red. Neither failure is in Hermes; both are
host differences the probes assumed away:

- Blacksmith ships /etc/profile.d/blacksmith.sh, which exports HOME back to the runner user's
  passwd home for every login shell. The `bash -lic` probes in test_install_fresh.py and
  hosts/_hosts.py then read /home/runner's rc files instead of the sandbox HOME the installer
  edited, so `command -v hermes` failed and ~/.local/bin was "missing". Login-shell probes now
  mask any /etc/profile.d script that exports HOME with /dev/null inside the existing bwrap
  sandbox (empty tuple elsewhere, so other hosts run unchanged).
- Blacksmith's Windows image computes the SAFER NORMALUSER token with BUILTIN\Administrators
  still enabled (GitHub's marks it deny-only), so the harness control in test_paths_and_acls.py
  correctly refused to vouch for the token. The probe now derives the standard-user token with
  CreateRestrictedToken (Administrators deny-only, max privileges dropped), the same shape as
  UAC's filtered token, so it no longer depends on the host's SAFER policy.

The stable-channel default from #139311 stays as it is; the sandbox harnesses already pin
their fresh installs to main through HERMES_INSTALL_CHANNEL (f9bdaa303e).
2026-10-16 14:33:30 -07:00
Teknium
f9bdaa303e test(e2e): upgrade harnesses install main from their tagless sandbox origins
Their origins publish commits on main and no release tags, so the stable
default (#139311) has no release to install there. Fresh installs pass
HERMES_INSTALL_CHANNEL=main and save the choice, so reruns pass nothing,
as users do and as the rerun-idempotence cell requires.
2026-10-15 12:09:14 -07:00
Teknium
4cfa3ecd97 fix(install): an unreachable release fails a fresh install instead of publishing an empty one
Review (jquesnelle, Greptile) on #139311: when the release lookup succeeded
but its tag could not be fetched, a fresh install had already cloned with
--no-checkout, the fallback cleared the release, and no step wrote the files:
the installer published an empty checkout and exited 0. A rerun in the same
state jumped to main's tip, against the PR's own keep-the-checkout rule.

Stable that applies but cannot be reached now fails a fresh install with a
retryable message (naming --channel main), and keeps a rerun's checkout,
unless stable was asked for by name, which fails. Lookup gains a third
source, origin's highest vX.Y.Z tag over the same transport the clone uses
(the publication run pushes final tags), so a lookup failure with git
working is no longer a separate case. The pytest upgrade harness, whose
origin carries no release tags, pins its fresh installs to main the way the
install E2E harnesses already do.
2026-10-15 12:09:14 -07:00
Teknium
3857c7b8ee fix(install): new installs land on the latest stable release
`hermes update` has followed the stable channel for official source checkouts
since #135847, but install.sh and install.ps1 still cloned main's tip, so every
new user (CLI one-liners and Hermes-Setup, which bakes `-Branch main`) started
on unreleased code and only reached stable at the next release.

For the official repository's main line, with no explicit --commit:
- a fresh install resolves the latest published vX.Y.Z release (GitHub API,
  then the github.com /releases/latest redirect, which needs no API quota),
  fetches its tag (releases can sit on release/* branches) and checks it out
  detached, where `hermes update` puts a stable checkout;
- a rerun with no recorded channel moves forward to that release and keeps a
  checkout that already contains it (forward-only, like the update default);
  if the lookup fails a rerun keeps its checkout instead of jumping to main;
- `--channel main` / `-Channel main` / HERMES_INSTALL_CHANNEL=main installs
  main's tip and saves the choice with `hermes update --set-channel`, so later
  updates keep following main. Forks, mirrors and other branches are unchanged.

The install E2E harnesses that serve unreleased commits from a tagged local
mirror pin themselves to main through the same variable.
2026-10-15 12:09:14 -07:00
Teknium
8dcf72feb5 fix: what the main merge left broken outside its conflict hunks
- Desktop input-requests: main's new `else clearParkedCard(ctx, id)` merged cleanly into this
  branch's extracted cancelParkedCredentialRequest, which had no ctx (tsc TS2304). The helper takes
  the event context.
- Composer: with a card waiting, Send answers it, so the primary button reads Send whatever the busy
  action (main's controls.test "answers a waiting card with Send"). The queue-button gate moves to
  a helper to stay inside the component's complexity cap.
- tests/e2e/test_relay_native_openai_stream.py: main fixed the same finalizer deadlock its own way
  (6e84ce66fb: wait only off the stream's loop); the merge kept main's wait but this branch's
  removal of its Event (F821). Take main's file.
- hermes_state_sessions.py went to 2005 lines (cap 2000) with main's two conversation model_config
  helpers on top of this branch's growth: their bodies move to hermes_state_sessions_model_config.py,
  the methods stay as thin delegates.
- overlay-gaps.json: drop the known gap for connectors.directory.receiptSaid, which the English
  catalog no longer has (overlay-completeness test).

Checks: desktop typecheck 0 errors; vitest 1736 + 16 passed; pytest 1243 + 124 + 10 passed;
scripts/check health 0 blocking vs 0e427d788d.
2026-10-14 06:09:56 -07:00
Teknium
0715474bfd Merge origin/main into feat/unified-gateway-runtime
375 commits from main (0e427d788d). 24 files conflicted; the resolutions that carry a decision:

- /initiate-setup: main removed the command (25bf722063). Its gateway rewrite, CLI handler and the
  Desktop kickoff go with main; this branch's command-layer admission of it is dropped too
  (gateway/session_commands.py _PROMPT_COMMANDS, its slash.exec test row, the parity doc row), and
  the Desktop slash dispatcher loses the `hidden` option that only the kickoff used.
- Code this branch moved out of its old file, carrying main's edits to the moved copy:
  first-contact notes (gateway/run_turn.py -> run_turn_prepare.py: no message/setup_command),
  the TUI agent factory (tui_gateway/server.py -> agent_factory.py: onboarding toolsets at build,
  setup_beat/set_theme lifecycle cards, no cli platform extras on a coding selection), the serve
  lifespan (web_server.py -> web_server_app.py standalone_lifespan: first-install probe before the
  state.db reconcile, onboarding due answer after the setup bootstrap), and the compression child
  publish (the shared _publish_compression_child_on_conn reads the parent's model_config).
- agent/auxiliary_client.py: both import changes (_route_key from main; this branch's move of
  _without_structured_output_format).
- Desktop: main's onboarding run (decideOnboarding, OnboardingEnd, card-waiting Send) replaces the
  kickoff; this branch's prepared-submission slash path, request_id on session.create and
  PreparedImageRecovery stay. Pool-limits imports are dropped (this branch removed the pool).
  createBackendSessionForSend takes main's (preview, overrides) signature.
- ci.yaml detect job: main's `ref: inputs.commit` plus this branch's sparse checkout.
- package.json / lock: main's vitest 4.1.11 plus this branch's ws 8.21.1.
- Generated: gateway-contract.openrpc.json regenerated; parity doc regenerated.
2026-10-14 05:52:49 -07:00
Teknium
6e84ce66fb test(relay): the OpenAI-stream e2e no longer self-deadlocks when the stream is buffered
Under load the fake provider stream is exhausted before the consumer pulls
its first chunk, and Relay then runs its finalizer inline on the stream loop:
on the consumer thread, inside __next__. The test made that finalizer wait
for the consumer to release it, which the same thread can never do (30 s),
and its assertion sat outside the finally that marks the finalizer done, so
the consumer then waited another 30 s. A monotonic timeline from a loaded
repro showed exactly that order. The finalizer now skips the wait when it
runs on the stream loop (the forced ordering already holds there), and the
wait sits inside the try. Loaded repro: 4/40 first-attempt failures before,
0/80 after.
2026-10-13 22:17:07 -07:00
alt-glitch
4db1b88fe9 fix(plugins): the go-live notice names skills and tool prefixes, not every tool
The notice an open chat gets when a plugin goes live listed every MCP tool with
a description (4,994 chars for Blender in a live run) and left out the plugin's
skills, though it stays in history and rides every later request. It now names
the plugin, each registered skill with "load it with skill_view", each MCP
server with its tool count and prefix (mcp__blender__*) or why it did not
connect, and one line on reaching deferred tools (tool_search / tool_describe /
tool_call). It is a "[System note: ...]" control frame and is sent for a
skills-only plugin too.

(cherry picked from commit 289ce1e1af254a0ae49ad5b682020019f0ff5f3e)
2026-10-14 00:06:58 +05:30
Teknium
0ae8272c94 test(relay): never gate Relay's finalizer on the consumer (finalize-at-EOF deadlock)
Release run 38168593013 (Python e2e): test_openai_stream_final_tool_call_delta_
reaches_relay_parent_event failed "Relay's finalizer did not finish", with the
paired "consumer did not release Relay's finalizer" from inside the finalizer.

Mechanism: Relay runs the finalizer on the stream's own event loop, which only
the consumer thread drives (ManagedLlmStream.__next__ -> run_until_complete).
Relay may reach EOF and finalize BEFORE it hands over the terminal chunk. The
harness's finalizer then waited (30 s) for the consumer to set
allow_relay_finalizer, but the consumer could only set it after receiving the
terminal chunk that the parked finalizer was holding back: a deadlock on that
schedule. Test-only; same file on main, so main's e2e carries the same latent
race (no code here differs from main).

Fix: the finalizer is never gated. Finalizing first already IS the
finalizer-before-consumer ordering the tests pin; the consumer-first ordering is
still forced by pumping the stream's loop until the finalizer finished.

25/25 consecutive passes locally. Guard intact: an accumulator that drops the
terminal (finish_reason) chunk -- the race 74de0fd4fe fixed -- still fails the
tool-call test.
2026-10-11 13:20:31 -07:00
Teknium
82a0d2dc88 Merge origin/main (#42: 9 commits to 79b45d1647) into feat/unified-gateway-runtime
No conflicts. Brings in main's fixes for the reds release run 38120936161 inherited:
79b45d1647 (signed reasoning replays after resume on Anthropic/Bedrock Converse),
7831de8999 + d3bdf761b0 (network upgrade E2E follow the new main-channel default),
0aa764fedd (Desktop hand-off test expects no channel-record request on main).
2026-10-11 03:09:45 -07:00
Teknium
79b45d1647 fix: signed reasoning replays after resume on Anthropic and Bedrock Converse
What users saw
- Anthropic (last-turn-only Claude models, e.g. Sonnet 4.5): after `chat --resume`
  or on the next gateway/TUI turn, the previous answer's signed thinking block was
  stripped, so its reasoning was lost.
- Bedrock Converse (non-Claude reasoning models, e.g. deepseek.v3): every resumed
  or later turn sent prior reasoning without its signature, and Bedrock rejected it
  with ValidationException "The reasoning block signature is missing or invalid".
  Streamed reasoning was also stored as two concatenated copies.

Root causes
- 33d6139ccd replaced "keep the latest assistant turn" with "keep the in-flight
  tool loop". Once a new user message closes that loop, the latest turn lands
  before loop_start and its signed thinking is dropped.
- d6f3199584 persisted Converse reasoning into reasoning_details, so the reasoning
  extractor now also read it and duplicated the streamed text. On reload, non-Claude
  turns replayed that text with the signature removed, because they could not tell
  their own signatures apart from a foreign model's.

Fix
- anthropic_message_convert: loop_start never goes past the latest assistant turn.
- bedrock_adapter + transports/bedrock: Converse turns record the model that produced them (a private
  `bedrock.native_assistant` reasoning_details record). When the same model reads
  them back, they replay verbatim with signatures. Other models keep the per-model
  policy. reasoning_content is now joined per block, not per streamed delta.
- test_chat_reasoning_variants: the long-session Portal test asserted the old
  "never replay reasoning_details to the Portal" contract that 336b11584c
  removed on purpose. It now asserts every earlier turn's blocks replay verbatim
  and every turn is answered.
2026-10-11 03:07:37 -07:00
Teknium
d3bdf761b0 test(release): the cut-tunnel cell proves it reached the cut tunnel
Review on #136509 (Greptile): assert_nothing_changed accepts any non-zero
exit, so an unrelated early failure could pass. The cell now asserts the
proxy recorded the EOF on github.com and the output names the failed fetch.
2026-10-11 02:55:56 -07:00
Teknium
7831de8999 test(release): install and network E2E follow the new update-channel defaults
rc.10-v0.21.7 failed 13 release jobs because the release-only E2E still
assumed the old update behavior:

- Install/update E2E (Linux, macOS, Windows; hermes-update and desktop-app
  routes). A fresh install of the official repo now defaults to the stable
  channel. Installed at HEAD it is newer than v0.21.6 and correctly waits
  ("Already up to date"), so the HEAD -> NEXT legs never moved ("checkout
  landed on NEXT", "no successful update completion receipt"). The drivers
  now record `hermes update --set-channel main` before the user-state
  snapshot, the same way the pytest sandboxes already do (3a4b4b6f83).
  Releases older than --set-channel follow main already and are skipped by a
  help probe.
- Network E2E (test_offline_and_flaky, test_proxy_only_egress). They asserted
  that `main` reads and retries releases/channels/main.json through the
  proxy. #136429 removed that read on purpose (regional WAF 403s, #128295).
  Rewritten to the new contract: `main` reads no release record, survives a
  release-host outage, and a cut tunnel to github.com still fails fast and
  changes nothing.

The desktop unit test with the same assumption was already fixed on main
(0aa764fedd).
2026-10-11 02:55:56 -07:00
Teknium
e1a10b0bc2 ci: bring the branch's own code under main's strict ruff config
Main made the strict ruff config the default (`ruff check .`, blocking), and
the branch's code carried 278 findings under it (main itself is clean). Fixed:

- PLW1510 (86): `check=False` on each subprocess.run, preserving behaviour,
  as main's own sweep (0006a5e229) did.
- ASYNC220 (9, test fixtures only): `noqa` with the reason, main's convention
  for a Popen that returns at once and whose handle the test drives.
- ruff's safe autofixes plus the narrow unsafe ones (UP006/UP037/RUF100/RUF013/
  PLR0402/RUF059 underscore renames/UP031/UP041/UP017/FURB167/PIE807/RUF007/
  RUF015/RUF022/FURB162), and by hand: four %-formats to f-strings, three
  unused unpacked names, one fixture loop over `.items()`.

No behaviour change. `ruff check .` passes; scripts/check passes; the 412 test
files mirroring every edited file pass (3 tests/pm files that fail only under
that batch's uv lookup pass solo, before and after this commit).
2026-10-10 17:59:08 -07:00
Teknium
b1ccce898b Merge origin/main (#38: 70 commits to c57331677d) into feat/unified-gateway-runtime
Conflicts: tests/hermes_cli/test_finite_chat_delegation.py and
tests/tools/test_completed_process_results.py, where main's lint sweep (0006a5e229) added
check=False to subprocess.run calls this branch had rewritten. Kept the branch's test bodies
and carried check=False onto their subprocess.run calls.
2026-10-10 17:47:35 -07:00
ethernet
9456670d2f Merge pull request #135743 from NousResearch/harder-linter-fixes-part3
Harder linter fixes part 3
2026-10-10 17:55:39 -04:00
Teknium
8f77dcbac4 test(e2e): the two-tenant cron wait reports which profile never fired
test_desktop_backend_never_crosses_tenants times out waiting for the first cron
fire about once in 6-24 loaded runs, on this branch and on c300c295c1 alike, and
the failure carried no evidence (the backend's serve.log is in a pytest tmp dir
CI discards). A timeout now reports each profile's cron provider-request count,
its jobs.json tail and the serve.log tail, so the next failure names the
profile whose tick did not fire. The wait and its bound are unchanged.
2026-10-10 14:32:11 -07:00
Teknium
5d2f94b92c Merge origin/main (#37: 15 commits to 1f711b275f) into feat/unified-gateway-runtime
No conflicts. Brings in #136276 (update e2e sandboxes pinned to the main channel; the
source hand-off fixture installs its loopback transport once).
2026-10-10 14:30:21 -07:00
Teknium
3a4b4b6f83 test(e2e): update sandboxes follow the main channel, not the stable default
#135847 made an official-origin source checkout default to the stable channel,
which resolves only from GitHub's latest published release. The upgrade-network,
Windows install+update and Desktop update harnesses keep the official URL as
origin, publish commits on main and never a release, so every update in them
stopped at the stable default:

- e2e-upgrade (network): "Could not resolve the stable source channel: No
  published stable release could be verified" (9 failed)
- Windows install + update E2E: "Release: stable v0.21.6; this checkout is
  newer and waits for the next release", checkout never moved (12 failed)
- Desktop update E2E (app-update, update-concurrency, build-fail): the update
  check answered {"channel":"stable","error":"release-unavailable"}

These suites test moving between commits, so each seeded install now records
`hermes update --set-channel main` right after its installer (new
_install_helpers.pin_main_channel; Windows Machine.install). Stable resolution
keeps its own coverage: test_release_channel_records sets stable explicitly on
the same seeded install, and tests/hermes_cli/test_source_release_channels.py.

Local: tests/e2e/core/upgrade/network on main plus this change, 21 passed
(4 failed in test_offline_and_flaky.py on main before it).
2026-10-10 14:29:51 -07:00
Teknium
cfaafec502 Merge origin/main (#35: 133 commits to f925b01791) into feat/unified-gateway-runtime
Three conflicts:
- apps/desktop/electron/updater/checkout-source.test.ts: main's 354fe11d7e is the
  same releases/latest fixture fix this branch carried as c300c295c1 (#135944); main's
  version (it also drops the unused release-candidates route) is taken.
- agent/context_compressor.py: both sides added one import line; both kept.
- gateway/run_turn.py: main's 4c7ab8b2a0 added trigger="gateway_hygiene" to the hygiene
  _compress_context call this branch moved to gateway/run_turn_hygiene.py; the branch side
  of run_turn.py is kept and the trigger is carried onto the moved call.
2026-10-10 06:49:02 -07:00
Maciej Lisiewski
c57fbf4584 ci: fix remaining ASYNCXXX linter errors 2026-10-10 15:20:14 +02:00
Maciej Lisiewski
bda3aea496 ci: remove unused variables (linter) 2026-10-10 15:20:14 +02:00
Maciej Lisiewski
7ef490ed3b ci: fix PLC0206, PLC0414 linter errors 2026-10-10 15:20:14 +02:00
Maciej Lisiewski
0006a5e229 ci: fix PLW1509, PLW1510, PLW2101 linter errors 2026-10-10 15:20:13 +02:00
Teknium
158cd52a6b fix(update): stable is the latest published GitHub release, never an R2 record
Publishing a vX.Y.Z GitHub release is the whole promotion: the source
updater's stable channel now reads only GitHub's latest published release
(non-draft, non-prerelease, strict vX.Y.Z) and verifies the tag on origin.
It no longer asks R2 for releases/channels/stable.json first, and it
ignores the R2 release-candidates pointer, which the stable pipeline writes
before the GitHub draft is published.
2026-10-09 19:46:19 -07:00
Teknium
408cc0d12e Merge origin/main (#32: 36 commits to cf23a1a5cc) into feat/unified-gateway-runtime
17 conflicts, all from main's lint sweep (ruff UP007/UP017/UP022/UP028/UP031/UP037/UP041,
FURB188/FURB192); no other main commit touches a conflicted file. Resolution: the branch side
of each file plus main's exact autofix (ruff 0.15.10, main's ruff.strict.toml, --fix
--unsafe-fixes). ruff.strict.toml takes main's copy. The pool-retirement live fixture stays
deleted with the pooled backend this branch retires.
2026-10-09 10:24:04 -07:00
Maciej Lisiewski
2ff58849f4 ci: ruff UP037 fixes 2026-10-09 17:34:38 +02:00
Maciej Lisiewski
9eab688b42 ci: ruff UP017 fixes 2026-10-09 17:34:36 +02:00
Maciej Lisiewski
aff64c3eeb ci: UP007, UP022, UP028, UP031, UP041 linter fixes 2026-10-09 17:31:52 +02:00