Repository navigation
fix(qqbot): honor the configured upgradeUrl in /bot-upgrade - #119357
ayaangazali wants to merge 4 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 11, 2026, 6:03 AM ET / 10:03 UTC. ClawSweeper reviewWhat this changesThe PR makes Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain The PR fixes a real current-main QQBot configuration defect at the command owner and preserves the public guide for unauthorised C2C senders. No code finding remains; redacted real delivery proof is still required before merge. Priority: P2 Review scores
Verification
How this fits togetherQQBot turns a C2C slash command into an outbound reply using the resolved account configuration and command authorization result. The configured guide may be an internal operator runbook, so the command must select it only for explicitly authorized senders. flowchart LR
A[C2C /bot-upgrade] --> B[QQBot command dispatcher]
B --> C[Explicit authorization check]
C --> D[Guide selection]
E[Resolved account configuration] --> D
F[Bundled public guide] --> D
D --> G[Outbound C2C reply]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +15, Tests +132, Docs +7. Total +154 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the clear command-boundary gate and attach redacted evidence that an authorized C2C sender receives the configured URL while an unauthorised sender receives the bundled public guide. Do we have a high-confidence way to reproduce the issue? Yes—current main accepts Is this the best way to solve the issue? Yes—the command handler owns the reply text, already receives both the resolved account configuration and authorization fact, and avoids adding a second policy path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f11b08c58361. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
CI is red here on All six failures are in one suite, Those are real-Gateway RPC timeouts in a PTY end-to-end suite. This PR changes two files, both under The same class of failure is showing up on
Both took I cannot rerun the job myself ( For what it is worth on the parts I can control: |
|
Following up on the CI red with the check I had skipped, plus the counter-evidence against my own first read. The fair counter-signal first: The one plausible mechanism was that this PR adds a static import ( The subpath was already in use elsewhere in this plugin ( With that ruled out, what is left points away from this diff:
So my read is a flaky real-backend E2E rather than a regression from this change, and the passing runs elsewhere are consistent with intermittency rather than with the job being healthy for every run. I am not pushing a speculative commit to retrigger, and I cannot rerun it myself ( Local state on the changed surface: |
|
The identical failure is happening on two of my open PRs whose diffs have nothing in common:
Both fail the same way, in the same suite: There is no single change that is simultaneously in the embedded agent runner and in a QQBot command string, so a shared real-Gateway PTY end-to-end suite timing out on 30s RPCs is the far more likely explanation than either diff. Supporting detail: the string I am not pushing speculative commits to retrigger, and I cannot rerun jobs myself ( |
|
Two things: the CI answer you asked for, and stronger proof so this PR is not sitting on unit tests alone. On My read is unchanged and I will restate it compactly, because it is cross-PR rather than a guess about my own diff:
I still cannot rerun jobs myself ( Stronger proof, which is what the review actually asked for. My earlier tests called the command handler through the registry, which proves wiring but not the reply an operator sees. The new test drives The first case asserts the configured URL is present and the bundled Full gates on the new head: If a redacted live QQBot C2C transcript is still required on top of this, say so and I will arrange one rather than keep substituting harness evidence for it. |
|
P3 fixed on Document the activated QQBot upgradeUrl setting. Fair, and the timing note is fair too: the gap predates this PR, but this PR is what makes the setting actually do something, so it belongs here. I deliberately did not document a root-versus-account precedence order. I verified that That restraint is deliberate: earlier in this PR series I described intended rather than observed behavior three times and had to correct it each time. Validation on The real QQBot C2C delivery proof is still outstanding. I do not have a live QQBot account, so unless a mock-gateway verdict artifact would satisfy it, that one stays open and I am not going to dress up the mocked dispatcher test as something it is not. |
|
Security P1 fixed on Do not reveal custom guides to unauthorised C2C senders. Confirmed rather than taken on faith: The gate is now The part I want to own explicitly: my own test was demonstrating the leak and I did not notice. Tests now cover both dispatch paths, and the deliberate break makes the leak explicit. Removing the gate fails Docs updated in the same change, since the previous wording would now be wrong: the note says the configured guide goes only to a sender on the explicit non-wildcard allowlist and that every other C2C sender gets the bundled link. Validation on
On the outstanding real-behavior proof: I still do not have a live QQBot C2C account, so that one remains genuinely open rather than quietly satisfied. If a mock-gateway verdict artifact would qualify, say so and I will produce one; otherwise this needs someone with a QQBot account. |
channels.qqbot.upgradeUrl documents itself as the URL /bot-upgrade returns, but the handler took no context and always emitted the bundled constant, so the key validated and did nothing. Read it from ctx.accountConfig with the bundled guide as fallback.
Drives /bot-upgrade through trySlashCommand with a real account config and asserts the text sent to the chat, rather than calling the handler directly.
The command table listed /bot-upgrade without telling operators which key controls the link it returns, so the setting this PR activates was not discoverable.
/bot-upgrade is deliberately outside the allowlist, so returning the operator-configured upgradeUrl exposed a potentially private runbook to any C2C contact. Authorized senders get the configured guide; everyone else keeps the bundled public link.
b6c6b61 to
fe64c71
Compare
|
Closing this: main removed the bundled QQBot source, so the file this patches no longer exists in the repo.
There is nothing to salvage by rebasing, since the change has no home here any more. One thing I would rather not see lost, and it is not the original fix. Beyond honoring If the extracted plugin carried the original behavior across, it very likely carried that hole with it, since it predates my change. Worth a look by whoever owns the Tencent package; I am happy to open it there if you point me at the right repo, and I am not going to file anything speculatively against a package I have not read. Closing rather than leaving it open, since a PR against deleted files only costs reviewers time. Thanks for the reviews on it, and the authorization finding in particular was a good catch on my own regression. |
What Problem This Solves
channels.qqbot.upgradeUrlis documented by its own type as the URL the/bot-upgradecommand returns, and the command ignores it.extensions/qqbot/src/types.ts:105-108:extensions/qqbot/src/engine/commands/builtin/register-basic.ts, before this change:The handler takes no context and always emits the bundled constant, so an operator who points
upgradeUrlat their own internal upgrade runbook still sees the publicq.qq.comlink. The key validates,openclaw config getechoes it back, and it changes nothing. Nothing anywhere in the repo reads it: outside the schema and the type declaration there are no references toupgradeUrlinextensions/qqbotor in core.This is the silent class rather than a loud one. There is no error to tell the operator the setting is inert, and the command still answers confidently with the wrong URL, which is worse than not answering.
Why This Change Was Made
The fix is to read the key that already exists rather than to add surface. The handler now takes
ctxand prefers the configured URL, falling back to the bundled guide:ctx.accountConfigwas already available to handlers and is used the same way by sibling commands (register-streaming.ts:37readsctx.accountConfig?.streaming,register-group-allways.ts:32readsctx.accountConfig?.defaultRequireMention), so this follows the established shape rather than inventing one.accountConfigis typedRecord<string, unknown>, so the value is narrowed with the existingnormalizeOptionalStringhelper instead of a cast; a blank or whitespace-only value falls back to the default rather than emitting an empty link.No config, schema, or default surface changes. The behavior only differs for operators who had already set the key, and for them it starts doing what its documentation says.
One thing I did not fix, on purpose
upgradeMode(extensions/qqbot/src/types.ts:110-114) is the sibling key, and it is inert in a way I did not want to resolve unilaterally:The
"doc"behavior is what the command already does. The"hot-reload"in-place npm update flow does not exist anywhere in the plugin. Making it real is a feature with obvious safety questions (a bot command that runs an in-place package update), and quietly deleting a documented mode is a product call, so both belong with a maintainer rather than in this PR. Happy to follow up either way once you say which.User Impact
Operators who set
channels.qqbot.upgradeUrl, for example to an internal runbook, now get that URL from/bot-upgrade. Everyone else sees the same bundled guide as before.Evidence
node scripts/run-vitest.mjs extensions/qqbot: 86 files / 767 tests passing.Two cases added to
slash-commands-impl.test.tsdrive the real registered command throughSlashCommandRegistryrather than calling a helper: one asserts a configured URL is returned and the bundled constant is absent, one asserts the fallback for both an unset key and a whitespace-only value.I checked the test actually pins the behavior by breaking the fix on purpose (forcing
configuredUrltoundefined) and re-running:then restored it and got 14/14.
Gates:
check-extension-package-tsc-boundary.mjsexit 0,generate-bundled-channel-config-metadata.ts --checkclean, oxlint clean on both changed files,git diff --checkclean.Worth noting that the boundary check earned its keep here. My first version used
ctx.accountConfig?.upgradeUrl?.trim(), which passes Vitest (no typecheck) but failsTS2339: Property 'trim' does not exist on type '{}'becauseaccountConfigisRecord<string, unknown>. The narrowing above is the fix.AI-assisted: written with AI assistance. I read the command registry, the handler, the sibling commands that consume
accountConfig, and the type declarations myself, and ran the tests, the deliberate-break check, and the gates locally.