Skip to content

refactor(qqbot): install plugin from Tencent package - #107295

Merged
steipete merged 6 commits into
mainfrom
refactor/externalize-qqbot
Aug 11, 2026
Merged

steipete merged 6 commits into
mainfrom
refactor/externalize-qqbot

Conversation

@sliverp

@sliverp sliverp commented Jul 14, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

QQBot is still maintained and released from the OpenClaw monorepo, unlike the other externally owned Tencent channels. This duplicates ownership and prevents Tencent Connect from shipping the channel independently.

Why This Change Was Made

  • Remove the bundled extensions/qqbot implementation and its root-only dependencies.
  • Register the published @tencent-connect/openclaw-qqbot package in the official external channel catalog and follow npm's latest tag.
  • Keep the public channel id as qqbot, and update onboarding, generated runtime metadata, release/build guards, and tests.
  • Keep the top-level QQBot documentation aligned with the external package install flow.

User Impact

New installs and onboarding now fetch Tencent Connect's external package from npm latest. Existing string credentials and the QQBOT_APP_ID / QQBOT_CLIENT_SECRET environment variables remain supported. The external package currently requires structured SecretRef users to move those credentials to environment variables before upgrading. QR login remains available in the external package. The documentation uses the unversioned package spec so future Tencent releases are picked up automatically.

AI-assisted: yes.

Evidence

  • Verified the published npm package, plugin id, channel contract, tools, and QR-login implementation; npm latest currently resolves to 2.0.0.
  • 414 targeted tests passed across catalog, onboarding, packaging, contract, and guardrail shards.
  • 99 runtime configuration, secrets, doctor, and external-plugin compatibility tests passed.
  • src/infra/tsdown-config.test.ts passed after removing the final qrcode-terminal build exclusion.
  • Channel catalog generation checks, formatting, lint, and git diff --check passed.
  • Focused latest-spec tests passed for catalog policy, onboarding, externalization bridges, and update migration.
  • Autoreview completed cleanly across the migration and final incremental cleanup, with no accepted/actionable findings.
  • Broad lanes are left to CI.

@sliverp
sliverp requested a review from a team as a code owner July 14, 2026 08:29
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation security Security documentation scripts Repository scripts commands Command implementations docker Docker and sandbox tooling channel: qqbot labels Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • extensions/qqbot/package.json
  • pnpm-lock.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfiles or workspace dependency policy changes are present.
  • Treat pnpm-lock.yaml and package-lock.json diffs as dependency security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 14, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Dependency removals noted

This PR only removes dependencies from the dependency graph, so the dependency guard is informational and does not require /allow-dependencies-change.

  • Removed @openclaw/plugin-sdk from extensions/qqbot/package.json.

  • Removed @tencent-connect/qqbot-connector from extensions/qqbot/package.json.

  • Removed @types/ws from extensions/qqbot/package.json.

  • Removed mpg123-decoder from extensions/qqbot/package.json.

  • Removed openclaw from extensions/qqbot/package.json.

  • Removed p-map from extensions/qqbot/package.json.

  • Removed pretty-ms from extensions/qqbot/package.json.

  • Removed silk-wasm from extensions/qqbot/package.json.

  • Removed ws from extensions/qqbot/package.json.

  • Removed zod from extensions/qqbot/package.json.

  • Removed @tencent-connect/qqbot-connector from pnpm-lock.yaml.

  • Current SHA: c3180f6c57ecf745e9bef2b39c14dc6b5a401752

A later push that adds or changes dependency graph entries will require a fresh security approval.

@sliverp
sliverp force-pushed the refactor/externalize-qqbot branch from e1c4444 to 0efc586 Compare July 14, 2026 08:34
@sliverp sliverp self-assigned this Jul 14, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Jul 14, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 14, 2026
@clawsweeper

clawsweeper Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 11, 2026, 6:00 PM ET / 22:00 UTC.

ClawSweeper review

What this changes

The PR removes bundled QQ Bot and moves catalog, installation, upgrade, setup, documentation, and secret compatibility support to Tencent’s external npm plugin.

Merge readiness

⚠️ Needs maintainer review before merge - 9 items remain

This PR is still necessary, but it is not ready to merge: the public guide keeps the removed QQ Bot package command, the SecretRef guidance contradicts the added compatibility bridge, the fallback can activate secrets for an unavailable plugin, and a new SDK export widens approval authority.

Priority: P1
Reviewed head: c3180f6c57ecf745e9bef2b39c14dc6b5a401752
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The external-package load path has strong terminal proof, but merge-blocking compatibility and authority defects remain.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The maintainer comment includes an after-fix isolated-state install, channel setup, plugin listing, and Gateway startup transcript for Tencent’s package.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The maintainer comment includes an after-fix isolated-state install, channel setup, plugin listing, and Gateway startup transcript for Tencent’s package.
Evidence reviewed 8 items Current main still uses the bundled package: The current QQ Bot guide instructs operators to install @openclaw/qqbot, so the central externalization behavior is not already on main.
Scoped package command bypasses catalog redirect: Only a bare plugin id is resolved through the official external catalog; a scoped npm package proceeds directly to npm, so the stale guide command will not redirect to Tencent’s package.
Approval client is privileged: The current helper supplies a process-local approval token, requests operator.approvals, and omits device identity for loopback use.
Findings 4 actionable findings [P1] Install Tencent’s QQ Bot package in the guide
[P1] Respect the active plugin-origin fence in the fallback
[P1] Keep approval-runtime authority out of the public SDK
Security Needs attention Public SDK can mint approval-runtime authority: The exported helper sends the process-local approval token; the Gateway marks a local backend client with that token as approvalRuntime and permits approval resolution without reviewer-device identity.

How this fits together

QQ Bot settings select an official catalog entry, which installs and loads Tencent’s plugin before the Gateway runs the channel. Upgrade, setup, and secret-resolution paths must preserve existing operators’ configuration while moving the plugin owner.

flowchart LR
  A[QQ Bot configuration] --> B[Official channel catalog]
  B --> C[Install and update bridge]
  C --> D[Tencent QQ Bot plugin]
  A --> E[Secret resolution]
  E --> D
  D --> F[Gateway channel runtime]
  F --> G[Approval actions]
Loading

Decision needed

Question Recommendation
Should the public plugin SDK expose a helper that mints the host’s device-less operator-approval runtime for Tencent QQ Bot? Keep authority injected: Remove the gateway-runtime export and provide Tencent’s channel only the host-injected, closure-bound approval runtime.

Why: This is a public authority-boundary expansion; the thread records temporary acceptance, but repository policy requires explicit SDK and security-owner acceptance before widening that trust boundary.

Before merge

  • Install Tencent’s QQ Bot package in the guide (P1) - The branch removes the bundled QQ Bot owner and registers Tencent’s package, but this still directs fresh operators to @openclaw/qqbot. Scoped package specs bypass the catalog redirect, so update the command to Tencent’s package rather than leaving users to install the removed package or fail.
  • Respect the active plugin-origin fence in the fallback (P1) - The fallback is returned after the record lookup filters against loadablePluginOrigins. Consequently, an absent or disabled QQ Bot plugin can still resolve a stale clientSecret SecretRef and block startup, contrary to the collector’s inactive-owner invariant. Return the catalog contract only when openclaw-qqbot is loadable, and cover the empty-origin case.
  • Keep approval-runtime authority out of the public SDK (P1) - This re-export lets every installed plugin call a helper that supplies the process-local approval token, omits device identity, and is recognized by the Gateway as a trusted approval runtime. That client may resolve approvals despite reviewer-device binding; inject the existing closure-bound runtime instead, or obtain explicit SDK and security-owner approval for this public authority contract.
  • Describe the SecretRef bridge accurately (P2) - The branch adds schema widening and a host fallback that resolves QQ Bot clientSecret SecretRefs, while these notes tell operators they must move them to env/file before upgrading. Document the supported host bridge or remove it; the current guide prescribes an unnecessary credential migration.
  • Resolve security concern: Public SDK can mint approval-runtime authority - The exported helper sends the process-local approval token; the Gateway marks a local backend client with that token as approvalRuntime and permits approval resolution without reviewer-device identity.
  • Resolve merge risk (P1) - Any installed plugin could use the new public helper to establish device-less approval authority, despite approval resolution being a remote-execution-grade permission.
  • Resolve merge risk (P2) - A stale unavailable QQ Bot configuration can resolve a SecretRef and block startup if the catalog fallback ignores the active plugin-origin set.
  • Resolve merge risk (P1) - The upgrade guide gives incompatible directions for package installation and structured credentials.

Findings

  • [P1] Install Tencent’s QQ Bot package in the guide — docs/channels/qqbot.md:22
  • [P1] Respect the active plugin-origin fence in the fallback — src/secrets/channel-contract-api.ts:230
  • [P1] Keep approval-runtime authority out of the public SDK — src/plugin-sdk/gateway-runtime.ts:37
  • [high] Public SDK can mint approval-runtime authority — src/plugin-sdk/gateway-runtime.ts:37
Agent review details

Security

Needs attention: The new public gateway-runtime export exposes a token-bearing approval client that can establish device-less approval authority from any installed plugin.

Review metrics

Metric Value Why it matters
Production versus test delta production net-negative; tests net-positive The bundled channel is removed, while new compatibility and migration coverage adds test code; the exact split could not be recomputed because the PR-head Git object is absent from this partial clone.
Public SDK authority exports 1 added The gateway-runtime entrypoint is a third-party plugin API, and the new export constructs a privileged approval client.
QQ Bot secret compatibility paths 1 host fallback added; 1 contradictory migration instruction Existing credential behavior must stay consistent between schema validation, runtime resolution, and upgrade documentation.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/qqbot/doctor-contract-api.ts, migration/backfill/repair: src/plugins/manifest-registry-installed.test.ts, migration/backfill/repair: test/plugin-npm-runtime-build.test.ts, migration/backfill/repair: test/scripts/root-dependency-ownership-audit.test.ts, serialized state: src/plugins/manifest-registry-installed.test.ts, serialized state: test/scripts/plugin-gateway-gauntlet.test.ts, and 6 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Repair migration boundaries before merge (recommended)
    Fix the guide, preserve inactive-plugin secret behavior, and replace the public approval client with the injected runtime path.
  2. Accept the temporary SDK authority
    A security and SDK owner may explicitly approve the public authority contract with a documented removal condition.
  3. Pause the externalization
    Pause this PR if Tencent’s package cannot promptly migrate off the public approval authority contract.

Technical review

Best possible solution:

Preserve the catalog-based QQ Bot migration, but correct the Tencent install and SecretRef documentation, gate fallback resolution on the active external owner, and use the existing injected closure-bound approval runtime instead of exporting token-bearing authority publicly.

Do we have a high-confidence way to reproduce the issue?

Yes. Source inspection reproduces the stale install command and the approval-authority path; the fallback’s missing active-origin guard follows directly from its unconditional catalog return in the supplied PR diff and current runtime collector contract.

Is this the best way to solve the issue?

No. Externalizing QQ Bot fits the plugin ownership direction, but public device-less approval authority and an ungated host fallback are broader than the existing injected-runtime and active-owner seams.

Full review comments:

  • [P1] Install Tencent’s QQ Bot package in the guide — docs/channels/qqbot.md:22
    The branch removes the bundled QQ Bot owner and registers Tencent’s package, but this still directs fresh operators to @openclaw/qqbot. Scoped package specs bypass the catalog redirect, so update the command to Tencent’s package rather than leaving users to install the removed package or fail.
    Confidence: 0.99
  • [P1] Respect the active plugin-origin fence in the fallback — src/secrets/channel-contract-api.ts:230
    The fallback is returned after the record lookup filters against loadablePluginOrigins. Consequently, an absent or disabled QQ Bot plugin can still resolve a stale clientSecret SecretRef and block startup, contrary to the collector’s inactive-owner invariant. Return the catalog contract only when openclaw-qqbot is loadable, and cover the empty-origin case.
    Confidence: 0.96
  • [P1] Keep approval-runtime authority out of the public SDK — src/plugin-sdk/gateway-runtime.ts:37
    This re-export lets every installed plugin call a helper that supplies the process-local approval token, omits device identity, and is recognized by the Gateway as a trusted approval runtime. That client may resolve approvals despite reviewer-device binding; inject the existing closure-bound runtime instead, or obtain explicit SDK and security-owner approval for this public authority contract.
    Confidence: 0.98
  • [P2] Describe the SecretRef bridge accurately — docs/channels/qqbot.md:114-117
    The branch adds schema widening and a host fallback that resolves QQ Bot clientSecret SecretRefs, while these notes tell operators they must move them to env/file before upgrading. Document the supported host bridge or remove it; the current guide prescribes an unnecessary credential migration.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 459c70e14a2c.

Labels

Label justifications:

  • P1: Fresh QQ Bot installation is directed to the removed package, while the new secret fallback can turn stale inactive config into a startup failure.
  • merge-risk: 🚨 compatibility: The PR migrates a bundled channel to a renamed external plugin package and changes upgrade-time configuration handling.
  • merge-risk: 🚨 auth-provider: The cutover changes how QQ Bot credentials and structured SecretRefs are validated and resolved.
  • merge-risk: 🚨 security-boundary: The PR adds a public helper that establishes the host’s device-less operator-approval runtime.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (terminal): The maintainer comment includes an after-fix isolated-state install, channel setup, plugin listing, and Gateway startup transcript for Tencent’s package.
  • proof: sufficient: Contributor real behavior proof is sufficient. The maintainer comment includes an after-fix isolated-state install, channel setup, plugin listing, and Gateway startup transcript for Tencent’s package.

Evidence

Security concerns:

  • [high] Public SDK can mint approval-runtime authority — src/plugin-sdk/gateway-runtime.ts:37
    The exported helper sends the process-local approval token; the Gateway marks a local backend client with that token as approvalRuntime and permits approval resolution without reviewer-device identity.
    Confidence: 0.98

What I checked:

Likely related people:

  • Kevin Lin: Current-main blame covers the QQ Bot guide and approval-runtime SDK vicinity; the retained commit also contains the Gateway trust-path code. (role: recent approval-runtime and documentation contributor; confidence: medium; commits: 2d0c30fd654e; files: docs/channels/qqbot.md, src/gateway/server/ws-connection/connect-session.ts, src/plugin-sdk/gateway-runtime.ts)
  • steipete: All current PR commits and maintainer comments cover the externalization, catalog, update bridge, and compatibility decisions. (role: recent QQ Bot externalization contributor; confidence: high; commits: 22308b10516f, 459224ea8d5f; files: docs/channels/qqbot.md, src/plugins/update-channel.ts, src/plugins/official-external-plugin-catalog.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Replace the obsolete package command and reconcile the SecretRef guide with runtime behavior.
  • Gate the fallback on the active external plugin owner and add the unavailable-owner regression.
  • Remove the public approval-runtime export or secure explicit SDK and security-owner approval.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (25 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-11T10:54:11.260Z sha 5080bd5bd655b1eb935fccc5628dc69bb1ea9e4d :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T11:09:44.773Z sha ca55c1b8189d740b9cca90feda02cfea1c36befa :: found issues before merge. :: [P1] Keep approval runtime authority out of the public SDK
  • reviewed 2026-08-11T11:58:30.214Z sha 25668f07b66b79b00196632e20005aac82221163 :: found issues before merge. :: [P1] Keep approval authority out of the public SDK
  • reviewed 2026-08-11T12:21:05.860Z sha b1a56455858c9147cb2e2b8ca22ea5bb46bdf513 :: found issues before merge. :: [P1] Keep approval runtime authority out of the public SDK | [P1] Point the install command at Tencent’s package
  • reviewed 2026-08-11T12:59:06.706Z sha 9cd16ae9feaf964ec26d8439ceddb8548479bcc8 :: found issues before merge. :: [P1] Keep approval-runtime authority out of the public SDK | [P1] Point the QQBot guide at Tencent’s package | [P2] Align SecretRef migration guidance with the host fallback
  • reviewed 2026-08-11T14:01:56.984Z sha 16398b6 :: found issues before merge. :: [P1] Do not publish device-less approval authority | [P1] Update the QQBot installation command | [P2] Describe the SecretRef compatibility behavior accurately
  • reviewed 2026-08-11T15:59:33.715Z sha e27b67f :: found issues before merge. :: [P1] Keep approval runtime authority out of the public SDK | [P2] Describe the SecretRef compatibility bridge accurately
  • reviewed 2026-08-11T18:56:05.944Z sha 5690413b7da51eb2d1776b4932f80d71cbb6da88 :: found issues before merge. :: [P1] Keep approval runtime authority out of the public SDK | [P1] Point the QQ Bot guide at Tencent’s package | [P2] Describe the SecretRef bridge accurately

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 14, 2026
@sliverp
sliverp force-pushed the refactor/externalize-qqbot branch from 49f57f1 to b93f133 Compare July 15, 2026 03:55
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jul 15, 2026
@sliverp
sliverp force-pushed the refactor/externalize-qqbot branch 4 times, most recently from 2e2002a to ce9be43 Compare July 15, 2026 05:11
@ayaangazali

Copy link
Copy Markdown
Contributor

Heads up: this landed without regenerating the config-docs baseline, so pnpm config:docs:check has been failing on main ever since and every config-touching PR now looks like it is deleting schema coverage.

Reproduced with a bisect on unmodified checkouts, no local diff:

  • At 84c7d45f15c~1, the committed baseline is channel: 3716, plugin: 4040 and regenerating produces exactly 3716 / 4040. In sync.
  • At current main (a5420dfd91c), the committed baseline is still 3716 / 4040 but regenerating produces 3582 / 3997.
  • core is unchanged at 2295 in both, which rules out a broken local environment.

The gap is exactly this change: counting entries in the generated channel and plugin baselines at 84c7d45f15c~1 gives 134 paths under channels.qqbot and 43 plugin paths mentioning qqbot. 3716 minus 134 is 3582, and 4040 minus 43 is 3997.

pnpm config:docs:check exits 1 on unmodified main today with Hash mismatch: docs/.generated/config-baseline.sha256.

The practical damage is on contributor PRs rather than the repo itself. Any branch that touches config surface and correctly reruns the generators now commits the smaller, accurate counts, and automated review reads that as an unexplained contraction. Six of my open PRs picked up findings this round saying the branch "erases unrelated baseline coverage" or "records a broad unexplained surface contraction", when the branches are right and the committed budget is stale.

The fix looks like pnpm config:docs:gen on main plus committing the artifacts. I have not opened a PR for it: it is a one-command generated-artifact refresh on a change you own, and the repo treats standalone chore PRs of that shape as noise. Happy to send one if you would rather have it from outside.

Not urgent for correctness at runtime, since the baseline is a drift guard rather than a validation input. It is just currently guarding the wrong number.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: qqbot cli CLI command changes commands Command implementations dependencies-changed PR changes dependency-related files docker Docker and sandbox tooling docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts security Security documentation size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants