Commit Graph

52 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
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
Teknium
ad249d9cac fix(hold-stream): a held reply kept as the budget fallback, and its codex commentary, in history
Two more ways a held turn (hold_stream=True transform_llm_output) left history
out of step with what the user got:

- When verify-on-stop or pre_verify sent the answer back on the last allowed
  call, _append_interim_answer had already flushed it as a hidden row. The
  finalizer reused it as the budget fallback and transformed it, but the row
  was settled: _store_rewrite_on_tail skipped it and _close_transcript_tail
  added nothing (the tail already held assistant text), so reopening the
  session lost the reply. A held turn's sent-back answer now flushes with the
  turn instead of at once (the user never saw it), and when the turn ends on
  it _store_rewrite_on_tail publishes that row: visible, content = the
  rewrite, api_content = the bytes the model wrote and already saw, so the
  wire and the cached prefix stay unchanged. One row, so role alternation
  holds.
- A codex_responses reply can carry commentary and the final answer in
  codex_message_items. Publishing the held final unhid the whole row, and
  project_history_commentary rebuilt display_commentary from those items on
  reload. publish_held_final_row now stamps display_metadata
  commentary_withheld on such a row; the projection then shows no
  commentary for it, while the items stay for model replay.

Also: the plugin-reload hold test waited 0.5 s for a negative check; it now
signals that the read started and waits 2 s (tests/AGENTS.md).

Tests (red on 72fd611fef): a pre_verify fallback ending a held turn (history
shows the rewrite, the resumed request replays the original bytes), and a
held codex_responses final with a commentary item (FakeResponsesServer
Message gains an optional phase).

Review: https://github.com/NousResearch/hermes-agent/pull/144266#discussion_r4370905634
Review: https://github.com/NousResearch/hermes-agent/pull/144266#discussion_r4370905635
Review: https://github.com/NousResearch/hermes-agent/pull/144266#discussion_r4370905636
2026-10-25 06:18:48 -07:00
Teknium
83b4128032 feat: hold a held session's reply until transform_llm_output rewrites it
When a plugin loaded in the session's profile registered transform_llm_output
with hold_stream=True, the reply is not streamed on any surface:

- agent: no text delta, post-tool-call text or interim commentary leaves the
  agent's display/TTS callbacks for the turn (resolved per turn), so messaging,
  local viewers (TUI, Desktop, classic CLI, ACP), the API server and managed
  workers all fall through to their existing "nothing streamed" path and
  deliver the rewritten final once.
- gateway: TurnRunner builds no stream consumer for a held turn, so no draft,
  edit, native stream frame (WeCom's empty seed + closing frame) or commentary
  bubble is sent; the final is one plain send (split like any long reply) while
  the typing indicator runs.

Commentary is model text the hook never sees, so a held turn drops it; tool
progress and reasoning keep their own display settings.
2026-10-25 06:18:48 -07:00
Teknium
e3cc65d767 test(e2e): fake Responses server sends cache_write_tokens the openai 2.54 SDK requires
openai 2.54.0 (128b101efd) made InputTokensDetails.cache_write_tokens a
required field. The fake Responses server builds its usage block from the
SDK's pydantic types, so every response.completed raised ValidationError in
the server thread, the socket closed mid-stream, and the Hermes child saw
APIConnectionError: oneshots retried until the 150 s timeout, the
rejected-replay cases fell through to the fallback, and the TUI gateway
turn never finished.

Turn gains cache_write_tokens (default 0) and the fake emits it, matching
the current Responses wire.
2026-10-25 03:01:52 -07:00
Teknium
21f35e3f48 test(plugins): plugin OAuth tests sign in over https and pin the review invariants
FakeIdP can serve https with a throwaway CA (make_test_ca gains IP SANs) and bind a fixed
address, so the https-only rule is exercised for real; the fake browser runs in its own thread
like a real one. Folds the auth_commands routing test into the lifecycle test and the two re-pin
delta tests into one. New invariants, red on the PR head: errors reach the plugin without a
credential, a revoked grant keeps no tokens, uninstall drops the grant, unattended sign-in is
refused, http/loopback endpoints and Hermes-owned client variables fail validation.
2026-10-19 07:09:56 -07:00
unsupportedpastels
04e1447acb fix(cron): pair output docs with attempts after sessions are known
An attempt claimed before or in the same second as another run's output
doc (a manual `hermes cron run` overlapping a tick) became the doc's
newest candidate. When it failed without a session, the doc rendered as
an extra cron_output row with that attempt's status, and the attempt's
own failed row stayed hidden because representation was decided before
reconciliation.

_list_cron_output_runs now returns docs and terminal ledger attempts
separately; _reconcile_cron_runs pairs each doc with its likeliest
writer once every attempt's session is known (an attempt closed before
the doc only reaches it through the grace; one whose session spans the
doc beats an overlapping one without; then the newest claim), so each
attempt gets exactly one row: its session, else its doc, else its
ledger row. The internal _execution_candidates/_execution_id row keys
are gone.

Also: the cron request partial index is built from CRON_PRINCIPAL_ID;
the admission SQL derives its substr offsets from CRON_REQUEST_PREFIX;
a prefix_range() helper replaces three hand-rolled half-open bounds;
the two cron run-history suites share tests/fakes/cron_owner.py.

Refs #134889 (CRON-1)
Refs #139162
Refs #138812
Addresses review by @kshitijk4poor on #139273.
2026-10-15 16:33:44 -04: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
Teknium
607a23e858 Merge origin/main (#30: 54 commits to 1744a19e0d) into feat/unified-gateway-runtime
8 conflicts, all from main's lint sweep (#135281 "Harder linter fixes" + the RUF series:
implicit-Optional, unused-unpacked-variable, next(...) for [...][0]). 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) on it. ruff.strict.toml takes main's
copy (the newly enabled rules). tests/cron/test_bot_chat_delivery_child_env.py stays deleted
(1cc9cb9199 retired its lane).
2026-10-08 21:38:54 -07:00
Maciej Lisiewski
4ee5e8e0f3 ci: RUF007 2026-10-08 21:35:58 +02:00
Teknium
65bec86e37 Merge origin/main (#27: 19 commits to 517b5e10fe) into feat/unified-gateway-runtime
45 conflicts, all from #135177 (lefthook + `ruff check --fix` over 2,366 files). No other main commit
touches a conflicted file. Resolution: the branch side of each file, then main's exact autofix
(ruff 0.15.10, `--config ./ruff.strict.toml --fix`) on it — rewrites only (typing generics, noqa
drops, import forms), no import removed. tests/cron/test_bot_chat_cli_home.py stays deleted
(1cc9cb9199 retired its lane).
2026-10-08 12:09:24 -07:00
Maciej Lisiewski
74f1f17a7e ci: fix RUF017, RUF018, RUF022 2026-10-08 19:54:07 +02:00
Maciej Lisiewski
d76cce4f11 ci: apply all automatic linter fixes available 2026-10-08 17:22:54 +02:00
Teknium
6f525dcf04 test(e2e): a refused launch's unconsumed reply cannot answer the next cell
The Windows crash cells share one FakeLLMServer whose script is FIFO. When
a launch is refused before reaching the provider (mid_fetch, handoff), its
pushed reply stays queued and answers the NEXT cell's prompt, so every later
cell printed the previous cell's REPLY id and failed "ran no turn" although
its turn ran (tree_moved, orphaned_update, mid_git, mid_git_bootstrap on
326aacfbcf: prompt reached provider=True, reply printed=<earlier id>).
one_shot_turn now drops unconsumed script entries before pushing its own.

(cherry picked from commit d485643808cb1f5ea34a841f33d0b3d74cf11abb)
2026-10-07 15:19:43 -07:00
Teknium
ca38632fc0 Merge origin/main (#17: 454 commits to e6757f2029) into feat/unified-gateway-runtime
12 conflicted files, resolved in three lanes:
- gateway/run.py: take the branch split; main's tirith removal and spool-replay
  ordering ported into run_runtime_init.py / run_bootstrap.py.
- config migrations: main keeps v50 (tirith); the branch's bot-chat timeout removal
  becomes v51 (_config_version 51, template + test updated).
- hermes_state_usage.py: main's voice_chat task route threaded through the branch's
  owner transaction; worker.persist usage allowlist accepts task.
- tui_gateway/server.py: branch side; main's edits applied where the code now lives
  (agent_factory, session_registry). Desktop sessions get the catalog toolset on the
  authority path; daemon-run finite CLI turns are not watched turns; lazy session info
  reports nous/welcome on the free tier.
- Desktop/Ink: one branch-child spinner fix (main's route-token check); main's
  uninstall i18n keys kept, pool keys stay removed; voice_turn forwarded and accepted
  by the authority submit (surface_v1.voice_turn).
- chat_ws / PTY keepalive test: main's stricter test kept.
2026-10-07 06:48:09 -07:00
Teknium
bc246e1f8a fix(providers): LM Studio and TokenHub profiles declare their credential env vars
#134320 registered ProviderProfiles for lmstudio and tencent-tokenhub without env_vars. That put
both into the provider-catalog E2E matrix for the first time with key_env=None. The shard fixture
then died on keys[""] (KeyError, every row of the shard errored), TokenHub turns could not find a
key, and LM Studio's /model switch could not reach the native /api/v1/models listing the fake
never served.

The profiles now name the same env vars their hermes_cli/auth.py registry rows use (that row stays
the lookup source of truth). The catalog fake also answers LM Studio's native listing.
2026-10-07 13:21:46 +05:30
Teknium
1e500ebce2 Merge origin/main (#16: 4,465 commits to 9dcab1e440) into feat/unified-gateway-runtime
99 conflicted files resolved in nine area lanes (Desktop composer, Desktop renderer/shared
client, Electron main, Ink, tui_gateway, gateway, state, CLI/config, cron/tools/CI). The
unified runtime's architecture wins where it deliberately replaced a mechanism (pool,
fallback lanes, claim poller, renderer queue); every orthogonal main change is kept, ported
into the <stem>_<topic> sibling that now owns relocated code.

Notable ports and repairs in this merge:
- tui_gateway/server.py relocated regions: atomic _attach_built_agent (#49852), slash ranking
  registry names, minted-key helpers methods_session.py calls, request_overrides, service tier.
- gateway/run_turn*.py: i18n accessors for the removed reply constants, first-contact
  internal/DM rule, rotated-compression persist, fast-mode tiers, prompt-pin rehydration.
- webhook: route_from_chat_id decodes main's opaque webhook:v2 chat ids (old ids still read).
- ws.py: main's per-connection dispatch queue with authority-first dispatch inside it.
- state: schema event for runtime revision renumbered to 31; worker mirrors updated for
  main's message uid/merge fields, on_contended lease arg, compression columns.
- config: branch's bot_chat_delivery_timeout removal renumbered v47 -> v50.
- Electron: primary-profile pin, redirect header scoping, remote fetchJsonForBackend, SSH
  teardown on profile delete, held-update dial gate restored (lost in earlier merges).
- Desktop: canonical clarify.request mapped to main's questions[] card; replay truncation vs
  snapshot_required; periodic secondary prune tick restored; DELETE already_absent restored.
- cron/tools: diagnostic category on cron failure notices restored; owner_holds_delivery
  ported onto the authority; admitted receipts can no longer be cancelled locally.
2026-10-06 14:24:24 -07:00
kshitijk4poor
22fcbee492 test(e2e): the fixture's shared-metrics answer carries offer_version, so interactive suites stop on no prompt
Since #133571 (b5025017d5, teknium1, 2026-10-05) a shared-metrics "No thanks" without
`offer_version` reads as `reask` and the interactive CLI/TUI offers the prompt once more. The
fake-provider home every e2e suite builds (`write_hermes_home`) wrote exactly that shape
(`enabled: false` only), so every PTY/tmux scenario now opens on the consent picker, never
reaches its ready status bar and times out: 61 failures in the e2e lane, the Windows unicode
CLI test, and the e2e-upgrade interactive-CLI entrypoint on main since the merge.

The fixture now records a complete current answer (`send: false`, `offer_version` imported
from the consent module so the next version bump cannot strand it again).
2026-10-06 03:29:28 -07:00
teknium1
406f19e190 test(e2e): fake homes answer the shared-metrics offer
An interactive chat on an undecided profile now stops on the one-time
offer; the shared e2e home writer records an answer like a real user
who already decided, so PTY/console drivers reach the composer.
2026-09-30 21:15:08 -07:00
teknium1
95db5e4977 test(e2e): a codex scenario whose CLI run persisted nothing reports that run's rc and output
CI showed eight fault scenarios dying as a bare 'no session persisted' with the
hermes -q exit status and stderr discarded.
2026-09-27 16:19:56 -07:00
teknium1
37fba503a3 fix(gateway): local viewers see codex messages that arrive without deltas
An interactive `hermes --tui` attached to the gateway lost the codex
app-server's commentary AND final answer whenever an agentMessage reached
item/completed without item/agentMessage/delta frames: the screen showed
the tool card and nothing else.

Root cause: the codex bridge hands every completed agentMessage to the
interim-commentary callback. With no deltas it arrives already_streamed=False,
goes to the stream consumer, and on the local route lands in
LocalSessionAdapter.send, which publishes nothing yet reports success. The
consumer records the text as delivered, the final send is suppressed
("Suppressing normal final send ... streamed=True") and message.complete
carries "". When codex does stream deltas the viewer already has the text
via message.delta, so the common case rendered fine.

Fix: on the local viewer route, unstreamed commentary is published as
message.interim (the contract the in-process tui_gateway already emits and
both the TUI and Desktop render), and it is handed to the consumer's
delivery accounting only when a viewer/observer actually took it.
Messaging platforms and already-streamed commentary are unchanged.

Test: tests/e2e/core/providers/test_native_codex_app_server_tui.py drives a
real `hermes --tui` on a PTY against the fake codex app-server with
deltas disabled (new `deltas: False` message-step option); red before
(final on screen 0x), green after. PtyHermes accepts llm=None for a home
the caller already wrote.

(cherry picked from commit c323f548e8f4ec57a9587635ca943defe5beaaba)
2026-09-27 15:07:36 -07:00
teknium1
e9330b2406 test(e2e/platforms): address review — non-vacuous stream finalize, stranger refusal, redelivery transcript, known_failure gates
- KNOWN cells use tests.e2e.core._pending_fixes.known_failure (Rig.gate) around the final
  assertions only; no strict xfail (merge-order safe)
- streaming scenarios: private chat per scenario (Rig.fresh_user), same-chat barrier re-sent
  when dropped in the #121393 window; wait_idle docstring corrected; TURN_TIMEOUT 90->30
- stream_finalize_rejected now faults the real finalize per transport (Telegram draft final
  sendMessage / group editMessageText, Slack closing appendStream/stopStream, Discord edit) and
  asserts the fault fired; + stream_finalize_rejected_group, stream_reply_once
- Telegram stand-in: sendMessageDraft/sendRichMessageDraft, unknown methods 404, empty/too-long
  text and MarkdownV2 parse errors; Slack unknown_method + users.conversations; Discord empty
  content 50006, handler 4xx recorded as faulted
- approval_click: stranger clicks Deny and must be refused (answered) before the owner approves
- redelivery_one_reply asserts the inbound reached the transcript once
- dm_one_reply asserts no formatting rejection (plain-text fallback) for a punctuated reply
- rig: model.supports_vision so the heic control PNG reaches the model as an image
- Slack stream_finalize_rejected(_group) KNOWN #95430 (partial stream left beside re-post)
2026-09-26 11:57:54 -07:00
teknium1
c1b98bc46c test(e2e): tighten platform contract (file disabled_toolsets, batched mention leak, KNOWN #121325/#121326) 2026-09-26 11:57:54 -07:00
teknium1
f0c96c3ba1 test: stand-in Telegram/Discord/Slack platform servers + drivers for the adapter contract suite
Local stand-ins implement only the endpoints the real adapters call, reached through each
SDK's own base URL (PTB base_url; discord.py Route.BASE + DEFAULT_GATEWAY and slack_sdk
base_url via sitecustomize shims), recording every call and accepting per-method faults.
2026-09-26 11:57:54 -07:00
teknium1
7088ba3b94 test: provider-catalog E2E: merge-order-safe KNOWN gates, exact-path fake, bounded vendor stalls
Review fixes on the provider-catalog matrix:

- KNOWN bugs go through tests.e2e.core._pending_fixes.known_failure again (strict_known and the
  "now green -> drop KNOWN" asserts are gone), so a fix PR landing first simply turns its cells
  green. Each KNOWN is gated on the bug's OWN observed signature via a dedicated CatalogGap raised
  only at the gated assertion: xai = no inference at the fake + api.x.ai CONNECT; listing = vendor
  host hit with no probe error; nebius switch = vendor-host validation error; fallback = fallback
  fake untouched + its vendor host CONNECTed; OAuth patterns anchored. Unlisted red cells still fail.
- CatalogFake answers only exact routes (configured base path + dialect endpoint / listing path),
  404 otherwise; reached_own_endpoint and the listing cells assert the exact path.
- Turns run with agent.auto_recovery_cycles: 0 (the documented post-exhaustion ladder parked the
  xai/fallback rows for minutes: 14 CONNECTs over 118 s, bounded by design, not a retry bug) and a
  watchdog kills a child 8 s after a vendor-host CONNECT with no inference at its fake.
- An unknown api_mode fails the row instead of skipping; only explicit auth types and the named
  keyless provider skip.
- Usage cell asserts the exact sum the fake reported for answered main-turn calls.
- Listing 404 / hang degradation cells for the rows that already list from the configured endpoint.
- Shard body moved into the helper; fallback key check uses the dialect's auth header; the three
  unconditional-skip OAuth params dropped (kept under NOT COVERED).
2026-09-24 05:41:14 -07:00
teknium1
063cdcaa06 test: provider-catalog OAuth E2E (device-code cadence, refresh rotation) + multi-dialect loopback fake 2026-09-24 05:41:14 -07:00
teknium1
229d13bc93 test: native provider suites: KNOWN xfails fail only on their symptom; codex orphan released without a foreign kill
Review fixes for #121345.

- Every strict xfail in tests/e2e/core/providers now uses raises=KnownSymptom (a shared
  AssertionError subclass in _native_helpers) and raises it only at the tracked bug's
  symptom. Preconditions (exit codes, request counts, the approval exchange, the
  descendant pid) are plain asserts, so harness failures - StopIteration from next(...),
  tuple-unpack errors, process death, fixture teardown errors - fail for real instead of
  counting as the known bug. pytest applies xfail to setup/teardown reports too; the
  codex faults file's "5 xfailed" for 4 xfail tests was the teardown error being eaten.
  Verified with --runxfail: all 19 KNOWN cells fail with KnownSymptom.
- Codex fake: the own-session grandchild (#121298) now lives until CodexRun.cleanup()
  drops a release file, so teardown retires the orphan without signalling a process that
  was reparented to init (the live-system guard blocked that kill and leaked a
  sleep(600) per run on dev boxes). Both codex modules carry live_system_guard_bypass
  for the SIGKILL fallback, matching tests/agent/test_shell_hooks_tree_kill.py.
- Copilot ACP resume test no longer asserts session/load is never sent (not a documented
  contract); it keeps the new-agent-process, in-order history and no-duplicate asserts.
- Copilot teardowns tolerate a pid exiting between the liveness check and the kill.
2026-09-24 05:01:07 -07:00
teknium1
e6db58be64 test: copilot-acp auto compaction mid-turn keeps the next ACP prompt valid and grounded
Summarizer runs through the ACP agent itself; the post-compaction prompt must carry the summary, the
user's ask and the latest tool result, drop the summarized tool output, and pass schema validation.
2026-09-24 05:01:07 -07:00
teknium1
20c41d1e69 test: copilot-acp wire E2E: schema-validating fake ACP agent, tool flow, resume, lifecycle, error semantics
Fake ACP agent executable (tests/fakes/providers/copilot_acp.py) validates every client request
against the agent-client-protocol schema and replays scripted turns. Suites drive real hermes chat -q:
tool round trip via the prompt tool bridge, model selection, fail-closed permissions, cwd-bounded fs,
resume = fresh session/new seeded with history, no orphaned agents (SIGTERM-ignoring agent), and
JSON-RPC error / crash retry semantics. Strict xfails: #65788 (late chunk), #121290 (auth remedy).
2026-09-24 05:01:07 -07:00
teknium1
8012693288 test: codex_app_server wire-conformance E2E (fake app-server + lifecycle/fault suites) 2026-09-24 05:01:07 -07:00
teknium1
5c69c57f9a test: Vertex AI wire-conformance E2E suite (OAuth JWT mint, TLS proxy fake, tools, signatures, errors, compaction, stream drop) 2026-09-24 05:01:07 -07:00
teknium1
0929292aca test(e2e): Gemini native generateContent wire-conformance suite (fake Google TLS endpoint + tools/resume, schema, errors, compaction) 2026-09-24 05:01:07 -07:00
teknium1
0be109efaf test: Bedrock Converse/ConverseStream wire-conformance E2E suite (SigV4-verified eventstream fake, tools, signed reasoning, resume, compaction, faults) 2026-09-24 05:01:07 -07:00
teknium1
4f9cf2a31e test: SDK oracle checks every content block against its request Param (assistant blocks were unchecked)
The request TypeAdapter accepts replayed assistant blocks through the SDK's
response BaseModels (ThinkingBlock, ToolUseBlock, TextBlock), which allow
extra keys, and the unknown-key walk stopped at a BaseModel. A bogus key on a
replayed thinking block therefore reached the wire with schema_errors() == []
while the real API answers 400 "Extra inputs are not permitted".

validate_request now re-validates every messages[].content[] and system[]
block against the request-side *Param TypedDict picked by its type literal
(derived from the SDK's MessageParam / BetaMessageParam content union) and
diffs the sent keys. test_anthropic_oracle.py proves it can fail: bogus keys
in assistant thinking/text/tool_use, user tool_result and system blocks are
reported (GA + beta), a response-only type is rejected, a clean body is [].

Also: records carry bearer/x_api_key, cassette_dir override, and a cheap
record-mode probe against a second local fake (cassette written, no auth
header values in it).
2026-09-24 04:32:48 -07:00
teknium1
48f6284d72 test: Anthropic Messages wire-conformance E2E suite (SDK-oracle fake, native route via TLS intercept)
Thinking-signature replay (in-turn, resume, tui_gateway), parallel tool pairing,
429/529/400 handling, stream drops (#121320 strict xfail), compaction with signed
thinking, model discovery endpoint (#120844 strict xfail) and OAuth wire aliases
(#120858 strict xfail).
2026-09-24 04:32:48 -07:00
teknium1
c66e4d584b test: Anthropic OAuth mid-turn refresh E2E via TLS-intercepting token proxy (#120815 strict xfail) 2026-09-24 04:32:48 -07:00
teknium1
c649f741e0 test: fake OAuth server + device-code login poll-cadence E2E (#121163, #121254 strict xfail) 2026-09-24 04:32:48 -07:00
teknium1
b1d70cc5a1 test: providers-openai E2E review fixes: decoys on the custom: slug path, fail-fast strict endpoint, Responses faults, KNOWN hygiene
Review findings on the OpenAI provider suite, fixed in place:

- Pricing decoy now takes the custom:<key> slug path: a relay keyed `deepseek`
  (a built-in, non-aggregator name) renders as `custom:deepseek`, so mapping any
  custom*-normalized slug to the aggregator in get_pricing_for_provider now turns
  the decoy red ("custom:deepseek (upstream: the relay) borrowed prices"). The old
  `myrelay`-only decoy stayed green under that sabotage.
- Ollama strict-endpoint test fails in ~30 s naming the requests that lost the
  user turn, instead of a 150 s subprocess timeout: auto_recovery_cycles is 0 for
  this test (a 500 is a transient outage to Hermes, retried for minutes by design),
  each turn is bounded, and the recorded-requests assertion runs before a harness
  overrun is re-raised.
- Responses dialect faults the fake already supported are now exercised: a stream
  that dies mid-function_call (half arguments, no terminal event) and a 429 with
  Retry-After. Unused fake branches deleted (Cassette replay + record mode, push(),
  CStreamError.partial_text, the `reasoning` delta alias).
- Fallback test runs 2 turns and asserts the fallback request carries the system
  prompt, turn 1's prompt and answer, and turn 2's prompt, equal to what the
  primary was last asked.
- KNOWN hygiene: strict xfails accept only KnownBugError, raised solely from
  bug_assertions() around each known bug's final assertions; TuiGateway call/
  wait_event/turn, wait_until and bounded_turn raise HarnessError (RuntimeError),
  so a harness break inside a KNOWN test is a real failure, not an xfail.
- The sitecustomize vendor-boundary shims chain-import the interpreter's original
  sitecustomize instead of shadowing it.
2026-09-24 04:32:16 -07:00
teknium1
8f44ff8634 test: chat-completions dialect-variant fake (reasoning_details, reasoning_content, in-stream errors, Ollama strict user turn, vendor-host impersonation) 2026-09-24 04:32:16 -07:00
teknium1
823107a1d0 test: OpenAI Responses fake (SDK-oracle validated) + Responses replay/parallel-call/soft-failure E2E 2026-09-24 04:32:16 -07:00
teknium1
616e8d4df6 test: C11 routing truth table across a fleet of keyed loopback providers
Class C11 (provider/model routing + credential resolution). One real
loopback OpenAI-compatible host per provider identity, each accepting only
its own key; every scenario configures all identities and only changes the
selection, and one invariant runs after every leg: requests land only on the
selected hosts, each with only that host's key, the user sees that host's
answer, and nothing egresses to a real inference API (CONNECT trap).

Real `hermes chat -q` / `hermes -z` subprocesses cover custom base_url
(key_env / literal), bare custom fail-fast, named providers: and legacy
custom_providers entries, startup -m aliases (#103933/#107191/#109440),
fallback after 401/429, credential pool rotation / single-key exhaustion,
per-profile routing, aux title + delegation routing. The real stdio
tui_gateway walks mid-session /model switches incl. pool recovery without
restart.

fake_llm_provider: api_key may be a list of accepted keys (pool on one
host) and opt-in record_get; defaults unchanged.

(cherry picked from commit bf1f07571d7777fe91b16f386e026c12bdbfe73b)
2026-09-23 17:55:23 -07:00
teknium1
23366b44f3 test(e2e): close the core-suite review findings (narrow xfails, surfaced handler errors, no-retry CI)
Independent review of #120171 found checks that could not fail. Each is now
proven red by a mutation that the old version reported as XFAIL or pass.

- chaos/test_tui_gateway_turn_liveness: the orphaned-tool xfail used
  raises=AssertionError and RpcError subclasses it, so a gateway crash counted
  as the expected failure. Every invariant is now asserted normally; only the
  known leftovers (surviving tool tree and the tool_call it leaves without a
  result, both fixed by #120306) raise ToolOutlivedGateway, the only exception
  the xfail accepts. The DB check used to sit behind the orphan assert and
  never ran; running it exposed the dangling tool_call half of the same bug.
- history/test_prefix_stability: surface_switch's strict xfail tripped at the
  first prefix break, before usage and integrity. Messages/system prompt,
  usage and integrity are asserted first; the tools-array drift is checked
  last and raises ToolsArrayDrift, the only exception the xfail accepts.
- history/test_transcript_ledger: scripted steer/interrupt callables run on
  the fake provider's handler thread, where an assert only dropped the
  connection. Script records those failures and the test re-raises them after
  every turn; steer must land and the interrupted turn must report
  interrupted=True within 30 s.
- fakes/fake_llm_provider: Hang drops the connection at its deadline instead
  of leaving a kept-alive client waiting past it.
- parity: the API server port was picked, released, then bound by the child.
  Readiness now requires our child's pid from authenticated /health/detailed
  and retries on a fresh port when the child reports it in use. The fixture
  guard refused any HERMES_HOME under ~/.hermes, failing all parity tests
  whenever TMPDIR is Hermes's scratch dir; it now refuses only the live root
  or a real profile.
- chaos/_gateway_harness: the gateway stays in pytest's process group, so
  the runner's kill of a timed-out file reaches it.
- sqlite: a DELETE-mode open can fail with SQLITE_BUSY reported as "vtable
  constructor failed: messages_fts"; the delete arm's busy tolerance keys on
  the result code. A failed episode's roles are stopped so the shared chamber
  and rig no longer fail every later episode.
- chaos, compaction, parity homes: updates.check=false (history already had
  it). The passive update check made a GitHub round-trip from every test
  surface, and on a blobless clone whose objects lag upstream its
  `git merge-base --is-ancestor <upstream tip> HEAD` starts a lazy fetch that
  the 5 s timeout orphans; the orphan scans then failed on git processes.
- chaos/test_agent_turn_liveness: a PROBE failure now carries the provider
  call counts and the agent's stale-kill log, so a cross-turn breaker trip
  can be told apart from a slow probe.
- tests.yml e2e: HERMES_TEST_FILE_RETRIES=0 so a race detector's red is never
  retried into green; own uv cache entry (cache-suffix: e2e).
2026-09-23 14:54:36 -07:00
teknium1
1123039790 test: C3 transcript ledger e2e (persisted == replayed == resumed, per step)
Class C3 (conversation-history persistence & replay integrity). A real AIAgent + SessionDB
runs a scenario matrix (plain turns, parallel tool batches, /steer mid-turn, interrupt,
stream drop + 500 retry, manual /compress, /compress here N, auto compaction, opt-in
micro-compaction) against the recording fake provider. After EVERY step it asserts:
exactly-once at the storage layer and in the model view, next request replays the
persisted view, nothing the model saw ever leaves the durable/display history, each typed
input shown once, rows monotonic, usage == provider-billed; then a FRESH
'hermes chat --resume' process must replay a byte-identical request prefix.

Red-proofs: reverting 526d135a96 (compress-here tail) and 91df54184d (micro-compaction
rewind flags) and an injected double row insert all go red. A strict xfail documents a live
micro-compaction bug (merged user row duplicates both inputs in the resumed display).

The fake provider now records the usage it billed per request (record['usage']).
2026-09-23 14:54:36 -07:00
teknium1
7b5b713517 test(fakes): optional request-derived usage and Text.finish_reason in the fake provider
Backward compatible: FakeLLMServer(prompt_tokens_fn=...) reports usage.prompt_tokens
computed from each request body (token-driven logic such as compaction triggers sees a
realistic, growing count instead of a constant 100), and Text(finish_reason=...) lets a
scripted reply end with e.g. 'length' (truncated summaries). Defaults are unchanged.
2026-09-23 14:54:36 -07:00
teknium1
462afbe58d test: fake provider gains StallMidStream, Raw bodies and verbatim tool-call arguments
Chaos lane (C8 agent-turn liveness) needs an upstream that opens the SSE
stream and then goes silent without closing, arbitrary malformed bodies,
and truncated/malformed tool-call argument JSON. All additions are new
response types or accept a str where a dict was required, so existing
scripts are unchanged.
2026-09-23 14:54:36 -07:00
teknium1
f2241e866f test: scripted recording loopback LLM provider for core E2E suites
One real OpenAI-compatible server (JSON + SSE) that records every request
and scripts tool calls, reasoning, long streams and provider faults, so E2E
tests drive the real client stack instead of mocking the agent loop.
2026-09-23 14:54:36 -07:00
teknium1
85cd82f1dd test: purge low-value tests, lane py15 (375 removed)
Change-detectors, tautologies, source-reading tests, redundant duplicates,
mock-echo tests and dead/unrunnable tests. Per-test rationale in the lane
ledger (category + reason for every removal).
2026-09-23 03:15:26 -07:00