Commit Graph

1178 Commits

Author SHA1 Message Date
kshitijk4poor
d1cb5d5cbd ci(process): no new detached spawn outside spawn_owned without a reason
A child started in its own session or group (start_new_session, os.setsid /
setpgid / setpgrp, windows_detach_popen_kwargs) does not die with a SIGKILLed
Hermes: it reparents to init and runs forever. That is how every family this PR
migrates leaked. With the families on spawn_owned, this keeps the class closed.

scripts/check_detached_spawns.py (AST) flags those shapes in the production trees
unless the line, or the line above it, says `detached-spawn: ok — <why>`. It runs
in scripts/check ("detached-spawns") and as a blocking lint.yml step. The baseline
is empty: every remaining site is on spawn_owned / own_process_groups, or carries
its reason. The reasons this commit adds are the census verdicts:
- must outlive the starter on purpose: restart watchers, /update and the updater
  hand-offs, dashboard/desktop/service launches, cron and kanban workers
  (restart-safe), the update-custody watchdog itself;
- awaited with a group kill on timeout: cron scripts, rg search, the Browser Use
  CLI, update completion (holds the checkout lock fd);
- covered by its own parent guard: the compute host (compute_host._parent_guard_loop
  flushes sessions; a supervisor KILL could cut that short);
- not a spawn: the wake-word `start_new_session` config key and event field.

tests/scripts/test_check_detached_spawns.py: each shape flagged, non-detached and
commented/string shapes not, the marker opts out on its line or the line above
and nowhere else, tests and the helper are out of scope, main() fails on a new
unmarked spawn, and the repository scan is empty. Teeth: appending an unmarked
start_new_session Popen to tools/file_operations_search.py turns
`scripts/check --only detached-spawns` red (rc 1); restoring it turns it green.
2026-10-29 16:58:09 +05:30
Teknium
3035c0c0ec fix(cron): grace_minutes=0 skips real misses instead of every run
The ticker fires seconds after the slot, so a 0 s catch-up window classified every on-time run as missed: with cron.catch_up_missed=false the job never fired at all, and with the default it still ran late misses and stamped every normal run catch_up. Floor the override at the existing 120 s tick tolerance, and let an explicit per-job grace skip a miss past its window regardless of the global catch-up default (that is what the user asked for on that job).
2026-10-28 19:40:40 -07:00
Teknium
3dbe3ec4d8 fix(cron): every slot move honours a job's pinned timezone
Two next_run_at writers still computed in the profile zone: extra_fire.settle (new on main since this branch was cut) after a manual run, and merge_job_definition when a profile distribution changes only the timezone. Either leaves an instant that is off the job's own cron lattice, so the next scan re-anchors past it without firing: one silently skipped run.
2026-10-28 19:40:40 -07:00
yliu325
b81e71addd feat(cron): optional per-job grace_minutes override
The catch-up window (how late a missed cron occurrence may run instead of being skipped) was
half the job's period, clamped to 120s-2h, for every job. A job can now override it outright:
0-1440 minutes, `0` meaning never catch up.

`grace_minutes` is a real 0, not "unset" — and the obvious write pattern would eat it:
`v in {None, "", False}` (the `workdir` update lambda) and `if value:` both treat `0` as
False in Python. Both doors therefore share `jobs_time.normalize_grace_minutes`, reads test
`is None`, and the renderer formats before testing truthiness.

The override moves the dispatch stamp too: `_classify_dispatch_lateness` and the dispatch
health metric read the same window, so a job the scheduler calls "late" is never reported
overdue by the dashboard.

Refused on `once`/`interval` schedules: the window describes a missed wall clock, and a
duration has none.

Split from the timezone commit so it can be reverted alone.
2026-10-28 19:40:40 -07:00
yliu325
bfa67878cd fix(cron): per-job timezone drives schedule compute and due-scan
A job may pin its own IANA timezone; its cron expression is then that zone's wall clock,
independent of the profile's configured timezone. Absent/None inherits the profile, so an
existing jobs.json keeps byte-identical behaviour and needs no migration.

The dispatch path needs the pin as much as the compute does. `compute_next_run()` resolves
the zone as job pin -> profile zone -> base offset, and every site that writes `next_run_at`
now passes it (advance, claim, resume, re-arm, recovery, and the quota/unreachable
planners); one missed site re-fires or skips a slot because the stored instant and the
expression would be read in different zones.

`_evaluate_due_job()` normalizes the stored instant into the JOB's zone, which hands every
downstream cron predicate the job's clock, and a pinned job skips
`_repair_timezone_shifted_cron` outright. That repair exists for jobs that FOLLOW the profile
zone across a zone change: on a pinned job its wall-clock comparison reads a due occurrence
as still-in-the-future and re-anchors past it.

Failing shape this fixes (profile America/Los_Angeles, job 0 9 * * 1-5 pinned to
America/New_York, scanned at 09:00 New York): `get_due_jobs()` returned [] and the job was
re-anchored to the next day, i.e. job zones east of the profile zone silently never fired.
The regression test drives the public store API and asserts both the fire and the absence of
the repair, and is proven red on main ([] and a rewritten instant).

Knobs live in the new sibling `cron/jobs_time.py`; `cron/jobs.py` stays over the file-lines
ratchet and only gained the call-site plumbing.
2026-10-28 19:40:40 -07:00
Teknium
f101b0f7b7 fix(cron): a quota hold on a manual run delays a queued run-now instead of desyncing it
When a manual run hit a provider quota window while another run-now was
queued, plan_hold moved next_run_at to the hold boundary but left
manual_run_at behind. The claim at the boundary no longer recognised the
queued extra fire, so it ran as a scheduled fire: it spent a repeat run and
dropped the scheduled slot saved in manual_run_restore_at.

extra_fire.reschedule moves the queued marker together with next_run_at, so
the run-now is delayed to the boundary and keeps its saved slot. A queued
run-now on a cron job waits for the boundary itself, not the next lattice
occurrence after it.
2026-10-28 13:08:26 -07:00
Teknium
af0d245b3a fix(cron): a run-now queued during a manual run survives its completion
A trigger_job that landed while a manual (extra) run was in flight had its
manual_run_at/manual_run_restore_at cleared by that run's mark_job_run, and
settle moved next_run_at off the queued "now", so the queued run fired as a
normal fire and completed the one-shot. The claim pops manual_run_restore_at
in its own save, so a job holding it again at completion was triggered
mid-run: keep its markers and leave it queued for its own claim.
fire_claim.at cannot order the two: the run heartbeat refreshes it.

settle's docstring said a recurring slot that passes mid-run is kept; it is
dropped (as on main). Corrected the docstring.
2026-10-28 13:08:26 -07:00
Teknium
481b6fe144 fix(cron): queued run-now intent survives a second trigger and the tick advance
Two review findings on the extra-fire change:
- A second trigger_job before the ticker claimed saved the first trigger's "now" as the slot
  to restore, so the original scheduled time was lost and the manual run consumed the one-shot.
  trigger_job now keeps the saved slot while a run-now is still queued.
- The tick's advance_next_runs rewrote next_run_at before the worker claimed, erasing the
  manual_run_at == next_run_at pair, so a gateway-forwarded recurring run spent repeat budget
  (and could retire the job). The advance now leaves a queued run-now alone; its claim restores
  the slot and owns the at-most-once advance.
2026-10-28 13:08:26 -07:00
Teknium
f799cf71d9 fix(cron): extra fires key on explicit run-now intent only
An unforced provider claim ahead of the slot keeps advancing next_run_at
(test_claim_succeeds_once_then_blocks); the dashboard Run already passes
manual=True. Diagnostics catch-all logs its traceback; user docs say a
manual run keeps the scheduled one.
2026-10-28 13:08:26 -07:00
Teknium
f656543e03 fix(cron): a manual run is an extra fire, never the scheduled one
`cronjob run` / `hermes cron run` / dashboard Run on an `in 30m` one-shot
completed the job (repeat 1/1, next_run_at null), so the real reminder
never fired; a recurring repeat.times=N job lost one of its N runs.

The fire claim now decides, under the jobs lock, whether the fire is
off-schedule (a run-now while the stored slot is still in the future)
and stamps the pending slot on fire_claim. claim_dispatch and
mark_job_run read that stamp: repeat.completed is untouched and
next_run_at stays on the slot. trigger_job (the gateway-forwarded run)
remembers the slot it overwrites and the claim restores it in the same
save, so a crash between claim and completion cannot lose it. A run at
or after the due slot is still the scheduled fire (no double fire).

The one-shot removal diagnostics move to cron/jobs_oneshot_diagnostics.py
so cron/jobs.py ends shorter than on main.
2026-10-28 13:08:26 -07:00
Ben Barclay
f4c54cd3cc fix(config-remote): a config backend outage ends one request, fire or turn, never the process
andrexibiza P1-B. ConfigBackendUnavailable subclasses SystemExit on purpose: a fail-open reader
must never serve defaults instead of the selected backend's config, and boot fails closed. That
contract stays. But long-lived consumers caught only Exception, so a plane blip after boot killed
the thread (or, inside an asyncio task, stopped the gateway's event loop).

The six named sites, each with its own outcome:
- gateway/readiness._probe_config: the existence check moved inside the guard; the outage reports
  {"status": "degraded", "detail": "config backend unavailable"}.
- cron/scheduler._load_cron_job_config: still refuses defaults (its except Exception lets the
  outage through); run_job, the fire's owner, now catches it and returns that fire's failure
  result; _run_one_job_body records it like an Exception (mark_job_run(False), finish_execution,
  crash notice) instead of re-raising into the ticker.
- cron/jobs._main_model_pin (moved to cron/jobs_model_pin.py to keep jobs.py under its cap):
  raises ValueError, so pinned=True create/update is refused as invalid input instead of silently
  dropping the lock or exiting.
- tui_gateway/server._profile_configured_cwd: None (logged); the cwd is a hint.
- tui_gateway/server._load_cfg_raw: the designed FailedConfigRead; _refuse_failed_read now
  refuses to save it with "could not be read", not "formatting error".
- tui_gateway/prompt_attachments._profile_attachments_storage: "" (logged): attachments stage in
  the profile home the sandbox mounts and the vision allowlist cover.

The owners above every other config read on a long-lived path (sweep in the PR body):
- TUI request owner already answers 4064 (_handle_admitted_request); deferred agent-build and
  resume-hydration threads now report agent_error / the resume failure and release their waiters;
  compute_host turn and frame workers answer turn.error / their error frame.
- gateway platform turn (_process_message_background) notifies the user and ends the turn
  instead of re-raising this SystemExit into the loop; api_server gets an outermost
  config_unavailable_middleware (503) since entering a profile scope reads config; the served-
  profile reconcile watcher and _serve_profile_runtime park the profile for the next rescan.

Tests: tests/plugins/config_backends/test_remote_unavailable_consumers.py (13), each raising the
real ConfigBackendUnavailable from the seam the consumer calls; every production file's fix was
reverted alone and its test(s) went red.
2026-10-27 17:33:48 -07:00
Ben Barclay
3b05d4501b refactor(config-remote): meet the code-health ratchet on main
The ratchet (scripts/check --only health, new on main) freezes every
file over 2,000 lines at its main size and blocks blind excepts.

- Facades back at or below their main size: the backend seam's local
  imports become module-level ones (config_exists via hermes_cli.config
  where that is already imported), and unrelated pure helpers move to
  topical siblings: _job_doc_header -> cron/scheduler_prompt.py,
  _csv_or_list_to_set -> gateway/run_common.py, the dotted config-path
  pair -> hermes_cli/backup_restore.py, voice/timezone/web checks ->
  hermes_cli/config_value_checks.py, a new profile's config document
  (seed, migrate, backend read) -> hermes_cli/profiles_config.py, pet
  spritesheet helpers -> tui_gateway/pet_sheet.py. Callers import from
  the defining module (no re-export).
- BLE001: _load_config_dict catches YAMLError/OSError/UnicodeError;
  run_migrations inlines the step loop again (the moved blind except
  keeps main's identity); the two intentional fail-opens carry
  '# health: allow' with their reason.
2026-10-27 17:33:48 -07:00
kshitijk4poor
de5f56c92a refactor(deadline): one poll_until for check-until-deadline loops
Twenty loops across 17 files hand-wrote the same thing:

    deadline = time.monotonic() + timeout
    while time.monotonic() < deadline:
        if condition(): return ...
        time.sleep(interval)

with small drifts between copies: some re-checked once after the loop,
some did not, one slept before its first check, and update_cmd_windows
kept a private _poll_until. A copy without the final check can miss a
condition that becomes true during the last sleep.

agent/deadline.py (already the home of clamp_timeout / run_bounded_*)
gains poll_until(predicate, timeout, interval): checks at once, cuts the
last sleep to the time left, checks again at the deadline, and returns
the predicate's last value so callers that wait for a pid / row /
identity get it back directly. timeout <= 0 is one check.

Converted: outbound_webhooks.flush, cron delivery wait and jobs flock,
host_attach channel wait, browser profile unlock, data-cleanup drain,
gateway dbus/bus waits, launchd fresh-pid and supervision waits,
supervised restart, gateway_migrate live-gateway wait, Windows
drain/absent waits, kanban init lock, local-runtime boot wait,
update_cmd_windows (private helper deleted), bot desktop start/stop
waits, TUI browser connect.

Left as is: loops whose body does more than check (progress callbacks,
interrupt handling, two distinct exits) and one site whose blind except
the health gate would reject once moved.

Behaviour changes, all small:
- loops that stopped at the deadline without re-checking now make one
  more check there;
- loops that already re-checked after a full last sleep now cut that
  sleep to the time left, so the check lands at the deadline (up to one
  interval sooner);
- a timeout <= 0 now means one check (some loops made none);
- the local-runtime boot wait checks before its first sleep instead of
  after it;
- _wait_for_user_dbus_socket also exports the user systemd env when the
  socket appears on that final check (before, that path returned True
  without it).

update_cmd_windows is imported by update_cmd on every OS, so the
fresh-source-install acceptance fixture (which keeps agent/ out of the
update path) now copies the stdlib-only agent/deadline.py too.

Tests: 4 pins for poll_until (two red against the classic
no-final-check variant), plus the existing suites for every touched
module.
2026-10-27 16:30:14 +05:30
Teknium
1843ff74c9 fix(left-core): count cron.model_provider and delegation backend routes as provider use
P2-2 (r4 review LC-1). _provider_choices never read the cron-wide cron.model_provider (every unpinned
cron job resolves through it) nor delegation.backends.<name>.options[] routes and their
fallback_providers (the only delegation routes while a backend such as model_map is active). Such a
home was never migrated by `hermes update` or agent start, and recover_for_provider, gated on the same
predicate, refused to install when a cron run or routed delegate resolved the provider: every run
failed with "Unknown provider".

cron.model_provider is read through a new cron.scheduler_preflight.cron_default_provider, which the
preflight's own requested-provider computation now uses too. Backend routes have no core loader (the
backends are plugins), so the routes are read in the options shape web_routers/delegation.py writes,
for any backend. A deep walk of every `provider:` key was rejected: `github` is a Copilot alias and
also a value of non-inference keys.
2026-10-25 22:22:46 -07:00
Ben Barclay
871900df63 feat(config): route every user config.yaml read and write through a ConfigBackend seam
Add hermes_cli/config_backend.py (config-config design §4.1, D10/D11): a
ConfigBackend protocol, the FileBackend (today's behaviour), selection by
HERMES_CONFIG_BACKEND only (default file; 'remote' and unknown values fail
closed with ConfigBackendUnavailable), and path-level helpers
(read_config_doc, read_config_doc_readonly, config_version, config_exists,
write_config_key, write_config_document, supports_file_tooling).

Migrate every direct reader/stat/exists/bypass writer of a user config.yaml
to the helpers (config.py loaders + caches, config_effective, env_loader,
gateway, TUI, CLI watchers, cron, tools, profiles, logging, time). File
tooling (config edit, backups, xAI migration rewrite, raw dashboard editor)
checks supports_file_tooling() first; migrations skip write-back without it.

Add scripts/check_config_yaml_readers.py (CI lint next to the writers gate)
that rejects a direct read of a config path outside the backend.
2026-10-25 18:54:09 -07:00
unsupportedpastels
2352d1d22c fix(gateway): write a local chat's cron result as a note, not a turn
A cron result admitted into a local chat ran as an automation turn over
the Bot Chat framing: a second model call over text that is already
finished. The admission now goes to the existing note executor
(session_completion_notes): a 'cron' producer is always noted, viewer or
not, so at the FIFO head the gateway writes the delivered text into the
chat's history (append_completion_note, keyed by the admission) and
settles it with no model call. The FIFO row is kept rather than a direct
write, which a live turn's lease would refuse. Failure notices are noted
the same way, marked diagnostic. The no-owner/unknown-chat/refusal/
timeout errors are unchanged.

Refs #143547
2026-10-25 19:18:26 -04:00
unsupportedpastels
65cac9a4c8 fix(gateway): deliver Kanban wakes, heartbeats and cron results into local chats
LocalSessionAdapter is a stub: no gateway_runner, no message handler, and a
send() that acknowledges a turn's own output. Three producers treated it like
a messaging adapter and lost their delivery to Desktop/TUI/CLI chats:

- KB-22: the adapter is built outside _create_adapter, so deliver_wake saw
  no runner, skipped admit_route_wake and fell to the missing handler
  (WakeNotAccepted). Bind gateway_runner from the authority it holds.
- RT-90: the heartbeat poller returned on a missing message handler before
  the authority branch, which needs none. Let a LocalSessionAdapter through.
- CRON-11: a local origin resolved to the stub send() (delivered, nothing
  shown) or, with no local chat restored yet, to "platform 'local' not
  configured/enabled". A local target is now admitted into the chat's FIFO
  by its owner in this process (owner_for_home, as cron execution uses),
  through admit_route_wake like a Kanban wake, with the Bot Chat framing.
  No owner in this process is an error, never a success.

Refs #143547

Co-authored-by: lucasfdale <89506270+lucasfdale@users.noreply.github.com>
Co-authored-by: gomediacoin <130362016+gomediacoin@users.noreply.github.com>
2026-10-25 19:18:26 -04:00
unsupportedpastels
18e16bdd7d fix(gateway): stable bot ownership for satellite fallback; relay completions survive a restart
Addresses review feedback on #144595.

Refs #143547
2026-10-25 19:16:23 -04:00
unsupportedpastels
f18ef0a15c fix(gateway): keep a reconnecting satellite off the primary bot
When a satellite profile's own bot hits a fatal error, its adapter is
popped from _profile_adapters and parked in _profile_failed_platforms
for reconnect. With a Desktop/CLI LOCAL adapter still in the map,
has_credential_platform() saw no credential platform and the cron tick
and restart-safe drain handed the profile the primary's routed bots, so
its output went out through the wrong bot until the reconnect landed.

has_credential_platform() now also takes the profile's
_profile_failed_platforms entry and counts a parked reconnect as owning
a bot, the same signal _is_shared_bot_satellite already uses for authz.
The drain reads it from the runner; the in-process ticker gets the live
map through a new profile_failed_platforms start kwarg.

Also update the native-ingress guards fixture to the remote-media
contract: an uncached remote URL is dropped with a note and the text
kept, while the trust-upgrade refusals stay.

Refs #143547
2026-10-25 19:16:23 -04:00
unsupportedpastels
01dffd3b47 fix(gateway): keep shared-bot fallback for a satellite that has a local session
Any local session (Desktop chat, CLI run, Kanban worker) adds a LOCAL
adapter to a satellite profile's adapter map. The shared-bot fallback
at three sites tested that map for truthiness, so once it held LOCAL
the satellite stopped borrowing the primary's routed bot and its cron
results, heartbeats and background notices failed as "not
configured/enabled".

has_credential_platform() ignores LOCAL when deciding whether a profile
has a bot of its own; _adapters_for_profile, tick_adapters_for and
_drain_restart_safe_cron_deliveries use it. _adapters_for_profile keeps
the satellite's LOCAL adapter layered over the borrowed primary map.

Refs #143547
Co-authored-by: liuhao1024 <11816344+liuhao1024@users.noreply.github.com>
2026-10-25 19:16:23 -04:00
qby
2420c0d599 fix(cron): serialise the tick's worktree prune sweeps
One process ticks every served profile, so the per-profile worktree-prune throttle let each
profile decide it was due and dispatched one cron-worktree-prune thread per due profile. A
338-profile gateway therefore had hundreds of threads forking `git` at the same moment, starved
the event loop past the liveness probes and exited 75; a supervisor restart reached the same first
tick and died again (#143255).

The sweep now runs through `cron/scheduler_worktree_maintenance.run_sweep`: one sweep at a time per
process (semaphore, bounded 120 s wait), so the number of concurrent `git` children no longer
scales with the profile count. Discovery runs inside the slot too.

The per-profile throttle is unchanged: every profile still decides when it is due, and its own
repos are still pruned.

Salvaged onto main: main already carries the per-repo claim half of this fix
(`claim_due_worktree_repos`, #144505), so this keeps that one claim mechanism (now keyed on
`normcase(realpath())`) instead of the original `due_repos` and drops its window test.
2026-10-25 11:02:27 -07:00
Teknium
c1b934a9d0 refactor(cron): the per-repo worktree prune claim lives in its own sibling
scheduler.py is over the 2,000-line ratchet, so the claim added for the
once-per-repo prune moves to cron/scheduler_worktree_maintenance.py and the
facade only calls it. scheduler.py ends one line shorter than main.
2026-10-25 07:53:55 -07:00
Teknium
adc330b185 fix(worktree): prune each repo once per interval, skip the whole-tree du when the count decides
A multiplexed gateway ticks cron once per served profile and every profile resolves the hermes
checkout, so the 6 h worktree maintenance (throttled per profile home) pruned the same repo once
per profile at the same second. Each pass ends in _warn_worktree_footprint, which ran
`du -sm <repo>/.worktrees` over every file of every tree (node_modules included) even when the
tree count alone (>= 10) already decided the warning. Observed: 4-11 concurrent full walks per
burst, on every boot and every 6 h.

- cron/scheduler.py: repo discovery stays throttled per profile home (own registry and jobs);
  the prune itself is claimed per resolved repo root, once per interval across every profile
  the process serves.
- worktrees_summary(size_below_count=...) skips the size probe when the count decides; the
  footprint warning drops the size text in that case instead of printing "unknown size".
- _tree_size_mb runs du through bounded_probe_run: subprocess.run's post-kill wait() never
  returns for a du stuck in uninterruptible disk I/O, hanging the caller (a `hermes -w`
  launch or the cron prune thread).
2026-10-25 07:53:55 -07:00
Sahil Vishnalya
7c8810dc21 fix(cron): a configured but disabled MCP server must not widen the job either
Addresses the two findings from the review on #142172.

The allowlist match ran against the ENABLED servers only, so a job that named a
server which is configured but ``enabled: false`` fell through to the union of
every enabled server: an operator who turned a server off for maintenance
silently widened an unattended job's permissions to all the others. The
interactive resolver refuses exactly that fall-through
(``hermes_cli.tools_config._merge_mcp_servers``: "A listed server that is
configured but disabled is still the user's server selection: it stays off, and
it must not fall through to every enabled server"), so the cron helper now
matches against the configured set as well.

The new tests live next to the helper's other cases (in
``tests/cron/test_scheduler.py::TestPerJobToolsetMcpMerge``) instead of in a
file of their own: the three controls they repeated are already covered there.
2026-10-24 15:40:43 -07:00
Sahil Vishnalya
11cebb30da fix(cron): a per-job MCP allowlist must not widen into every enabled server
A job names an MCP server by its TOOLSET name (`mcp-<server>`) or by the bare
alias the registry registers for it, but the per-job merge helper compared the
job's list against the BARE server names only. The intersection never matched,
so the "a server is already listed -> allowlist, add nothing" branch was
skipped and the fallback unioned EVERY enabled MCP server into the job's
allowlist: a job that asked for one server ran with all of them.

With three servers enabled (filesystem, github, slack), a job whose
`enabled_toolsets` was `["mcp-filesystem"]` resolved to
`["mcp-filesystem", "filesystem", "github", "slack"]`.

The comparison now accepts both spellings, so the two name the same server and
mean the same allowlist. Unchanged: a list that names no MCP server still
merges every enabled one (an operator's native-toolset allowlist must not
silently strip MCP tools), and the `no_mcp` sentinel still means none.

Refs #141468
2026-10-24 15:40:43 -07:00
liuhao1024
da1453688a fix(cron): forward the voice flag when cron delivery calls send_voice
Cron's _send_media_via_adapter used _is_voice to pick the voice sender
but never passed it on, so the Telegram adapter fell back to extension
routing and a [[audio_as_voice]] .mp3 always arrived as a sendAudio
music file while the run was recorded as delivered. Forward the flag
exactly like the gateway dispatch (BasePlatformAdapter._send_one):
voice-tagged audio transcodes into a voice bubble, plain audio-ext
attachments forward False and stay music files.

Fixes #132120
2026-10-23 17:40:07 -07:00
Teknium
e1b65c5f0b refactor(browser): callers stop naming agent-browser, Camofox and the built-in browser tools
- hermes acp --setup-browser installs pm's chromium (browser_exec's local
  browser), not agent-browser;
- the codex hermes-tools MCP server stops exposing the deleted browser_*
  tools (browser_exec stays out: it runs model-written Python outside
  codex's sandbox and approval UI); /codex-runtime copy follows;
- telemetry: the removed tool names become RETIRED_TOOL_NAMES so the shipped
  schema enums keep them; camofox stays a legacy browser backend label;
- CLI config defaults drop browser.camofox / record_sessions (the camofox
  plugin reads browser.camofox itself);
- learn prompt names browser_exec; stale comments and help text updated.
2026-10-23 01:41:24 -07:00
alt-glitch
c8029f51eb fix(cron,kanban): a claimed welcome trial runs cron jobs and Kanban workers on a fresh install (review)
The trial's free model was a fallback only ordinary session.create calls reached. A fresh install that claimed the trial has no model.default, so a default cron job refused with "no model configured" and a Kanban worker's launch policy carried an empty model that restore_policy rejected as storage_unavailable.

The trial is now the last rung of model resolution (anon_auth.trial_model): _resolve_gateway_model falls back to it, which covers session.create, Kanban workers and every other gateway reader, and the cron ladder ends on it below HERMES_MODEL. It is never written to config.yaml, so a configured model wins at once. A chat created on the trial model keeps its FOLLOW_ADOPTED mark.
2026-10-22 17:16:22 +05:30
Teknium
ce18aafe01 fix(mcp): spend totals survive session rotation; each cron run has its own; review fixes
Independent review of #142470:
- Compression (CLI, TUI/Desktop) and /branch continue a chat under a new session id, which reset its
  spend total: a chat at its limit got a fresh budget. The continuation hook every rotation site already
  calls (transfer_session_yolo) now moves the total too.
- Every cron job in a process shared one tally (their approval session key is ""), so one job's spend
  refused the next and stayed spent until restart. The cron run scope binds its own run id.
- tool_costs keys the server does not offer (a typo, or Hermes' mcp_<server>_ prefix) are named in a
  warning at registration instead of silently carrying no budget.
- Untrusted over-limit prompts lead with the limit notice (the gateway text fallback keeps ~200 chars);
  "1 credit", not "1 credits"; the multiplex rekey moves the prompt slots with the totals.
- Tests: rotation + per-run cron tally + unknown-key warning (red on the previous head), and parallel
  over-limit prompts asked one at a time (red with the prompt slot made a no-op).
- Docs: where a total survives and resets, the counted-on-start wording, the same-name override note.
2026-10-21 04:12:11 -07:00
Teknium
70872e7fa6 fix(gateway): the default profile keeps env-only credentials after the in-place multiplex switch
Once a single-profile gateway started multiplexing for a newly created profile, the
default profile's re-wired adapter handlers, cron fires and the kanban decomposer
bound a files-only secret scope (build_profile_secret_scope). A key that reached the
process only through docker -e, systemd Environment= or op run has no .env line, so
new turns read None and a turn already in flight raised UnscopedSecretError.

Every per-home binding point now builds through
tui_gateway.launch_profile_policy.owner_secret_scope: the launch home gets
launch_secret_scope (env frozen at activation + .env), any other home its own files
only. A standalone primary-adapter body is also marked at entry (launch_body), so if
fail-closed is armed mid-turn its unscoped reads resolve from the launch mapping
rather than raising. No os.environ fallthrough is added.

The e2e test now sends the default profile's message through the production handler
the switch re-wires, instead of calling launch_profile_scope_if_multiplexed().
2026-10-20 08:42:13 -07:00
Teknium
3882113085 feat: archive stale dirty worktrees before removing them, sweep every repo, ask on dirty exit
The worktree pruner never removed a dirty or unpushed tree at any age, so leftovers of finished
lanes (stray probe files, WIP commits on closed PRs) accumulated forever: 658 trees / ~1 TB on
one machine, 553 of them named lane trees. Approved design (Teknium, 2026-10-17):

- Snapshot-then-delete: an idle tree past its tier (hermes-*/subagent-* 24h, named 72h) with
  uncommitted changes or unpushed commits is archived to refs/hermes/archive/<tree> (HEAD +
  staged + unstaged + non-ignored untracked bytes, built with a temporary index; large untracked
  files skipped and listed) and then removed. A failed archive keeps the tree. Branch kept when
  published on a remote, otherwise the archive anchors its commits.
- Never touched at any age or budget: live hermes lock owners, any live process whose cwd/open fd
  is inside the tree (/proc on Linux, psutil cwd elsewhere), trees with recent file/ref activity,
  Kanban t_<hex> trees.
- No count cap; optional worktrees.max_total_gb evicts the oldest idle trees first.
- Per-profile registry (<HERMES_HOME>/worktree_repos.json) of every repo Hermes made a worktree
  in (hermes -w, /worktree new, subagent isolation, Desktop git pane); the 6h cron sweep unions
  it with its existing sources, scoped and throttled per profile.
- Subagent worktrees with commits/edits are archived and removed at child finish (branch kept).
- Interactive `hermes -w` (CLI and --tui) exit with a dirty/unpushed tree asks Keep (default) /
  Archive & remove / Remove and discard; non-interactive exits never ask.
- `hermes worktree restore <name> [--path]`, archives in `hermes worktree list`, a full
  decision table in `hermes worktree prune --dry-run`, archive retention (30 days).
- worktrees.archive_dirty: false restores the classic never-delete-dirty pruner exactly.
2026-10-17 21:49:14 -07:00
Teknium
1237193f46 fix(windows): dirs made while elevated stay usable; an unusable token-lock dir parks once
An elevated Hermes (install, `hermes update` as admin, a gateway started from an
admin prompt) creating a dir with mode=0o700 gets CPython's protected
SYSTEM + Administrators + OWNER RIGHTS DACL, owned by Administrators. The same
user's non-elevated Desktop/gateway/CLI then gets WinError 5 inside it (#139845).

- hermes_dir_acl.make_user_dir: Path.mkdir that, only when the process is
  elevated on Windows, adds an inheriting full-control ACE for the token's user
  SID to every dir it created and to an existing leaf (repairs a dir an earlier
  elevated run left). No-op off Windows / unelevated. Routed through it: the
  gateway lock dir (scoped token locks, host rendezvous, update host
  obligation), bot mailbox, gateway.lock homes, pending_messages, media/attachment
  roots, process logs, spill dirs, vault, outbox, backups, home skeleton and
  mkdir_under_hermes_home (logs).
- W2: acquire_scoped_lock raises ScopedLockDirUnusable when this token may not
  use gateway-locks (or read a stale lock in it), logged WARNING once per dir with
  the repair (`icacls DIR /reset /t`). _acquire_platform_lock parks the adapter
  as non-retryable `lock_dir_unusable` naming the dir and the fix, instead of a
  raw PermissionError that Telegram retried forever.
- Builds on @KoNit-K's update-time ACL repair (#139870), which re-grants the
  whole home after an elevated update.

No Windows host was available: the ACL behavior is covered by
tests/test_hermes_dir_acl_windows.py (Windows CI) and needs a live retest.

Refs #134889 (W8, W2)
Refs #139845
Refs #140337
2026-10-17 08:03:52 -07:00
Teknium
7789d75c64 fix(platforms): cron home order and dashboard value checks match main (review)
- origin-less cron reports: platforms outside the priority list follow registry order again,
  as on main, instead of an alphabetical sort.
- dashboard PUT: without rules on the entry (the dashboard profile disabled the plugin, or a user
  plugin overrides it) a bundled platform's dashboard_card.py supplies them, read from its file,
  so the edited profile's Telegram/Slack values are still checked. The file loader is now
  gateway.platform_env.bundled_sibling(directory, stem).
2026-10-16 19:42:34 -07:00
Teknium
0663bdf98c refactor(platforms): read connected checks, allowlist env, cron home vars and status labels from the plugin registry
Delete the hand-written per-platform rows that duplicated data every bundled
platform plugin already declares on its PlatformEntry:

- gateway/config.py `_PLATFORM_CONNECTED_CHECKERS`: the weixin, whatsapp_cloud,
  signal, bluebubbles, qqbot and yuanbao rows move to a new narrow
  `PlatformEntry.config_connected_fn` (verdict from the merged PlatformConfig
  alone, no env fallback, owns the token shortcut so Weixin can refuse a bare
  token). Core-only rows (api_server, webhook, msgraph_webhook, relay) stay.
- gateway/pairing.py `_PLATFORM_ALLOWLIST_ENV` and the derived authz maps
  `_ALLOWED_USERS_ENV` / `_ALLOW_ALL_ENV`: read `allowed_users_env` /
  `allow_all_env` (discovering plugins first). The unauthorized-DM
  "allowlist set -> ignore" default keeps its historical platform set as a
  names-only frozenset so irc/teams/... DM behaviour does not change.
- cron `_HOME_TARGET_ENV_VARS`: env var from `cron_deliver_env_var`; the
  origin-fallback / deliver=all order is kept as a names-only priority tuple.
  `_KNOWN_DELIVERY_PLATFORMS` keeps only webhook and wecom_callback (no cron var).
- hermes status `_PLATFORM_LABELS`: plugin labels already overrode every row;
  discover first and use them alone.
- dashboard `_platform_authz_env_names` drops its read of the pairing table.

Differential oracle (connected matrix, pairing/dashboard env lookup,
_is_user_authorized + unauthorized-DM matrix, cron known/home/resolve/all,
hermes status platform section, hermes dump) is identical on base and head.
2026-10-16 19:42:34 -07:00
Maciej Lisiewski
6b0e0a33a9 fix(cron): stale-run reclaim acts only on the snapshot it judged
recover_interrupted_executions read rows outside a write transaction, probed
owner liveness, then marked silent live-owned runs 'unknown' without re-checking;
a worker stamping progress in between was filed wedged and its job could fire
twice. The reclaim UPDATE now also matches the snapshot's claimed_at/progress_at.
2026-10-15 22:12:28 +02:00
Teknium
0f2fe9ff5a fix(cron): canonical completion ids retire once nothing can replay them
Mechanism: mark_job_run appended every canonical execution id to the job's
canonical_completions (the idempotency tombstone that makes a recovered
receipt replay a no-op) and never removed one. A recurring one-minute job
grew this list by ~525k ids a year, and every membership check and
jobs.json rewrite grew with it.

Fix: the only path that can replay a completion into mark_job_run is
journal recovery (scheduler_authority.reconcile_pending iterates
cron/admissions/<hash>.json; finish_completed_run unlinks the journal as
its last step). When recording a new completion, keep only the earlier
ids whose admission journal still exists, then append the new id (it stays
last, which delivery_outcome._settle_job_record relies on). An id is
retired exactly when its recovery window has closed - no blind cap.

Test: tests/cron/test_canonical_completion_retention.py fires 65 runs
through mark_job_run with real journals: one whose tail crashed (journal
kept) plus 64 normal ones. The list is ['pending', 'run-63'], and replaying
the still-journaled completion is still a no-op (repeat.completed
unchanged). Fails on r14-base (66 ids retained).

Review: andrexibiza 4243963763
2026-10-11 23:38:03 -07:00
Teknium
eef16d28c8 fix(cron): recovery books a missing admission failed and lifts its own unknown pause
Mechanism (two branches of reconcile_pending):
- 'missing' (the owner holds no admission for the fire) paused the job,
  while the same verdict inside run_canonical_job's submit path books an
  ordinary failed run. A firer that died between journaling and the
  owner's commit therefore stopped a recurring schedule until a manual
  `hermes cron resume`.
- CronExecutionUnknown (any transport drop while polling status) pauses
  the job; when the owner's receipt later proves the run terminal,
  recovery booked output/delivery/mark_job_run but never undid that
  pause, so later fires were skipped. Main had no observer connection
  whose drop could stop a schedule.

Fix: 'missing' becomes the same terminal failed result the submit path
books (no pause); only 'unknown' pauses. Every recovery pause (the
firer's CronExecutionUnknown pause via pause_for_unknown, and
reconcile's own unknown pause) records its exact identity
(paused_at + reason) on the fire's journal; after a verified terminal
receipt is booked, the job is resumed iff it is still held by exactly
that pause, so an operator's own pause or resume is never touched.

Red on r13-base2: tests/cron/test_cron_recover_pause.py (missing ->
paused; terminal receipt -> job stays paused).

Review: dokterdok N98
Review: ahrazzle ahrazzle-B2-08
2026-10-11 19:31:34 -07:00
Teknium
3a41994f45 fix(cron): a firer-booked terminal row retires its admission journal
Mechanism: run_canonical_job journals every canonical fire; only
finish_completed_run unlinked it. The firer's other exits
(_record_fire_ownership_lost, finish_interrupted_run, the generic
exception tail of run_one_job) book the ledger row failed and return with
the journal still on disk. execution_owner_live() is False for a failed
row, so the next tick's reconcile_pending read the owner's terminal
receipt and replayed the whole tail: a second output save, a delivery of
the result the stale firer deliberately discarded, and an unfenced
mark_job_run (last_run_at/repeat/last_status rewritten).

Fix: reconcile_pending treats a journal whose execution row this firer
already finished (completed/failed) as settled: it unlinks it and books
nothing. Only rows still claimed/running/unknown (the firer never
observed the result) remain recoverable. One guard covers every
firer-terminal exit (SWEEP_cron_journal_terminal.md).

Red on r13-base2: tests/cron/test_cron_journal_terminal_exits.py (all
three exits re-save output and re-mark the job).

Review: JoaoMarcos44 JM44-r2-P1-4
Review: ahrazzle ahrazzle-B2-03
2026-10-11 19:31:34 -07:00
Teknium
3e35f5e944 fix(cron): observe a fire whose submit failed after the owner committed it
Mechanism: run_canonical_job's submit raised after the admission row committed
(a lost answer, or an owner error past the commit). It called recover, which
found the run, but only the 'missing' verdict was handled; every other status
re-raised, the outer handler turned it into CronExecutionUnknown, and the
scheduler paused the job and gave up a run the owner then completed.

Fix: recover now returns the admission's receipt (session_id, admission_id)
with its status, and the firer continues its ordinary poll loop through that
receipt when the run is queued, started or terminal. Any other verdict still
re-raises (fail closed: CronExecutionUnknown, pause).

Test: tests/cron/test_cron_recover_after_commit.py drives the real
_run_one_job_body against a real SessionAuthority/SQLite whose submit commits
(and settles) the admission and then raises; red on r12-base with either file
reverted (job paused); green: the execution row completes and the job stays
scheduled.

Review: dokterdok N61
(cherry picked from commit c8f22b60eaf2ef2de0c061c4879544c81c384d15)
2026-10-11 07:34:28 -07:00
Teknium
e74bb8bf65 fix(cron): an owner-side cron run stamps progress on the firer's ledger row
A canonical cron fire is executed by the gateway owner (session_cron.execute
-> run_job), but its execution row belongs to the firer (the restart-safe
external worker). execute passed the frozen get_job snapshot, which has no
execution_id, so _run_agent_with_watchdog's ExecutionProgressStamper got ''
and returned early; and touch_execution_progress is fenced to the row owner
anyway. The firer's observe loop only polled cron.status. progress_at was
never written, so recover_interrupted_executions swept a long, healthy run
'unknown' once the derived live-owner stale bound passed.

execute now hands run_job a copy of the snapshot carrying the fire's
execution id; the stamper records each progress verdict in
scheduler_liveness.owner_progress (cleared when execute ends); cron.status
reports it as progress_at; and the firer's observe loop stamps its own row
once per new owner stamp (so at the stamper's _RUN_CLAIM_HEARTBEAT_SECONDS
cadence). No sweep exemption: a wedged owner stops stamping and the bound
still fires.

Test: tests/gateway/test_cron_owner_progress_stamp.py::test_owner_progress_reaches_the_firers_ledger_row

Review: dokterdok dokterdok-N29
(cherry picked from commit f8009f32e255e80a37627940584d04cc157af85e)
2026-10-10 22:49:17 -07:00
Teknium
a50325417d chore(cron): drop finish_execution's uncalled departed_owner branch
finish_execution(departed_owner=True) let receipt recovery settle a running
attempt whose firer had exited, but no caller passes it: receipt recovery
settles through recover_receipted_execution (which also covers the unknown
audit row). The branch was a second, untested path to the same write.

Removed the parameter, its docstring paragraph and the branch; behaviour of
every existing caller is unchanged (dead-code removal, no new test).

Review: kshitijk4poor kshitijk4poor-P3-cron-departed-owner
(cherry picked from commit 8ec10553dc5fb6ee9a3c99ed325cc8db1113c2e2)
2026-10-10 22:49:17 -07:00
Teknium
6ed97629c5 fix(cron): park a Bot Chat delivery whose target owner is not running
_deliver_to_bot_chat returned "... unverified: profile authority is not
ready" when find_canonical_live_owner raised (the target profile's gateway is
down, starting or draining) and wrote no receipt, so _deliver_result appended
it to delivery_errors and the run was booked delivery_failed; through the
restart-safe worker queue, delivery_queue.drain booked the row 'failed' and
claim_next never looks at it again. Nothing retried it, although the
docstring promised "stays unverified for retry". Main parked these through
cron/bot_chat_delivery.defer; this branch retired that lane in 1cc9cb9199
but kept its upgrade drain (cron/bot_chat_legacy.drain_legacy_pending, run
every tick under the tick lock), which already hands each queued record to
the live owner once, idempotently, under its own delivery id.

A not-ready target now parks the output there (bot_chat_legacy.defer, under
the same stable delivery id) and records a 'queued' receipt, which the caller
books as delivery in progress (last_delivery_queued), not as a failure. An
absent store or a delivery error keeps its existing explicit status.

Test: tests/cron/test_bot_chat_delivery_no_owner.py::test_bot_chat_target_without_live_owner_is_parked_and_admitted_later
(tests/cron/test_cron_bot_chat_delivery.py::test_deliver_without_authority_is_parked_not_a_second_writer
updated: it pinned the old unverified string.)

Review: Adolanium Adolanium-reg-2
(cherry picked from commit 963cc681b6b4bd8622b0f1e0739bfda4e954e987)
2026-10-10 22:49:17 -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
Maciej Lisiewski
0006a5e229 ci: fix PLW1509, PLW1510, PLW2101 linter errors 2026-10-10 15:20:13 +02:00
Teknium
2b3c8aef77 fix(cron): a firer that gives up on a canonical run records its attempt as given up
When an in-gateway firer raised CronExecutionUnknown, _run_one_job_body paused
the job and returned, but its own executions row stayed `running` until a
restart's dead-owner sweep. Receipt recovery deliberately never acts for a
same-process claimed/running row (the in-gateway ticker fires on pool
threads), so the owner's later terminal receipt could not settle it either:
history showed the run in flight for the whole process lifetime.

The give-up path now marks the attempt `unknown` with the firer's reason
through cron.executions.give_up_execution, owner-fenced to this process
(a foreign or terminal row is untouched). An `unknown` same-process row is
exactly what recovery treats as given up, so a terminal canonical receipt
settles it via recover_receipted_execution. The job stays paused (no
re-execution of uncertain work). cron/scheduler.py stays below main's size.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5475590057
2026-10-10 05:53:17 -07:00
Teknium
c3981f19fa refactor(cron): move job-mode invariants to cron/jobs_invariants.py
cron/jobs.py is past 2,000 lines and the branch grew it past main (3,527 vs
3,503) by adding the script-is-a-command-line refusal to
_validate_job_mode_invariants. The whole responsibility - the mode
invariants create_job and update_job both enforce, plus their error
constants (NO_AGENT_WITHOUT_SCRIPT_ERROR, SCRIPT_IS_COMMAND_LINE_ERROR) and
_script_is_command_line - moves to a new topical sibling
cron/jobs_invariants.py.

Pure move: no test patches these names, jobs.py imports the validator at
module level (jobs_invariants imports nothing from cron.jobs, so no cycle),
and the one other reader (scheduler._run_no_agent_job) now imports the
constant from its defining module. No alias left in cron.jobs.

cron/jobs.py: 3,527 -> 3,483 lines (main 3,503).

Review: https://github.com/NousResearch/hermes-agent/pull/106742#discussion_r4230769970
(cherry picked from commit e71977a0569e36c4daf21ec9c8579bd92a101f30)
2026-10-09 17:31:25 -07:00
Teknium
ee2a175608 refactor(cron): move completed-run bookkeeping to scheduler_bookkeeping
cron/scheduler.py is past 2,000 lines and the branch grew it past main
(4,485 vs 4,437). The completed-run tail (_finish_completed_run) is the
branch's largest growth there and is pure terminal bookkeeping, so it joins
fail_empty_response / finish_interrupted_run / _classify_delivery_outcome in
cron/scheduler_bookkeeping.py as finish_completed_run.

Pure move. The store/ledger writers it calls (mark_job_run, finish_execution,
self_removal_delivery_allowed, _mark_incident_alerted, delivery lane helpers)
are read off the cron.scheduler facade through a late import, the same seam
finish_interrupted_run already uses, so every existing
patch("cron.scheduler.mark_job_run") / setattr(scheduler, "finish_execution")
still intercepts. Callers updated: _run_one_job_body,
scheduler_authority.reconcile_pending, tests/cron/test_unreachable_retry.py.
No alias left in cron.scheduler.

cron/scheduler.py: 4,485 -> 4,411 lines (main 4,437).

Review: https://github.com/NousResearch/hermes-agent/pull/106742#discussion_r4230769970
(cherry picked from commit 4f0fee6e625816e07af33759023f80ede418a1a5)
2026-10-09 17:31:25 -07:00
Teknium
a274d3388f fix: core modules import again on Python 3.11-3.13 (re-quote eager forward references)
#135348 ran ruff's UP037 autofix with ruff.strict.toml's target-version = "py314". On 3.14
annotations are lazy (PEP 649), so stripping quotes is safe there; on 3.11-3.13 a function or
variable annotation is evaluated when the def or statement runs. Every unquoted annotation that
names the enclosing class (`def clone_for_agent(self) -> ContextEngine`), a class bound later in
the module, or a TYPE_CHECKING-only import now raises NameError on import: 300 modules on main
(gateway.config, run_agent, hermes_state, cron.jobs, the Telegram adapter, ...) fail to import
under 3.11, the update path crashes mid-`hermes update` on any install whose interpreter is
older than 3.14, and the e2e-upgrade suite's retry leg fails with
`NameError: name 'ContextEngine' is not defined`.

- Re-quote exactly the 79 annotations (36 files) that name something unbound when they are
  evaluated (including tui_gateway/server.py's `_TurnScopes`, which only reaches that module's
  globals through register() after import); no other text changes.
- agent/turn_scripted_prelude.py: `Generator[...]` gets its third argument back. d76cce4f11
  applied UP043 (default type args, valid only from 3.13) to a module-level alias, so
  `Generator[Y, S]` raises TypeError on 3.11/3.12 and takes gateway.run, agent.conversation_loop
  and tui_gateway.{server,ws,entry} down with it.
- ruff.strict.toml target-version = "py311", the requires-python floor. With it UP037 leaves
  these quotes alone and only strips the two that are genuinely redundant, which this commit
  strips; any future version-gated fix stays valid on every supported Python.
- tests/ci/test_strict_ruff_target.py pins the target to the requires-python floor (red on main).
2026-10-09 14:25:07 -07:00
Teknium
b31923c8a7 fix: core modules import again on Python 3.11-3.13 (re-quote eager forward references)
annotations are lazy (PEP 649), so stripping quotes is safe there; on 3.11-3.13 a function or
variable annotation is evaluated when the def or statement runs. Every unquoted annotation that
names the enclosing class (`def clone_for_agent(self) -> ContextEngine`), a class bound later in
the module, or a TYPE_CHECKING-only import now raises NameError on import: 300 modules on main
(gateway.config, run_agent, hermes_state, cron.jobs, the Telegram adapter, ...) fail to import
under 3.11, the update path crashes mid-`hermes update` on any install whose interpreter is
older than 3.14, and the e2e-upgrade suite's retry leg fails with
`NameError: name 'ContextEngine' is not defined`.

- Re-quote exactly the 79 annotations (36 files) that name something unbound when they are
  evaluated (including tui_gateway/server.py's `_TurnScopes`, which only reaches that module's
  globals through register() after import); no other text changes.
- agent/turn_scripted_prelude.py: `Generator[...]` gets its third argument back. d76cce4f11
  applied UP043 (default type args, valid only from 3.13) to a module-level alias, so
  `Generator[Y, S]` raises TypeError on 3.11/3.12 and takes gateway.run, agent.conversation_loop
  and tui_gateway.{server,ws,entry} down with it.
- ruff.strict.toml target-version = "py311", the requires-python floor. With it UP037 leaves
  these quotes alone and only strips the two that are genuinely redundant, which this commit
  strips; any future version-gated fix stays valid on every supported Python.
- tests/ci/test_strict_ruff_target.py pins the target to the requires-python floor (red on main).

(cherry picked from commit 7091436b76e7dd51f2d350b2780fda231103eac6)
2026-10-09 12:25:47 -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