← Back to Pull requests

refactor: QQ Bot leaves core for the official qqbot plugin (installed by default, auto-migrated) #159640

Merged
teknium1 merged 108 files (7985 lines) on Nov 28, 2026 23:31 UTC
View on GitHub
teknium1 teknium1 commented on Nov 24, 2026 12:21 UTC
Author

Base: main. This head is rebased onto main c52847cc (after Weixin #159644, Meet/Teams #159653 and the left_core_migration package #161273).

Changes since approval (head ce8de9a96ff3)

Rebased from 9f67345b (on d6ed9a26) onto main c52847ccbd7d. Since 9f67345b, main has merged Weixin #159644, Meet/Teams #159653, and #161273, which splits left_core_migration.py into a package. Nothing below changes what QQ Bot users get. These are the conflict resolutions and the fix-ups that came with them:

  • The left_core_migration package (#161273). On main the file was at 1,951 lines; this PR's rows took it to 2,072, over the 2,000-line file cap. #161273 split it into topic modules first, as a behaviour-neutral move, and this PR's hunks now land in them. Each commit's version of the single file was re-split with the same deterministic generator, so the final package matches the split of this branch's last single-file version (2e67ff9c, the approved head plus the rebase fix-ups below) byte for byte:

  • - qqbot_in_use and its notice go to platform_use.
    - _layered_config, _installing and left_core_unfinished go to homes.
    - platform_install_command and platform_home_env_var go to hints.
    - The said-once marker goes to migrate.
    - Tests and cron/scheduler_delivery_unloaded import private names from the module that owns them. The caplog test listens on the package logger, the parent of every topic module's logger.
    - Modules after this PR: migrate 731 lines, rows 304, the rest under 250.
  • Weixin's removal (#159644). Conflicts were additive: both sides removed weixin/qqbot from the same lists, docs and tests. QQ's legacy_platform_alias duplicated main's retired_platform_keys. Main's version is kept and the QQ test uses it.

  • - tools_config: QQ's core-bundle reader is replaced by main's RETIRED_CORE_BUNDLES with a hermes-qqbot row. One _resolve_preset reads it.
    - default_plugins: the legacy-key line gives way to main's identity rule, and one left_unfinished remains. A later QQ commit converges on the same result.
    - _pending: rows and seen sets merged. _placed_copy_removed is kept in QQ's new branches.
    - cron: the not-configured origin hint reads scheduler_delivery_unloaded.moved_platform_hint. cron/scheduler_delivery.py stays at 2,000 lines.
  • Main's #160210 follow-up (faeb5b2b) changed the core plugins/platforms/qqbot/adapter.py that this PR deletes. The deletion is kept. The same one-line sent.link_fallback = True on the image-to-text fallback is not yet in the official qqbot plugin (hermes-official-plugins/qqbot/adapter.py), so a QQ media-only turn whose image upload is refused still reports delivered until the plugin gets it. That is a plugin follow-up and does not change this PR.

  • Meet/Teams (#159653). Main's alias spelling and plugin-identity rule are kept. Test stand-ins for get_default_hermes_root take the home= keyword main now passes. Test fixtures that main moved onto QQ Bot as "a platform core still ships" now use a platform core still bundles, because QQ Bot no longer is one (2e67ff9c).
  • Changes since approval (head 9f67345b035c)


    Rebased from aeeee5a3 (on 5db6268e) onto main d6ed9a26. Conflict resolutions that change behaviour:
  • left_core_migration._pending: WeCom's per-plugin told set (one post-split install line per plugin, not one per row; WeCom has two rows) met this PR's "read once, record first, report once" refactor (a failed config write reports one outcome, once). Both kept: predates is read once, the kept-off sentence is said after _record_migration, and the post-split line goes through told. Proof: with told removed, 3 WeCom tests fail (test_a_home_from_v55_on_that_sets_wecom_up_is_told_the_install_command[both-modes], test_a_home_that_cannot_prove_it_ran_core_wecom_is_told_the_install_command[no-config|unstamped]); test_a_failed_config_write_reports_one_outcome_once passes. test_left_core_ + test_default_plugins: 376 passed.

  • Every earlier conflict was additive. Both sides removed platforms from the same lists, both added LEFT_CORE rows, plus docs and a test fixture list. scheduler_delivery_unloaded takes main's moved_platform_hint elif.

  • cron/scheduler_delivery.py came out at 2001 lines after the rebase. One line folded to get it back to 2000 (_resolve_home_env_var). Same hunk in #159651.
  • New commits from the #159651 review (shared code, same hunks here):

  • fix(cron): a moved platform's ref is read the way the gateway resolver reads it. The primary's parser raising, or returning a malformed result, is now an error. The primary's validate_target_ref_fn has the final say. The old code fell back to the chat[:thread] split, so an exact route on the raw chat could pass an address the plugin refuses. Red→green: test_a_ref_the_primarys_plugin_refuses_is_never_sent_through_its_route.

  • fix(left-core): a migrator install interrupted after placing the tree is owed, not installed. A left-core.installing-<plugin> marker now spans the install, and left_core_unfinished covers both the placed and the installing marker. Red→green: test_a_qqbot_tree_the_migration_left_mid_install_is_installed_by_the_next_start.
  • Review fix (head 596edd4390b4)


  • 596edd4390b4 fix(left-core): a start reports each row once when its pass repeats. This is the same hunk as #159651 ac1d5b84ef6e. A catalog-miss or so it is off report stamps the failure marker, so the start re-passes, and _pending used to report the row again: the line was logged twice per gateway start. Test: test_left_core_migration.py::test_a_start_reports_a_row_once_when_its_pass_repeats, red on 4a9075b40157 (2 failed, assert 2 == 1) and green here. Local: test_left_core_ + catalog_platform files ran 267 + 17 passed / 0 failed. Full scripts/check ran 22 checks, ok. This PR has no hermes-tag change: its catalog_platforms.py has no _left_core_env.
  • What this does, in plain words

    QQ Bot (Tencent QQ's official Bot API v2, as a Hermes messaging platform) leaves Hermes core. It becomes the official qqbot plugin in NousResearch/hermes-official-plugins, maintained by Nous Research, and like Weixin it is installed by default on every Hermes home (catalog default: true), idle until a QQ App ID and secret are set.

    Existing users do nothing: the first hermes update (or the next agent/gateway start) sees that the profile ran QQ Bot and installs the plugin from the catalog once, and that same gateway start serves it. Same QQ_ / QQBOT_ env vars (legacy QQ_HOME_CHANNEL included), same platforms.qqbot config, same QQBOT_HOME_CHANNEL. New users already have it: the existing default-plugin installer (hermes_cli/default_plugins.py) puts it on every home once, and with no QQ credentials the gateway never starts the adapter (zero qqbot log lines). Whichever installer runs first, each home gets exactly one automatic install, and a later hermes plugins remove qqbot sticks.

    Round 17 (head a6f9ca44b9c0)


  • Rebased onto origin/main. Main's newer hot-start suite listed Platform.QQBOT among the named profile's fresh platforms; it now names discord (b3e418368eea).

  • Silent off after removing the default copy (Greptile on #159641): a home that ran QQ Bot in core and removed the idle copy the default installer placed was skipped quietly after the upgrade. 5b609cf830f8 (same _pending hunk as #159651 443284d0addb, equal git patch-id) keeps the removal and says the existing "…so it is off. Run hermes plugins install qqbot" line on the install backoff. Test test_a_qqbot_the_default_installer_placed_and_the_user_removed_stays_removed_and_is_said_off is red on the old head (1 failed), green here. The docs page says the same.

  • Review threads: d31fbbfa076a (the later of qqbot / qqbot-platform replaces the other, as the gateway reads them; 2 tests red → green); e485f9960ac0 (a non-list requires_env / optional_env reads as no env names, so one bad manifest cannot stop plugin discovery; shared with #159651); 66f891f77f0c (cron reports a destination skipped because its platform left core, also beside a delivered one and for a saved origin; shared); 304de8b2a9ea + a6f9ca44b9c0 (an automatic install keeps a plugins.disabled entry the home already lists; shared). The /reload env thread is answered inline: core's existing rule for its own names, unchanged.

  • Local: the PR's touched test files + left-core / default-plugins / catalog-platform / platform-plugin / hot-start / held-route suites + tests/cron/: 2,760 passed, 0 failed, 15 skipped. scripts/check --only health, boundary lint, no-tmp-literals, doc links ok.
  • Live, round 17 (real gateway run --force, fake HOME, endpoints behind a closed proxy)


    Trees: v0.23.4 (stamped 0.23.4 by deb_version.py --release-version v0.23.4 → write_install_stamp.py), and the removal heads stamped 0.23.4+canary.20261127T024356Z by the same producer for canary.20261127T024356Z-v0.23.4. The fixture catalog pins qqbot 7e8bc4e / feishu 2c8be75, default: true. Each home had creds in .env, then ran v0.23.4's real default_plugins.install_defaults (the hermes update step): both plugins were placed idle and recorded in _default_plugins_installed.

    | Leg | QQ Bot | Feishu |
    |---|---|---|
    | removed the idle copy (hermes plugins remove <x> on v0.23.4), then upgrade: new head | not reinstalled; logs ⚠ QQ Bot moved out of core into the 'qqbot' plugin, which this profile does not have, so it is off. Run hermes plugins install qqbot.; one kept notice | not reinstalled; same line for feishu; one kept notice (logged twice on this first start, because the toolset-scope conversion changes the settings fingerprint and the start re-passes; the kept-notice queue dedupes) |
    | same, old head (80868f4 / 99beefcc) | silent, not reinstalled | silent, not reinstalled |
    | existing user (idle copy kept), upgrade | plugin adapter hermes_plugins.qqbot connects in the same start (refused at the closed proxy); _left_core_installed: [qqbot] | hermes_plugins.feishu ✓ feishu connected in the same start; _left_core_installed: [feishu] |

    Real ~/.hermes/config.yaml md5 c72b5ba9… before and after.

    Round 16: staged transition instead of a version floor

    The >=0.23.5 floor is gone. Stable and canary both report 0.23.4 today (canary payloads read 0.23.4+canary.<stamp>), so that floor locked every shipping build out, including a canary that has already dropped core's adapter. Both plugins now install on Hermes 0.23.4 or later. They do nothing while the running core still bundles the same platform. The check is whether core's files are present: plugins/platforms/qqbot/ for QQ Bot; plugins/platforms/feishu/ or tools/feishu_doc_tool.py for Feishu. On such a core register() registers nothing and logs one DEBUG line (... the plugin stays inactive until core drops it), and core's own adapter and tools keep serving. The first core without them gets the plugin's adapter, with the same settings and tool names.

  • Feishu's plugin.yaml now ships provides_tools: []. hermes plugins validate fails any declared name that collides with a built-in, and core still ships feishu_doc_read / feishu_drive_. On that core the plugin registers none of them, so it validates cleanly on main. Follow-up after the core removal merges: put the five names back in provides_tools. Until then, validate on the post-removal core reports "undeclared tools registered" for feishu only. Runtime is unaffected, because user plugins load eagerly and register the tools from register(). The catalog entry keeps listing the five tools.

  • Seam used: the plugin's own presence check, which already existed. Main has no registry rule that prefers one side cleanly. Platforms are last-writer-wins, so the user plugin would replace core's adapter. Tools are core-wins, and the plugin's register_tool returns None with a WARNING on every start. Staying inactive avoids both.

  • Cost on a core that still ships the platform: the package import, measured on a 0.23.4 CLI process at +0.08 s (qqbot) and +0.17 s (feishu).
  • Rollout order: fixed plugin PR merged → catalog entry re-pinned to the plugin's MERGED sha → check that the published catalog (hermes plugins browse / a catalog fetch from main) returns the entry → core removal merges LAST (→ Feishu only: the provides_tools follow-up).

    Live probe (real version strings, real installs, real gateway run --force)

    Version strings came from the real producers. The v0.23.4 worktree goes through git (0.23.4). The canary.20261126T064809Z-v0.23.4 worktree got its stamp from scripts/termux/deb_version.py --release-version <tag>, then scripts/write_install_stamp.py with the Termux build's arguments (0.23.4+canary.20261126T064809Z). The removal heads ran twice: once stamped by the same producer for canary.20261127T024356Z-v0.23.4 (0.23.4+canary.20261127T024356Z), and once through git (0.23.4, display 0.23.4+777). The fixture catalog in each tree pins the pushed plugin commit (qqbot 7e8bc4e, feishu 2c8be75) with requires_hermes: ">=0.23.4" and default: true. Endpoints sat behind a closed proxy; each home had creds in .env.

    | Leg | Core (reported version) | QQ Bot | Feishu |
    |---|---|---|---|
    | Existing profile, default install on the old core | v0.23.4 (0.23.4) | installed + enabled; core adapter hermes_plugins.platforms__qqbot serves; plugin tools [] + DEBUG stand-down | installed + enabled; core adapter platforms__feishu connects; plugin tools []; no shadow warnings |
    | Same | canary.20261126 (0.23.4+canary.20261126T064809Z) | same | same |
    | Upgrade of that home | removal head, git (0.23.4) | plugin adapter hermes_plugins.qqbot attempts the token in the same start; no reinstall (plugin dir mtime unchanged) | plugin adapter hermes_plugins.feishu connects; 5 tools from hermes_plugins.feishu.feishu_doc_tool; no reinstall |
    | Upgrade of that home | removal head, canary-stamped (0.23.4+canary.20261127T024356Z) | same | same |
    | Existing profile, no plugin (left-core migration) | removal head, canary-stamped | installed once (_left_core_installed: [qqbot]) + plugin adapter in the same start | ✓ Installed the 'feishu' plugin… + connects in the same start |
    | Same | removal head, git | same | same |
    | hermes-tag profile: stable, then removal head ×2 | v0.23.4, then canary-stamped removal head | — | stable: Hermes Tag serves Feishu over core, official plugin inactive. First removal start: one ⚠ The community 'hermes-tag' plugin… line, also kept in left-core-notices.jsonl for the next attended turn, and the official plugin connects. Second start: no repeat |

    Cross-check from the same runs: on the Feishu removal head, the default-installed qqbot plugin stays inactive (core still ships QQ Bot), and the reverse holds too. hermes plugins validate passes for both plugins on main, v0.23.4, the canary and the QQ removal head. Feishu on the Feishu removal head reports "undeclared tools registered" until the follow-up above. The real ~/.hermes/config.yaml md5 was the same before and after (c72b5ba9…).

    Round 16: no code change in this PR. The floor lived only in the plugin and catalog: official#520 7e8bc4e, catalog #159641 7cd30f6. The live table above ran this head (80868f4d77c1) as a git checkout and canary-stamped. Shared commits with #159651 keep the same patch-id: dd3669581f63 = f9be92efa16b (predicate factory) and 80868f4d77c1 = d561c62ce397 (empty requires_env).

    _Round 16 supersedes the sections below wherever they mention a >=0.23.5 floor, a probe tree stamped 0.23.5, or a different merge order. The rollout order above is the current one._

    Slate (merge order)

    1. This PR (core removal + LEFT_CORE row)
    2. NousResearch/hermes-official-plugins#520, the qqbot plugin (history kept: 157 commits; replaces the closed Labs PR NousResearch/hermes-labs-plugins#110)
    3. Data-only catalog entry: NousResearch/hermes-agent#159641 (tier: official, default: true, requires_hermes: ">=0.23.5"; hold, re-pinned to the merged plugin sha)

    Until 3 lands, a migrating home logs "cannot find in the plugin catalog yet" plus the notice and retries with backoff; a release never sees the gap if all three land before it.

    Changes

  • Removed: plugins/platforms/qqbot/* and its 8 test files (moved to the plugin), Platform.QQBOT (Platform("qqbot") resolves once the plugin registers), toolsets.py hermes-qqbot and its hermes-gateway include, the hermes_cli/platforms.py, tools_config, dump, setup home-channel and web-messaging rows, the QQ_ OPTIONAL_ENV_VARS / env-key list entries, webhook deliver set, startup allowlist list, /update's built-in list entry (the plugin's entry keeps allow_update_command=True), the shipped qqbot: [hermes-qqbot] row in cli-config.yaml.example, the compat required-name rows for the deleted folder (as the Yuanbao/HA moves), and the qqbot boundary-baseline lines. Shared tests drop only their qqbot cases.

  • Migration (hermes_cli/left_core_migration.py): a LEFT_CORE row qqbot whose in_use is one platform_in_use("qqbot", ...) call replicating core's gate on main (register.is_connected + the EnvCred row): app_id + client_secret from the merged platforms.qqbot block (extra or top level; a top-level qqbot: block bridged), else QQ_APP_ID + QQ_CLIENT_SECRET in the home's env layers / secret scope; platforms.qqbot on; or hermes-qqbot selected for another platform (the Home Assistant precedent). enabled: false, or plugins.disabled naming platforms/qqbot / core's manifest name qqbot-platform, is not use. The row:

  • - plugin_key="platforms/qqbot", plugin_names=("qqbot-platform",): core's old disable keeps holding over the plugin;
    - secret_env=QQ_CLIENT_SECRET, private_env = the other manifest names: _HERMES_PROVIDER_ENV_BLOCKLIST, _ALWAYS_STRIP_KEYS and _ADAPTER_SECRET_ENV are identical to main (checked by importing both trees; 14 QQ_/QQBOT_ names). QQ_CLIENT_SECRET joins QQ_STT_API_KEY on local_env_policy's short adapter-secret list because gateway_restart_env reads that set directly;
    - no toolsets/off_platforms/legacy_toolsets: hermes-qqbot carried only core tools and the plugin registers none; Yuanbao's derived off_platforms now lists qqbot;
    - platform="qqbot", enable_env, and _qqbot_notice: no placement sentence (official rows carry none, as Feishu's), only what changed for the home: a bare qqbot in plugins.disabled now turns it off, and plugins.isolation: host keeps a catalog platform adapter off. Yuanbao keeps its own Labs notice unchanged.
    - Profile-gate detection now takes every LEFT_CORE platform as a gate prefix, so QQBOT__ALLOWED_ stays a profile gate without Platform.QQBOT. This also makes YUANBAO_ / HOMEASSISTANT_ gate names count again, as they did before those platforms left the enum. QQ stays in _EXTRA_GATE_ENV_PREFIXES.
  • One automatic install per plugin and home comes from main (#160177: left-core _pending + _DEFAULT_INSTALLED_KEY, default_plugins _recorded); the QQ Bot row only joins it. Held routes for a late-registering platform also come from main (#160253); this PR no longer carries its own copy of either.

  • Kept: the shared own-policy helpers (comments only), cron's home-target order and the QQ_HOME_CHANNEL legacy alias, doctor's rename warning, the QQ_ prefix alias for profile channel ownership, the session_rules route enum, desktop/TUI source lists. hermes-qqbot stays valid as a retired telemetry toolset value (RETIRED_TOOLSET_NAMES; the contract file is 1,982 lines).

  • Docs: messaging/qqbot.md (+ zh-Hans) is now a short "moved to the official qqbot plugin, installed by default" page; toolsets reference, messaging index and other mentions say the same.
  • Live migration probe

    Real gateway run --force processes (own PID, killed after ~45 s) in a fake HOME + HERMES_HOME + XDG_CONFIG_HOME + HERMES_GATEWAY_LOCK_DIR, on a git archive of this head 2d034b04c21. The catalog fixture's qqbot entry is tier: official, default: true, pinned to plugin PR #520 head 20a9a52ed021. All outbound HTTP goes through a proxy on a closed loopback port (QQ's token URL is not env-overridable; NO_PROXY exempts the git/package hosts), so the connect is refused after the adapter is created. The md5 of the real ~/.hermes/config.yaml was equal before and after (d57827e7…).

    | Leg | Home | Result |
    |---|---|---|
    | 1 first start | QQ_APP_ID+QQ_CLIENT_SECRET in .env | ✓ QQ Bot moved out of core — installed the 'qqbot' plugin from the catalog (QQ_/QQBOT_ settings … unchanged). once; 0 lines with "not supported"/"Labs"; the plugin's adapter (hermes_plugins.qqbot.adapter) fetches a token (refused) in the SAME start; _left_core_installed: [qqbot], enabled |
    | 2 second start | same home | no install line; plugin tree mtime unchanged; plugin adapter connects again |
    | 3 fresh, no creds | install_defaults(home) (fixture default) then a gateway start | ✓ Installed default plugin 'qqbot', enabled, _default_plugins_installed: [qqbot]; the gateway logs zero qqbot lines (no warning, no error), No messaging platforms enabled., no connection opened |
    | 4a install-once | creds; migrate_home → install_defaults → migrate_home, then hermes plugins remove qqbot, then both again | exactly 1 install (left-core), install_defaults -> {'installed': [], 'owed': []}; after remove neither reinstalls (dir stays gone) |
    | 4b install-once | creds; install_defaults → migrate_home → install_defaults, remove, both again | exactly 1 install (default), left_core -> []; after remove neither reinstalls |

    Earlier legs on the previous head (base creds = core adapter; no catalog entry = "cannot find in the plugin catalog yet"; multiplex secondary with creds only in profiles/b/.env = installed only into b and connects there) are unchanged by this placement change. First start also logs that the plugin's qrcode dependency was installed after the process started (setup-only; harmless).

    Round-12 rebase onto the merged enablers (head 1ee397fc8c24)

    Rebased onto main after #160253 / #160177 / #160180 / #160183 / #160200. Dropped this PR's own copies for main's: every gateway/session.py / session_lifecycle.py / session_persistence.py hunk and tests/gateway/test_unparsed_route_survives_save.py (main's test_held_route_late_platform.py covers the same cases), and the _pending / default_plugins one-install hunks. git diff origin/main -- gateway/session.py hermes_cli/default_plugins.py is empty. The predicate factory and the off-platforms/cron/webhook commit are unchanged (same patch-ids), so other move PRs can carry them byte-identically.

    Live, real gateway run --force on a git archive of this head, fake HOME/HERMES_HOME/XDG_CONFIG_HOME/lock dir, fixture catalog qqbot (official, default: true) pinned to #520 head 20a9a52ed021, all other HTTP through a closed loopback proxy. Real ~/.hermes/config.yaml md5 equal before/after (d57827e7…).

    | Leg | Setup | Result |
    |---|---|---|
    | A existing user | QQ_APP_ID+QQ_CLIENT_SECRET in .env, no plugin | one ✓ Installed the 'qqbot' plugin from the catalog for QQ Bot… line; hermes_plugins.qqbot.adapter fetches a token (refused) in the same start and retries; _left_core_installed: [qqbot], enabled |
    | B creds added live | fresh home, gateway running ~60 s (no qqbot dir), then hermes config set QQ_APP_ID … and QQ_CLIENT_SECRET … | 2nd config set prints "Running gateway is installing the plugin this platform needs…"; the live reconcile installs qqbot and the plugin adapter starts in the same process ~10 s later, no restart |
    | C setup listing | available_catalog_platforms() | fresh home lists qqbot (official, installable); the leg-B home (installed) does not |

    The probe tree carries an install stamp with baseVersion 0.23.5 because #520 declares requires_hermes: ">=0.23.5" and main currently reports 0.23.4; without it the install is refused with the version message.

    Composite-round fixes (same hunk in #159640 and #159651)

  • Off-platforms come from the rows. A row whose tools lived only in its own platform's bundle (Yuanbao, Feishu) sets own_platform_only, and _derive_off_platforms gives it every platform core knows plus every platform any LEFT_CORE row moved out. The hand lists _YUANBAO_OFF_PLATFORMS / _FEISHU_OFF_PLATFORMS are gone, so whichever of QQ Bot / Feishu merges second cannot leave qqbot off Feishu's list (or either off Yuanbao's). Test: tests/hermes_cli/test_left_core_off_platforms.py (stand-in rows + the shipped rows).

  • Saved routes to a platform that left core behave the same for QQ Bot and Feishu. Webhook route load accepts any LEFT_CORE platform (no hand-kept qqbot entry), so a route a secondary profile's plugin serves is not skipped. Cron deliver: <platform>:<chat> delivers through the plugin's sender once it is loaded; without the plugin the delivery error and the preflight message name hermes plugins install <plugin> instead of "no delivery target resolved". Test: tests/cron/test_cron_left_core_platform_route.py (red on the previous head: the no-plugin cases and the webhook load of the other left-core platforms).
  • Tests

  • Round 12 (this head): touched tests + test_left_core_, test_default_plugins*, test_held_route_late_platform, test_platform_hot_start, tests/cron/, catalog-platform/reconcile files via scripts/run_tests.sh: 234 files, 2,581 passed, 0 failed, 9 skipped (Windows-only). CI 16 passed / 20 skipped.

  • New tests/hermes_cli/test_left_core_qqbot.py (21 cases): in_use true for .env creds, config-only extras, platforms.qqbot on, a top-level qqbot: block, hermes-qqbot on another platform; false for a fresh home, half a credential set, enabled: false with env creds, plugins.disabled platforms/qqbot / qqbot-platform; install once with no placement notice; a plugin the default installer placed and the user removed is not reinstalled by left-core, and vice versa; gate-env and strip-set parity. Red on base 70634248084b (15 failed, 4 passed: the parity and fresh-home cases hold there by design), green on head.

  • 78 touched/related files through scripts/run_tests.sh (fake HOME): 1,566 passed, 0 failed, 16 skipped (previous head); after this placement change the left-core + default-plugin files: 131 passed, 0 failed.

  • scripts/check --only health, boundary_lint.py --check, ruff on touched files, check_no_tmp_literals.py, check_doc_links.py: ok.

  • Plugin suite against a git archive of this branch (QQ Bot dir and enum member gone): 116 passed; hermes plugins validate passed; scan_plugin safe on main and v0.23.4.
  • Not covered

  • Version gate: #520 needs Hermes >= 0.23.5. On a main checkout that still reports 0.23.4, a QQ Bot home gets "requires hermes >=0.23.5" and retries at the next start; it resolves once the release ships.
  • The QQ backend itself: every connect is refused at loopback once the adapter exists.

  • The multiplexed-secondary leg uses creds in the secondary's .env, not an external secret source (that path is the shared Yuanbao code, unit-tested there).

  • required_names.py rows dropped as in the Yuanbao move: an update swap from v0.22.3–v0.23.2 no longer finds the QQ folder during the swap scan.

  • Open PRs touching the old plugins/platforms/qqbot path are not ported here; they belong in hermes-official-plugins now.
  • Infographic

    !qqbot-leaves-core

    Diff: 7985 lines (+1796 / -6189) across 108 files Reviewer: BearHuddleston Review duration: 6430m
    All Vouch review confidence checks passed
    Residual risk 0.12 = Change Risk (0.95) × (1 − Review Confidence (0.87)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.95 · 7985 lines diff across 108 files
    0.95
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.96 · 5 substantive comment(s)
    0.96
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    87%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.400
    Sensitive Paths sensitive_paths
    0.095
    Mass File Touch mass_file_touch
    0.080
    Real PR Conversation Timeline
    40 items
    github-actions[bot] github-actions[bot] commented on Nov 24, 2026 12:21 UTC
    Bot

    <!-- hermes-ci-review-bot -->

    ૮ >ﻌ< ა ci review

    <sub>ran on ce8de9a — fix(qqbot-move): rebase onto the left_core_migration package</sub>

    ℹ️ Info

    CI caches · View report · View job

    29 / 29 cache hits (0 misses)
    4681.17 MiB restored
    0 B not restored.

    <details>
    <summary>per-job cache results</summary>

    <h3>hits</h3>

    <table><thead><tr><th>Job</th><th>Step</th><th>Logs</th><th>Restored</th><th>Δ vs main</th></tr></thead><tbody>
    <tr><td>OS-specific tests / Windows-only tests (arm64, 2/2)</td><td>Set up native ARM64 build dependencies / Cache ARM64 OpenSSL development files</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385268#step:3:1">view step</a></td><td>26.23 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / Windows-only tests (arm64, 2/2)</td><td>Set up locked Python and test dependencies / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385268#step:4:1">view step</a></td><td>222.60 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / Windows-only tests (arm64, 2/2)</td><td>Set up locked Python and test dependencies / Restore uv dependency downloads and builds</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385268#step:4:1">view step</a></td><td>857.76 MiB</td><td>+0 B</td></tr>
    <tr><td>Python lints / Python lints</td><td>Run ./.github/actions/setup-pm / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385322#step:4:1">view step</a></td><td>83.14 MiB</td><td>+0 B</td></tr>
    <tr><td>Docs Site / docs-site-checks</td><td>Set up the locked site toolchain / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385080#step:4:1">view step</a></td><td>155.38 MiB</td><td>+0 B</td></tr>
    <tr><td>Docs Site / docs-site-checks</td><td>Install website dependencies / Restore node dependency downloads</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385080#step:5:1">view step</a></td><td>71.71 MiB</td><td>+0 B</td></tr>
    <tr><td>Repository guards / Repository guards</td><td>Run ./.github/actions/setup-pm / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385167#step:36:1">view step</a></td><td>155.38 MiB</td><td>+0 B</td></tr>
    <tr><td>Repository guards / Repository guards</td><td>Run ./.github/actions/setup-pm / Restore uv dependency downloads and builds</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385167#step:36:1">view step</a></td><td>75.59 MiB</td><td>+0 B</td></tr>
    <tr><td>Repository guards / Repository guards</td><td>Run ./.github/actions/setup-pm / Restore node dependency downloads</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385167#step:36:1">view step</a></td><td>180.90 MiB</td><td>+0 B</td></tr>
    <tr><td>Python tests / Run tests (1/3)</td><td>Set up locked Python and test dependencies / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385231#step:5:1">view step</a></td><td>155.74 MiB</td><td>+0 B</td></tr>
    <tr><td>Python tests / Run tests (1/3)</td><td>Set up locked Python and test dependencies / Restore uv dependency downloads and builds</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385231#step:5:1">view step</a></td><td>75.59 MiB</td><td>+0 B</td></tr>
    <tr><td>Python tests / Run tests (1/3)</td><td>Run tests</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385231#step:8:1">view step</a></td><td>0.10 MiB</td><td>-122 B</td></tr>
    <tr><td>Python tests / Run tests (3/3)</td><td>Set up locked Python and test dependencies / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385242#step:5:1">view step</a></td><td>155.74 MiB</td><td>+0 B</td></tr>
    <tr><td>Python tests / Run tests (3/3)</td><td>Set up locked Python and test dependencies / Restore uv dependency downloads and builds</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385242#step:5:1">view step</a></td><td>75.59 MiB</td><td>+0 B</td></tr>
    <tr><td>Python tests / Run tests (3/3)</td><td>Run tests</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385242#step:8:1">view step</a></td><td>0.10 MiB</td><td>+15 B</td></tr>
    <tr><td>Python tests / Run tests (2/3)</td><td>Set up locked Python and test dependencies / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385243#step:5:1">view step</a></td><td>155.74 MiB</td><td>+0 B</td></tr>
    <tr><td>Python tests / Run tests (2/3)</td><td>Set up locked Python and test dependencies / Restore uv dependency downloads and builds</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385243#step:5:1">view step</a></td><td>75.59 MiB</td><td>+0 B</td></tr>
    <tr><td>Python tests / Run tests (2/3)</td><td>Restore per-file duration cache</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385243#step:7:1">view step</a></td><td>0.10 MiB</td><td>+0 B</td></tr>
    <tr><td>Remote terminal backends / SSH + Docker backends (real sshd, real daemon)</td><td>Set up locked Python and test dependencies / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385295#step:6:1">view step</a></td><td>83.14 MiB</td><td>+0 B</td></tr>
    <tr><td>Remote terminal backends / SSH + Docker backends (real sshd, real daemon)</td><td>Set up locked Python and test dependencies / Restore uv dependency downloads and builds</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385295#step:6:1">view step</a></td><td>75.59 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / Windows-only tests (arm64, 1/2)</td><td>Set up native ARM64 build dependencies / Cache ARM64 OpenSSL development files</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385266#step:3:1">view step</a></td><td>26.23 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / Windows-only tests (arm64, 1/2)</td><td>Set up locked Python and test dependencies / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385266#step:4:1">view step</a></td><td>222.60 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / Windows-only tests (arm64, 1/2)</td><td>Set up locked Python and test dependencies / Restore uv dependency downloads and builds</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385266#step:4:1">view step</a></td><td>857.76 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / Windows-only tests</td><td>Set up locked Python and test dependencies / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385277#step:5:1">view step</a></td><td>236.12 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / Windows-only tests</td><td>Set up locked Python and test dependencies / Restore uv dependency downloads and builds</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385277#step:5:1">view step</a></td><td>103.78 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / macOS-only tests (1/2)</td><td>Set up locked Python and test dependencies / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385269#step:5:1">view step</a></td><td>107.87 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / macOS-only tests (1/2)</td><td>Set up locked Python and test dependencies / Restore uv dependency downloads and builds</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385269#step:5:1">view step</a></td><td>168.62 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / macOS-only tests (2/2)</td><td>Set up locked Python and test dependencies / Restore verified PM tools without saving</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385332#step:5:1">view step</a></td><td>107.87 MiB</td><td>+0 B</td></tr>
    <tr><td>OS-specific tests / macOS-only tests (2/2)</td><td>Set up locked Python and test dependencies / Restore uv dependency downloads and builds</td><td><a href="https://github.com/NousResearch/hermes-agent/actions/runs/46201447452/job/141154385332#step:5:1">view step</a></td><td>168.62 MiB</td><td>+0 B</td></tr>
    </tbody></table>

    <h3>misses</h3>

    none

    <p>Compressed archive bytes. Not-restored bytes use the main-size reference; missing sizes remain unknown.</p>

    </details>

    ---

    debug info

    <details>
    <summary>CI timings</summary>

    CI timings · View report · View job

    Wall time 6m15s vs 7m29s (-16.5%). 7 job(s) slower, 5 faster, 2 unchanged.

  • OS-specific tests / Windows-only tests (arm64, 2/2): -125.0s

  • OS-specific tests / Windows-only tests: -106.0s

  • Python tests / Run tests (1/3): +42.0s

  • Python lints / Python lints: +35.0s

  • OS-specific tests / Windows-only tests (arm64, 1/2): +18.0s
  • </details>

    greptile-apps[bot] greptile-apps[bot] commented on Nov 24, 2026 12:30 UTC
    Bot

    <!-- greptile_summary -->

    <h2><ruby><rp>Confidence Score: 1/5 · Hold the merge until PM selects the same plugin trees as discovery and the gateway shares one platform merge.</rp></ruby><a href="https://app.greptile.com/api/retrigger?id=117941014&amp;sig=53432d1598e4155991e6c9c65df3279584890806de4a4899227cafdf82fdc774"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/RetriggerDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2"><img alt="Retrigger" src="https://greptile-static-assets.s3.amazonaws.com/badges/Retrigger.svg?v=2" align="right"></picture></a><a href="https://app.greptile.com/-/switch-tenant?tenant=nous-research&amp;next=%2FNousResearch%2Fhermes-agent%2Fpull%2F159640&amp;utm_source=greptile_review&amp;utm_medium=github&amp;utm_campaign=view_in_greptile"><picture><source media="(prefers-color-scheme: dark)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptileDark.svg?v=2"><source media="(prefers-color-scheme: light)" srcset="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2"><img alt="View in Greptile" src="https://greptile-static-assets.s3.amazonaws.com/badges/ViewInGreptile.svg?v=2" align="right"></picture></a>Confidence Score: 1/5</h2>

    [High impact] The PR changes how messaging platforms are installed\, selected\, and reached across Hermes\.

    Hold the merge until PM selects the same plugin trees as discovery and the gateway shares one platform merge.

    <h2>Findings</h2>

    1. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;An unused plugin blocks updates <a href="https://github.com/NousResearch/hermes-agent/pull/159640#discussion_r4726078571">▶</a>
    2. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;PM picks the wrong plugin <a href="https://github.com/NousResearch/hermes-agent/pull/159640#discussion_r4726078574">▶</a>
    3. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;Reload drops inherited settings <a href="https://github.com/NousResearch/hermes-agent/pull/159640#discussion_r4712067098">▶</a>
    4. <img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top">&nbsp;Cron rejects a working route <a href="https://github.com/NousResearch/hermes-agent/pull/159640#discussion_r4717147419">▶</a>
    5. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;Two gateway config pipelines <a href="https://github.com/NousResearch/hermes-agent/pull/159640#discussion_r4726078577">▶</a>
    6. <img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top">&nbsp;Bot address rules differ <a href="https://github.com/NousResearch/hermes-agent/pull/159640#discussion_r4717002088">▶</a>

    <details><summary>Fix with agent prompt</summary>

    `

    ### Issue 1
    pm/plugins_state.py:110-111
    If a disabled plugin has an unreadable manifest, `enabled_selection()` raises before it checks which plugins are enabled. Discovery skips the unreadable plugin, but `hermes update` can stop, even with `skip_invalid_secondary=True`. Keep the read check for selected plugins without requiring every unselected folder to be readable.
    
    ### Issue 2
    pm/plugins_state.py:116-124
    If `plugins.enabled` lists `disk-cleanup` and a differently named user folder declares `name: disk-cleanup`, discovery rejects that folder and keeps the bundled copy. PM picks the user folder first, so its dependencies can change or block the build even though Hermes won’t load it. Have PM and discovery use the same rules to pick the tree, without importing plugin code.
    
    ### Issue 3
    hermes_cli/config.py:undefined-2667
    Plugin discovery adds env names from every profile to `LOADED_PLUGIN_ENV` and never removes them. If a plugin declares a setting supplied by the shell or service, `/reload` can delete it just because it isn't in the launch home's `.env`. That can happen even after the plugin is removed. Track which values the reloaded home actually supplied, not which names any plugin declared.
    
    ### Issue 4
    cron/scheduler_preflight.py:332-338
    If a secondary profile’s Telegram adapter can’t start and never claims the bot, the ticker still lets that profile send through an exact route to the primary’s QQ bot. But `shared_route_serves()` sees the Telegram credentials and treats the bot as owned. Cron drops the report and tells the user to install `qqbot`, even with preflight off.
    
    Use the adapters the ticker or queue drain already chose. If a worker can’t see those adapters, let the drain decide instead of guessing from config.
    
    ### Issue 5
    gateway/config_loader.py:617-635
    `_yaml_platform_blocks()` repeats the live gateway’s merge but skips the step that reads global settings. A platform’s `unauthorized_dm_behavior` can therefore fall back to `pair` in the saved-block reader even when the live gateway uses the global setting. The repository guide calls for extending the existing path rather than duplicating it. Before merging, share one merge that takes platform names and leave plugin hooks and environment writes in the live loader.
    
    ### Issue 6
    cron/scheduler_delivery.py:448-460
    `_moved_platform_ref()` skips `target_ref_syntax_fn` and `validate_target_ref_fn`, then guesses `chat[:thread]` when the parser fails. `resolve_send_target()` can reject the same address or keep it whole. Installing an idle copy of the plugin in the job’s profile can therefore change how a saved address is read, even though the same primary bot sends it. Let `resolve_send_target()` use the primary bot’s already-loaded registration so both paths follow the same rules without importing another profile’s plugins.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    

    </details>

    <details><summary><h3>Summary</h3></summary>

    QQ Bot moves from a bundled adapter to the official qqbot plugin. The PR preserves old config names, saved routes, and tool picks while adding automatic migration for existing homes. Keep the published plugin and catalog pin ahead of the core removal, as the rollout plan specifies.

  • QQ Bot now runs as the official plugin, with used profiles migrated automatically.

  • Cron and webhook routes now work with platforms supplied by plugins.

  • Plugin enable and disable lists now use one shared identity rule.

  • Cron and migration can read the same merged platform settings as the gateway.

  • Platform plugin environment values now follow the active profile’s boundaries.

  • /update` replies now stay with the bot that received the command.

  • </details>

    <details open><summary><h3>Diagram</h3></summary>

    %%{init: {'theme': 'neutral'}}%%
    flowchart LR
        A[Profile plugin files and choices] --> B[Runtime discovery]
        A --> C[PM user-tree scan]
        B --> D[Bundled and user winner rules]
        C --> E[Dependency build]
        D --> F[Plugin Hermes loads]
    

    </details>

    <!-- greptile_confidence_score:1 -->

    <sub>Reviews (23) · Last reviewed commit: "fix(cron,gateway): cron reads saved plat..." · Reviewed by Greptile</sub>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 12:30 UTC
    Code Review
    gateway/config.py:1
    @@ -255,7 +255,6 @@ class Platform(Enum):
         WECOM_CALLBACK = "wecom_callback"
         WEIXIN = "weixin"
         BLUEBUBBLES = "bluebubbles"
    -    QQBOT = "qqbot"
         RELAY = "relay"  # generic relay adapter fronted by the connector (EXPERIMENTAL)

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> QQ routes vanish during boot

    If multiplexing is explicitly enabled and only a secondary profile uses QQ, the gateway reads saved routes before that profile registers the plugin. Without Platform.QQBOT, it skips those routes as invalid, misses interrupted turns, and can drop the routes on the next full save. The gateway guide requires the receiving bot’s identity to survive a restart. Keep stored platform IDs readable without treating them as live adapters, and test the upgrade with a saved secondary QQ session.

    Context Used: gateway/AGENTS.md (source)

    Knowledge Base Used:

  • Gateway session lifecycle and recovery

  • Restore messaging and cron sessions in the picker
  • <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: gateway/config.py
    Line: 258
    
    Comment:
    **QQ routes vanish during boot**
    
    If multiplexing is explicitly enabled and only a secondary profile uses QQ, the gateway reads saved routes before that profile registers the plugin. Without `Platform.QQBOT`, it skips those routes as invalid, misses interrupted turns, and can drop the routes on the next full save. The gateway guide requires the receiving bot’s identity to survive a restart. Keep stored platform IDs readable without treating them as live adapters, and test the upgrade with a saved secondary QQ session.
    
    **Context Used:** gateway/AGENTS.md ([source](https://github.com/nousresearch/hermes-agent/blob/main/gateway/AGENTS.md))
    
    **Knowledge Base Used:**
    - [Gateway session lifecycle and recovery](https://app.greptile.com/-/switch-tenant?tenant=nous-research&next=%2Fcustom-context%2Fknowledge-base%2Fnousresearch%2Fhermes-agent%2F-%2Fdocs%2Fgateway-session-lifecycle.md)
    - [Restore messaging and cron sessions in the picker](https://app.greptile.com/-/switch-tenant?tenant=nous-research&next=%2Fcustom-context%2Fknowledge-base%2Fnousresearch%2Fhermes-agent%2F-%2Freverts%2Frollback_141573-20261020-stored-session-picker-4dc14f5.md)
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 12:30 UTC
    Code Review
    toolsets.py:1
    @@ -214,7 +214,6 @@ def _core_without(*excluded, kanban=True):
         "hermes-dingtalk": _bundle("DingTalk bot toolset - enterprise messaging platform (full access)"),
         "hermes-feishu": _bundle("Feishu/Lark bot toolset - enterprise messaging via Feishu/Lark (full access)", _FEISHU_TOOLS),
         "hermes-weixin": _bundle("Weixin bot toolset - personal WeChat messaging via iLink (full access)"),
    -    "hermes-qqbot": _bundle("QQBot toolset - QQ messaging via Official Bot API v2 (full access)"),
         "hermes-wecom": _bundle("WeCom bot toolset - enterprise WeChat messaging (full access)"),

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Saved tool picks lose tools

    A saved selection like platform_toolsets.telegram: [hermes-qqbot, file] loses the tools from hermes-qqbot even after the plugin installs. Mixed lists expand only presets in TOOLSETS, and validate_toolset() rejects the name when it reaches the final picker. Keep the old name as an alias for the same core tools. Then selecting that preset on another platform doesn’t need to install a messaging plugin.

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: toolsets.py
    Line: 216-217
    
    Comment:
    **Saved tool picks lose tools**
    
    A saved selection like `platform_toolsets.telegram: [hermes-qqbot, file]` loses the tools from `hermes-qqbot` even after the plugin installs. Mixed lists expand only presets in `TOOLSETS`, and `validate_toolset()` rejects the name when it reaches the final picker. Keep the old name as an alias for the same core tools. Then selecting that preset on another platform doesn’t need to install a messaging plugin.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 12:30 UTC
    Code Review
    hermes_cli/config.py:1
    @@ -204,10 +204,6 @@ def validate_env_var_name_for_write(key: str) -> None:
         "WEIXIN_HOME_CHANNEL", "WEIXIN_HOME_CHANNEL_NAME", "WEIXIN_DM_POLICY", "WEIXIN_GROUP_POLICY",
         "WEIXIN_ALLOWED_USERS", "WEIXIN_GROUP_ALLOWED_USERS", "WEIXIN_ALLOW_ALL_USERS",
         "BLUEBUBBLES_SERVER_URL", "BLUEBUBBLES_PASSWORD", "BLUEBUBBLES_HOME_CHANNEL", "BLUEBUBBLES_HOME_CHANNEL_NAME",
    -    "QQ_APP_ID", "QQ_CLIENT_SECRET", "QQBOT_HOME_CHANNEL", "QQBOT_HOME_CHANNEL_NAME",
    -    "QQ_HOME_CHANNEL", "QQ_HOME_CHANNEL_NAME",  # legacy aliases (pre-rename, still read for back-compat)
    -    "QQ_ALLOWED_USERS", "QQ_GROUP_ALLOWED_USERS", "QQ_ALLOW_ALL_USERS", "QQ_MARKDOWN_SUPPORT",
    -    "QQ_STT_API_KEY", "QQ_STT_BASE_URL", "QQ_STT_MODEL",
         "IRC_SERVER", "IRC_PORT", "IRC_NICKNAME", "IRC_CHANNEL", "IRC_USE_TLS", "IRC_SERVER_PASSWORD",

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Reload keeps deleted QQ settings

    If a single-profile gateway installs QQ during startup, it has already scanned the plugin manifests. Removing the old keys from _EXTRA_ENV_KEYS means /reload no longer clears them. Delete a QQ home-channel setting from .env and cron can still send to the old destination. Keep the legacy keys in reload’s cleanup list using the migration data.

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: hermes_cli/config.py
    Line: 206-207
    
    Comment:
    **Reload keeps deleted QQ settings**
    
    If a single-profile gateway installs QQ during startup, it has already scanned the plugin manifests. Removing the old keys from `_EXTRA_ENV_KEYS` means `/reload` no longer clears them. Delete a QQ home-channel setting from `.env` and cron can still send to the old destination. Keep the legacy keys in reload’s cleanup list using the migration data.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 12:30 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -149,34 +149,63 @@ def homeassistant_in_use(home: Path, *, process_env: bool = False) -> bool:
             _read_config(home), frozenset({"homeassistant", "hermes-homeassistant"}), own_platform="homeassistant")
     
     
    -def yuanbao_in_use(home: Path, *, process_env: bool = False) -> bool:
    -    """What made core run Yuanbao for *home*. The adapter: unless the merged gateway config block says
    -    ``enabled: false`` (core never re-enabled an explicitly disabled platform), the platform on there
    -    (:func:`platform_configured_on`) or its credential gate passing as core's ``_is_connected`` read it,
    -    per field: App ID from the block's ``app_id`` (``extra`` or top level), else ``YUANBAO_APP_ID``, else
    -    the legacy ``YUANBAO_APP_KEY``; App Secret from the block's ``app_secret``, else ``YUANBAO_APP_SECRET``
    -    (env read through :func:`_home_env`; the process env too for the launch home with *process_env*). The
    -    tools: the ``yuanbao`` / ``hermes-yuanbao`` toolset selected for another platform or in the top-level
    -    ``toolsets`` list. The shipped ``yuanbao: [hermes-yuanbao]`` platform_toolsets row is not use: it scoped
    -    Yuanbao's own sessions, which need the platform on. Nothing counts when ``plugins.disabled`` names
    -    ``platforms/yuanbao`` or core's manifest name ``yuanbao-platform``: core's loader never ran the adapter
    -    there. A bare ``yuanbao`` there did not stop core's adapter, so it is still use (the notice says it
    -    now turns the plugin off)."""
    -    if _plugins_listed(home, ("platforms/yuanbao", "yuanbao-platform"))[1]:
    -        return False
    -    block = _merged_platform_block(home, "yuanbao")
    -    if block is not None and "enabled" in block and not _platform_config(block).enabled:
    -        return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    -    if platform_configured_on(home, "yuanbao"):
    -        return True
    -    extra = _platform_config(block).extra if block is not None else {}
    +# A credential field: (block key, env name, legacy env names...). A credential set is a tuple of fields that
    +# must ALL be present; a platform with several connection modes passes one set per mode.
    +CredField = tuple[str, ...]
    +
    +
    +def platform_in_use(platform: str, *, plugin_keys: tuple[str, ...] = (),
    +                    cred_sets: tuple[tuple[CredField, ...], ...] = (),
    +                    toolsets: tuple[str, ...] = ()) -> Callable[..., bool]:
    +    """The ``in_use`` predicate for a bundled platform leaving core: what made core run *platform* for a home.
    +
    +    The adapter: unless the merged gateway config block says ``enabled: false`` (core never re-enabled an
    +    explicitly disabled platform), the platform on there (:func:`platform_configured_on`) or one of
    +    *cred_sets* passing as core's ``_is_connected`` read it, per field: the block's key (``extra`` or top
    +    level), else any of the field's env names (read through :func:`_home_env`; the process env too for the
    +    launch home with *process_env*). The tools: a toolset in *toolsets* selected for another platform or in
    +    the top-level ``toolsets`` list; the platform's own ``platform_toolsets`` row is not use (it scoped the
    +    platform's own sessions, which need the platform on). Nothing counts when ``plugins.disabled`` names one
    +    of *plugin_keys* (``platforms/<x>``, core's manifest name): core's loader never ran the adapter there."""
    +    names = frozenset(toolsets)
    +
    +    def tools_selected(home: Path) -> bool:
    +        return bool(names) and _toolset_listed(_read_config(home), names, own_platform=platform)
    +
    +    def in_use(home: Path, *, process_env: bool = False) -> bool:
    +        if plugin_keys and _plugins_listed(home, plugin_keys)[1]:
    +            return False
    +        block = _merged_platform_block(home, platform)
    +        if block is not None and "enabled" in block and not _platform_config(block).enabled:
    +            return tools_selected(home)
    +        if platform_configured_on(home, platform):
    +            return True
    +        extra = _platform_config(block).extra if block is not None else {}
     
    -    def field(key: str, *env_names: str) -> bool:
    -        return bool(str(extra.get(key) or "").strip()) or any(
    -            _home_env(home, env_name, process_env=process_env) for env_name in env_names)
    -    if field("app_id", "YUANBAO_APP_ID", "YUANBAO_APP_KEY") and field("app_secret", "YUANBAO_APP_SECRET"):
    -        return True
    -    return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    +        def present(field: CredField) -> bool:
    +            key, *env_names = field
    +            return bool(str(extra.get(key) or "").strip()) or any(
    +                _home_env(home, env_name, process_env=process_env) for env_name in env_names)
    +        if any(all(present(field) for field in fields) for fields in cred_sets):
    +            return True
    +        return tools_selected(home)
    +    return in_use
    +
    +
    +# Yuanbao: a bare ``yuanbao`` in plugins.disabled did not stop core's adapter, so it is still use (the notice
    +# says it now turns the plugin off).
    +yuanbao_in_use = platform_in_use(
    +    "yuanbao", plugin_keys=("platforms/yuanbao", "yuanbao-platform"),
    +    cred_sets=((("app_id", "YUANBAO_APP_ID", "YUANBAO_APP_KEY"), ("app_secret", "YUANBAO_APP_SECRET")),),
    +    toolsets=("yuanbao", "hermes-yuanbao"))
    +
    +# QQ Bot: core's is_connected took app_id + client_secret from the block's extra, else QQ_APP_ID + QQ_CLIENT_SECRET.
    +# ``hermes-qqbot`` carried only core tools; selected for another platform it is still use, as hermes-homeassistant
    +# was: it resolves again once the plugin registers the platform.
    +qqbot_in_use = platform_in_use(
    +    "qqbot", plugin_keys=("platforms/qqbot", "qqbot-platform"),
    +    cred_sets=((("app_id", "QQ_APP_ID"), ("client_secret", "QQ_CLIENT_SECRET")),),
    +    toolsets=("hermes-qqbot",))

    <a href=""><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> Partial setup triggers installation

    Without enabled: true, the old gateway needed both QQ credentials in YAML or both in the environment. The new check accepts an app ID from YAML and a secret from the environment, so an unfinished setup can trigger a plugin install. Require a complete pair from one source and update the mixed-input test.

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: hermes_cli/left_core_migration.py
    Line: 205-208
    
    Comment:
    **Partial setup triggers installation**
    
    Without `enabled: true`, the old gateway needed both QQ credentials in YAML or both in the environment. The new check accepts an app ID from YAML and a secret from the environment, so an unfinished setup can trigger a plugin install. Require a complete pair from one source and update the mixed-input test.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 12:30 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -149,34 +149,63 @@ def homeassistant_in_use(home: Path, *, process_env: bool = False) -> bool:
             _read_config(home), frozenset({"homeassistant", "hermes-homeassistant"}), own_platform="homeassistant")
     
     
    -def yuanbao_in_use(home: Path, *, process_env: bool = False) -> bool:
    -    """What made core run Yuanbao for *home*. The adapter: unless the merged gateway config block says
    -    ``enabled: false`` (core never re-enabled an explicitly disabled platform), the platform on there
    -    (:func:`platform_configured_on`) or its credential gate passing as core's ``_is_connected`` read it,
    -    per field: App ID from the block's ``app_id`` (``extra`` or top level), else ``YUANBAO_APP_ID``, else
    -    the legacy ``YUANBAO_APP_KEY``; App Secret from the block's ``app_secret``, else ``YUANBAO_APP_SECRET``
    -    (env read through :func:`_home_env`; the process env too for the launch home with *process_env*). The
    -    tools: the ``yuanbao`` / ``hermes-yuanbao`` toolset selected for another platform or in the top-level
    -    ``toolsets`` list. The shipped ``yuanbao: [hermes-yuanbao]`` platform_toolsets row is not use: it scoped
    -    Yuanbao's own sessions, which need the platform on. Nothing counts when ``plugins.disabled`` names
    -    ``platforms/yuanbao`` or core's manifest name ``yuanbao-platform``: core's loader never ran the adapter
    -    there. A bare ``yuanbao`` there did not stop core's adapter, so it is still use (the notice says it
    -    now turns the plugin off)."""
    -    if _plugins_listed(home, ("platforms/yuanbao", "yuanbao-platform"))[1]:
    -        return False
    -    block = _merged_platform_block(home, "yuanbao")
    -    if block is not None and "enabled" in block and not _platform_config(block).enabled:
    -        return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    -    if platform_configured_on(home, "yuanbao"):
    -        return True
    -    extra = _platform_config(block).extra if block is not None else {}
    +# A credential field: (block key, env name, legacy env names...). A credential set is a tuple of fields that
    +# must ALL be present; a platform with several connection modes passes one set per mode.
    +CredField = tuple[str, ...]
    +
    +
    +def platform_in_use(platform: str, *, plugin_keys: tuple[str, ...] = (),
    +                    cred_sets: tuple[tuple[CredField, ...], ...] = (),
    +                    toolsets: tuple[str, ...] = ()) -> Callable[..., bool]:
    +    """The ``in_use`` predicate for a bundled platform leaving core: what made core run *platform* for a home.
    +
    +    The adapter: unless the merged gateway config block says ``enabled: false`` (core never re-enabled an
    +    explicitly disabled platform), the platform on there (:func:`platform_configured_on`) or one of
    +    *cred_sets* passing as core's ``_is_connected`` read it, per field: the block's key (``extra`` or top
    +    level), else any of the field's env names (read through :func:`_home_env`; the process env too for the
    +    launch home with *process_env*). The tools: a toolset in *toolsets* selected for another platform or in
    +    the top-level ``toolsets`` list; the platform's own ``platform_toolsets`` row is not use (it scoped the
    +    platform's own sessions, which need the platform on). Nothing counts when ``plugins.disabled`` names one
    +    of *plugin_keys* (``platforms/<x>``, core's manifest name): core's loader never ran the adapter there."""
    +    names = frozenset(toolsets)
    +
    +    def tools_selected(home: Path) -> bool:
    +        return bool(names) and _toolset_listed(_read_config(home), names, own_platform=platform)
    +
    +    def in_use(home: Path, *, process_env: bool = False) -> bool:
    +        if plugin_keys and _plugins_listed(home, plugin_keys)[1]:
    +            return False
    +        block = _merged_platform_block(home, platform)
    +        if block is not None and "enabled" in block and not _platform_config(block).enabled:
    +            return tools_selected(home)
    +        if platform_configured_on(home, platform):
    +            return True
    +        extra = _platform_config(block).extra if block is not None else {}

    <a href=""><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> Migration reads platform config twice

    platform_in_use() merges the config, then calls platform_configured_on() to merge it again. Use one parsed block for the whole check so each new platform doesn’t repeat that work. Have Yuanbao use _labs_notice() too, so the disable advice only needs to be maintained in one place.

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: hermes_cli/left_core_migration.py
    Line: 175-183
    
    Comment:
    **Migration reads platform config twice**
    
    `platform_in_use()` merges the config, then calls `platform_configured_on()` to merge it again. Use one parsed block for the whole check so each new platform doesn’t repeat that work. Have Yuanbao use `_labs_notice()` too, so the disable advice only needs to be maintained in one place.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 12:41 UTC
    Code Review
    gateway/webhook_targets.py:1
    @@ -6,7 +6,7 @@
     BUILTIN_DELIVER_PLATFORMS = frozenset({
         "telegram", "discord", "slack", "signal", "sms", "whatsapp", "matrix", "mattermost",
         "email", "dingtalk", "feishu", "wecom", "wecom_callback", "weixin",
    -    "bluebubbles", "qqbot"})
    +    "bluebubbles"})

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> QQ webhook routes disappear

    If QQ Bot is installed only in the secondary profile that receives the webhook, the shared listener checks deliver: qqbot against the launch profile’s registry. It drops the saved route and won’t check it again until the file changes. Requests return 404 even after the bot connects. Keep saved routes separate from live adapter checks, and look up the destination in the route’s own profile.

    Context Used: gateway/AGENTS.md (source)

    Knowledge Base Used: Gateway platform delivery and streaming

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: gateway/webhook_targets.py
    Line: 9
    
    Comment:
    **QQ webhook routes disappear**
    
    If QQ Bot is installed only in the secondary profile that receives the webhook, the shared listener checks `deliver: qqbot` against the launch profile’s registry. It drops the saved route and won’t check it again until the file changes. Requests return 404 even after the bot connects. Keep saved routes separate from live adapter checks, and look up the destination in the route’s own profile.
    
    **Context Used:** gateway/AGENTS.md ([source](https://github.com/nousresearch/hermes-agent/blob/main/gateway/AGENTS.md))
    
    **Knowledge Base Used:** [Gateway platform delivery and streaming](https://app.greptile.com/-/switch-tenant?tenant=nous-research&next=%2Fcustom-context%2Fknowledge-base%2Fnousresearch%2Fhermes-agent%2F-%2Fdocs%2Fgateway-platform-delivery.md)
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 12:41 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -149,34 +149,63 @@ def homeassistant_in_use(home: Path, *, process_env: bool = False) -> bool:
             _read_config(home), frozenset({"homeassistant", "hermes-homeassistant"}), own_platform="homeassistant")
     
     
    -def yuanbao_in_use(home: Path, *, process_env: bool = False) -> bool:
    -    """What made core run Yuanbao for *home*. The adapter: unless the merged gateway config block says
    -    ``enabled: false`` (core never re-enabled an explicitly disabled platform), the platform on there
    -    (:func:`platform_configured_on`) or its credential gate passing as core's ``_is_connected`` read it,
    -    per field: App ID from the block's ``app_id`` (``extra`` or top level), else ``YUANBAO_APP_ID``, else
    -    the legacy ``YUANBAO_APP_KEY``; App Secret from the block's ``app_secret``, else ``YUANBAO_APP_SECRET``
    -    (env read through :func:`_home_env`; the process env too for the launch home with *process_env*). The
    -    tools: the ``yuanbao`` / ``hermes-yuanbao`` toolset selected for another platform or in the top-level
    -    ``toolsets`` list. The shipped ``yuanbao: [hermes-yuanbao]`` platform_toolsets row is not use: it scoped
    -    Yuanbao's own sessions, which need the platform on. Nothing counts when ``plugins.disabled`` names
    -    ``platforms/yuanbao`` or core's manifest name ``yuanbao-platform``: core's loader never ran the adapter
    -    there. A bare ``yuanbao`` there did not stop core's adapter, so it is still use (the notice says it
    -    now turns the plugin off)."""
    -    if _plugins_listed(home, ("platforms/yuanbao", "yuanbao-platform"))[1]:
    -        return False
    -    block = _merged_platform_block(home, "yuanbao")
    -    if block is not None and "enabled" in block and not _platform_config(block).enabled:
    -        return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    -    if platform_configured_on(home, "yuanbao"):
    -        return True
    -    extra = _platform_config(block).extra if block is not None else {}
    +# A credential field: (block key, env name, legacy env names...). A credential set is a tuple of fields that
    +# must ALL be present; a platform with several connection modes passes one set per mode.
    +CredField = tuple[str, ...]
    +
    +
    +def platform_in_use(platform: str, *, plugin_keys: tuple[str, ...] = (),
    +                    cred_sets: tuple[tuple[CredField, ...], ...] = (),
    +                    toolsets: tuple[str, ...] = ()) -> Callable[..., bool]:
    +    """The ``in_use`` predicate for a bundled platform leaving core: what made core run *platform* for a home.
    +
    +    The adapter: unless the merged gateway config block says ``enabled: false`` (core never re-enabled an
    +    explicitly disabled platform), the platform on there (:func:`platform_configured_on`) or one of
    +    *cred_sets* passing as core's ``_is_connected`` read it, per field: the block's key (``extra`` or top
    +    level), else any of the field's env names (read through :func:`_home_env`; the process env too for the
    +    launch home with *process_env*). The tools: a toolset in *toolsets* selected for another platform or in
    +    the top-level ``toolsets`` list; the platform's own ``platform_toolsets`` row is not use (it scoped the
    +    platform's own sessions, which need the platform on). Nothing counts when ``plugins.disabled`` names one
    +    of *plugin_keys* (``platforms/<x>``, core's manifest name): core's loader never ran the adapter there."""
    +    names = frozenset(toolsets)
    +
    +    def tools_selected(home: Path) -> bool:
    +        return bool(names) and _toolset_listed(_read_config(home), names, own_platform=platform)
    +
    +    def in_use(home: Path, *, process_env: bool = False) -> bool:
    +        if plugin_keys and _plugins_listed(home, plugin_keys)[1]:
    +            return False
    +        block = _merged_platform_block(home, platform)
    +        if block is not None and "enabled" in block and not _platform_config(block).enabled:
    +            return tools_selected(home)
    +        if platform_configured_on(home, platform):
    +            return True
    +        extra = _platform_config(block).extra if block is not None else {}
     
    -    def field(key: str, *env_names: str) -> bool:
    -        return bool(str(extra.get(key) or "").strip()) or any(
    -            _home_env(home, env_name, process_env=process_env) for env_name in env_names)
    -    if field("app_id", "YUANBAO_APP_ID", "YUANBAO_APP_KEY") and field("app_secret", "YUANBAO_APP_SECRET"):
    -        return True
    -    return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    +        def present(field: CredField) -> bool:
    +            key, *env_names = field
    +            return bool(str(extra.get(key) or "").strip()) or any(
    +                _home_env(home, env_name, process_env=process_env) for env_name in env_names)
    +        if any(all(present(field) for field in fields) for fields in cred_sets):
    +            return True
    +        return tools_selected(home)
    +    return in_use
    +
    +
    +# Yuanbao: a bare ``yuanbao`` in plugins.disabled did not stop core's adapter, so it is still use (the notice
    +# says it now turns the plugin off).
    +yuanbao_in_use = platform_in_use(
    +    "yuanbao", plugin_keys=("platforms/yuanbao", "yuanbao-platform"),
    +    cred_sets=((("app_id", "YUANBAO_APP_ID", "YUANBAO_APP_KEY"), ("app_secret", "YUANBAO_APP_SECRET")),),
    +    toolsets=("yuanbao", "hermes-yuanbao"))
    +
    +# QQ Bot: core's is_connected took app_id + client_secret from the block's extra, else QQ_APP_ID + QQ_CLIENT_SECRET.
    +# ``hermes-qqbot`` carried only core tools; selected for another platform it is still use, as hermes-homeassistant
    +# was: it resolves again once the plugin registers the platform.
    +qqbot_in_use = platform_in_use(
    +    "qqbot", plugin_keys=("platforms/qqbot", "qqbot-platform"),
    +    cred_sets=((("app_id", "QQ_APP_ID"), ("client_secret", "QQ_CLIENT_SECRET")),),

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Old QQ config stops working

    The old gateway accepted platforms.qqbot-platform as platforms.qqbot. The migration reads only qqbot, and removing the bundled adapter also removes that alias. A bot enabled under the old key with credentials in YAML goes offline, and installing the plugin manually doesn’t restore the settings. Map the old key to qqbot in the shared config loader so migration and startup read the same settings, including an explicit disable.

    Context Used: hermes_cli/AGENTS.md (source)

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: hermes_cli/left_core_migration.py
    Line: 205-207
    
    Comment:
    **Old QQ config stops working**
    
    The old gateway accepted `platforms.qqbot-platform` as `platforms.qqbot`. The migration reads only `qqbot`, and removing the bundled adapter also removes that alias. A bot enabled under the old key with credentials in YAML goes offline, and installing the plugin manually doesn’t restore the settings. Map the old key to `qqbot` in the shared config loader so migration and startup read the same settings, including an explicit disable.
    
    **Context Used:** hermes_cli/AGENTS.md ([source](https://github.com/nousresearch/hermes-agent/blob/main/hermes_cli/AGENTS.md))
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 12:41 UTC
    Code Review
    hermes_cli/tools_config.py:1
    @@ -374,7 +374,7 @@ def _row(name: str, badge: str = "", tag: str = "", env_vars: list = (), **marke
     # --- Platform / Toolset Helpers ---
     _PLATFORM_ENABLE_ENV_VARS = (
         ("telegram", "TELEGRAM_BOT_TOKEN"), ("discord", "DISCORD_BOT_TOKEN"), ("slack", "SLACK_BOT_TOKEN"),
    -    ("whatsapp", "WHATSAPP_ENABLED"), ("qqbot", "QQ_APP_ID"))
    +    ("whatsapp", "WHATSAPP_ENABLED"))

    <a href=""><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> QQ loses its tool picker

    hermes tools still builds its menu from _PLATFORM_ENABLE_ENV_VARS. Removing QQ Bot from that list means users can’t edit its tools in the menu, and “Configure all platforms” skips it even after the plugin installs. Use the same profile-specific platform list and labels as gateway setup.

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: hermes_cli/tools_config.py
    Line: 375-377
    
    Comment:
    **QQ loses its tool picker**
    
    `hermes tools` still builds its menu from `_PLATFORM_ENABLE_ENV_VARS`. Removing QQ Bot from that list means users can’t edit its tools in the menu, and “Configure all platforms” skips it even after the plugin installs. Use the same profile-specific platform list and labels as gateway setup.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    BearHuddleston BearHuddleston commented on code on Nov 24, 2026 12:48 UTC
    Code Review
    hermes_cli/config_defaults.py:1
    @@ -2997,22 +2997,6 @@
             "Allowed iMessage addresses (comma-separated)", None),
         "BLUEBUBBLES_ALLOW_ALL_USERS": _msg("Allow all BlueBubbles users without allowlist",
             "Allow All BlueBubbles Users", password=None),
    -    "QQ_APP_ID": _msg("QQ Bot App ID from QQ Open Platform (q.qq.com)", "QQ App ID",
    -        "https://q.qq.com", password=None),
    -    "QQ_CLIENT_SECRET": _msg("QQ Bot Client Secret from QQ Open Platform", "QQ Client Secret",
    -        password=True),

    The Channels card now shows the QQ client secret as plain text while it's typed, after an in-process install or when the plugin lives only in a secondary profile.

    hermes_cli/web_routers/messaging.py::_messaging_env_info takes each card field's metadata from OPTIONAL_ENV_VARS, else _MESSAGING_ENV_FALLBACKS. These two entries were what made QQ_CLIENT_SECRET a password field. After this PR, OPTIONAL_ENV_VARS gets the QQ names back only from hermes_cli.config._inject_platform_plugin_env_vars(), which runs once at import and reads the launch home's plugins. The left-core install at agent/gateway start happens after that import, and a secondary profile's plugin is never read.

    I drove the real GET /api/messaging/platforms handler (get_messaging_platforms) with the labs plugin at 8ab64db6 copied into a fake home:

  • main (QQ in core): QQ_CLIENT_SECRET has is_password: true, prompt "QQ Client Secret"

  • this head, plugin present before hermes_cli.config imports (a restarted process): true

  • this head, plugin installed after the import (what the migration does in a running Desktop or dashboard backend): false, prompt QQ_CLIENT_SECRET

  • this head, multiplex, plugin only in profiles/b, card read with profile=b: false
  • The saved value stays redacted, but the form echoes the secret as it's typed. #159638 fixed the same exposure for DingTalk in 7325b77b.

    Fix, the same shape as that commit: add the two rows to _MESSAGING_ENV_FALLBACKS. OPTIONAL_ENV_VARS still wins whenever the manifest was read, so the restarted card doesn't change. The new test fails on this head (assert False is True) and passes with the fix, and with the fix the real handler returns is_password: true in both failing cases above. The 20 files covering the messaging routes and the left-core rows: 420 passed, 0 failed, 21 skipped. scripts/check --only ruff,health: ok. Sol (gpt-6.2-sol) reviewed this patch and marked the finding resolved.

    <details><summary>Patch (applies to f11752fd; also applies in either order with the test patch in finding 2)</summary>

    diff --git a/hermes_cli/web_routers/messaging.py b/hermes_cli/web_routers/messaging.py
    index dc4cd75..c1f9981 100644
    --- a/hermes_cli/web_routers/messaging.py
    +++ b/hermes_cli/web_routers/messaging.py
    @@ -101,6 +101,8 @@ _MESSAGING_ENV_FALLBACKS: dict[str, dict[str, Any]] = {
             ("FEISHU_VERIFICATION_TOKEN", "Feishu / Lark verification token", "Verification token", {"password": True}),
             ("DINGTALK_CLIENT_ID", "DingTalk client ID (App key)", "Client ID", {}),
             ("DINGTALK_CLIENT_SECRET", "DingTalk client secret (App secret)", "Client secret", {"password": True}),
    +        ("QQ_APP_ID", "QQ Bot App ID from QQ Open Platform (q.qq.com)", "QQ App ID", {"url": "https://q.qq.com"}),
    +        ("QQ_CLIENT_SECRET", "QQ Bot Client Secret from QQ Open Platform", "QQ Client Secret", {"password": True}),
         )
     }
     
    diff --git a/tests/hermes_cli/test_left_core_qqbot.py b/tests/hermes_cli/test_left_core_qqbot.py
    index 2ce559c..a14825e 100644
    --- a/tests/hermes_cli/test_left_core_qqbot.py
    +++ b/tests/hermes_cli/test_left_core_qqbot.py
    @@ -99,3 +99,15 @@ def test_qq_gates_stay_profile_gates_with_the_plugin_absent(name):
         (``Platform.QQBOT`` named the prefix); the row keeps that while the plugin is absent."""
         from tools.environments.local_env_policy import is_profile_gate_env
         assert is_profile_gate_env(name) is True
    +
    +
    +def test_the_channels_card_keeps_the_qq_secret_masked_without_the_plugin_manifest(monkeypatch):
    +    """The dashboard reads field metadata from OPTIONAL_ENV_VARS, which lists the plugin's names only when the
    +    launch home had the plugin when hermes_cli.config was imported. A card built after an in-process install, or
    +    for a secondary profile's plugin, must still render QQ_CLIENT_SECRET as a password field, as core did."""
    +    from hermes_cli import config
    +    from hermes_cli.web_routers import messaging
    +    for name in ("QQ_APP_ID", "QQ_CLIENT_SECRET"):
    +        monkeypatch.delitem(config.OPTIONAL_ENV_VARS, name, raising=False)
    +    assert messaging._messaging_env_info("QQ_CLIENT_SECRET")["is_password"] is True
    +    assert messaging._messaging_env_info("QQ_APP_ID")["prompt"] == "QQ App ID"
    

    </details>

    BearHuddleston BearHuddleston commented on code on Nov 24, 2026 12:48 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -644,6 +687,18 @@ class LeftCoreFeature:
             legacy_toolsets=("hermes-yuanbao", "hermes-gateway"),
             platform="yuanbao", enable_env=("YUANBAO_APP_ID", "YUANBAO_APP_SECRET"), notice=_yuanbao_notice,
         ),
    +    LeftCoreFeature(
    +        # QQ_STT_API_KEY stays on local_env_policy's own short list, as core had it. QQ_* channel ownership
    +        # stays profile_channels' ``qqbot`` alias prefix: no tool shares it.
    +        plugin="qqbot", label="QQ Bot", in_use=qqbot_in_use, plugin_key="platforms/qqbot",
    +        plugin_names=("qqbot-platform",),
    +        unchanged="QQ_*/QQBOT_* settings, platforms.qqbot and QQBOT_HOME_CHANNEL are unchanged",
    +        secret_env=("QQ_CLIENT_SECRET",),
    +        private_env=("QQ_APP_ID", "QQ_ALLOWED_USERS", "QQ_GROUP_ALLOWED_USERS", "QQ_ALLOW_ALL_USERS",
    +                     "QQBOT_HOME_CHANNEL", "QQBOT_HOME_CHANNEL_NAME", "QQBOT_HOME_CHANNEL_THREAD_ID",
    +                     "QQ_MARKDOWN_SUPPORT", "QQ_SANDBOX", "QQ_PORTAL_HOST", "QQ_STT_BASE_URL", "QQ_STT_MODEL"),

    Nit: the new tests don't pin the row's legacy disable name, the child-env strip set or the Yuanbao off-platform entry. Mutants of each pass the suite.

    I ran 11 mutants of this row and the factory, plus 2 of the local_env_policy.py hunk, against 9 files (test_left_core_qqbot.py, test_left_core_migration.py, test_left_core_yuanbao.py, test_left_core_managed_platform.py, test_profile_gate_env_shape.py, test_local_env_blocklist.py, test_platform_env_overrides.py, test_profile_key_env_scrub.py, tests/gateway/test_left_core_platform_reload.py; 222 passed unmutated). 6 of the 13 were caught. These survivors change behaviour:

  • plugin_names=(): legacy_plugin_alias("qqbot-platform") returns "", so core's old plugins.disabled: [qqbot-platform] no longer disables the installed plugin.

  • private_env without QQ_APP_ID: the name leaves _HERMES_PROVIDER_ENV_BLOCKLIST, which main had it in.

  • local_env_policy without the added QQ_CLIENT_SECRET: it leaves _ADAPTER_SECRET_ENV and _ALWAYS_STRIP_KEYS.

  • _core_platforms_except("yuanbao", "homeassistant") without "qqbot": a home crossing both moves no longer keeps Yuanbao's tools off in QQ sessions.

  • Also surviving: enable_env=(), and the bare-qqbot disable sentence in _labs_notice.
  • The PR body lists "gate-env and strip-set parity" among the tests, but the file only has the gate half. Here's an optional patch with three tests in the style #159638 used. They pass on this head and catch plugin_names=(), both dropped names and the off-platform drop. secret_env=() still passes, because the hardcoded local_env_policy entry covers the same name. scripts/check --only ruff,health: ok.

    <details><summary>Patch (tests only; inserts above the gate test so it applies in either order with finding 1's patch)</summary>

    diff --git a/tests/hermes_cli/test_left_core_qqbot.py b/tests/hermes_cli/test_left_core_qqbot.py
    index 2ce559c..9e0b35d 100644
    --- a/tests/hermes_cli/test_left_core_qqbot.py
    +++ b/tests/hermes_cli/test_left_core_qqbot.py
    @@ -93,6 +93,30 @@ def test_a_fresh_or_shipped_default_home_installs_nothing(tmp_path):
             assert said == []
     
     
    +@pytest.mark.parametrize("name", ["platforms/qqbot", "qqbot-platform"])
    +def test_core_s_old_disable_still_disables_the_installed_plugin(name):
    +    """``plugins.disabled`` naming core's adapter kept QQ Bot off; it names the catalog plugin now and still wins."""
    +    from hermes_cli.plugins_discovery import gate_manifest
    +    from hermes_cli.plugins_manifest import PluginManifest
    +    manifest = PluginManifest(name="qqbot", source="user", path="qqbot", key="qqbot")
    +    assert lcm.legacy_plugin_alias(name) == "qqbot"
    +    assert gate_manifest(manifest, {name}, {"qqbot"}).error == \
    +        "listed in both plugins.enabled and plugins.disabled — disabled wins"
    +
    +
    +def test_child_processes_keep_the_qq_strip_set_core_had():
    +    """With the plugin absent, children lose the QQ names core's manifest made them lose."""
    +    from tools.environments import local_env_policy as policy
    +    assert {"QQ_CLIENT_SECRET", "QQ_STT_API_KEY"} <= policy._ADAPTER_SECRET_ENV & policy._ALWAYS_STRIP_KEYS
    +    assert {"QQ_APP_ID", "QQ_CLIENT_SECRET", "QQ_ALLOWED_USERS", "QQBOT_HOME_CHANNEL"} <= \
    +        policy._HERMES_PROVIDER_ENV_BLOCKLIST
    +
    +
    +def test_yuanbao_tools_stay_off_in_qqbot_sessions():
    +    """A home upgrading across both removals: core never carried the yb_* tools in hermes-qqbot."""
    +    assert "qqbot" in next(f for f in lcm.LEFT_CORE if f.plugin == "yuanbao").off_platforms
    +
    +
     @pytest.mark.parametrize("name", ["QQ_ALLOWED_USERS", "QQ_ALLOW_ALL_USERS", "QQBOT_ALLOWED_USERS"])
     def test_qq_gates_stay_profile_gates_with_the_plugin_absent(name):
         """``QQ_*`` and ``QQBOT_*`` gates stayed out of another profile's children while core shipped QQ Bot
    

    </details>

    BearHuddleston BearHuddleston commented on code on Nov 24, 2026 12:48 UTC
    Code Review
    tests/hermes_cli/test_left_core_qqbot.py:1
    @@ -0,0 +1,101 @@
    +"""The QQ Bot ``LEFT_CORE`` row: homes core ran QQ Bot for get the ``qqbot`` catalog plugin, others never.
    +
    +Real config/.env files under a temp home; the catalog lookup and the install are stand-ins (the live install is
    +exercised end to end outside the unit suite).
    +"""
    +
    +from __future__ import annotations
    +
    +from pathlib import Path
    +
    +import pytest
    +
    +import hermes_cli.left_core_migration as lcm
    +
    +_CREDS = "QQ_APP_ID=a\nQQ_CLIENT_SECRET=s\n"
    +
    +
    +@pytest.fixture(autouse=True)
    +def _fresh(monkeypatch):
    +    monkeypatch.setattr(lcm, "_attempted", set())
    +    for name in ("QQ_APP_ID", "QQ_CLIENT_SECRET"):
    +        monkeypatch.delenv(name, raising=False)
    +    import hermes_cli.memory_provider_migration as mpm
    +    monkeypatch.setattr(mpm, "catalog_source", lambda name: name)
    +
    +
    +def _home(tmp_path: Path, *, env: str = "", config: str = "") -> Path:
    +    home = tmp_path / "home"
    +    home.mkdir()
    +    if env:
    +        (home / ".env").write_text(env, encoding="utf-8")
    +    if config:
    +        (home / "config.yaml").write_text(config, encoding="utf-8")
    +    return home
    +
    +
    +def _qqbot_in_use(home: Path) -> bool:
    +    return next(f for f in lcm.LEFT_CORE if f.plugin == "qqbot").in_use(home)
    +
    +
    +# The platform_toolsets block cli-config.yaml.example shipped while QQ Bot was in core; the installers seed
    +# config.yaml from it, so its qqbot row alone says nothing about use.
    +_SHIPPED_PLATFORM_TOOLSETS = "platform_toolsets:\n  cli: [hermes-cli]\n  telegram: [hermes-telegram]\n  qqbot: [hermes-qqbot]\n"
    +
    +
    +@pytest.mark.parametrize(("env", "config", "in_use"), [
    +    (_CREDS, "", True),
    +    # Core's is_connected read app_id + client_secret from the block's extra too, per field.
    +    ("", "platforms:\n  qqbot:\n    extra: {app_id: a, client_secret: s}\n", True),
    +    ("QQ_CLIENT_SECRET=s\n", "platforms:\n  qqbot:\n    extra: {app_id: a}\n", True),
    +    ("", "platforms:\n  qqbot:\n    enabled: true\n", True),
    +    ("", "qqbot:\n  app_id: a\n  client_secret: s\n", True),  # top-level block, bridged into extra
    +    ("", "platform_toolsets:\n  telegram: [hermes-qqbot]\n", True),
    +    ("", "", False),
    +    ("QQ_APP_ID=a\n", "", False),  # half a credential set never enabled the adapter

    Nit: main did enable the adapter with half a credential set. It just never connected.

    Main's gateway_env.py used EnvCred(Platform.QQBOT, (("QQ_APP_ID", "QQ_CLIENT_SECRET"),), ...), a single any-of group, so QQ_APP_ID alone enabled QQ and the adapter then failed with qq_missing_credentials. My base probe (main's load_gateway_config with plugins discovered) gives enabled: True, is_connected: False for this home. False is still the right answer, since the labs plugin's env_enablement needs both names. This only changes the comment:

        ("QQ_APP_ID=a\n", "", False),  # half a set: core enabled the adapter, but it never connected
    

    BearHuddleston BearHuddleston commented on Nov 24, 2026 12:48 UTC
    Reviewer

    TL;DR: One should-fix: after the move, the dashboard's Channels card shows the QQ client secret as plain text while it's typed, both after the in-process install and for a plugin that lives only in a secondary profile. A tested patch is inline. There are two nits inline and two more below, and my notes on Greptile's eight items follow the table.

    | # | Finding | Severity | Where | Status |
    |---|---|---|---|---|
    | 1 | The Channels card renders QQ_CLIENT_SECRET as a text field after an in-process install or for a secondary profile's plugin | Should-fix | hermes_cli/config_defaults.py:3000 (removed lines) | Open |
    | 2 | The new tests don't pin the row's legacy disable name, the child-env strip set or the Yuanbao off-platform entry | Nit | hermes_cli/left_core_migration.py:694 | Open |
    | 3 | A test comment says half a credential set never enabled the adapter; main enabled it, it just never connected | Nit | tests/hermes_cli/test_left_core_qqbot.py:55 | Open |
    | 4 | With env credentials and a legacy gateway.json enabled: false, main ran QQ but qqbot_in_use says no | Nit | hermes_cli/left_core_migration.py:179 | Open |
    | 5 | A string-saved row such as telegram: '["hermes-qqbot"]' doesn't count as use | Nit | hermes_cli/left_core_migration.py:127 | Open |

  • Finding 4: _merged_platform_block reads gateway.json as the base layer, but main's loader set _enabled_explicit only for YAML, so env credentials re-enabled QQ over a gateway.json disable. My probe: main enabled: True, is_connected: True, head False. The shared factory already answers this way for Yuanbao on main, and #159638 pins it in a test, so it's a rare legacy layer rather than something to fix in this PR.

  • Finding 5: the runtime parses that string with parse_platform_toolsets_value. #159638's 7325b77b already switches the shared _toolset_listed to it, so this row gets the fix once that change lands; nothing extra is needed here if both go in.
  • On Greptile's items, checked with my own probes:

  • I disagree with "Partial setup triggers installation" (r4679996924). Main's gateway enabled and connected QQ for split credentials in both directions: app_id in platforms.qqbot.extra with QQ_CLIENT_SECRET in .env, the reverse, and a top-level qqbot: {app_id} with the env secret. EnvCred's (("QQ_APP_ID", "QQ_CLIENT_SECRET"),) is one any-of group, and its optional step copies the env value into extra. Requiring a pair from one source would skip homes main ran, so the PR's mixed-input row is right.

  • "Saved tool picks lose tools" (r4679996896) reproduces, but it's narrower than it reads. With the plugin registered, QQ's own row keeps its tools: qqbot: [hermes-qqbot] and [hermes-qqbot, spotify] resolve to main's sets plus the raw name. Only another platform's mixed list loses them: telegram: [hermes-qqbot, file] gives 17 toolsets on main and only file on this head. I'd call it a nit.

  • I agree with "Reload keeps deleted QQ settings" (r4679996908) from reading reload_env, which only removes names in OPTIONAL_ENV_VARS | _EXTRA_ENV_KEYS. It applies after an in-process install, and always for the legacy QQ_HOME_CHANNEL names, which the plugin manifest doesn't declare.

  • For "QQ routes vanish during boot" (r4679996875), I confirmed the decode step: SessionEntry.from_dict reaches Platform("qqbot"), which _missing_ answers with None until the plugin registers, so the row is logged as invalid and skipped. I didn't reproduce the multiplex boot order or the deletion on a full save. Sol raised the same thing independently and rated it a blocker. The decode step is the same on main for Yuanbao, so the path isn't new, but it is new for QQ users.

  • I agree with "QQ loses its tool picker" (r4680117641). _get_enabled_platforms lists cli plus four env-keyed platforms, so QQ drops out of hermes tools even after the install, as other plugin platforms already do.

  • I didn't check the webhook-route item (r4680117608) or the platforms.qqbot-platform alias item (r4680117623). Sol raised the webhook one too, as a nit.
  • CI on f11752f passed all 17 checks that ran, none failed or pending, including Python tests 1/3 to 3/3, Python lints, the Windows (x64 and arm64) and macOS lanes, Repository guards, the docs site and "All required checks pass (v2)". Locally, I ran a base-vs-head in_use matrix over 28 fake homes, comparing main's gateway (load_gateway_config with plugins discovered) against qqbot_in_use(process_env=True). 22 agree. The 6 that differ are finding 4, the two half-credential homes (head's False is right, see finding 3), the two designed homes that select hermes-qqbot for another platform, and a token-only platforms.qqbot block (head installs, main never enabled it; harmless). With the plugin absent, the child-env sets match main exactly (454 blocklist, 47 adapter-secret and 76 always-strip names), and the gate prefixes add HOMEASSISTANT and YUANBAO, as the body says. On the merge base, the PR's new tests give 15 failed (the row is missing) and 4 passed, matching the body. Sol (gpt-6.2-sol) ran two rounds: round 1 raised 11 items and round 2 resolved finding 1's patch. I didn't run the live gateway legs or reproduce the multiplex boot order.

    Details are in the inline comments.

    ---
    Written and posted by Hermes Agent, Bear's AI agent, without Bear reading it first. An approval from it is never on behalf of hermes-agent-core: where that team's review is requested or required, the approval comes from Bear himself.*

    teknium1 teknium1 commented on code on Nov 24, 2026 14:21 UTC
    Code Review
    gateway/config.py:1
    @@ -255,7 +255,6 @@ class Platform(Enum):
         WECOM_CALLBACK = "wecom_callback"
         WEIXIN = "weixin"
         BLUEBUBBLES = "bluebubbles"
    -    QQBOT = "qqbot"
         RELAY = "relay"  # generic relay adapter fronted by the connector (EXPERIMENTAL)

    Fixed in be507f47a5b0. The decode step you named is real: SessionEntry.from_dict raises for platform: qqbot until the plugin registers, and _load_routing_rows_locked / the legacy sessions.json import skipped the row, so the next full save (replace_routing_entries deletes the scope, then inserts _entries) dropped it. Now a well-formed row that fails to parse is held in _unparsed_routes and merged under the live entries in _snapshot_routing_locked, so a save writes it back and a later start that has the plugin loads it. Test: tests/gateway/test_unparsed_route_survives_save.py (saved qqbot route + a full save on a restarted store); red on f11752fd, green now. Not reproduced: the multiplex boot ordering itself; the fix covers every path that saves before the plugin registers.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:21 UTC
    Code Review
    toolsets.py:1
    @@ -214,7 +214,6 @@ def _core_without(*excluded, kanban=True):
         "hermes-dingtalk": _bundle("DingTalk bot toolset - enterprise messaging platform (full access)"),
         "hermes-feishu": _bundle("Feishu/Lark bot toolset - enterprise messaging via Feishu/Lark (full access)", _FEISHU_TOOLS),
         "hermes-weixin": _bundle("Weixin bot toolset - personal WeChat messaging via iLink (full access)"),
    -    "hermes-qqbot": _bundle("QQBot toolset - QQ messaging via Official Bot API v2 (full access)"),
         "hermes-wecom": _bundle("WeCom bot toolset - enterprise WeChat messaging (full access)"),

    Fixed in be507f47a5b0. Confirmed the narrow case Bear measured: telegram: [hermes-qqbot, file] kept only file, because _explicit_toolsets expanded composites only when the name is in TOOLSETS. It now also expands a plugin platform's implicit hermes-<platform> bundle (toolsets._plugin_platform_bundle, the same resolver resolve_toolset already uses), so the core tools come back once the plugin registers. Not re-adding a static hermes-qqbot alias: core would then claim a bundle for a platform it no longer ships. Test: test_a_mixed_list_naming_hermes_qqbot_keeps_its_tools_once_the_plugin_registers; red on f11752fd.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:21 UTC
    Code Review
    hermes_cli/config.py:1
    @@ -204,10 +204,6 @@ def validate_env_var_name_for_write(key: str) -> None:
         "WEIXIN_HOME_CHANNEL", "WEIXIN_HOME_CHANNEL_NAME", "WEIXIN_DM_POLICY", "WEIXIN_GROUP_POLICY",
         "WEIXIN_ALLOWED_USERS", "WEIXIN_GROUP_ALLOWED_USERS", "WEIXIN_ALLOW_ALL_USERS",
         "BLUEBUBBLES_SERVER_URL", "BLUEBUBBLES_PASSWORD", "BLUEBUBBLES_HOME_CHANNEL", "BLUEBUBBLES_HOME_CHANNEL_NAME",
    -    "QQ_APP_ID", "QQ_CLIENT_SECRET", "QQBOT_HOME_CHANNEL", "QQBOT_HOME_CHANNEL_NAME",
    -    "QQ_HOME_CHANNEL", "QQ_HOME_CHANNEL_NAME",  # legacy aliases (pre-rename, still read for back-compat)
    -    "QQ_ALLOWED_USERS", "QQ_GROUP_ALLOWED_USERS", "QQ_ALLOW_ALL_USERS", "QQ_MARKDOWN_SUPPORT",
    -    "QQ_STT_API_KEY", "QQ_STT_BASE_URL", "QQ_STT_MODEL",
         "IRC_SERVER", "IRC_PORT", "IRC_NICKNAME", "IRC_CHANNEL", "IRC_USE_TLS", "IRC_SERVER_PASSWORD",

    Fixed in be507f47a5b0: the QQ_ / QQBOT_ names, including the legacy QQ_HOME_CHANNEL / QQ_HOME_CHANNEL_NAME aliases the manifest never declared, are back in _EXTRA_ENV_KEYS, so reload_env drops a removed line after an in-process install. The child-env strip sets are unchanged (checked against main). Test: test_reload_and_config_set_still_know_the_qq_env_names; red on f11752fd.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:21 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -149,34 +149,63 @@ def homeassistant_in_use(home: Path, *, process_env: bool = False) -> bool:
             _read_config(home), frozenset({"homeassistant", "hermes-homeassistant"}), own_platform="homeassistant")
     
     
    -def yuanbao_in_use(home: Path, *, process_env: bool = False) -> bool:
    -    """What made core run Yuanbao for *home*. The adapter: unless the merged gateway config block says
    -    ``enabled: false`` (core never re-enabled an explicitly disabled platform), the platform on there
    -    (:func:`platform_configured_on`) or its credential gate passing as core's ``_is_connected`` read it,
    -    per field: App ID from the block's ``app_id`` (``extra`` or top level), else ``YUANBAO_APP_ID``, else
    -    the legacy ``YUANBAO_APP_KEY``; App Secret from the block's ``app_secret``, else ``YUANBAO_APP_SECRET``
    -    (env read through :func:`_home_env`; the process env too for the launch home with *process_env*). The
    -    tools: the ``yuanbao`` / ``hermes-yuanbao`` toolset selected for another platform or in the top-level
    -    ``toolsets`` list. The shipped ``yuanbao: [hermes-yuanbao]`` platform_toolsets row is not use: it scoped
    -    Yuanbao's own sessions, which need the platform on. Nothing counts when ``plugins.disabled`` names
    -    ``platforms/yuanbao`` or core's manifest name ``yuanbao-platform``: core's loader never ran the adapter
    -    there. A bare ``yuanbao`` there did not stop core's adapter, so it is still use (the notice says it
    -    now turns the plugin off)."""
    -    if _plugins_listed(home, ("platforms/yuanbao", "yuanbao-platform"))[1]:
    -        return False
    -    block = _merged_platform_block(home, "yuanbao")
    -    if block is not None and "enabled" in block and not _platform_config(block).enabled:
    -        return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    -    if platform_configured_on(home, "yuanbao"):
    -        return True
    -    extra = _platform_config(block).extra if block is not None else {}
    +# A credential field: (block key, env name, legacy env names...). A credential set is a tuple of fields that
    +# must ALL be present; a platform with several connection modes passes one set per mode.
    +CredField = tuple[str, ...]
    +
    +
    +def platform_in_use(platform: str, *, plugin_keys: tuple[str, ...] = (),
    +                    cred_sets: tuple[tuple[CredField, ...], ...] = (),
    +                    toolsets: tuple[str, ...] = ()) -> Callable[..., bool]:
    +    """The ``in_use`` predicate for a bundled platform leaving core: what made core run *platform* for a home.
    +
    +    The adapter: unless the merged gateway config block says ``enabled: false`` (core never re-enabled an
    +    explicitly disabled platform), the platform on there (:func:`platform_configured_on`) or one of
    +    *cred_sets* passing as core's ``_is_connected`` read it, per field: the block's key (``extra`` or top
    +    level), else any of the field's env names (read through :func:`_home_env`; the process env too for the
    +    launch home with *process_env*). The tools: a toolset in *toolsets* selected for another platform or in
    +    the top-level ``toolsets`` list; the platform's own ``platform_toolsets`` row is not use (it scoped the
    +    platform's own sessions, which need the platform on). Nothing counts when ``plugins.disabled`` names one
    +    of *plugin_keys* (``platforms/<x>``, core's manifest name): core's loader never ran the adapter there."""
    +    names = frozenset(toolsets)
    +
    +    def tools_selected(home: Path) -> bool:
    +        return bool(names) and _toolset_listed(_read_config(home), names, own_platform=platform)
    +
    +    def in_use(home: Path, *, process_env: bool = False) -> bool:
    +        if plugin_keys and _plugins_listed(home, plugin_keys)[1]:
    +            return False
    +        block = _merged_platform_block(home, platform)
    +        if block is not None and "enabled" in block and not _platform_config(block).enabled:
    +            return tools_selected(home)
    +        if platform_configured_on(home, platform):
    +            return True
    +        extra = _platform_config(block).extra if block is not None else {}
     
    -    def field(key: str, *env_names: str) -> bool:
    -        return bool(str(extra.get(key) or "").strip()) or any(
    -            _home_env(home, env_name, process_env=process_env) for env_name in env_names)
    -    if field("app_id", "YUANBAO_APP_ID", "YUANBAO_APP_KEY") and field("app_secret", "YUANBAO_APP_SECRET"):
    -        return True
    -    return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    +        def present(field: CredField) -> bool:
    +            key, *env_names = field
    +            return bool(str(extra.get(key) or "").strip()) or any(
    +                _home_env(home, env_name, process_env=process_env) for env_name in env_names)
    +        if any(all(present(field) for field in fields) for fields in cred_sets):
    +            return True
    +        return tools_selected(home)
    +    return in_use
    +
    +
    +# Yuanbao: a bare ``yuanbao`` in plugins.disabled did not stop core's adapter, so it is still use (the notice
    +# says it now turns the plugin off).
    +yuanbao_in_use = platform_in_use(
    +    "yuanbao", plugin_keys=("platforms/yuanbao", "yuanbao-platform"),
    +    cred_sets=((("app_id", "YUANBAO_APP_ID", "YUANBAO_APP_KEY"), ("app_secret", "YUANBAO_APP_SECRET")),),
    +    toolsets=("yuanbao", "hermes-yuanbao"))
    +
    +# QQ Bot: core's is_connected took app_id + client_secret from the block's extra, else QQ_APP_ID + QQ_CLIENT_SECRET.
    +# ``hermes-qqbot`` carried only core tools; selected for another platform it is still use, as hermes-homeassistant
    +# was: it resolves again once the plugin registers the platform.
    +qqbot_in_use = platform_in_use(
    +    "qqbot", plugin_keys=("platforms/qqbot", "qqbot-platform"),
    +    cred_sets=((("app_id", "QQ_APP_ID"), ("client_secret", "QQ_CLIENT_SECRET")),),
    +    toolsets=("hermes-qqbot",))

    Not a bug; keeping the per-field read. Main's gateway enabled and connected QQ with split sources in both directions (app_id in platforms.qqbot.extra + QQ_CLIENT_SECRET in .env, the reverse, and a top-level qqbot: {app_id} + env secret): EnvCred(("QQ_APP_ID", "QQ_CLIENT_SECRET"),) gates on env, and is_connected reads extra.get("app_id") or env, per field. Requiring one source would skip homes main ran. BearHuddleston probed main independently and got the same answer.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:21 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -149,34 +149,63 @@ def homeassistant_in_use(home: Path, *, process_env: bool = False) -> bool:
             _read_config(home), frozenset({"homeassistant", "hermes-homeassistant"}), own_platform="homeassistant")
     
     
    -def yuanbao_in_use(home: Path, *, process_env: bool = False) -> bool:
    -    """What made core run Yuanbao for *home*. The adapter: unless the merged gateway config block says
    -    ``enabled: false`` (core never re-enabled an explicitly disabled platform), the platform on there
    -    (:func:`platform_configured_on`) or its credential gate passing as core's ``_is_connected`` read it,
    -    per field: App ID from the block's ``app_id`` (``extra`` or top level), else ``YUANBAO_APP_ID``, else
    -    the legacy ``YUANBAO_APP_KEY``; App Secret from the block's ``app_secret``, else ``YUANBAO_APP_SECRET``
    -    (env read through :func:`_home_env`; the process env too for the launch home with *process_env*). The
    -    tools: the ``yuanbao`` / ``hermes-yuanbao`` toolset selected for another platform or in the top-level
    -    ``toolsets`` list. The shipped ``yuanbao: [hermes-yuanbao]`` platform_toolsets row is not use: it scoped
    -    Yuanbao's own sessions, which need the platform on. Nothing counts when ``plugins.disabled`` names
    -    ``platforms/yuanbao`` or core's manifest name ``yuanbao-platform``: core's loader never ran the adapter
    -    there. A bare ``yuanbao`` there did not stop core's adapter, so it is still use (the notice says it
    -    now turns the plugin off)."""
    -    if _plugins_listed(home, ("platforms/yuanbao", "yuanbao-platform"))[1]:
    -        return False
    -    block = _merged_platform_block(home, "yuanbao")
    -    if block is not None and "enabled" in block and not _platform_config(block).enabled:
    -        return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    -    if platform_configured_on(home, "yuanbao"):
    -        return True
    -    extra = _platform_config(block).extra if block is not None else {}
    +# A credential field: (block key, env name, legacy env names...). A credential set is a tuple of fields that
    +# must ALL be present; a platform with several connection modes passes one set per mode.
    +CredField = tuple[str, ...]
    +
    +
    +def platform_in_use(platform: str, *, plugin_keys: tuple[str, ...] = (),
    +                    cred_sets: tuple[tuple[CredField, ...], ...] = (),
    +                    toolsets: tuple[str, ...] = ()) -> Callable[..., bool]:
    +    """The ``in_use`` predicate for a bundled platform leaving core: what made core run *platform* for a home.
    +
    +    The adapter: unless the merged gateway config block says ``enabled: false`` (core never re-enabled an
    +    explicitly disabled platform), the platform on there (:func:`platform_configured_on`) or one of
    +    *cred_sets* passing as core's ``_is_connected`` read it, per field: the block's key (``extra`` or top
    +    level), else any of the field's env names (read through :func:`_home_env`; the process env too for the
    +    launch home with *process_env*). The tools: a toolset in *toolsets* selected for another platform or in
    +    the top-level ``toolsets`` list; the platform's own ``platform_toolsets`` row is not use (it scoped the
    +    platform's own sessions, which need the platform on). Nothing counts when ``plugins.disabled`` names one
    +    of *plugin_keys* (``platforms/<x>``, core's manifest name): core's loader never ran the adapter there."""
    +    names = frozenset(toolsets)
    +
    +    def tools_selected(home: Path) -> bool:
    +        return bool(names) and _toolset_listed(_read_config(home), names, own_platform=platform)
    +
    +    def in_use(home: Path, *, process_env: bool = False) -> bool:
    +        if plugin_keys and _plugins_listed(home, plugin_keys)[1]:
    +            return False
    +        block = _merged_platform_block(home, platform)
    +        if block is not None and "enabled" in block and not _platform_config(block).enabled:
    +            return tools_selected(home)
    +        if platform_configured_on(home, platform):
    +            return True
    +        extra = _platform_config(block).extra if block is not None else {}

    Fixed in be507f47a5b0. platform_in_use now checks the block it already merged (_block_on(block)); platform_configured_on is a thin wrapper over the same helper, so the second read is gone for every platform row. Yuanbao's notice is now _labs_notice("yuanbao", "Yuanbao"); the hand-written _YUANBAO_NOTICE / _yuanbao_notice copy is removed (same text, same stale-disable sentence; the Yuanbao suite passes unchanged).

    teknium1 teknium1 commented on code on Nov 24, 2026 14:21 UTC
    Code Review
    gateway/webhook_targets.py:1
    @@ -6,7 +6,7 @@
     BUILTIN_DELIVER_PLATFORMS = frozenset({
         "telegram", "discord", "slack", "signal", "sms", "whatsapp", "matrix", "mattermost",
         "email", "dingtalk", "feishu", "wecom", "wecom_callback", "weixin",
    -    "bluebubbles", "qqbot"})
    +    "bluebubbles"})

    Fixed in be507f47a5b0: qqbot stays in BUILTIN_DELIVER_PLATFORMS, so a saved deliver: qqbot route is never dropped just because the launch profile's registry lacks the plugin (the secondary-profile case). Delivery still goes through _deliver_cross_platform, which resolves the adapter in the route's profile and errors if none is connected. Test: test_webhook_routes_keep_a_qqbot_target_before_the_plugin_registers; red on f11752fd.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:21 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -149,34 +149,63 @@ def homeassistant_in_use(home: Path, *, process_env: bool = False) -> bool:
             _read_config(home), frozenset({"homeassistant", "hermes-homeassistant"}), own_platform="homeassistant")
     
     
    -def yuanbao_in_use(home: Path, *, process_env: bool = False) -> bool:
    -    """What made core run Yuanbao for *home*. The adapter: unless the merged gateway config block says
    -    ``enabled: false`` (core never re-enabled an explicitly disabled platform), the platform on there
    -    (:func:`platform_configured_on`) or its credential gate passing as core's ``_is_connected`` read it,
    -    per field: App ID from the block's ``app_id`` (``extra`` or top level), else ``YUANBAO_APP_ID``, else
    -    the legacy ``YUANBAO_APP_KEY``; App Secret from the block's ``app_secret``, else ``YUANBAO_APP_SECRET``
    -    (env read through :func:`_home_env`; the process env too for the launch home with *process_env*). The
    -    tools: the ``yuanbao`` / ``hermes-yuanbao`` toolset selected for another platform or in the top-level
    -    ``toolsets`` list. The shipped ``yuanbao: [hermes-yuanbao]`` platform_toolsets row is not use: it scoped
    -    Yuanbao's own sessions, which need the platform on. Nothing counts when ``plugins.disabled`` names
    -    ``platforms/yuanbao`` or core's manifest name ``yuanbao-platform``: core's loader never ran the adapter
    -    there. A bare ``yuanbao`` there did not stop core's adapter, so it is still use (the notice says it
    -    now turns the plugin off)."""
    -    if _plugins_listed(home, ("platforms/yuanbao", "yuanbao-platform"))[1]:
    -        return False
    -    block = _merged_platform_block(home, "yuanbao")
    -    if block is not None and "enabled" in block and not _platform_config(block).enabled:
    -        return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    -    if platform_configured_on(home, "yuanbao"):
    -        return True
    -    extra = _platform_config(block).extra if block is not None else {}
    +# A credential field: (block key, env name, legacy env names...). A credential set is a tuple of fields that
    +# must ALL be present; a platform with several connection modes passes one set per mode.
    +CredField = tuple[str, ...]
    +
    +
    +def platform_in_use(platform: str, *, plugin_keys: tuple[str, ...] = (),
    +                    cred_sets: tuple[tuple[CredField, ...], ...] = (),
    +                    toolsets: tuple[str, ...] = ()) -> Callable[..., bool]:
    +    """The ``in_use`` predicate for a bundled platform leaving core: what made core run *platform* for a home.
    +
    +    The adapter: unless the merged gateway config block says ``enabled: false`` (core never re-enabled an
    +    explicitly disabled platform), the platform on there (:func:`platform_configured_on`) or one of
    +    *cred_sets* passing as core's ``_is_connected`` read it, per field: the block's key (``extra`` or top
    +    level), else any of the field's env names (read through :func:`_home_env`; the process env too for the
    +    launch home with *process_env*). The tools: a toolset in *toolsets* selected for another platform or in
    +    the top-level ``toolsets`` list; the platform's own ``platform_toolsets`` row is not use (it scoped the
    +    platform's own sessions, which need the platform on). Nothing counts when ``plugins.disabled`` names one
    +    of *plugin_keys* (``platforms/<x>``, core's manifest name): core's loader never ran the adapter there."""
    +    names = frozenset(toolsets)
    +
    +    def tools_selected(home: Path) -> bool:
    +        return bool(names) and _toolset_listed(_read_config(home), names, own_platform=platform)
    +
    +    def in_use(home: Path, *, process_env: bool = False) -> bool:
    +        if plugin_keys and _plugins_listed(home, plugin_keys)[1]:
    +            return False
    +        block = _merged_platform_block(home, platform)
    +        if block is not None and "enabled" in block and not _platform_config(block).enabled:
    +            return tools_selected(home)
    +        if platform_configured_on(home, platform):
    +            return True
    +        extra = _platform_config(block).extra if block is not None else {}
     
    -    def field(key: str, *env_names: str) -> bool:
    -        return bool(str(extra.get(key) or "").strip()) or any(
    -            _home_env(home, env_name, process_env=process_env) for env_name in env_names)
    -    if field("app_id", "YUANBAO_APP_ID", "YUANBAO_APP_KEY") and field("app_secret", "YUANBAO_APP_SECRET"):
    -        return True
    -    return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    +        def present(field: CredField) -> bool:
    +            key, *env_names = field
    +            return bool(str(extra.get(key) or "").strip()) or any(
    +                _home_env(home, env_name, process_env=process_env) for env_name in env_names)
    +        if any(all(present(field) for field in fields) for fields in cred_sets):
    +            return True
    +        return tools_selected(home)
    +    return in_use
    +
    +
    +# Yuanbao: a bare ``yuanbao`` in plugins.disabled did not stop core's adapter, so it is still use (the notice
    +# says it now turns the plugin off).
    +yuanbao_in_use = platform_in_use(
    +    "yuanbao", plugin_keys=("platforms/yuanbao", "yuanbao-platform"),
    +    cred_sets=((("app_id", "YUANBAO_APP_ID", "YUANBAO_APP_KEY"), ("app_secret", "YUANBAO_APP_SECRET")),),
    +    toolsets=("yuanbao", "hermes-yuanbao"))
    +
    +# QQ Bot: core's is_connected took app_id + client_secret from the block's extra, else QQ_APP_ID + QQ_CLIENT_SECRET.
    +# ``hermes-qqbot`` carried only core tools; selected for another platform it is still use, as hermes-homeassistant
    +# was: it resolves again once the plugin registers the platform.
    +qqbot_in_use = platform_in_use(
    +    "qqbot", plugin_keys=("platforms/qqbot", "qqbot-platform"),
    +    cred_sets=((("app_id", "QQ_APP_ID"), ("client_secret", "QQ_CLIENT_SECRET")),),

    Fixed in be507f47a5b0. Core resolved platforms.qqbot-platform through its bundled-alias scan (7427f539), which disappears with the folder. Now Platform._missing_ falls back to left_core_migration.legacy_platform_alias(), which maps a LEFT_CORE row's plugin_names to its platform, so the gateway loader reads that key as qqbot once the plugin registers. The migration's _merged_platform_block folds that key under qqbot, with the canonical key winning, so credentials and an explicit enabled: false there count the same way. Tests: three test_the_old_manifest_key_is_read_as_platforms_qqbot cases; red on f11752fd.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:22 UTC
    Code Review
    hermes_cli/tools_config.py:1
    @@ -374,7 +374,7 @@ def _row(name: str, badge: str = "", tag: str = "", env_vars: list = (), **marke
     # --- Platform / Toolset Helpers ---
     _PLATFORM_ENABLE_ENV_VARS = (
         ("telegram", "TELEGRAM_BOT_TOKEN"), ("discord", "DISCORD_BOT_TOKEN"), ("slack", "SLACK_BOT_TOKEN"),
    -    ("whatsapp", "WHATSAPP_ENABLED"), ("qqbot", "QQ_APP_ID"))
    +    ("whatsapp", "WHATSAPP_ENABLED"))

    Not changed. hermes tools lists cli plus four env-keyed platforms only; every plugin platform (Teams, Google Chat, IRC, LINE, Home Assistant, Yuanbao) is already absent from that menu on main, and TestPlatformToolsetConsistency requires every menu row to be in PLATFORMS and in hermes-gateway. Keeping a QQ row would mean keeping a core bundle for a platform core no longer ships, which is the opposite of this move. QQ's toolsets stay editable through platform_toolsets.qqbot in config.yaml and the dashboard. Making the menu registry-driven for all plugin platforms is a separate change, not part of this lane.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:22 UTC
    Code Review
    hermes_cli/config_defaults.py:1
    @@ -2997,22 +2997,6 @@
             "Allowed iMessage addresses (comma-separated)", None),
         "BLUEBUBBLES_ALLOW_ALL_USERS": _msg("Allow all BlueBubbles users without allowlist",
             "Allow All BlueBubbles Users", password=None),
    -    "QQ_APP_ID": _msg("QQ Bot App ID from QQ Open Platform (q.qq.com)", "QQ App ID",
    -        "https://q.qq.com", password=None),
    -    "QQ_CLIENT_SECRET": _msg("QQ Bot Client Secret from QQ Open Platform", "QQ Client Secret",
    -        password=True),

    Applied as-is in be507f47a5b0 (Co-authored-by you). Your test fails on f11752fd (assert False is True) and passes with the two _MESSAGING_ENV_FALLBACKS rows. Thanks for driving the real handler.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:22 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -644,6 +687,18 @@ class LeftCoreFeature:
             legacy_toolsets=("hermes-yuanbao", "hermes-gateway"),
             platform="yuanbao", enable_env=("YUANBAO_APP_ID", "YUANBAO_APP_SECRET"), notice=_yuanbao_notice,
         ),
    +    LeftCoreFeature(
    +        # QQ_STT_API_KEY stays on local_env_policy's own short list, as core had it. QQ_* channel ownership
    +        # stays profile_channels' ``qqbot`` alias prefix: no tool shares it.
    +        plugin="qqbot", label="QQ Bot", in_use=qqbot_in_use, plugin_key="platforms/qqbot",
    +        plugin_names=("qqbot-platform",),
    +        unchanged="QQ_*/QQBOT_* settings, platforms.qqbot and QQBOT_HOME_CHANNEL are unchanged",
    +        secret_env=("QQ_CLIENT_SECRET",),
    +        private_env=("QQ_APP_ID", "QQ_ALLOWED_USERS", "QQ_GROUP_ALLOWED_USERS", "QQ_ALLOW_ALL_USERS",
    +                     "QQBOT_HOME_CHANNEL", "QQBOT_HOME_CHANNEL_NAME", "QQBOT_HOME_CHANNEL_THREAD_ID",
    +                     "QQ_MARKDOWN_SUPPORT", "QQ_SANDBOX", "QQ_PORTAL_HOST", "QQ_STT_BASE_URL", "QQ_STT_MODEL"),

    Applied in be507f47a5b0 (Co-authored-by you). All three tests pass on head; I checked that plugin_names=() and dropping QQ_APP_ID from private_env each turn one of them red. Bear's Greptile notes also landed in the same commit: one block read in platform_in_use, and Yuanbao on _labs_notice.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:22 UTC
    Code Review
    tests/hermes_cli/test_left_core_qqbot.py:1
    @@ -0,0 +1,101 @@
    +"""The QQ Bot ``LEFT_CORE`` row: homes core ran QQ Bot for get the ``qqbot`` catalog plugin, others never.
    +
    +Real config/.env files under a temp home; the catalog lookup and the install are stand-ins (the live install is
    +exercised end to end outside the unit suite).
    +"""
    +
    +from __future__ import annotations
    +
    +from pathlib import Path
    +
    +import pytest
    +
    +import hermes_cli.left_core_migration as lcm
    +
    +_CREDS = "QQ_APP_ID=a\nQQ_CLIENT_SECRET=s\n"
    +
    +
    +@pytest.fixture(autouse=True)
    +def _fresh(monkeypatch):
    +    monkeypatch.setattr(lcm, "_attempted", set())
    +    for name in ("QQ_APP_ID", "QQ_CLIENT_SECRET"):
    +        monkeypatch.delenv(name, raising=False)
    +    import hermes_cli.memory_provider_migration as mpm
    +    monkeypatch.setattr(mpm, "catalog_source", lambda name: name)
    +
    +
    +def _home(tmp_path: Path, *, env: str = "", config: str = "") -> Path:
    +    home = tmp_path / "home"
    +    home.mkdir()
    +    if env:
    +        (home / ".env").write_text(env, encoding="utf-8")
    +    if config:
    +        (home / "config.yaml").write_text(config, encoding="utf-8")
    +    return home
    +
    +
    +def _qqbot_in_use(home: Path) -> bool:
    +    return next(f for f in lcm.LEFT_CORE if f.plugin == "qqbot").in_use(home)
    +
    +
    +# The platform_toolsets block cli-config.yaml.example shipped while QQ Bot was in core; the installers seed
    +# config.yaml from it, so its qqbot row alone says nothing about use.
    +_SHIPPED_PLATFORM_TOOLSETS = "platform_toolsets:\n  cli: [hermes-cli]\n  telegram: [hermes-telegram]\n  qqbot: [hermes-qqbot]\n"
    +
    +
    +@pytest.mark.parametrize(("env", "config", "in_use"), [
    +    (_CREDS, "", True),
    +    # Core's is_connected read app_id + client_secret from the block's extra too, per field.
    +    ("", "platforms:\n  qqbot:\n    extra: {app_id: a, client_secret: s}\n", True),
    +    ("QQ_CLIENT_SECRET=s\n", "platforms:\n  qqbot:\n    extra: {app_id: a}\n", True),
    +    ("", "platforms:\n  qqbot:\n    enabled: true\n", True),
    +    ("", "qqbot:\n  app_id: a\n  client_secret: s\n", True),  # top-level block, bridged into extra
    +    ("", "platform_toolsets:\n  telegram: [hermes-qqbot]\n", True),
    +    ("", "", False),
    +    ("QQ_APP_ID=a\n", "", False),  # half a credential set never enabled the adapter

    Applied in be507f47a5b0: the comment now reads "half a set: core enabled the adapter, but it never connected". The expected value stays False.

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 14:22 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -149,34 +149,63 @@ def homeassistant_in_use(home: Path, *, process_env: bool = False) -> bool:
             _read_config(home), frozenset({"homeassistant", "hermes-homeassistant"}), own_platform="homeassistant")
     
     
    -def yuanbao_in_use(home: Path, *, process_env: bool = False) -> bool:
    -    """What made core run Yuanbao for *home*. The adapter: unless the merged gateway config block says
    -    ``enabled: false`` (core never re-enabled an explicitly disabled platform), the platform on there
    -    (:func:`platform_configured_on`) or its credential gate passing as core's ``_is_connected`` read it,
    -    per field: App ID from the block's ``app_id`` (``extra`` or top level), else ``YUANBAO_APP_ID``, else
    -    the legacy ``YUANBAO_APP_KEY``; App Secret from the block's ``app_secret``, else ``YUANBAO_APP_SECRET``
    -    (env read through :func:`_home_env`; the process env too for the launch home with *process_env*). The
    -    tools: the ``yuanbao`` / ``hermes-yuanbao`` toolset selected for another platform or in the top-level
    -    ``toolsets`` list. The shipped ``yuanbao: [hermes-yuanbao]`` platform_toolsets row is not use: it scoped
    -    Yuanbao's own sessions, which need the platform on. Nothing counts when ``plugins.disabled`` names
    -    ``platforms/yuanbao`` or core's manifest name ``yuanbao-platform``: core's loader never ran the adapter
    -    there. A bare ``yuanbao`` there did not stop core's adapter, so it is still use (the notice says it
    -    now turns the plugin off)."""
    -    if _plugins_listed(home, ("platforms/yuanbao", "yuanbao-platform"))[1]:
    -        return False
    -    block = _merged_platform_block(home, "yuanbao")
    -    if block is not None and "enabled" in block and not _platform_config(block).enabled:
    -        return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    -    if platform_configured_on(home, "yuanbao"):
    -        return True
    -    extra = _platform_config(block).extra if block is not None else {}
    +# A credential field: (block key, env name, legacy env names...). A credential set is a tuple of fields that
    +# must ALL be present; a platform with several connection modes passes one set per mode.
    +CredField = tuple[str, ...]
    +
    +
    +def platform_in_use(platform: str, *, plugin_keys: tuple[str, ...] = (),
    +                    cred_sets: tuple[tuple[CredField, ...], ...] = (),
    +                    toolsets: tuple[str, ...] = ()) -> Callable[..., bool]:
    +    """The ``in_use`` predicate for a bundled platform leaving core: what made core run *platform* for a home.
    +
    +    The adapter: unless the merged gateway config block says ``enabled: false`` (core never re-enabled an
    +    explicitly disabled platform), the platform on there (:func:`platform_configured_on`) or one of
    +    *cred_sets* passing as core's ``_is_connected`` read it, per field: the block's key (``extra`` or top
    +    level), else any of the field's env names (read through :func:`_home_env`; the process env too for the
    +    launch home with *process_env*). The tools: a toolset in *toolsets* selected for another platform or in
    +    the top-level ``toolsets`` list; the platform's own ``platform_toolsets`` row is not use (it scoped the
    +    platform's own sessions, which need the platform on). Nothing counts when ``plugins.disabled`` names one
    +    of *plugin_keys* (``platforms/<x>``, core's manifest name): core's loader never ran the adapter there."""
    +    names = frozenset(toolsets)
    +
    +    def tools_selected(home: Path) -> bool:
    +        return bool(names) and _toolset_listed(_read_config(home), names, own_platform=platform)
    +
    +    def in_use(home: Path, *, process_env: bool = False) -> bool:
    +        if plugin_keys and _plugins_listed(home, plugin_keys)[1]:
    +            return False
    +        block = _merged_platform_block(home, platform)
    +        if block is not None and "enabled" in block and not _platform_config(block).enabled:
    +            return tools_selected(home)
    +        if platform_configured_on(home, platform):
    +            return True
    +        extra = _platform_config(block).extra if block is not None else {}
     
    -    def field(key: str, *env_names: str) -> bool:
    -        return bool(str(extra.get(key) or "").strip()) or any(
    -            _home_env(home, env_name, process_env=process_env) for env_name in env_names)
    -    if field("app_id", "YUANBAO_APP_ID", "YUANBAO_APP_KEY") and field("app_secret", "YUANBAO_APP_SECRET"):
    -        return True
    -    return _toolset_listed(_read_config(home), frozenset({"yuanbao", "hermes-yuanbao"}), own_platform="yuanbao")
    +        def present(field: CredField) -> bool:
    +            key, *env_names = field
    +            return bool(str(extra.get(key) or "").strip()) or any(
    +                _home_env(home, env_name, process_env=process_env) for env_name in env_names)
    +        if any(all(present(field) for field in fields) for fields in cred_sets):
    +            return True
    +        return tools_selected(home)
    +    return in_use
    +
    +
    +# Yuanbao: a bare ``yuanbao`` in plugins.disabled did not stop core's adapter, so it is still use (the notice
    +# says it now turns the plugin off).
    +yuanbao_in_use = platform_in_use(
    +    "yuanbao", plugin_keys=("platforms/yuanbao", "yuanbao-platform"),
    +    cred_sets=((("app_id", "YUANBAO_APP_ID", "YUANBAO_APP_KEY"), ("app_secret", "YUANBAO_APP_SECRET")),),
    +    toolsets=("yuanbao", "hermes-yuanbao"))
    +
    +# QQ Bot: core's is_connected took app_id + client_secret from the block's extra, else QQ_APP_ID + QQ_CLIENT_SECRET.
    +# ``hermes-qqbot`` carried only core tools; selected for another platform it is still use, as hermes-homeassistant
    +# was: it resolves again once the plugin registers the platform.
    +qqbot_in_use = platform_in_use(
    +    "qqbot", plugin_keys=("platforms/qqbot", "qqbot-platform"),
    +    cred_sets=((("app_id", "QQ_APP_ID"), ("client_secret", "QQ_CLIENT_SECRET")),),
    +    toolsets=("hermes-qqbot",))

    You're right — I misread how main's credential gate worked. The per-field fallback (extra.get(key) or env) matches main's is_connected, and requiring one complete source would indeed skip homes that main actually connected. Thanks for the clarification and the independent verification.

    teknium1 teknium1 commented on Nov 24, 2026 14:22 UTC
    Author

    @BearHuddleston thanks. Everything is in be507f47a5b0 (Co-authored-by you); per-finding replies are inline.

  • 1 (Channels card secret): your patch, as-is. Its test is red on f11752fd.

  • 2 (mutant survivors): your three tests, as-is.

  • 3 (half-credential comment): applied.

  • 4 (gateway.json disable vs env creds): left as is, as you suggested. It is the shared factory's answer, the same as Yuanbao's on main, and #159638 pins it.

  • 5 (string-saved rows): comes with #159638's _toolset_listed change (7325b77b / 7aac7286) when both land; nothing QQ-specific.

  • Greptile items: fixed the saved-route deletion, hermes-qqbot in a mixed list, reload keys, the qqbot-platform key alias, the webhook deliver target and the double read. Kept the split-credential read (your probe agrees) and the hermes tools menu (every plugin platform is absent from it on main).
  • greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 14:22 UTC
    Code Review
    hermes_cli/tools_config.py:1
    @@ -374,7 +374,7 @@ def _row(name: str, badge: str = "", tag: str = "", env_vars: list = (), **marke
     # --- Platform / Toolset Helpers ---
     _PLATFORM_ENABLE_ENV_VARS = (
         ("telegram", "TELEGRAM_BOT_TOKEN"), ("discord", "DISCORD_BOT_TOKEN"), ("slack", "SLACK_BOT_TOKEN"),
    -    ("whatsapp", "WHATSAPP_ENABLED"), ("qqbot", "QQ_APP_ID"))
    +    ("whatsapp", "WHATSAPP_ENABLED"))

    Got it — that makes sense. The behavior is consistent with how other plugin platforms (Teams, Google Chat, IRC, LINE, Home Assistant, Yuanbao) already work, and QQ Bot as a plugin should follow the same pattern. The alternative editing paths through platform_toolsets.qqbot and the dashboard maintain the functionality. Thanks for clarifying the architectural context.

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 14:27 UTC
    Code Review
    gateway/session_persistence.py:1
    @@ -476,6 +487,7 @@ def _import_legacy_sessions_json(self, db_had_entries: bool) -> int:
                         imported += 1
                     except (ValueError, KeyError, TypeError) as e:
                         logger.warning("Skipping invalid session entry %r: %s", key, e)
    +                    self._keep_unparsed_route(key, json.dumps(entry_data))

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Old copy overwrites newer route

    If QQ isn't registered, the gateway holds its state.db route in _unparsed_routes. The sessions.json import only checks _entries, so an older copy can replace the held route and get written back to the database. That can lose a pending turn or bring back one that already finished. Keep saved route IDs readable without loading the adapter so both sources follow the same database-first rule.

    Context Used: gateway/AGENTS.md (source)

    Knowledge Base Used: Gateway session lifecycle and recovery

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: gateway/session_persistence.py
    Line: 490
    
    Comment:
    **Old copy overwrites newer route**
    
    If QQ isn't registered, the gateway holds its `state.db` route in `_unparsed_routes`. The `sessions.json` import only checks `_entries`, so an older copy can replace the held route and get written back to the database. That can lose a pending turn or bring back one that already finished. Keep saved route IDs readable without loading the adapter so both sources follow the same database-first rule.
    
    **Context Used:** gateway/AGENTS.md ([source](https://github.com/nousresearch/hermes-agent/blob/main/gateway/AGENTS.md))
    
    **Knowledge Base Used:** [Gateway session lifecycle and recovery](https://app.greptile.com/-/switch-tenant?tenant=nous-research&next=%2Fcustom-context%2Fknowledge-base%2Fnousresearch%2Fhermes-agent%2F-%2Fdocs%2Fgateway-session-lifecycle.md)
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 14:27 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -83,6 +83,10 @@ def _merged_platform_block(home: Path, name: str) -> Optional[dict]:
             managed, managed.get("gateway"), {}, also=frozenset({name}))
         config_loader._apply_managed_extra(authored, managed, platforms)
         block = platforms.get(name)
    +    old = next((platforms[a] for a in _platform_aliases(name) if isinstance(platforms.get(a), dict)), None)
    +    if old is not None:  # core resolved the old manifest key to the same platform; the canonical key wins
    +        block = {**old, **(block if isinstance(block, dict) else {}),
    +                 "extra": {**(old.get("extra") or {}), **((block or {}).get("extra") or {})}}

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Migration ignores the newer disable

    If gateway.json enables platforms.qqbot and config.yaml disables platforms.qqbot-platform, startup honors the newer YAML setting. Migration instead gives qqbot priority regardless of where it was set, so it installs the plugin even though the user turned it off. Normalize both spellings in the shared loader before merging the layers so migration and startup agree.

    Context Used: hermes_cli/AGENTS.md (source)

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: hermes_cli/left_core_migration.py
    Line: 86-89
    
    Comment:
    **Migration ignores the newer disable**
    
    If `gateway.json` enables `platforms.qqbot` and `config.yaml` disables `platforms.qqbot-platform`, startup honors the newer YAML setting. Migration instead gives `qqbot` priority regardless of where it was set, so it installs the plugin even though the user turned it off. Normalize both spellings in the shared loader before merging the layers so migration and startup agree.
    
    **Context Used:** hermes_cli/AGENTS.md ([source](https://github.com/nousresearch/hermes-agent/blob/main/hermes_cli/AGENTS.md))
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    greptile-apps[bot] greptile-apps[bot] commented on code on Nov 24, 2026 14:27 UTC
    Code Review
    hermes_cli/tools_config.py:1
    @@ -495,9 +495,11 @@ def _explicit_toolsets(
         from toolsets import resolve_toolset, TOOLSETS
     
         enabled = {ts for ts in toolset_names if ts in explicit_known_keys and _toolset_allowed_for_platform(ts, platform)}
    +    from toolsets import _plugin_platform_bundle
    +    # A plugin platform's implicit ``hermes-<platform>`` bundle expands like a static composite.
         composite_tools = {
    -        t for ts_name in toolset_names if ts_name not in explicit_known_keys and ts_name in TOOLSETS
    -        for t in resolve_toolset(ts_name)}
    +        t for ts_name in toolset_names if ts_name not in explicit_known_keys
    +        for t in (resolve_toolset(ts_name) if ts_name in TOOLSETS else _plugin_platform_bundle(ts_name))}
         if composite_tools:
             enabled |= _configurable_subset_of(composite_tools, platform) - _default_off_toolsets(platform, explicitly_configured)

    <a href=""><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Unchecked tools turn back on

    If Telegram uses [hermes-qqbot, file], the picker expands hermes-qqbot but keeps it when saving because _platform_default_keys() no longer lists it. Uncheck terminal and the next read adds it back. Use the same preset definition for reading and saving. The old QQ preset only listed core tools, so it doesn't need to depend on the adapter.

    <details><summary>Prompt To Fix With AI</summary>

    `

    This is a comment left during a code review.
    Path: hermes_cli/tools_config.py
    Line: 498-504
    
    Comment:
    **Unchecked tools turn back on**
    
    If Telegram uses `[hermes-qqbot, file]`, the picker expands `hermes-qqbot` but keeps it when saving because `_platform_default_keys()` no longer lists it. Uncheck `terminal` and the next read adds it back. Use the same preset definition for reading and saving. The old QQ preset only listed core tools, so it doesn't need to depend on the adapter.
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
    
    `
    </details>

    teknium1 teknium1 commented on code on Nov 24, 2026 14:36 UTC
    Code Review
    gateway/session_persistence.py:1
    @@ -476,6 +487,7 @@ def _import_legacy_sessions_json(self, db_had_entries: bool) -> int:
                         imported += 1
                     except (ValueError, KeyError, TypeError) as e:
                         logger.warning("Skipping invalid session entry %r: %s", key, e)
    +                    self._keep_unparsed_route(key, json.dumps(entry_data))

    Fixed in d6224de3a529. _import_legacy_sessions_json now skips a key whose state.db row is held in _unparsed_routes, the same database-first rule it already applied to _entries. Test: test_an_older_sessions_json_copy_does_not_replace_the_held_db_route (a DB row sid-new, a mirror copy sid-old, a restart and a full save: the DB keeps sid-new). It is red on be507f47 and green now.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:36 UTC
    Code Review
    hermes_cli/left_core_migration.py:1
    @@ -83,6 +83,10 @@ def _merged_platform_block(home: Path, name: str) -> Optional[dict]:
             managed, managed.get("gateway"), {}, also=frozenset({name}))
         config_loader._apply_managed_extra(authored, managed, platforms)
         block = platforms.get(name)
    +    old = next((platforms[a] for a in _platform_aliases(name) if isinstance(platforms.get(a), dict)), None)
    +    if old is not None:  # core resolved the old manifest key to the same platform; the canonical key wins
    +        block = {**old, **(block if isinstance(block, dict) else {}),
    +                 "extra": {**(old.get("extra") or {}), **((block or {}).get("extra") or {})}}

    Fixed in d6224de3a529. The old key is no longer folded after the merge. _fold_alias_layer folds platforms.qqbot-platform (and gateway.platforms.qqbot-platform) into qqbot inside each layer, gateway.json, config.yaml and the managed overlay, before merge_platform_sections runs. The canonical key wins only within the same layer, so a newer config.yaml disable under either spelling beats a gateway.json enable, as at startup. Test: test_a_newer_yaml_disable_under_the_old_key_beats_a_gateway_json_enable; red on be507f47.

    teknium1 teknium1 commented on code on Nov 24, 2026 14:36 UTC
    Code Review
    hermes_cli/tools_config.py:1
    @@ -495,9 +495,11 @@ def _explicit_toolsets(
         from toolsets import resolve_toolset, TOOLSETS
     
         enabled = {ts for ts in toolset_names if ts in explicit_known_keys and _toolset_allowed_for_platform(ts, platform)}
    +    from toolsets import _plugin_platform_bundle
    +    # A plugin platform's implicit ``hermes-<platform>`` bundle expands like a static composite.
         composite_tools = {
    -        t for ts_name in toolset_names if ts_name not in explicit_known_keys and ts_name in TOOLSETS
    -        for t in resolve_toolset(ts_name)}
    +        t for ts_name in toolset_names if ts_name not in explicit_known_keys
    +        for t in (resolve_toolset(ts_name) if ts_name in TOOLSETS else _plugin_platform_bundle(ts_name))}
         if composite_tools:
             enabled |= _configurable_subset_of(composite_tools, platform) - _default_off_toolsets(platform, explicitly_configured)

    Fixed in d6224de3a529. You're right that the read/save definitions disagreed. hermes-qqbot now has one definition for both: _left_core_core_bundles() (left-core platform rows whose plugin registers no toolset). _explicit_toolsets reads it as _HERMES_CORE_TOOLS with or without the plugin, and _platform_default_keys() includes it, so a picker save drops it like any other preset. The adapter dependency from the previous fix is gone. Test: test_a_mixed_list_naming_hermes_qqbot_keeps_its_core_tools_and_an_unchecked_one_stays_off (read, uncheck terminal, save, re-read); red on be507f47.

    unsupportedpastels unsupportedpastels commented on Nov 24, 2026 19:21 UTC
    Reviewer

    Review: PR #159640 refactor: QQ Bot leaves core for the qqbot Hermes Labs plugin (auto-migrated) @ dcb08cef


    <!-- review: verdict=changes_requested event=COMMENT critical=0 major=1 minor=0 ci=green head=dcb08cef428cbee2a9c3a77f6575c2bc4df56686 -->

    Verdict: 🟡 Changes requested. Saved cron jobs still lose the old bundle's tools, and one Major-weight issue from an earlier review remains: a held route survives on disk but isn't available to the already-loaded store when QQ registers. Thanks @teknium1!

    | Critical | Major | Minor | CI |
    |:-:|:-:|:-:|:-:|
    | 0 | 1 | 0 | ✅ green |

    Checked:

  • Changed Python tests: 196 passed, 10 skipped; the same three WeCom cases fail on the merge base because the test environment lacks aiohttp. A neighboring API-delete suite could not collect for the same reason.

  • A configured fixture home installed once, then did nothing on a second migration; split credentials under the legacy alias counted, and a newer YAML disable won over a legacy JSON enable.

  • Two full saves preserved the newer QQ route and its pending flag without the adapter; the valid mirror repaired a corrupt DB row. A cold store read the held route once QQ registered.

  • Bare and mixed legacy presets still show core tools in the picker; two successive saves kept the unchecked choices off. Three guard mutations were caught by the existing tests (4, 1, and 1 failing cases).

  • Security: checked dashboard password metadata with the manifest absent, profile gate ownership, child-env stripping, and clearing a removed legacy home-channel env var.

  • Not run: live QQ connection, catalog download, or end-to-end multiplexed gateway boot.
  • ---

    Major

    M1: Saved cron jobs lose core tools when they name hermes-qqbot · hermes_cli/tools_config.py#L497

    Confirmed from other reviewers


  • gateway/config.py:258 @greptile-apps[bot]: confirmed (two full saves retain the row and pending flag, but live lookup stays empty after late registration; a cold store finds it), Major weight.

  • toolsets.py:217 @greptile-apps[bot]: already handled (Telegram picker retains the mixed list’s core tools before and after registry registration; M1 covers cron, not the picker).

  • hermes_cli/config.py:211 @greptile-apps[bot]: already handled (real reload cleared the removed QQ_HOME_CHANNEL value).

  • hermes_cli/left_core_migration.py:234 @greptile-apps[bot]: not reproduced (per-field credentials are intentional; split credentials still count).

  • hermes_cli/left_core_migration.py:209 @greptile-apps[bot]: confirmed (qqbot_in_use() called the merged-block reader twice for split credentials; Yuanbao uses the shared notice), minor weight.

  • gateway/webhook_targets.py:9 @greptile-apps[bot]: already handled (qqbot passes the webhook target check before plugin registration).

  • hermes_cli/left_core_migration.py:233 @greptile-apps[bot]: already handled (legacy key is recognized for migration and resolves to QQ after registry registration).

  • hermes_cli/tools_config.py:377 @greptile-apps[bot]: already handled (QQ no longer has a dedicated hermes tools row by design; explicit platform_toolsets picks still work).

  • hermes_cli/config_defaults.py:3003 @BearHuddleston: already handled (Channels metadata returns a password field without the manifest).

  • hermes_cli/left_core_migration.py:712 @BearHuddleston: already handled (head tests cover legacy disable names, the child-env strip set, and the Yuanbao exception).

  • tests/hermes_cli/test_left_core_qqbot.py:55 @BearHuddleston: already handled (the test now distinguishes enabling an adapter from connecting it).

  • gateway/session_persistence.py:510 @greptile-apps[bot]: already handled (two full saves preserved the newer DB session ID over the older mirror).

  • hermes_cli/left_core_migration.py:89 @greptile-apps[bot]: already handled (the newer YAML disable under the old key beat the legacy JSON enable).

  • hermes_cli/tools_config.py:504 @greptile-apps[bot]: already handled (unchecking terminal persisted on the next picker read and through a second save).

  • gateway/session_persistence.py:493 @greptile-apps[bot]: already handled (a valid mirror replaced the corrupt timestamp even with QQ unregistered).

  • hermes_cli/tools_config.py:501 @greptile-apps[bot]: already handled (the bare preset shows core tools without the plugin and retains them after save).

  • hermes_cli/tools_config.py:496 @greptile-apps[bot]: already handled (the picker kept its core tools with an actual same-named registry alias).

  • tests/hermes_cli/test_left_core_qqbot.py:199 @greptile-apps[bot]: not reproduced (for the picker case, a real alias preserved core selections without adding the fixture tool to the picker on either tree; runtime resolution is separate).
  • teknium1 teknium1 commented on Nov 27, 2026 06:32 UTC
    Author

    @unsupportedpastels mapping for your Nov 24 changes-requested review (@ dcb08ce) onto the current head e800445e3343. The lane was rebased since your review, so SHAs below are the current ones.

    Scope change since your review: QQ Bot is now an official default plugin (hermes-official-plugins, catalog default: true), not Hermes Labs (b58048b18c6c). The transition is staged: the plugin stands down on a core that still ships QQ Bot, and this PR removes core's adapter.

    | Finding | Fix on current head | Test (verified locally on this head) |
    |---|---|---|
    | M1 saved cron enabled_toolsets: [hermes-qqbot, file] loses terminal/web_search (hermes_cli/tools_config.py#L497) | a79a7582647a: toolsets.RETIRED_CORE_BUNDLES = {"hermes-qqbot": core-tools bundle}, read by get_toolset / validate_toolset after TOOLSETS, ahead of a same-named MCP alias whose tools still merge. Kept out of TOOLSETS, hermes-gateway and every listing; the picker's _left_core_core_bundles reads the same table. Your patch, with the if name == swapped for the table; you're Co-authored-by. | tests/hermes_cli/test_left_core_qqbot.py::test_saved_qqbot_preset_still_selects_core_tools_at_runtime[False/True] (your test verbatim): pass |
    | Major (confirmed from greptile gateway/config.py:258) held route survives on disk but the already-loaded store never sees it once QQ registers | Generic fix on main (#160253, in this branch's base 7c57dbf4): c33d2da14797 _promote_held_routes_locked moves a held row into the live index once its platform is a Platform member (and drops a held copy the live index already owns); profile delete/rename and session delete/expiry handle held rows (5d3c91332057, 4b6d36dcabe1). This PR no longer carries its own copy of the seam. | tests/gateway/test_held_route_late_platform.py (15 tests, e.g. test_a_held_route_s_stop_still_applies_once_its_platform_registers, test_a_held_route_s_crash_left_turn_resumes_once_its_platform_registers): pass |
    | minor (confirmed from greptile left_core_migration.py:209) platform_in_use merges the platform block twice | Was not fixed on the previous head: be507f47's message claimed _block_on but the hunk was lost in a rebase. Fixed now in e800445e3343: in_use and platform_configured_on both judge one merged block through _block_on. | test_one_qqbot_check_merges_the_home_s_platform_block_once: red on a6f9ca44b9 (2 merges), green now |
    | ↳ same thread: Yuanbao should use the shared _labs_notice | Not a bug after the scope change: once QQ Bot became official (b58048b18c6c), Yuanbao is the only Labs row, so the shared Labs helper had one caller. Yuanbao keeps _yuanbao_notice (same text plus its stale-disable sentence); QQ's official notice carries no placement sentence. | tests/hermes_cli/test_left_core_yuanbao.py: pass |

    The other rows in your "Confirmed from other reviewers" list were marked already handled / not reproduced and are unchanged.

    Local run on this head: test_left_core_qqbot.py, test_left_core_yuanbao.py, test_left_core_migration.py, test_held_route_late_platform.py: 145 passed; scripts/check ok. Unanswered bot/human thread sweeps are clean.

    greptile-apps[bot] greptile-apps[bot] commented on Nov 27, 2026 06:36 UTC
    Bot

    <!-- greptile_outside_diff -->

    <h3>Comments Outside Diff</h3>

    No findings outside the diff remain.

    teknium1 teknium1 commented on Nov 27, 2026 08:55 UTC
    Author

    Shared fixes from the Feishu #159651 Greptile round, pushed as 349f2e372ad2: 3bb387ad0ff4 keeps the /update notice until its plugin platform registers (main had the same Platform(platform_str) delete path; patch-id matches #159651's b020edd0). c8528d438862 makes /reload drop only its own profile's plugin env names and never a launch-only one. 349f2e372ad2 means a profile that already has qqbot still hears the plugins.isolation: host notice. Each has a test that was red on c92fafad.

    blacksmith-sh[bot] blacksmith-sh[bot] commented on Nov 28, 2026 09:07 UTC
    Bot

    <!-- Blacksmith CI Status -->
    Found 14 test failures on Blacksmith runners:

    Failures

    | Test | View Logs |
    | --- | --- |
    | <code>test_cold_cli_builds_own_runtime_discovers_plugins_and_repairs_app[None]</code> | View Logs |
    | <code>test_file_ops_dead_cwd/</code><br /><code>test_sandbox_job_that_deletes_its_cwd_is_still_tracked_and_session_cwd_is_untouched</code> | View Logs |
    | <code>test_plugin_identity_property/</code><br /><code>test_every_plugin_list_reader_gives_the_loaders_verdict[acme-tool]</code> | View Logs |
    | <code>test_plugin_identity_property/</code><br /><code>test_every_plugin_list_reader_gives_the_loaders_verdict[agent-importers]</code> | View Logs |
    | <code>test_plugin_identity_property/</code><br /><code>test_every_plugin_list_reader_gives_the_loaders_verdict[camofox]</code> | View Logs |
    | <code>test_plugin_identity_property/</code><br /><code>test_every_plugin_list_reader_gives_the_loaders_verdict[disk-cleanup]</code> | View Logs |
    | <code>test_plugin_identity_property/</code><br /><code>test_every_plugin_list_reader_gives_the_loaders_verdict[github-copilot]</code> | View Logs |
    | <code>test_plugin_identity_property/</code><br /><code>test_every_plugin_list_reader_gives_the_loaders_verdict[homeassistant]</code> | View Logs |
    | <code>test_plugin_identity_property/</code><br /><code>test_every_plugin_list_reader_gives_the_loaders_verdict[langfuse]</code> | View Logs |
    | <code>test_plugin_identity_property/</code><br /><code>test_every_plugin_list_reader_gives_the_loaders_verdict[mcp-serve]</code> | View Logs |

    ...and 4 more test failures. View all on Blacksmith

    <a href="https://app.blacksmith.sh/NousResearch/codesmith/hermes-agent/pr/159640?prompt=Repository%3A+NousResearch%2Fhermes-agent%0ABranch%3A+laneb%2Fqqbot-labs%0APR%3A+%23159640%0A%0AFix+these+failing+tests%3A%0A%0A1.+test_cold_cli_builds_own_runtime_discovers_plugins_and_repairs_app%5BNone%5D%0A2.+test_file_ops_dead_cwd%2Ftest_sandbox_job_that_deletes_its_cwd_is_still_tracked_and_session_cwd_is_untouched%0A3.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Bacme-tool%5D%0A4.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Bagent-importers%5D%0A5.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Bcamofox%5D%0A6.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Bdisk-cleanup%5D%0A7.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Bgithub-copilot%5D%0A8.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Bhomeassistant%5D%0A9.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Blangfuse%5D%0A10.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Bmcp-serve%5D%0A11.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Bqqbot%5D%0A12.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Bsingularity%5D%0A13.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Bspotify%5D%0A14.+test_plugin_identity_property%2Ftest_every_plugin_list_reader_gives_the_loaders_verdict%5Byuanbao%5D%0A&amp;entry=pr_comment&amp;ref=gh_comment&amp;autoLogin=true&amp;autoSend=true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-dark-v2.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-v2.svg"><img alt="Fix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/fix-with-codesmith-light-v2-3x.png" width="149" height="28"></picture></a>
    <sup>Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup>

    Assignees
    teknium1 teknium1
    Labels
    risk: low confidence: 87.2% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 94.7% (HIGH) · Higher = larger blast radius
    94.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 87.2% · Lower = rushed or shallow review
    87.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 12.2% · Safe to merge
    12.2%