Commit Graph

2874 Commits

Author SHA1 Message Date
Teknium
d3cd685fb6 fix(gateway): per-session setting commands run their messaging handler for a local session
slash.exec admits /reasoning /voice /approvals /codex-runtime /footer /busy /verbose /yolo /fast
/personality and runs the same _handle_<name>_command a messaging chat runs. Only what made that
handler wrong for a LOCAL session changes (gateway/session_setting_commands.py finds its LiveSession):

- /reasoning <level>: the session override now reaches a local turn (current_reasoning_config honours
  it before the frozen policy), config.get reasoning and session.info; `--global` saves AND applies to
  this frozen session; show/hide sets the session's streamed reasoning; a session.mutate reasoning
  pick clears a typed override.
- /fast: the session's tier is read from its policy; `--global` applies to this session too.
- /busy: applied to the session (config.get busy) besides the saved default.
- /verbose: no messaging opt-in gate for a local session; cycles its own tool-progress mode
  (off/new/all/verbose, no messaging-only `log`).
- /footer: parsed its argument from a field MessageEvent does not have, so `status|on|off` toggled.

Proof: tests/gateway/test_session_setting_commands.py runs every handler on a real local session
against a loopback model, reads back through config.get and the next turn's request
(reasoning_effort high, then low after --global).

(cherry picked from commit 64e27e54954b5c5a80ca781d7fabcc7b8ea78df7)
2026-10-13 02:43:13 -07:00
Teknium
88056a7556 docs(gateway): parity table rows for the admitted authoring and goal-family commands
Regenerated by scripts/gen_gateway_command_parity.py: /plan /learn /init /initiate-setup /moa
/blueprint /egress /goal /subgoal /loop /heartbeat /review /refine /debug /curator /login are
``control`` on slash.exec, so the classic CLI, Ink and Desktop columns reach them. The stale
"/curator has no gateway handler" note is gone (``_handle_curator_command`` exists now).
2026-10-13 01:58:38 -07:00
Teknium
2efe028116 fix(tui,gateway): /status, /context and /cron read as main's TUI on the shared owner
A TUI session's slash.exec reached the messaging gateway's handlers:
/status printed "📊 **Hermes Gateway Status**" markdown, /context the
gateway's gauge instead of the category table, and /cron was refused
(FINDINGS rows 17 / 19 / 21).

For a session created with source 'tui' the owner now renders main's
TUI text itself (gateway/session_tui_reads.py), inside the owning
profile's scope and the session's workspace:
- /status: main's session.status lines (status_report.build_status_fields)
  from the stored row and the live agent;
- /context: main's _format_live_context_output, the conversation counts,
  then render_context_breakdown_lines(grid=False) off the live agent;
- bare /cron and /cron list [--all]: the classic CLI's text, now built by
  cron_overview_lines / cron_list_lines in cli_commands_mixin (the CLI
  prints the same lines). Every /cron write stays refused.
Other surfaces keep the gateway handlers. The parity table records the
TUI reads.

Live (tmux, fake provider): all three pages match MAIN line for line,
apart from the session id format.
2026-10-13 00:35:44 -07:00
Teknium
a89f374d7c Merge origin/main (#45: 255 commits to 3b63f7b0a4) into feat/unified-gateway-runtime
Conflicts (2 files, 1 hunk each); every main-side change is kept, ported to
where the branch moved the code:

hermes_cli/kanban_db.py (build_worker_context helpers _ctx_cap .. _ctx_comments)
  main:   f5a6651231c/d56e357556f coerce foreign/text timestamps on read; in
          _ctx_role_history the "Recent work" stamp became
          _ctx_stamp(_to_epoch(row['ended_at']) or 0, now) instead of int().
  branch: moved the whole _ctx_* helper block into hermes_cli/kanban_db_context.py
          (kanban_db.py imports it back), deleting it from kanban_db.py.
  merged: kept the branch's deletion in kanban_db.py and applied main's change in
          kanban_db_context.py::_ctx_role_history as
          _ctx_stamp(_kb._to_epoch(row['ended_at']) or 0, now). Main's other
          timestamp coercions in kanban_db.py (Task/Run/Comment/Attachment/Event
          from_row, _TASK_EPOCH_COLUMNS, release_stale_claims,
          _extend_live_stale_claim, task_age) auto-merged unchanged.

hermes_cli/web_server.py (_lifespan)
  main:   d7830c6f42 reworded one comment in the free-tier bootstrap block
          ("the ONE place its identity is created" -> "the one boot-time creator
          of its identity"; guests are now also created on first connector use).
  branch: moved _lifespan's body into hermes_cli/web_server_app.py::app_lifespan.
  merged: kept the branch's relocation and applied main's comment rewording in
          web_server_app.py.

Merge-induced health fix (no conflict marker; the combination tripped the ratchet):
apps/desktop/src/app/session/hooks/use-cwd-actions.ts::changeSessionCwd
  main:   63ed3caa4ba/dbc538547fc grew the function (statusbar cwd change for the
          focused chat / tile runtime ids) to CC 20.
  branch: added the session_busy refusal mapping (sidebar.projects.moveBusy) in
          its catch, +1 branch -> CC 21 > target 20 (scripts/check health blocking).
  merged: both behaviours kept; the busy-error mapping moved verbatim into a
          module-level cwdChangeError(err) helper. Health back to 0 blocking.

Check: every line main added between 1fd1827726 and 3b63f7b0a4 (317 files) is
present in the merged tree.
2026-10-12 16:55:20 -07:00
Teknium
3b63f7b0a4 fix(install): Windows installs under a long profile path no longer fail "Clone succeeded, but checkout failed"
install.ps1 clones into %LOCALAPPDATA%\hermes\.hermes-clone-<pid>-<random>\tree
before publishing, which puts the deepest tracked file (a 159-character zh-Hans
docs path) past MAX_PATH once LOCALAPPDATA is longer than ~55 characters. Git
for Windows then refuses the file ("Filename too long"), every clone attempt
and the deferred checkout fail the same way, and the user sees "fatal: unable to
checkout working tree" from both the PowerShell one-liner and Hermes-Setup.

Clone with --config core.longpaths=true so the setting lands before the first
checkout and stays in the repo for `hermes update`; an installer rerun over an
existing checkout sets it too.

Salvages the long-path half of #72744 by @Imagineer99, written against the
pre-rewrite installer.

Co-authored-by: Lee Jackson <samleejackson0@gmail.com>
2026-10-12 16:42:41 -07:00
Teknium
119fbcf84e fix(plugin-catalog): rule 17 gate no longer fails every Python entry on bytecode validate wrote
The pinned-source gate runs `hermes plugins validate --install-deps` (which
imports the plugin) before scan_plugin_payloads.py, so the scan walked the
untracked __pycache__/*.pyc that import just wrote and reported it as
"committed Python bytecode". In a git checkout the scanner now judges the
tracked set, i.e. what the pinned commit ships; committed bytecode still fails.
Non-checkouts and untracked trees keep the full walk.
2026-10-12 03:18:02 -07:00
ethernet
4b050f6731 fix(release): stable advance trusts receipts instead of downloading ~33 GB
The 0.21.7 publication pass downloaded every package twice (~13 GB of
native handoffs, then all 20.5 GB of candidate files including the Store
packages the feeds never reference) to recompute digests the receipts
already bind, then died in the macOS feed merge:

  ModuleNotFoundError: No module named 'ruamel'

- The sequencer steps run under python_packages with ruamel.yaml (the
  node toolchain has no project deps), as the canary finalize already does.
- Stable advance fetches only metadata-*.json and the per-arch *-mac.yml
  legs. assemble(local_bytes=False) binds each artifact by its receipt
  sha256 and takes the macOS sha512s from the receipt-bound feed legs,
  cross-checked against receipt sizes.
- promote() materializes only non-package files (feed legs, APT indexes).
- finalize(verify_bytes=False) checks remote sizes with HEAD instead of
  streaming the zip/dmg back down.

Canary (no accepted candidate) keeps the full download path unchanged.
2026-10-12 02:18:43 -04:00
ethernet
bfa4f5098c feat(release): the stable sequencer narrates what it is doing
A publication run sat silent for 8+ minutes while it downloaded ~20 GB,
with no way to tell which phase it was in or why a claim was held.

scripts/releases/progress.py logs to stderr (stdout stays the JSON steps)
with GitHub ::group::/::notice::/::error:: markers:

- every git/gh/docker command the sequencer runs, with its time and result
- discovery counts, and each claim's state with the reason (run attempt
  and conclusion, draft location, abandon marker, receipt/release match)
- the plan: why each version advances, is skipped, or is held
- each step as a timed group: publish (receipt digests) and advance
- the channel advance's phases, plus per-file progress for the handoff
  fetch and candidate materialize downloads (the slow part)
- the head before and after, and a top-level ::error:: on failure
2026-10-12 02:13:17 -04:00
ethernet
36efcb8c87 fix(release): a fresh flip advances the head with the receipt it just wrote
Publishing 0.21.7 made the release public, then failed the channel
advance in the same pass with

  ChannelError: Stable candidate manifest differs from the final release receipt

discover() builds each record before the vX.Y.Z receipt tag exists, so a
green claim's record has candidate_manifest_sha256 = None.
publish_attempt() writes the receipt but returned only the Docker digest,
so the advance compared the archive's real digest against None. Every
first-pass publish of a bundle release failed here; only a rerun (which
rediscovers the receipt) could advance the head.

publish_attempt() now returns both receipt digests and the sequencer
applies them to the record before the advance. The sequencer fixture can
now stage a fresh green claim (no receipt tag, draft on the attempt ref,
one successful run); the new test fails on main with the production error.
2026-10-12 02:00:07 -04:00
ethernet
310e05c027 fix(release): the final stable tag push authenticates with GH_TOKEN
The publication reconcile checks out with persist-credentials: false, so
when the sequencer reached ensure_final_tag() its `git push origin
refs/tags/vX.Y.Z` died with

  fatal: could not read Username for 'https://github.com'

GH_TOKEN authenticated gh but never git. The push now carries its own
auth: when GH_TOKEN is set it resets inherited credential helpers and
uses `gh auth git-credential`, so the token stays out of argv and out of
.git/config, and the checkout keeps persisting nothing.
2026-10-12 01:36:01 -04:00
ethernet
576012d329 fix(release): stable advance checks native metadata against the payload tag
Stable Release Publication for 0.21.7 failed in advance_stable with

  ChannelError: Native metadata release identity mismatch

publish_release() passes the attempt ref (rc.15-v0.21.7) to
read_native_receipts(), which is right for the handoff receipts: they are
staged under releases/tag/<attempt>/. But record() stamps each
metadata-<platform>-<arch>.json with the payload tag (v0.21.7), so the
row check compared v0.21.7 against rc.15-v0.21.7 and refused every
stable release. Canary never noticed because its tag == payload_tag.

read_native_receipts() now takes payload_tag for the metadata row check
while receipts keep binding the attempt ref. The existing fixture used a
plain vX.Y.Z tag for both, which is how this stayed hidden; the new test
stages attempt-ref receipts with payload-tag rows.
2026-10-12 01:26:03 -04:00
Teknium
8a7a5a905f fix(install): name -TypeName on the new Invoke-Logged queue
A positional New-Object binds -ComObject on callers that shim New-Object
(test_install_ps1_desktop_stage boundary wrapper), so the redirected path
threw "Parameter set cannot be resolved". Use -TypeName like the quiet
path's neighbours and keep the last 20 lines only.
2026-10-11 21:42:15 -07:00
Teknium
3c758ec967 fix(install): git failures name git's own error, so Hermes-Setup's screen shows the cause
A failed clone, fetch, checkout or reset reported only the step ("git clone
failed; no checkout published"). Hermes-Setup shows the stage reason as-is, so a
user behind a proxy or a DNS block saw no cause and every report needed a
round-trip for bootstrap-installer.log.

run_logged / Invoke-Logged now keep the failed command's first fatal:/error:
line (else its last line, capped at 240 chars) and the git Fail sites append it:
"git clone failed; no checkout published: fatal: unable to access ...: Could not
resolve host: ...". Both output modes are covered: redirected (the Hermes-Setup
driver, CI) and the interactive status line. stderr still streams as before.

Script-only: the website Hermes-Setup.exe downloads install.ps1 / install.sh
from main on every run and on Retry, so copies already in the field show it.
2026-10-11 21:42:15 -07:00
Teknium
ddfe1d7662 fix(release): a Store submission failure never blocks publishing
The Microsoft Store step is no longer a release gate:

- stable-store runs with continue-on-error, and stable-phase-result no
  longer requires it, so a failed submission leaves the run green and
  'release.py publish' available.
- On failure it prints a warning and a run-summary section with the exact
  Store .msixbundle URL to upload in Partner Center by hand.
- The publication pass turns a failed or unreadable Store check into a
  warning instead of failing after the release has moved.

Also covers a camelCase (REST-shaped) submission (review).
2026-10-11 17:28:32 -07:00
Teknium
6992df4cdc fix(release): the Store submit reads the CLI's PascalCase submission keys
rc.13-v0.21.7 failed 'Submit the verified Store package' with
'unreadable submission: {"Id": ..., "ApplicationCategory": ...'.

msstore submission get serializes the .NET DevCenterSubmission property names
(Status, TargetPublishMode), not the REST API's camelCase, so the in-flight
check never found 'status' and the Manual-publish write added a second
'targetPublishMode' key the CLI would ignore. Both now use the key as the CLI
spells it. The test fake emits the CLI's casing; with it main fails 5 tests
with the production error.
2026-10-11 17:28:32 -07:00
Teknium
a0a49926f4 fix(check): blob-size exempts untracked copies and reads --head's allowlist (review)
- An untracked file whose bytes the base tree already holds (git hash-object
  matches a base blob) is no longer an offender, matching what staging the
  same copy already did.
- With an explicit --head, the allowlist comes from that revision
  (git cat-file <head>:.github/blob-size-allowlist.txt; none = no
  exemptions), so `--base A --head B` judges B by B's own exceptions.
  Working-tree mode still reads the file from disk.
- Tests for both: untracked copies of a base binary and base text file pass
  while an edited one is still caught; --head honours head's list over a
  conflicting checkout, a head without the list exempts nothing, and
  working-tree mode reads the disk list.
2026-10-11 17:16:57 -07:00
Teknium
9c5a59c63f feat(check): run the blob-size guard in scripts/check
The guard judges a diff, so it gets the same base/head as the ratchet:
--staged judges the index, --commit the pushed tip, and a plain run the
working tree plus untracked files against the merge-base with
origin/main. `python scripts/check --only blob-size` reproduces CI.
2026-10-11 17:16:57 -07:00
Teknium
db5e618205 feat(ci): reject PRs that add binaries or new files over 500 KiB
Every blob a merge adds stays in every clone forever. In the last 90
days main received a 2 MB PR screenshot, a 2 MB default.tar.gz, three
PR infographics, a Windows cache database written by a test and a 1 MB
fuzz corpus at the repo root; nothing looked at file size.

scripts/ci/check_blob_size.py judges each path changed base -> head:
a binary (git's own --numstat detection) whose new content is over
500 KiB, added or modified, and any newly added file over 500 KiB.
Edits to existing text files stay with the code-health FILE_LINES
ratchet. Content the base tree already holds (a pure move, a copy)
adds no bytes and is not judged. Exact-path exceptions live in
.github/blob-size-allowlist.txt (CODEOWNERS-reviewed), seeded with the
one generated asset over the limit that legitimately changes.

It runs as its own unconditional workflow, like the case-collision
check, because asset-only PRs skip the Python and frontend lanes.
2026-10-11 17:16:57 -07:00
Teknium
cc5928bd73 Merge origin/main (#44: 15 commits to 1fd1827726) into feat/unified-gateway-runtime 2026-10-11 14:02:25 -07:00
Teknium
1fd1827726 fix(release): the Store submit reads the submission with 'get', not 'status'
rc.12-v0.21.7 failed 'Submit the verified Store package' with
StoreError: unreadable submission status: ''.

store.submit parsed 'msstore submission status' as JSON. For a packaged
(MSIX) app that command prints a Spectre markup line ('Submission Status =
...') plus status tables, never JSON, and prints nothing when no submission
is pending (msstore-cli Commands/Submission/StatusCommand.cs). The first real
Store submission therefore always failed. 'msstore submission get' serializes
the submission as JSON (GetCommand.cs) and is already what submit reads after
the upload, so the in-flight check reads that instead.

The test fake now answers 'status' the way the CLI does; with it, main fails
5 tests with the production error.
2026-10-11 13:31:55 -07:00
ethernet
a12c3417c8 fix(release): abandon only the approved attempt, and only after the new cut is viable
Review findings on the abandon prompt:

- The prompt approved one ref but `abandon()` re-read the remote and cleared
  every outstanding attempt of that version, so a concurrent operator's
  replacement attempt could be cancelled and its draft deleted. The remote
  is now read again after the answer, and anything other than the same single
  attempt is refused; only that attempt is abandoned.
- Abandonment ran before the ancestry, final-tag and draft-body checks, so a
  yes could destroy the old attempt and then refuse the replacement. Those
  checks now run first; the prompt is the last step before the claim. The
  attempt number ignores markers, so abandoning does not change the tag.
- The prompt test now varies stdin and stdout separately and asserts `input`
  is never called unless both are terminals.
2026-10-11 15:22:52 -04:00
ethernet
74d788fcc9 feat(release): offer to abandon a blocking attempt from an interactive terminal
`release.py release` refuses while any attempt is outstanding and prints
the abandon command for the operator to copy. When stdin and stdout are
both terminals it now asks `Abandon <ref> and cut a new attempt? [y/N]`
right after that guidance. Yes goes through the same `abandon` as the
subcommand (cancel runs, delete the draft, write the marker) and the cut
continues as the next attempt; the default is no, and anything
non-interactive still refuses as before.

The confirmer and `inspect` are parameters of `release()`, not globals,
so only the CLI entrypoint opts in.
2026-10-11 15:22:52 -04:00
Teknium
8f05f890c5 ci(remote-backends): debian 13 for the test sshd, container setup as a mounted script
Review nits from #136602: the sshd and docker-backend image moves to the
current stable debian:13-slim (digest-pinned index), and the inline bash -c
setup becomes scripts/ci/test_sshd_container_setup.sh, mounted read-only and
run in the container. The new script joins the remote_backends path gate.
2026-10-11 11:55:56 -07:00
Teknium
ecf7d948e6 ci(remote-backends): fail on skips from the runner's parsed counts (review)
The lane's skip check grepped the progress line for an "<n>s," suffix, but
_print_progress prints skips before expected failures, so a skip beside the
SSH suite's xfail ("23✓ 1s 1xf, ...") passed unnoticed.

- run_tests_parallel.py: new --fail-on-skip. After the run, any parsed
  pytest skip count fails the exit code and lists the skipping files, the
  same way the zero-collected guard does; no display format involved. The
  skip and failure reports move out of main() into helpers (health ratchet).
- remote-backends.yml: runs scripts/run_tests.sh --fail-on-skip instead of
  tee + grep.
- Tests: a skip next to a strict xfail passes without the flag and fails
  with it; a skip-free run passes with it; the workflow test pins the flag.
2026-10-11 11:55:56 -07:00
Teknium
438d10200c ci: run the SSH and Docker terminal backends against a real sshd and daemon
The SSH backend's real-host tests skipped on every CI run (nothing set
TERMINAL_SSH_HOST), and every Docker backend test mocked subprocess or the
docker CLI, so no CI run had executed either backend end to end.

- remote-backends.yml: starts a throwaway sshd container on 127.0.0.1 with a
  per-run keypair (scripts/ci/start_test_sshd.sh) and runs
  test_ssh_environment.py plus the new test_docker_backend_real.py against it
  and the runner's Docker daemon with a digest-pinned debian:12-slim. A file
  that skips fails the job, so the lane cannot go green over zero coverage.
- New classifier lane `remote_backends` (tools/environments/, tools/terminal_tool*,
  the real tests, the sshd harness, run_tests.sh). ci.yaml calls the workflow
  only when it fires, plus every push to main; required_results makes a selected
  lane mandatory, like the update consumers.
- The real tests read HERMES_TEST_SSH_* / HERMES_TEST_DOCKER_IMAGE (forwarded
  by run_tests.sh), because the hermetic conftest blanks TERMINAL_SSH_KEY as a
  credential before any test can read it.
- New real SSH cases: exit code/stderr, cwd persistence with spaces vs per-call
  workdir, quoting across the ssh hop, SendEnv passthrough through a real
  AcceptEnv, file tools write/read on the remote.
- New real Docker cases: exec + exit codes, cwd vs workdir, exported env
  persistence, docker_env/docker_forward_env reach the container and
  nothing else does, quoting, file tools write/read, /root surviving a
  container replacement.
- The existing one-shot test is xfail(strict): TERMINAL_SSH_PERSISTENT=false
  is read into ssh_config["persistent"] but SSHEnvironment never consumes it,
  so every SSH session persists exported env. Its _cleanup also cleaned the
  raw task id, not the resolved env key, so one test's env leaked into the next.
2026-10-11 11:55:56 -07:00
Teknium
0d3b11c21c ci(release): refuse Intel-less retirement targets and define opt-in platforms once
- Retiring a preview channel now requires the stable head to carry every
  package the preview ships. An Intel preview could otherwise be pinned to an
  arm64-only stable head it has no package in, and its client would fail to
  resolve the retirement for good.
- The docs and release.py's next-steps text said Intel Macs stay on the last
  Intel release's feed. They do not: promote rewrites the one shared macOS
  stable feed with the arm64 leg, so Intel Macs get no update until a release
  opts Intel back in. Only the Termux APT channel stays on its previous release.
- New scripts/releases/optional_platforms.py holds the claim flag, jobs,
  handoff, target and smoke of each opt-in platform; stable.py, channel
  releases, release artifacts and the entrypoint read from it. stable.py is
  back under 1,000 lines. No behavior change.
- Test: a macOS Intel receipt against a baseline without Intel plans no
  upgrade arm (baseline=none); against a baseline with Intel it plans one.
2026-10-11 11:38:33 -07:00
Teknium
5f9b77cce0 ci(release): stop building macOS Intel and Termux in stable releases by default
Stable releases no longer build the macOS Intel (darwin-x64) desktop bundle
or the Termux APT package unless the release is cut with an opt-in flag.
Intel macOS is not supported on main, and its macos-15-intel bundle leg
takes 76-88 minutes, which is most of the release's wall time.

    python scripts/release.py release --commit SHA --include-macos-intel
    python scripts/release.py release --commit SHA --include-termux

The flags are written into the signed claim as includeMacosIntel and
includeTermux, like skipBundles/skipTests. admit emits them, and the
candidates-darwin-x64, transitions-darwin-x64 and macos-packaged-x64 jobs
(Intel) and candidates-termux and termux-checks (Termux) run only when
their flag is on. The gate requires those jobs to report skipped when the
flag is off; the skip flags keep their meaning.

Claims cut before these keys existed (every rc.* tag so far) have neither
key. validate_claim treats a missing key as false and still refuses a
non-boolean value or any unknown key, so sequencer discover/reconcile keep
working over the historical tags.

Without the opt-in platforms the candidate manifest, receipts, mac feed,
protected R2 head, APT promotion and downloads table all work with those
rows absent: the macOS feed carries the arm64 leg alone, the APT indexes
are left on the previous Termux release, and the unbuilt smoke is recorded
as skipped (a passed smoke for an unbuilt target is refused). A release
that opts Intel back in after one that left it out has no Intel baseline,
so its Intel upgrade arm is skipped like a first release.

Preview channels, canary and the PM bundle artifacts are unchanged.
2026-10-11 11:38:33 -07:00
Teknium
74f77ab9b0 Code health blocks new wall-clock sleeps in tests (HX013), adds a shared wait_until helper (#136644)
* feat(code-health): HX013 blocks new wall-clock sleeps in tests

A fixed time.sleep()/asyncio.sleep() is a bet that the code under test finishes
in time; on a loaded runner it loses and the test flakes. Main has ~1,470 of
them in tests/ and nothing stopped new ones (HX rules exclude tests).

HX013 runs only on test paths (Rule.include) and flags time/asyncio/anyio/trio
sleeps with a delay that is not a literal 0, plus a fresh threading.Event().wait(x).
Existing sleeps are grandfathered by the ratchet's base-relative compare; moved
code keeps its debt; '# health: allow HX013 -- <why>' waives a deliberate delay.

The fix text points at tests/waiting.py (wait_until / async_wait_until), a shared
poll-with-deadline helper replacing the ~60 private copies across the suite.

* fix(code-health): HX013 passes the interval of a poll under a deadline

The frozen replay (PRs merged 2026-10-08..09) hit three private poll helpers
(while not done and monotonic() < end: sleep(x)): that is the compliant shape the
fix text recommends, not a fixed delay. A while loop that reads a clock and can
end on a non-clock condition now exempts its sleep; a loop that only waits out
the clock, or polls with no deadline, still counts. tests/waiting.py needs no
waiver any more; tests/AGENTS.md names the rule and the helper.

* fix(code-health): HX013 passes a round-bounded poll loop

The second frozen window (2026-10-06..07) hit 'for _ in range(200): await
asyncio.sleep(0.01); if idle: return', a poll bounded by its round count: load
stretches it but cannot make it return early. A for-range loop whose body can
leave on a non-clock condition now exempts its sleep; a range loop of fixed
delays, or a poll over arbitrary items, still counts.

* fix(code-health): HX013 exempts only a real poll's own interval

Review fixes for the HX013 poll-loop exemption, plus a file split:

- Split: the HX013 checker moves to scripts/code_health/py_rules_sleep.py,
  and the AST helpers it shares with py_rules (Ctx, _FUNCS, _dotted,
  _call_name, _deferred_parts, _eager) move to a leaf module py_ast.py.
  py_rules.py drops from 1,034 to 877 lines (928 on main); CHECKERS still
  registers HX013.
- Clock-only conditions: only a test operand that reads something other
  than the clock counts as a condition. Combined clock checks
  (`monotonic() < a and monotonic() < b`), `not`/constant operands, and
  locals assigned only from clock arithmetic (`now < end`) no longer
  exempt the sleep. `and`/`or`/`not` follow their logic, so `while not
  done() or monotonic() < end` still waits out the clock.
- Loop ownership: a `break` ends only the loop whose body holds it (a
  nested loop's break does not count for the outer loop; one in the
  nested loop's `else:` does). Nested defs, lambdas and classes are
  skipped. A sleep in a loop's `else:`, `while` test or `for` iterable is
  not that loop's interval.
- Retry polls: a `try` body's return/break counts as conditional when the
  body calls something that can raise (`try: return probe() except
  OSError: sleep`). A body that only sleeps still counts as a fixed delay.

On origin/main this flags 2 more grandfathered sleeps and exempts 12 retry
polls the old rule missed, so the count goes from 923 to 913.
2026-10-11 11:27:22 -07:00
Teknium
549e53fd72 Merge origin/main (#43: 73 commits to c0ef5af520) into feat/unified-gateway-runtime
Conflicts (5 files):
- gateway/run_notifications.py: main lifted completion ownership into a new
  GatewayNotificationOwnershipMixin (run_notifications_ownership.py); the branch had lifted the
  update watcher into GatewayUpdateNotificationsMixin. The mixin inherits both. Kept both sides
  of the completion-event metadata (the branch's automation identities + local display card,
  main's proven_session_id / completion_ids), and in the async-delegation group the branch's
  authority admission runs first, then main's terminal-parent drop. Neither function main moved
  was changed on the branch.
- gateway/run_turn.py: the branch moved _hmwa_resolve_session into run_turn_prepare.py; main's
  one changed line there (the resolver receives the proven session id and completion ids) is
  ported into run_turn_prepare.py.
- hermes_cli/subcommands/sessions.py: keep both main's lazy cmd_sessions and the branch's
  rename/discard parser helper.
- ui-tui: keep both canonicalEn and connectorsEn catalogs; keep the branch's interfaces import
  plus main's findSlashCommand import.
2026-10-11 11:24:19 -07:00
Teknium
76c1a50eb1 fix(release): an artifact download that fails its checksum is fetched again
rc.11-v0.21.7's Windows x64 MSIX smoke failed with 'Artifact checksum
mismatch' on the 2.6 GB package. The stored object was correct (re-downloaded:
size and SHA256 match the receipt exactly), so the runner received bad bytes.
_download_url retried HTTP and connection errors but raised on a completed
body that failed its hash, so one bad transfer failed the job and its
dependents until a whole-run rerun.

A size/SHA256 mismatch now counts as a bad transfer and is fetched again
within the same three attempts. A stored object that really differs from its
receipt fails all three the same way, and the verified destination is never
replaced.
2026-10-11 06:06:05 -07:00
Teknium
7bc05085f0 fix(ci): docs drift handles repeated placeholders, scopes its warning filter
Review follow-ups: `providers.<id>.models.<model>.timeout_seconds` now
matches (a second <...> segment no longer ends the pattern), the YAML
warning filter is scoped with catch_warnings, and the slash-command list
drops a `hidden` filter CommandDef never had.
2026-10-11 05:09:46 -07:00
Teknium
4e8fe569e4 feat(ci): new config keys and slash commands must ship with docs
DEFAULT_CONFIG changed 183 times in 30 days and nothing checked that a new
key reached the docs; /pause (the global emergency stop) went undocumented
for two months.

scripts/ci/check_docs_drift.py lists every DEFAULT_CONFIG leaf and every
registered slash command and finds the ones the docs never mention. A key is
documented by its dotted path, a placeholder path in inline code
(`auxiliary.<task>.timeout`, `display.pet.*`), or a YAML example nesting it
under its parents; a slash command by a `/name` row in
reference/slash-commands.md.

The 132 keys undocumented today are baselined in docs_drift_baseline.json;
tests/ci/test_docs_drift.py fails only on NEW gaps, so it never blocks an
unrelated PR, and documenting a baselined key never fails. Deterministic,
stdlib + repo imports, ~1s.

/pause is documented here, so the slash-command baseline starts empty.
contributing.md says what to do when the test fails.
2026-10-11 05:09:46 -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
cdce56faf2 plugin-catalog CI: enforce rule 17 — scan pinned entries for unscannable payloads
The admission gate ran the install scanner (dangerous fails) but nothing refused
a compiled binary, committed bytecode, or an archive hiding either — the shapes
the scanner cannot read. This adds that enforcement to pinned-source-validate.

- scripts/scan_plugin_payloads.py (stdlib-only, so the no-install validator and
  third-party CI can run it): flags compiled binaries by magic header (ELF,
  Mach-O, PE/MZ, WebAssembly — not by extension, which a rename defeats),
  .pyc/.pyo bytecode (incl. sourceless/hash-forged caches that run instead of
  the .py beside them), and archives whose members are not reviewable source.
  Plain-text source bundles and inert assets (fonts, images) pass.
- plugin-catalog-ci.yml: after `hermes plugins validate`, each changed entry is
  scanned; a finding fails it. An entry may list `attested_binaries:` paths,
  each verified with `gh attestation verify --repo <repo> --source-digest <sha>`
  against the pinned commit; verified paths are dropped before the scan, any
  other binary still fails. Repo-controlled filenames are newline-stripped in
  the log so none can forge a workflow command.
- validate_plugin_catalog.py: `attested_binaries` is a known key, shape-checked
  as a list of relative paths.
- Tests: unit tests for the detector and two new workflow-driven bypass cases
  (bundled .exe, committed .pyc) in the confinement harness, which runs the real
  `run:` block.

Full-content re-sweep of all 543 pins: only tabro carries a native binary (it is
delisted in the companion PR). Three entries (crawl4ai, hermes-vision-inline,
mermail) commit __pycache__/*.pyc build litter and would fail rule 17 on their
next pin bump — pre-existing, not touched here.
2026-10-11 03:03:39 -07:00
Teknium
efd17a70b5 fix(release): staging checks each metadata row's commit and tag, not stamp-only fields
rc.10-v0.21.7's "Stage verified stable candidate artifacts" job failed with

  ValueError: Built package provenance does not match the release

assemble() ran stamp_matches() on each metadata row. stamp_matches() is the
check for an install-stamp.json and requires baseVersion, but a metadata row
is what record() writes (platform, arch, tag, commit, identity, version, ...)
and never carries baseVersion. So every bundled stable release failed here
once all packages were built. record() already verified each package's own
stamp (including baseVersion) when it wrote the row.

The row check is now what the row actually contains: commit and tag. The
staged-candidate fixture wrote a baseVersion into its rows, which is how the
mismatch stayed hidden; it now writes exactly the keys record() does. With
the corrected fixture, main's code fails 8 tests with the production error.
2026-10-11 02:56:13 -07:00
Teknium
c152ba5a82 docs(ci): prompt-surface changes need one core approval, not two
The prompt-surface-review ruleset was meant to require one other reviewer;
it is now set to one hermes-agent-core approval. CODEOWNERS, the CI comment,
the staleness-test message and the developer docs said two.
2026-10-11 02:26:46 -07:00
Teknium
ae3598c7cd feat(ci): reviewers see every change to the system prompt and tool schemas
A one-line code change can rewrite what every session sends to the model -- a
guidance constant moving tiers, a toolset gaining a tool, a dynamic rewriter
editing a description -- without the diff showing it. The rendered prompt
surface is now committed and reviewed like code.

- scripts/ci/prompt_surface.py renders the system prompt
  (build_system_prompt_parts) and the agent's tools[] through the production
  code for nine surfaces (cli x claude/gpt/gemini/hermes, cli in a code
  workspace, desktop, telegram, discord, cron) into
  tests/fixtures/prompt_surface/. A fresh home in a child process; clock,
  host OS, network, tool availability, env probe and machine paths pinned,
  so a laptop and CI produce the same bytes. Each tool schema is stored once,
  with a per-surface copy only where a surface serves a different schema.
- tests/ci/test_prompt_surface.py fails when the committed snapshot is stale,
  so a surface change must carry the regenerated snapshot in the same PR.
- prompt-surface-diff.yml (advisory, PR-only, stdlib-only, no PR code runs)
  posts per-surface token deltas, prompt hunks and per-tool
  description/param changes into the unified review comment.
- CODEOWNERS requests hermes-agent-core on the snapshot; a new
  prompt-surface-review ruleset requires two of their approvals.
- Docs: prompt-assembly.md (how it works), contributing.md (what to do when
  the test fails).
2026-10-11 01:21:18 -07:00
Teknium
6bc23a8097 Merge origin/main (#41: 2 commits to b30f95ac4a) into feat/unified-gateway-runtime 2026-10-11 00:16:34 -07:00
Teknium
b30f95ac4a fix(release): discover orders attempts numerically so rc.10 is the version's record
Review on #136434 (@jquesnelle): discover() sorted records by version only,
so attempts inside a version kept git ls-remote's NAME order (rc.10 between
rc.1 and rc.2). reconcile indexes records by version with the last one
winning, so once a version reached rc.10 it handed rc.9 (burned, no release)
to publish_attempt, which refuses with "Final tag release database ID is
invalid". v0.21.7 is at rc.9, so its next cut is exactly rc.10.

- Sort by (version, attempt).
- The test fakes list refs sorted by name, as git does; insertion order hid this.
- rc.10 test (fails without the sort), and a same-commit retry test (rc.1
  abandoned, rc.2 re-cut at the same commit wins).
2026-10-10 23:58:25 -07:00
Teknium
3e1d9dc59a fix(release): an abandoned attempt is burned before its version's final tag is checked
Every Stable Release Publication run since v0.21.6 has crashed in
sequencer.discover():

  ValueError: v0.21.6 points at a different commit than rc.1-v0.21.6

v0.21.6 took four attempts: rc.1-3 were abandoned (each has its
abandoned-rc.<N> marker) and rc.4 won and became v0.21.6. discover() tested
"does the final tag exist" before "is this attempt abandoned", so for rc.1 it
compared v0.21.6's commit (rc.4's) with rc.1's and raised; the abandoned
branch was only reachable for versions that never got a final tag. Any
version whose winner was not rc.1 broke every later reconcile, including the
next release's publish.

The abandoned marker is now checked first: an abandoned attempt is burned
whatever its version became. A NON-abandoned attempt whose final tag points
elsewhere still raises.
2026-10-10 23:58:25 -07:00
Teknium
bec207e9e4 docs(parity): a refused Ink subcommand keeps the rest of the command routed
The parity generator treated any canonical.controls.notAvailable in an Ink
command block as "the whole command refused". After the /voice tts refusal it
would have reported all of /voice as refused, although /voice on|off|status
still reach voice.toggle. ink_cell now recognises a refusal that names a
subcommand ('voice tts') and reports the route plus "`tts` refused". The
table is regenerated; /voice is the only row that changed.

Test: tests/hermes_cli/test_gateway_command_parity_live_session.py::test_a_refused_subcommand_keeps_the_rest_of_the_command_routed
(cherry picked from commit 08098c50613c90f51f9e36353d4a24ae55beb4d6)
2026-10-10 22:49:21 -07:00
Teknium
37434ad0e3 fix(tui): display preferences say they are not saved on the shared gateway
/mouse, /density, /details (global and per-section), /focus, /statusbar and
/battery patched the view, printed success and sent config.set with
.catch(() => {}). The shared gateway's config.set accepts only
busy/verbose/yolo/model (gateway/session_busy_controls.py::busy_config) and
answers invalid_params for the rest, so the preference silently vanished on
the next launch while the notice implied it had been saved.

These are client display preferences, not session state, so they still apply
to the view; on gw.isCanonical the command no longer sends the doomed write and
adds "/<cmd> applies to this view only; not saved on the shared gateway"
(canonical.controls.prefNotSaved, translated in all 16 bundled TUI packs) after
its own notice. A standalone backend persists through config.set as before.
The parity generator marks such Ink cells "(preference not saved)" instead of
listing config.set as the route; the table is regenerated.

Test (red on r11-base): ui-tui/src/__tests__/canonicalDisplayPrefs.test.ts

Review: andrexibiza 28
Review: andrexibiza 5479692359-P3.c
Review: kshitijk4poor P3-tui-config-set-keys
(cherry picked from commit 1671c2c8f1be9593bd0f216b8fb16ae8633742bf)
2026-10-10 22:49:20 -07:00
Teknium
1d691d84d8 fix(tui): Ink /rollback refuses on the shared gateway; parity table says so
Ink sent rollback.list/diff/restore with the shared-owner session id. The
owner has no handler (-32601), the interactive fallback reaches the legacy
sidecar, and those handlers are @_rpc(..., live_session=True): they resolve
the id in the sidecar's in-memory _sessions map, which never holds an
authority session, so every /rollback answered "session not found". The
parity table still listed Ink as "sidecar: rollback.*" because _rpc_cell only
flagged session-namespace methods.

Ink /rollback now refuses on gw.isCanonical with canonical.controls.notAvailable
(as /reload and /reload-mcp do) until the owner serves checkpoints; checkpoint
restore is not routed through the owner's cwd. The parity generator reads the
live_session=True sidecar RPCs from tui_gateway and reports a client cell that
depends on one as broken (4001) instead of served; the table is regenerated.

Tests (red on r11-base): ui-tui/src/__tests__/canonicalRollbackRefusal.test.ts,
tests/hermes_cli/test_gateway_command_parity_live_session.py

Review: dokterdok N39
(cherry picked from commit 8cc6968010a8f8f66dc468664bcb5d7fe5b7f90c)
2026-10-10 22:49:20 -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
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
elvindu
013e94b38a fix(install): name the marker owner as the Desktop hand-off pid
The posix hand-off hands marker line 1 to a custodian subshell
(marker_refresher_start) and then exported HERMES_UPDATE_HANDOFF_PID="$$" —
the hand-off script's own pid.

`hermes update` adopts a live claim only when the owner is its own pid, the
HERMES_UPDATE_HANDOFF_PID value, or an ancestor
(update_lock.UpdateLock._is_partner). The custodian is a *sibling* of the
hand-off script, so it is none of the three and the ancestry walk can never
reach it: every desktop-initiated update refused the claim its own script had
just made and exited 2 ("Another Hermes update is already running ...
process <custodian>"), leaving the Desktop to relaunch and retry forever.

Export $MY_PID instead: the custodian once the handover succeeded, and the
script's own pid when it did not.

Fixes #134268
2026-10-10 10:44:34 -07:00
Teknium
837f50b3da Merge origin/main (#36: 11 commits to a62979dc36) into feat/unified-gateway-runtime
One conflict: agent/context_compressor.py imports. Main's a62979dc36 dropped the
now-unused _safe_int import; the branch's retryable_user_text import is kept.
2026-10-10 08:36:16 -07:00
kshitijk4poor
31d1bd3491 fix(scripts): count only committed attempts as batch compactions in the micro-compaction report
Review thread on #136050 (agent/conversation_compression_telemetry.py,
"Refusals inflate batch counts"). Since #135807 every exit of
`compress_context` (blocked by a guard, skipped, aborted, refused) logs one
`context compression attempt telemetry:` line, and
`scripts/micro_compaction_report.py` counted every such line as a batch
compaction. Keep only records whose `commit_status` is `committed`.
2026-10-10 20:18:10 +05:30