Commit Graph

2759 Commits

Author SHA1 Message Date
Teknium eeb7671e69 simplify(compat): hermes_cli small facades — drop 7 re-exports/aliases (+relay_runtime alias module), repoint 12 callers/tests 2026-09-03 13:05:57 -07:00
Teknium b610e603db simplify(compat): plugins/platforms+web — drop 7 re-exports + 3 aliases, repoint 1 caller + 11 tests, re-remove credential_summary
dingtalk: drop DINGTALK_TYPE_MAPPING/EXT_MAP re-exports. google_chat: card_spec_to_cards_v2 test -> .cards.
matrix: drop module-level MAX_MESSAGE_LENGTH alias (no importers). teams: drop TeamsSummaryWriter re-export
(teams_pipeline/runtime + tests -> summary_writer). wecom: drop WeComStreamExpiredError/STREAM_EXPIRED_ERRCODE/
MAX_INTERMEDIATE_FRAMES re-exports (tests -> .streaming). parallel: drop _get_parallel_client/_get_async_parallel_client
aliases (tests -> _get_sync_client). email: drop stale 'alias' comment (_esecret_int is the only name).
photon: re-remove credential_summary() (shim-only, cb9b7c36f3); its no-leak test now drives print_credential_summary.
2026-09-03 13:04:17 -07:00
Teknium 9c7238572e review-fix(vision): restore _validate_image_url/_image_url_shape_ok (public on main) + SSRF/localhost-block tests
ethernet8023: TestValidateImageUrl (incl. localhost block) was deleted with the sync
validator. Both names restored with BASE semantics; the async validator (the live
download path) now shares _image_url_shape_ok and gets its own localhost/malformed test.
2026-09-03 09:37:18 -07:00
Teknium 057681739f review-fix(voice): restore listen_for_speech (main's rolling-floor VAD barge monitor) + its 6 tests
ethernet8023: both documented VAD false-trip regression tests were deleted with the
function they covered. listen_for_speech is public API on main (plugins may import it),
so the body is restored byte-identical to BASE; full_duplex_listen/_BargeDetector is
A/B-verified identical to BASE over 400 fuzzed playback/speech scenarios.
2026-09-03 09:35:38 -07:00
Teknium febbe6ae12 review-fix(computer_use): restore per-axis scroll coordinate semantics
main guarded scroll's x/y independently (coordinate=[null,100] -> y=100),
while click treats a coordinate without x as no point. The shared _xy()
applied click semantics to scroll; split out _scroll_xy() with main's
per-axis guard and pin both behaviors in a test.
2026-09-03 09:32:38 -07:00
Teknium 0c62b297c6 review-fix(mcp): preserve MCP SDK 2 input schemas in the schema-cache write-through (salvaged from #91451 / #102129)
`_write_schema_cache` in the extracted owner tools/mcp_tool_registration.py
read `t.inputSchema` with a bare camelCase getattr. mcp 2.0 renamed the
model field to `input_schema` and kept `inputSchema` only as a serialization
alias, which pydantic does not apply to attribute access, so on SDK 2.x the
cache persisted `"inputSchema": {}` for every tool and a `lazy: true` server
registered from that cache was advertised to the model with all parameters
stripped. Pre-existing on BASE (tools/mcp_tool.py); fixed with the canonical
`mcp_field(t, "input_schema", "inputSchema")` helper, as both PRs do.

Adds the real-SDK regression test from #102129 (genuine `mcp.types.Tool`
driven through `_register_server_tools` -> cache write ->
`_register_from_cache_sync`), ported to the new module layout and isolated
from the module-global registration state.

Co-authored-by: mzkarami <mehrzad.karami@gmail.com>
Co-authored-by: lijinxiao1982 <120761624+lijinxiao1982@users.noreply.github.com>
2026-09-03 09:32:31 -07:00
Teknium 5dcd3b2620 ci: ASYNC220 ignore follows Popen to run_shutdown.py; windows-only tests patch the defining module; whatsapp taskkill kwargs explicit 2026-09-03 05:12:25 -07:00
Teknium e010327ff7 Merge branch 'simp/r3-34' into hermes/simplify-codebase 2026-09-03 04:34:19 -07:00
Teknium 0071ba9965 Merge origin/main (561b053f79) into simp/forwardport: forward-port 220 main commits into the simplified tree 2026-09-03 03:31:03 -07:00
Teknium c96568f66c perf(delegation): finished delegate children no longer pin their transcripts in the parent heap
A parent that fanned out 1,320 subagents over 13h reached 2.6 GB RSS
(1.9 GB anonymous heap). Every closed child AIAgent stayed reachable and
still owned a copy of its full message history. gc.get_referrers on a
finished child (30-child fan-out bench, evals/fanout_resource_bench.py)
showed two retainers:

1. bind_subagent_parent() stored the agent strongly in the
   `hermes_subagent_lifecycle_parent` ContextVar. Each child binds ITSELF
   for its own turn, and every asyncio Handle/Future scheduled during
   that turn (LSP reader loops, kernel pipe transports) snapshots the
   Context — 56 live Contexts held 14 finished children after the bench.
   The ContextVar now holds a weakref (non-weakrefable doubles fall back
   to a closure); get_active_subagent_parent() dereferences it.

2. AIAgent.close() cleared _session_messages but not the
   _db_flush_scan_prefix snapshot (a `messages[:]` shallow copy taken on
   every successful DB flush) nor _streamed_assistant_text_parts, so the
   agent — kept alive by (1) — retained every message dict. close() now
   drops both.

The delegate_task result entry never carried `messages`; a pin test
confirms the per-child result JSON is unchanged.

Bench (30 children / 10 worktrees, ~100 KB final replies so retention is
visible): post-fan-out live child AIAgents 14 -> 0; RSS after fan-out
636 MB -> 556 MB. With the harness' tiny default replies both runs sit at
~192-194 MB (the children's transcripts were never the dominant cost
there; the leaked objects were).
2026-09-03 02:35:37 -07:00
Teknium 8cd2dbe6e8 merge simp/r3-34-F pass2 into simp/r3-34 2026-09-03 01:31:07 -07:00
liuhao1024 b462989a68 fix(vision): honor supports_vision_tool_messages=False in tool-result media gates
A ProviderProfile that declares supports_vision_tool_messages=False accepts
images in user messages but rejects list-type tool-result content with 400
(xiaomi/MiMo "text is not set"). supports_vision=True alone used to flip
_supports_media_in_tool_results to True, and a vision-capable capability
lookup could re-open _should_use_native_vision_fast_path — so the native
multimodal envelope landed in a role:tool message and 400'd every turn.

Both gates now go through one _profile_rejects_tool_media() veto.

Refs #89981

(cherry picked from commit daed88f940a6a475f12bb435498e48181da60f4d, trimmed)
2026-09-03 00:57:40 -07:00
Teknium 05c6da2985 refactor(tools): drop test-only _has_any_command_tts_provider, fold tts provider write paths and speaker text pump 2026-09-03 00:51:58 -07:00
Teknium 75934b89c8 Merge branch 'simp/r2-tools-b' (tools wave 2 net-deletion: approval/delegate/skills_hub/terminal/computer_use) into simp/integration3
Conflicts (union): computer_use/{cua_backend,cua_backend_daemon,doctor}.py — kept r2-tools-b's
_run_quiet/_run_driver/_cli_text helpers and the integration3 stdin=DEVNULL fix (06fb390212).
2026-09-03 00:44:12 -07:00
liuhao1024 2e542c92e6 fix(desktop): annotate canonical relay targets for remote @mentions
The Bot Mode mention middleware built message_agent targets from
botHandle(), which prefers a roster row's source-qualified UI alias
("default-vera"). Neither resolver accepts that form — the relay matches
canonical handle/profile (± @connection-id) and the local path a bare
profile name or "hermes" — so remote handoffs died with "No teammate
named" before enqueue.

Annotate the canonical form instead: profile@connection-id for remote
rows, canonical bare handle (default→hermes) for local ones. Pin the
profile@connection form on the relay side too, so the emitted target
stays inside the documented resolver contract (#97678).
2026-09-03 00:18:31 -07:00
Brooklyn Nicholson 29e5172487 [verified] fix(cron): harden gateway restart handoff 2026-09-03 12:40:26 +05:30
Teknium 47a0636bcf Merge branch 'simp/r3-34-E' into simp/integration3 2026-09-03 00:10:18 -07:00
Teknium eeaf3e9a11 Merge branch 'simp/r3-25-J' into simp/integration3 2026-09-03 00:09:15 -07:00
Teknium 0b8f881a96 refactor(hermes_cli/voice): single _continuous_callbacks tuple replaces four callback globals; fold reserved-char sets 2026-09-02 23:57:35 -07:00
Teknium c9e117ebfb Merge branch 'simp/r2-tools-b-cua2' into simp/r2-tools-b 2026-09-02 23:56:02 -07:00
Teknium 365e2835d4 fix(execute_code): POSIX kernels exit when their host dies mid-cell (death pipe)
Widens the Windows parent-death fix to the class: the kernel inherits
the read end of a pipe whose only write end lives in the host, so host
death by any means (SIGKILL, OOM, crash) is EOF and the kernel exits.
Stdin EOF alone only reaches the runner between cells, so a kernel
SIGKILLed mid-cell used to outlive its host indefinitely. The
integration test now runs on every platform and is trimmed to the
contract (kill host mid-cell, kernel gone), not the handle plumbing.
2026-09-02 23:55:30 -07:00
Dolverin 32d5e9d357 fix(execute_code): stop Windows kernels with backend parent 2026-09-02 23:55:30 -07:00
Teknium 0177c16903 fix(code-execution): remote kernel reap/evict skip kernels with a running cell
Same attached-cell guard as the local kernel host (#101861): a remote
kernel mid-cell is never reaped or cap-evicted, so a fan-out never has
its runner killed under a live poll loop.
2026-09-02 23:55:14 -07:00
nftpoetrist d4126c6f49 fix(code-execution): reap idle and cap remote session kernels
Local session kernels sweep idle-expired entries and enforce a
process-wide cap (DEFAULT_MAX_SESSION_KERNELS) on every call
(tools/code_kernel.py's _reap_unlocked / _evict_over_cap_unlocked). The
new remote kernel host (#96991) never got the same treatment:
_REMOTE_KERNELS only shrinks lazily when a specific key is revisited and
found dead, so an owner that opens kernels for several distinct
(env_type, task_env_id) combinations (or delegated children) and never
revisits some of them accumulates host-side bookkeeping entries for the
life of the gateway process.

Note this is narrower than the local case: the remote runner already
self-reaps on its own idle timeout, and SSH/Docker connections are
independently bounded by their own transport-level lifecycles (SSH
ControlPersist, Docker's session-scoped idle-timeout in terminal_tool.py)
— so nothing here leaks a live remote connection. What's missing is
purely the host-side dict/cap bookkeeping symmetry with local kernels.

Adds _reap_unlocked/_evict_over_cap_unlocked mirroring the local
implementation, reusing the same max_session_kernels config as an
independent cap on _REMOTE_KERNELS.
2026-09-02 23:55:14 -07:00
Teknium e50e571719 refactor(tools): inline _reset_spawn_warning_state, share _active_org_id, tighten eligibility checks 2026-09-02 23:19:42 -07:00
Teknium e23dbb5492 Merge branch 'simp/r3-34-E' into simp/integration3 2026-09-02 23:12:43 -07:00
Teknium d96d9f8071 Merge branch 'simp/r3-32-E' into simp/integration3 2026-09-02 23:12:06 -07:00
Teknium fc694f401e refactor(tools): unify scrub builders via _scrubbed_env, fold group-alive probe and kanban scrub, compact env_passthrough refusal loop and docstrings 2026-09-02 23:09:52 -07:00
Teknium 9737d9d86c refactor(tools): drop test-only merge_skill/skill_trees_of_root aliases and unused re-exports 2026-09-02 23:04:48 -07:00
Teknium 796a7e4829 refactor(computer_use): inline single-use session wrappers, hoist result classifiers to module level, fold list_windows 2026-09-02 22:50:24 -07:00
Teknium 0e0de99c61 Merge branch 'simp/r3-33-I' into simp/integration3 2026-09-02 22:41:31 -07:00
Teknium 0615725d45 Merge branch 'simp/r3-33-C' into simp/integration3 2026-09-02 22:41:25 -07:00
Teknium 9334b1718f Merge branch 'simp/r3-32-F' into simp/integration3 2026-09-02 22:41:18 -07:00
Teknium d9090dce5c Merge branch 'simp/r3-32-E' into simp/integration3 2026-09-02 22:41:17 -07:00
Teknium a3cb4e9fb3 Merge branch 'simp/r3-32-A' into simp/integration3 2026-09-02 22:41:12 -07:00
Teknium d6fbf44e90 Merge branch 'simp/r3-31-C' into simp/integration3 2026-09-02 22:41:09 -07:00
Teknium b15ac86686 refactor(tools): file_tools shares write/patch plumbing and terminal env bring-up 2026-09-02 22:31:59 -07:00
Teknium 8b249e4b3d refactor(tools): compact local env builders, env_probe, env_passthrough, pythonpath/gitbash helpers; fold force-unwrap and kill-group flows 2026-09-02 22:24:19 -07:00
Teknium 71dadfeb99 refactor(tools): trim skill_manage stack — dead linter CLI/format helpers, merged path resolvers, compact layout 2026-09-02 22:23:24 -07:00
Teknium 0c9b0256d4 refactor(tools): memory store — inline reload/read helpers, dict-dispatch write-gate text 2026-09-02 22:14:49 -07:00
Teknium e1cacc050e refactor(tools): fold modal_utils abstract seam into managed_modal (its only consumer); layout hug 2026-09-02 22:12:25 -07:00
Teknium 89881ad022 refactor(tools): simplify execute_code stack — drop kernel_mode shim, extract per-call remote path, reuse terminal config helpers 2026-09-02 22:10:19 -07:00
Teknium 63e9553fa2 Merge branch 'simp/r3-09' into simp/integration3 2026-09-02 21:57:14 -07:00
Teknium 4dac5f28af fix(execute_code): parallel cells no longer orphan kernel processes; LSP stops treating package dirs as project roots
Session kernels: a kernel mid-spawn (proc=None) read as dead, so every
concurrent cell for one owner replaced the registry entry and the
winner's process leaked outside the registry (110 live kernels, 1.1 GB,
330 threads under one 4-capped process). Reap/evict also tore down
kernels with cells attached, rmtree-ing the staging dir under the
spawner. Kernels now track attached cells: only settled kernels are
reaped/evicted, a kernel dropped while busy is torn down by its last
cell, and in-cell registry pops never remove a replacement.

LSP: a directory holding __init__.py is a package, not a project root.
hermes_cli/setup.py matched the python marker list and gave every
worktree a second pyright rooted at hermes_cli/ (70 of 105 reaped
clients in one session, ~40 servers / 8.7 GB live).
2026-09-02 21:50:00 -07:00
Teknium 303a8cafb0 refactor(computer_use): compact capture/input/backend — drop dead UIElement.center, section banners, reflow docstrings to 118 cols 2026-09-02 21:28:25 -07:00
Teknium 77cb01a3bc refactor(skills_hub): github tree fetch via _github_get/_github_json, table-driven auth, shared id split 2026-09-02 20:06:42 -07:00
Teknium 5def9faff0 refactor(cli): reuse banner art from hermes_cli.banner; collapse _cprint loop fallbacks 2026-09-02 19:02:17 -07:00
Teknium 8c9c7a041a refactor(cli): extract git worktree machinery into hermes_cli/worktree_ops.py (cli re-exports) 2026-09-02 18:44:44 -07:00
Teknium 5a8fbbf16c refactor(cron): split scheduler.py into delivery/script/prompt/preflight modules
cron/scheduler.py 6386 -> 3423. Four sibling modules hold the free-function clusters,
re-exported from cron.scheduler so every existing import/monkeypatch target keeps resolving;
origin-resident helpers are reached late-bound via `_sched` (same-object visibility, no
import cycle). Every moved node is AST-identical to the base. Source-inspection test for the
bash resolver repointed to cron/scheduler_script.py.
2026-09-02 18:34:26 -07:00
Teknium 70ef2d349f Merge branch 'simp/r2-tools-b-cua' into simp/r2-tools-b 2026-09-02 17:26:14 -07:00