Skip to content

fix(auto-reply): restore channel-authorized /new and /reset on non-owner-enforced channels - #125618

Merged
steipete merged 3 commits into
openclaw:mainfrom
chelsealong:fix/reset-authorization-non-owner-enforced-channels
Aug 29, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
chelsealong:fix/reset-authorization-non-owner-enforced-channels

Conversation

@chelsealong

@chelsealong chelsealong commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #125540

What Problem This Solves

Fixes an issue where channel-authorized users cannot run /new or /reset after an operator configures a separate commands.ownerAllowFrom list, even when the channel plugin does not enforce owner-only commands. The reported Feishu/Lark per-peer session remains unchanged; the same shared-policy defect also affects Buzz.

Why This Change Was Made

The command-authorization owner now makes one closed decision: denied, reset-only, or ordinary commands. Session initialization, archived-session admission, and reset handling consume that decision without reconstructing policy downstream. The separate reset-authorization module is removed, as is a redundant native-command authorization branch. Reset-only access does not grant ordinary command authority or owner status.

Explicit commands.allowFrom denials, including an empty provider-specific list overriding a wildcard global list, remain authoritative. Plugin-enforced owner policy and internal Gateway scope requirements remain intact. Both published SDK authorization types, inferred resolver return types, and the runtime authorization object's seven own keys are unchanged; no optional policy flags are added to the public contract.

This is a maintainer rewrite of the editable contributor PR, preserving @chelsealong's credit and its explicit-denial correction. A raw-admission fallback would reopen the explicit-allowlist bypass; exporting policy flags would unnecessarily expose internal decisions and leave reset policy duplicated. Keeping the decision inside its existing owner is the better fit.

Provenance: the strict reset gate was introduced by commit 5c1c9f42d665d3d04a0a8bb023084e29b93704e7 in #118580 (2026-08-03), code author Pavan Kumar Gondhi, PR author and merger @pgondhi987. That change correctly protected owner-enforcing channels but also suppressed admitted non-owner resets on other plugins. This repair retains that protection rather than reverting it globally.

User Impact

Admitted users on non-owner-enforcing channels can again reset the session selected by the channel's existing routing. Feishu per-channel-peer routing stays peer-scoped; Buzz remains room-scoped, with thread reply placement unchanged. No session-key, storage-schema, configuration, dependency, or protocol changes are introduced.

The slash-command documentation now explains reset-only admission and explicit deny-all behavior. It also corrects a misleading example: enforceOwnerForCommands is plugin policy, not an openclaw.json setting.

Release-note context: restore channel-authorized session resets without widening ordinary command or owner authority; preserve explicit command allowlists and owner-enforcing plugin policy. Thanks @chelsealong.

Evidence

The maintainer's new regression cases fail against the unfixed owner: seven failures and thirteen passing denial/compatibility controls. Applying this rewrite makes the identical twenty cases pass. The broader owner/sibling run passes all 533 tests across nine files:

node scripts/run-vitest.mjs src/auto-reply/reply/session.test.ts src/auto-reply/reply/commands-reset-hooks.test.ts src/auto-reply/command-control.test.ts src/plugin-sdk/command-auth.test.ts src/auto-reply/reply/dispatch-from-config.delivery.test.ts src/auto-reply/command-auth.owner-default.test.ts src/auto-reply/reply/session-reset-model.test.ts src/auto-reply/reply/session-reset-cleanup.test.ts src/auto-reply/reply/session-reset-prompt.test.ts

Coverage observes real session initialization and SQLite lifecycle revisions, reset acknowledgments without inference, CLI-binding cleanup, transcript reset events, archived-session admission, other-peer preservation, native/text command parity, explicit deny/grant/empty policy, provider-resolution errors, owner-enforcing plugins, and internal scope/Provider-vs-Surface precedence. The SDK assertions cover both published facades.

Independent Codex review of the rewritten diff and full owner context found no actionable P0–P2 issues. The canonical changed-file check plan is complete, including core/plugin production and test types, SDK export/surface checks, lint, unused exports, import cycles, database/schema and authorization guards. Initial checks caught two test-only typing/lint mistakes; both were corrected and their affected tests and gates passed.

The first exact-head CI run failed only the production lint-suppression inventory: newly landed #132399 (code author, PR author and merger @steipete) added a second packaged-bootstrap credential-redaction catch while the allowance remained one. The two operations now share one local execution/error owner, preserving redaction-before-truncation, the bounded diagnostic, contextual messages, execution ordering and omission of raw causes. Current main subsequently raised that allowance to two in #132394; this PR shrinks it back to the one remaining intentional suppression. The original failing test passes, as do real child-process failures and startup cleanup. Type checking caught a nullable environment capture during repair; the prepared command now captures its validated environment before the callback, and final types/lint/guards pass.

The second exact-head CI run exposed a current-main core-lint failure: #132099 (code author, PR author and merger @sjf-oa) added an unsafe-timestamp migration regression that took its test module over the existing 1,000-line limit. The failure also reproduced directly on main. A fixture-only extraction was prepared and verified here, but #132444 independently landed a smaller equivalent extraction while this candidate built. The resulting merge conflict is resolved by retaining that main fix and dropping our redundant extraction. Every migration test remains, and all 15 cases plus targeted lint pass after integration. No migration/schema change, raised limit or new suppression is carried in this PR.

Final candidate b0c8a4f95ff41d4e6d9f5cebde21f86d5c9c2e05 integrates pinned main 0120daca2b49c29c92037c84a1286833ef524a90. Reset policy, QA redaction and suppression-shrink patches have identical range-diffs; only the now-redundant test extraction was dropped. Before this test-only main integration, 650 tests passed across 14 files/five shards, with one existing QA skip; all 19 affected migration/tooling cases and migration lint pass again afterward. All ten native-command/owner-default cases pass again. Assertion-safety, conflict and changed-file types/lint gates passed. Final-head normal build (5m14s), private QA build (52s), canonical build stamp, and real Buzz proof below passed. Exact-head CI and the required openclaw/ci-gate completed successfully before native landing.

Review disposition: the earlier whole-candidate independent P0–P2 review was clean. The final refresh raised one native-command-access concern, rejected after inspecting the complete decision: !requireOwner makes isOwnerForCommands unconditionally true, so the removed native allowance cannot add access. The existing native no-owner and explicit-owner-denial cases exercise both sides of that invariant. No policy branch is reintroduced for an unreachable state.

Real Buzz before/after proof

The pre-fix compiled Gateway reproduced the failure against the official Buzz service, using signed events from a genuinely admitted non-owner and two independently authenticated bot accounts. /reset produced no reset acknowledgment, changed neither target nor control-room lifecycle, and invoked no model. An ordered normal-message barrier then succeeded, showing the command failure was not an offline transport. The run intentionally failed and retained its RED receipt.

After-fix verification passed on final head b0c8a4f95ff41d4e6d9f5cebde21f86d5c9c2e05, following three earlier passing candidate runs with the identical driver. Threaded /reset and top-level /new each produced a different durable lifecycle revision, retained the stable session ID, and returned exactly one signed acknowledgment with zero additional model requests. The second account/room stayed unchanged. The compiled CLI then set commands.allowFrom.buzz=[]; after the owned restart, both commands were denied without lifecycle mutation or a reset acknowledgment. Ordered ordinary-message barriers still succeeded, with only those barriers invoking the mock model.

{
  "head": "b0c8a4f95ff41d4e6d9f5cebde21f86d5c9c2e05",
  "liveBuzzVerdict": "PASS",
  "allowedResetCases": 2,
  "explicitDenyCases": 2,
  "modelRequestsForResetCommands": 0,
  "modelRequestsForSeedsAndLivenessBarriers": 5,
  "otherAccountRoomUnchanged": true,
  "runtimeUnchanged": true,
  "gatewayAndMockPortsClosed": true,
  "nativeClientsClosed": 3,
  "taskKeyCopiesRemoved": 2,
  "effectiveProfilesUnchanged": 4
}

Official service revision: 4f554b6385065b698db819498a6f359b17a45459. Final frozen runtime SHA-256: 334e04310977afb4eb3f4e022616c966b2abe912f81853741adeb6da0cc68b4d. Driver SHA-256: aa06a4f889fe2b02ca9a32f7c1cf915a72760e06c2cb16163bafe8eedd2431bd. Final receipt SHA-256: 9393b44264cdfe95464d6cb358147fe454b7a0b9ee0396937b158207affd1749.

The Buzz relay, authentication, signatures, compiled Gateway, CLI and SQLite lifecycle are real; model responses are mocked. This is not a live Feishu or WhatsApp transport claim. Their shared policy and original Feishu peer-routing behavior are covered by owner-boundary tests. Temporary Gateway processes, ports, native clients, key copies, effective profiles, and frozen runtime hashes are checked during cleanup.

Review and scope

Production LOC: +109/-99 (net +10), including the separate QA CI repair (+47/-45). Tests and test support: +495/-137. Docs: +11/-5. The reset owner adds eight lines to retain the shipped SDK projection while keeping reset-only state private; the old policy module and redundant native path are deleted. The QA owner adds two lines to unify two credential-bearing execution boundaries while reducing the current-main suppression allowance. No additional compatibility shim is introduced.

The latest ClawSweeper review found no introduced P0–P2 defect and requested resolution of exact-head CI. The maintainer accepts the intentional restoration of reset-only admission and the explained production delta, with explicit-denial, scope and durable-session controls covered by tests and live evidence. Final mergeability and exact-head CI will be checked before native landing.

AI-assisted: Yes.

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 3:15 AM ET / 07:15 UTC.

ClawSweeper review

What this changes

The branch restores /new and /reset for channel-authorized non-owners on channels without owner enforcement, while preserving explicit command denials and Gateway scope checks.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open. Current main still denies reset whenever ordinary command authorization is false, so the reported regression remains; the proposed private reset-only tier repairs that split without an introduced correctness finding. Exact-head CI is still in progress before merge.

Priority: P1
Reviewed head: 994b065ada00acb1dfdd037e8f857b9c13497028

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A well-scoped owner-boundary repair with strong focused coverage and supplied real behavior evidence; current-head CI completion remains the practical merge gate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The changed production owner is the central command authorization path consumed by session initialization and reset dispatch. The supplied compiled-Gateway Buzz before/after trace exercises reset acknowledgement, lifecycle mutation, explicit deny-all, and isolation of another room; the final commit only consolidates QA bootstrap error redaction, whose real child-process fixtures cover the error boundary.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The changed production owner is the central command authorization path consumed by session initialization and reset dispatch. The supplied compiled-Gateway Buzz before/after trace exercises reset acknowledgement, lifecycle mutation, explicit deny-all, and isolation of another room; the final commit only consolidates QA bootstrap error redaction, whose real child-process fixtures cover the error boundary.
Evidence reviewed 8 items Current-main regression remains: Current main's reset helper rejects any sender whose public authorization projection is false; its command policy makes a channel-admitted non-owner false when a global owner list is configured.
Canonical repair owner: The branch records denied, reset-only, and ordinary-command outcomes in the command authorization owner; explicit command allowlists and plugin owner enforcement produce denied before reset admission.
Reset effects consume the canonical decision: Both session initialization and command dispatch call the shared reset authorization before recognizing or handling reset commands.
Findings None None.
Security None None.

How this fits together

Inbound channel messages pass admission and central command authorization before reset handlers can change session lifecycle state. The PR adds a private reset-only outcome to that shared decision rather than granting ordinary command authority.

flowchart LR
  A[Inbound channel message] --> B[Channel admission]
  B --> C[Command authorization]
  C --> D{Denied, reset-only, or commands}
  D --> E[Session reset handlers]
  D --> F[Ordinary command handlers]
  E --> G[Durable session lifecycle]
Loading

Before merge

  • Resolve merge risk (P1) - Merging intentionally restores session-reset authority for channel-admitted non-owners; explicit command allowlists, owner-enforcing plugins, and Gateway scopes must remain the controlling restrictions.
  • Resolve merge risk (P1) - Production code is net +10 lines across the private access-tier and shared QA redaction owner; this is justified by removing duplicate policy/error paths, but exact-head CI remains incomplete.
  • Complete next step (P2) - No repair finding remains; the maintainer-facing next action is completion of exact-head CI and normal merge gating.
Agent review details

Security

None.

PR surface

Source +41, Tests +327, Docs +6. Total +374 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 6 196 155 +41
Tests 4 407 80 +327
Docs 1 11 5 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 614 240 +374

Review metrics

Metric Value Why it matters
Production versus test delta production +109/-99 (net +10); tests/test support +494/-136; docs +11/-5 The small production increase establishes one private access tier and one shared redaction boundary while the larger test change covers reset lifecycle and authorization controls.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #125540
Summary: This PR is the focused candidate repair for the reported reset-authorization regression.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete exact-head validation (recommended)
    Wait for the current head’s required CI to finish green, then merge the verified owner-boundary repair.
  2. Pause if a control fails
    Do not merge if final checks expose a change to explicit deny, owner-enforcing, or Gateway-scope behavior; repair that control at the central authorization owner.

Technical review

Best possible solution:

Keep reset-only authorization private inside the central policy owner, retain the explicit-denial and owner-enforcement controls, and merge once the exact current head’s required checks are green.

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

Yes, source-reproducible: current main rejects reset at src/auto-reply/reply/reset-authorization.ts:13 whenever the owner-gated public command projection is false. The supplied compiled-Gateway before/after Buzz evidence independently matches that path.

Is this the best way to solve the issue?

Yes. The branch puts the closed reset-only decision in the existing command-authorization owner and both reset entry points consume it, avoiding a raw-admission bypass or public SDK expansion.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: This repairs a current regression that silently prevents admitted users on affected channels from resetting their own session.
  • merge-risk: 🚨 compatibility: Existing channel admission, owner allowlists, and command allowlists determine the changed authorization result.
  • merge-risk: 🚨 session-state: The restored commands create or reset durable session lifecycle state.
  • merge-risk: 🚨 security-boundary: The branch intentionally changes which admitted non-owner principals may invoke a session-mutating action.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The changed production owner is the central command authorization path consumed by session initialization and reset dispatch. The supplied compiled-Gateway Buzz before/after trace exercises reset acknowledgement, lifecycle mutation, explicit deny-all, and isolation of another room; the final commit only consolidates QA bootstrap error redaction, whose real child-process fixtures cover the error boundary.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed production owner is the central command authorization path consumed by session initialization and reset dispatch. The supplied compiled-Gateway Buzz before/after trace exercises reset acknowledgement, lifecycle mutation, explicit deny-all, and isolation of another room; the final commit only consolidates QA bootstrap error redaction, whose real child-process fixtures cover the error boundary.

Evidence

What I checked:

  • Current-main regression remains: Current main's reset helper rejects any sender whose public authorization projection is false; its command policy makes a channel-admitted non-owner false when a global owner list is configured. (src/auto-reply/reply/reset-authorization.ts:13, c28cf4fb7563)
  • Canonical repair owner: The branch records denied, reset-only, and ordinary-command outcomes in the command authorization owner; explicit command allowlists and plugin owner enforcement produce denied before reset admission. (src/auto-reply/command-auth.ts:348, 994b065ada00)
  • Reset effects consume the canonical decision: Both session initialization and command dispatch call the shared reset authorization before recognizing or handling reset commands. (src/auto-reply/reply/session.ts:553, 994b065ada00)
  • Boundary regression coverage: The table-driven lifecycle test covers admitted non-owners, Feishu peer-scoped sessions, explicit command denies, owner-enforcing plugins, and internal write versus admin scopes while asserting lifecycle and acknowledgment effects. (src/auto-reply/reply/session.test.ts:3423, 994b065ada00)
  • SDK projection remains stable: The public authorization object and both resolver return types remain the existing seven-key projection; reset-only state is private to the owner. (src/plugin-sdk/command-auth.test.ts:51, 994b065ada00)
  • QA refactor preserves credential handling: The supplementary QA change centralizes both packaged bootstrap operations behind redaction-before-truncation and discards the raw cause; its child-process fixtures assert the secret is absent from both error and cause. (extensions/qa-lab/src/gateway-child-setup.ts:114, 994b065ada00)

Likely related people:

  • steipete: Local blame attributes the surrounding command and session paths to Peter Steinberger, and the focused repair was introduced in the current branch history. (role: recent authorization and session contributor; confidence: high; commits: 63440143a764, 89c2343c6fb0; files: src/auto-reply/command-auth.ts, src/auto-reply/reply/session.ts)
  • pgondhi987: The prior merged reset-authorization change is the directly related policy history for the repaired behavior. (role: prior reset-policy contributor; confidence: high; commits: 5c1c9f42d665; files: src/auto-reply/reply/reset-authorization.ts)

Rank-up moves

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

  • Let required checks for the exact current head complete green before merging.

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 (5 earlier review cycles)
  • reviewed 2026-08-18T06:13:13.591Z sha bf624dea246ceb399d262b52c0f2fb9b6e15785c :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-21T12:30:49.443Z sha bf624dea246ceb399d262b52c0f2fb9b6e15785c :: needs real behavior proof before merge. :: [P1] Preserve commands.allowFrom when authorizing resets
  • reviewed 2026-08-21T15:27:35.633Z sha 89325659038ca01fa96cabb824b05d650368e298 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-22T01:23:22.019Z sha 89325659038ca01fa96cabb824b05d650368e298 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-29T06:46:05.079Z sha 8950a40980ef52179a3971d7ce62f0b7410655a4 :: needs maintainer review before merge. :: none

@chelsealong

Copy link
Copy Markdown
Contributor Author

Added the requested real-behavior boundary proof to the PR body: drove the actual maybeHandleResetCommand dispatch entrypoint (not just the exported isResetAuthorizedForContext predicate) with a registered Feishu-shaped (non-enforcing) and WhatsApp-shaped (enforceOwnerForCommands: true) test channel plugin. Captured output shows the non-enforcing channel rotates the session (reset hook fires, "✅ Session reset.") while the enforcing channel denies the same non-owner sender (no hook, no reply) — exactly the boundary distinction this fix restores. No production or test code changed in this update.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Aug 18, 2026
@chelsealong

Copy link
Copy Markdown
Contributor Author

Made the requested SDK-compat fix: CommandAuthorization.enforceOwnerForCommands (src/auto-reply/command-auth.ts:31) is now optional instead of required, so existing downstream TypeScript code constructing this re-exported Plugin SDK type still compiles. isResetAuthorizedForContext already treated a falsy/absent value as non-enforcing, so no behavior change. Verified: pnpm test src/auto-reply/reply/reset-authorization.test.ts src/auto-reply/command-auth.owner-default.test.ts src/auto-reply/command-control.test.ts (62 passed), pnpm tsgo, pnpm check:test-types, and pnpm plugin-sdk:surface:check all pass clean. Pushed as bf624dea246.

@chelsealong

Copy link
Copy Markdown
Contributor Author

Looked into the "Add real behavior proof" ask (live Feishu/Lark output or an ephemeral-Gateway verdict JSON).

Live Feishu/Lark transport proof isn't producible here: docs/concepts/qa-e2e-automation.md only documents live QA transport lanes for Buzz, Discord, Matrix, Slack, Telegram, and WhatsApp — there is no Feishu/Lark live lane or credential pool in this repo to run against, with or without maintainer creds.

Correction to my own earlier claim: the PR body says no checked-in mock-gateway harness exists for this boundary — that's wrong. extensions/qa-channel + extensions/qa-lab + qa/scenarios/channels/*.yaml is exactly that harness (ephemeral child Gateway, synthetic channel, mock-openai provider, no live creds), and qa-channel itself never sets enforceOwnerForCommands, so it's a natural non-enforcing-channel stand-in for Feishu. I built a scenario on it (commands.ownerAllowFrom via gatewayConfigPatch, non-owner /reset) and ran it with pnpm openclaw qa suite: against pre-fix source it reproduces the reported regression exactly (times out, zero reply — the silent drop from commands-reset.ts:122-126); against the post-fix source on this branch it was inconsistent across repeated runs (passed once, then intermittently routed the same /reset text to the model instead of the command handler) in ways I can't yet root-cause. Since I can't explain that flakiness, I'm not committing the scenario or citing it as passing evidence — that would overstate what I actually verified.

No code or test changes in this pass. The previously posted driven-handler trace and unit tests are unchanged; per the review's own "Accept mock-only evidence" option, that disposition is a maintainer call.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 21, 2026
@chelsealong

Copy link
Copy Markdown
Contributor Author

Addressed the P1 finding: exposed commandsAllowFromEnforced from resolveCommandAuthorization (src/auto-reply/command-auth.ts) — true when isAuthorizedSender was decided from a configured commands.allowFrom policy (or a provider-resolution error with commands.allowFrom configured) rather than raw channel ingress/native admission. The reset gate (src/auto-reply/reply/reset-authorization.ts:16-19) now only falls back to params.commandAuthorized when neither enforceOwnerForCommands nor commandsAllowFromEnforced applies, so a configured commands.allowFrom denial stays authoritative and can no longer be bypassed by raw channel admission on non-enforcing channels.

Added a regression case ("denies a channel-admitted sender excluded by a configured commands.allowFrom") that fails on pre-fix code (AssertionError: expected true to be false) and passes post-fix. Full local proof:

$ pnpm test src/auto-reply/reply/reset-authorization.test.ts src/auto-reply/command-auth.owner-default.test.ts src/auto-reply/command-control.test.ts
Test Files  2 passed (2)
     Tests  63 passed (63)

$ pnpm test src/auto-reply/reply/session.test.ts
Test Files  1 passed (1)
     Tests  166 passed (166)

$ pnpm test src/auto-reply
Test Files  187 passed | 1 skipped (188)
     Tests  4292 passed | 2 skipped (4294)

Also clean: node scripts/run-oxlint.mjs, oxfmt --check, pnpm tsgo, pnpm check:test-types, pnpm plugin-sdk:surface:check (additive optional field, no forbidden subpaths). Pushed as 893256590.

I did not attempt a new ephemeral-Gateway/live-channel run for this pass — the existing unit/boundary proof already covers the changed branch, and the prior attempt at that harness was reported as flaky for unrelated reasons.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 21, 2026
@chelsealong

Copy link
Copy Markdown
Contributor Author

Ran the ephemeral-Gateway qa-channel scenario the prior pass couldn't root-cause. Post-fix (89325659038c), the non-owner-sender /reset under commands.ownerAllowFrom rotates the session and delivers "✅ Session reset." (4/6 clean passes); pre-fix (90526f3a9c873bac9ce822b9695ff3d7724a7672) reliably reproduces the reported silent drop. The 2/6 intermittent failures happen at the plain seed message before /reset is ever sent — correlated with memory-core's non-owner "intent tool unavailable" path (extensions/memory-core/index.ts:159-161), not with the changed command-auth.ts/reset-authorization.ts — so it's a pre-existing harness timing hazard for non-owner-sender turns, not something this diff introduces. Full run output and analysis are in the PR body. Not committing the scenario since it's occasionally flaky for reasons outside this PR's diff.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 22, 2026
@steipete steipete self-assigned this Aug 29, 2026
@steipete
steipete force-pushed the fix/reset-authorization-non-owner-enforced-channels branch from 8932565 to 8950a40 Compare August 29, 2026 06:33
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: L and removed size: S labels Aug 29, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer rewrite pushed to the existing contributor branch as 8950a40980ef52179a3971d7ce62f0b7410655a4, retaining @chelsealong's credit and explicit-allowlist denial fix. Reset-only permission now stays inside the canonical authorization owner; the old reset-policy module and redundant native branch are removed, and both public SDK result contracts remain unchanged.

The new owner regression tests reproduced seven failures before the fix and now pass with all thirteen denial/compatibility controls. The broader 533-test run, corrected final 17 session/six SDK cases, canonical local gates, normal build, and fresh independent review are complete. A real compiled Gateway against official Buzz reproduced the original failure. The after-fix live run and new-head CI are still pending, so this is a review request rather than a merge-ready claim. The PR body now describes the rewritten implementation, provenance, test evidence and remaining proof precisely.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@steipete
steipete force-pushed the fix/reset-authorization-non-owner-enforced-channels branch from 8950a40 to 994b065 Compare August 29, 2026 07:04
@steipete
steipete force-pushed the fix/reset-authorization-non-owner-enforced-channels branch from 994b065 to 4c8f1b9 Compare August 29, 2026 07:36
steipete and others added 3 commits August 29, 2026 00:38
Keep reset-only admission inside command authorization while preserving
explicit command denials, plugin owner enforcement, internal Gateway scopes,
and the published authorization object. Remove the duplicate reset policy
module and redundant native branch, and prove durable session effects and
acknowledgments across text, native, peer, and owner-policy cases.

Restore /new and /reset for admitted senders without granting ordinary
command or owner authority. Correct the slash-command policy documentation.

Fixes openclaw#125540
Co-authored-by: chelsealong <[email protected]>
Route auth bootstrap and packaged plugin preparation through one local
execution boundary that redacts and bounds diagnostics without retaining
credential-bearing causes. Preserve command ordering and the existing
single-suppression baseline.

Fixes the tooling CI regression exposed after openclaw#132399 while preparing
openclaw#125618. The unchanged suppression test fails before and passes after;
real child-process failure and startup cleanup tests pass.
@steipete
steipete force-pushed the fix/reset-authorization-non-owner-enforced-channels branch from 4c8f1b9 to b0c8a4f Compare August 29, 2026 07:45
@steipete

Copy link
Copy Markdown
Contributor

Maintainer verification for head b0c8a4f95ff41d4e6d9f5cebde21f86d5c9c2e05:

The reset policy is now owned by the existing command-authorization decision, with a private reset-only outcome. It does not grant ordinary commands or owner status. Explicit command denials, owner-enforcing plugins, internal scope checks, and the published seven-key SDK projection remain intact. The duplicate reset-policy module and redundant native branch are removed. Contributor @chelsealong's credit is preserved.

The original failure reproduced both in owner regressions and through the actual compiled Gateway against official Buzz. The unchanged live driver passes on the final head: threaded /reset and top-level /new each preserve session identity, rotate its durable lifecycle revision, and return one signed acknowledgment with zero inference. Applying commands.allowFrom.buzz=[] through the real compiled CLI then denies both commands; ordered ordinary-message barriers prove transport liveness. The other account/room is unchanged. The relay, authentication, signatures, CLI, Gateway and SQLite lifecycle are real; the model is mocked. This is not a live Feishu/WhatsApp transport claim.

Final proof receipt SHA-256: 9393b44264cdfe95464d6cb358147fe454b7a0b9ee0396937b158207affd1749. Frozen runtime SHA-256: 334e04310977afb4eb3f4e022616c966b2abe912f81853741adeb6da0cc68b4d. All three clients closed, two key copies were removed, four effective profiles stayed unchanged, and the owned Gateway/process listeners were independently verified stopped. No retained service was torn down.

Local validation included:

node scripts/run-vitest.mjs src/auto-reply/reply/session.test.ts src/auto-reply/reply/commands-reset-hooks.test.ts src/auto-reply/command-control.test.ts src/plugin-sdk/command-auth.test.ts src/auto-reply/reply/dispatch-from-config.delivery.test.ts src/auto-reply/command-auth.owner-default.test.ts src/auto-reply/reply/session-reset-model.test.ts src/auto-reply/reply/session-reset-cleanup.test.ts src/auto-reply/reply/session-reset-prompt.test.ts
node scripts/run-vitest.mjs test/scripts/lint-suppressions.test.ts src/infra/state-migrations.media-persistence.test.ts
node scripts/run-vitest.mjs src/auto-reply/command-auth.owner-default.test.ts
pnpm build
OPENCLAW_BUILD_PRIVATE_QA=1 node --import ./scripts/tsx.mjs scripts/build-all.mts qaRuntime
node --import ./scripts/tsx.mjs scripts/write-build-info.ts

The broader integrated run passed 650 tests with one existing skip. Following the mechanical test-only integration, all 19 affected migration/tooling tests, migration lint, and ten native/owner controls passed again. Changed-file types/lint/SDK/architecture/database/authorization checks passed. Normal final build took 5m14s; private QA build took 52s.

Two earlier CI failures were addressed without weakening checks: packaged-bootstrap redaction now has one canonical catch, shrinking the current-main suppression inventory; the migration-test line-limit repair is provided by already-landed #132444, so our redundant extraction was dropped. The fresh independent review's sole concern was an impossible native-access state: !requireOwner already makes isOwnerForCommands=true. Full code inspection and existing native controls disprove the alleged regression; no accepted actionable findings remain. The latest ClawSweeper review has no code finding, and its exact-head-CI rank-up is addressed below. Production +109/-99 (net +10), tests/support +495/-137, docs +11/-5; the small production growth preserves the existing public contract and removes duplicated policy/redaction paths.

Exact-head CI33241566470 completed successfully. The reviewed candidate is ready for the repository-native prepare/merge flow. The remaining proof limitation is live Feishu/WhatsApp transport, not the shared policy or Buzz flow; no schema or native reaction capability is included.

@steipete
steipete merged commit 562aead into openclaw:main Aug 29, 2026
276 of 278 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 30, 2026
…ner-enforced channels (openclaw#125618)

* fix(auto-reply): restore admitted non-owner session resets

Keep reset-only admission inside command authorization while preserving
explicit command denials, plugin owner enforcement, internal Gateway scopes,
and the published authorization object. Remove the duplicate reset policy
module and redundant native branch, and prove durable session effects and
acknowledgments across text, native, peer, and owner-policy cases.

Restore /new and /reset for admitted senders without granting ordinary
command or owner authority. Correct the slash-command policy documentation.

Fixes openclaw#125540
Co-authored-by: chelsealong <[email protected]>

* refactor(qa): centralize packaged bootstrap error redaction

Route auth bootstrap and packaged plugin preparation through one local
execution boundary that redacts and bounds diagnostics without retaining
credential-bearing causes. Preserve command ordering and the existing
single-suppression baseline.

Fixes the tooling CI regression exposed after openclaw#132399 while preparing
openclaw#125618. The unchanged suppression test fails before and passes after;
real child-process failure and startup cleanup tests pass.

* test(qa): tighten packaged bootstrap suppression inventory

---------

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: chelsealong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: qa-lab 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. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: #118580 makes /new and /reset globally owner-gated, regressing #61707 on Feishu and other non-owner-enforced channels

2 participants