Skip to content

fix: plugin reload succeeds after handing off its turn - #182929

Merged
steipete merged 2 commits into
openclaw:mainfrom
PollyBot13:fix/plugins-reload-resume-auth
Oct 26, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
PollyBot13:fix/plugins-reload-resume-auth

Conversation

@PollyBot13

@PollyBot13 PollyBot13 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Related: #180662

What Problem This Solves

An authorized conversation can yield for a plugin reload and then receive a missing-admin error instead of reloading.

User Impact

The requested plugin reloads after turn cleanup, and the same conversation receives its result. Callers without administrator authority are rejected before the turn yields. Personal scope ceilings, revocation, and checks immediately before effects remain enforced.

Why This Change Was Made

The generic handoff captured authority for an agent request before knowing that it needed an administrator-only reload. The existing handoff now preauthorizes one fixed reload, retains its source through cleanup, and reauthorizes through the normal Gateway dispatcher. The capability cannot dispatch twice or run an arbitrary administrative callback. GitHub preparation keeps its generic continuation path.

The maintainer cleanup makes callback and fixed-request inputs mutually exclusive, shares the handoff-scope type, and adds independent proof that changing the original request cannot retarget the reload or permit a second dispatch. No configuration, protocol, schema, or plugin lifecycle changes are required.

Evidence

  • Base regression at 0f26254ccacd, with owner source identical to current main: the host-system case yielded without reaching reload; both write-only and personal nonadmin cases returned started instead of rejecting before yield. All three failed for those reasons (135.03 seconds wall).
  • Candidate: 96/96 tests passed across plugin handoff, Gateway continuation/scopes, and GitHub tool suites (91 in 359.40 seconds wall, plus five GitHub handoff cases in 87.93 seconds). The new fixed-request/one-shot case took 57 ms. The plugin handoff suite exercises real session admission and authenticated resumed tools, including revocation, cancellation, replacement and non-owner cases; its 16 cases took 118.83 seconds wall including compilation, about 37 seconds executing. That existing integration layer protects the authority transfer that an isolated mock cannot prove.
  • Targeted type-aware oxlint, eight-file oxfmt and two independent P0–P2 reviews passed. The narrow agent typecheck reports the same unchanged benchmark JSON-overload and tooltip/JSX errors already reproduced on the clean tooling base; no changed-file errors or baseline edits.
  • Changed-file checks caught two test typing errors in the added one-shot fixture; both were repaired without casts. The focused case passed again (123.80 seconds wall including cold imports) and the Gateway test typecheck passed.
  • The optional changed-file check passed production export analysis and the remaining policy guards. Its export scan also reports the known Telegram dynamic-import false positive (reproduced on the clean tooling baseline) and unchanged full-tree test-support exports whose baseline status was not separately replayed. No export ignores, type baselines, or unrelated files were changed.
  • After integrating main f7292780f214, all 36 tests passed across plugin reload, generic continuation, and GitHub handoff (180.01 seconds wall). Targeted lint, eight-file formatting, and diff checks passed again. Exact-head CI 40248902801 passed: 48 successful jobs, 30 skipped, no failures, including all three PostgreSQL conformance shards.
  • Delta against main: production +148, tests +55, docs +5. The necessary growth is the fixed-request authorization capability and its integration with the existing handoff owner. Cleanup removes repeated scope signatures and invalid optional-operation states; it does not widen generic authority.
  • Supporting contributor canary at 4699a42489425bce225ee7b18b3d91a74e4521dc: a source-matched isolated Gateway received a real Discord message, the model called plugins.reloadAndResume once, registration count rose 1→2 after cleanup, and the same session called the replacement plugin instance. Final Discord delivery was not independently read back. Earlier canaries also observed nonadmin refusal and a role downgrade stopping a queued replacement before registration. These are prior-head observations, not fresh final-head proof.

Final-head live Gateway/channel round trips were not repeated: QA broker credentials are unavailable, and a fresh isolated Gateway build and canary would exceed the live-test budget. ClawSweeper completed the final-head review with zero findings. Security-owner clearance remains a separate required gate: the security-sensitive check is awaiting maintainer approval for this exact head.

Original contribution by @PollyBot13; contributor commit authorship is preserved.

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Maintainer security changes approved

A maintainer approved this revision with an explicit security approval comment.

A later push requires a fresh approval comment for an external contributor's PR.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: M labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR authorizes one fixed plugin reload before yielding, then dispatches it after turn cleanup and resumes the conversation.

Example: An admitted host-system conversation calls plugins with action reloadAndResume and pluginId reload-fixture.

  • Before: The turn yields, but the retained operator.write ceiling causes plugins.reload to fail with MISSING_SCOPE operator.admin.
  • After: The fixed reload is authorized before yielding and dispatched once after cleanup, while unauthorized callers are rejected before yielding.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful repair with shipped-path canary evidence, distinct regression coverage, and no actionable findings; enforced security approval remains separate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied isolated Gateway/Discord/model canary exercises reload after cleanup and same-session replacement-plugin execution, with reported nonadmin refusal and role-downgrade rejection before registration. The canary-tested authority implementation is unchanged at this head; subsequent handoff edits are type-only. Final Discord delivery readback and a fresh final-head channel run are not claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An authorized conversation ends its turn for a plugin reload but receives a missing-admin error instead of the requested reload.
Reason: The change restores an existing maintenance capability through a narrowly bound request and preserves personal permission ceilings.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR addresses a verified current-main authorization defect, and I found no actionable introduced bug. Current-head maintainer security approval remains required, and CI is still running.

Priority: P2
Reviewed head: b36b0a9c4dcaff1aa38aae0c1bc6319d76e4af2f

Before merge

  • Await maintainer action - A maintainer must review the sensitive authority changes at b36b0a9 and satisfy the enforced gate with /allow-security-sensitive-change.

Findings

None.

Agent review details

How this fits together

The agent tool hands work to the session lifecycle owner; retained Gateway authority authorizes the reload, and a session event carries its result into the same conversation.

flowchart TD
A[Plugins tool] --> B[Fixed request authorization]
B --> C[Turn yield and cleanup]
C --> D[One shot Gateway dispatch]
D --> E[Plugin lifecycle guards]
E --> F[Same session result event]
Loading

Technical review

Best possible solution:

Retain the immutable reload request through the existing handoff and reauthorize it through the normal dispatcher immediately before plugin effects.

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

Current-main source deterministically captures an unrelated write-only continuation before dispatching an admin-only reload, matching the canonical report and the supplied base regression; I ran no target code.

Is this the best way to solve the issue?

This repairs the authorization producer without widening generic callbacks, preserves the existing GitHub handoff, and keeps reload lifecycle and final-effect checks with their current owners.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6cb193f681c5.

Provenance checked

  • Generic continuation authority changes intended behavior with a stated reason (d0dcc9d: Retain the selected operator source while preserving caller scope limits across continuation work.)
  • Cleanup handoff and shared continuation keeps the original intent (00b330b: Avoid plugin reload waiting on its own active turn by yielding and waiting for normal cleanup before reload and resume.)
  • Shared GitHub preparation path keeps the original intent (c1658c0: Share the session handoff while preparing an existing PR into a conversation-owned workspace.)
  • Resumed owner and Gateway context keeps the original intent (41f55f5: Preserve admitted owner authority and Gateway binding while selecting the replacement plugin registry for the resumed turn.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main retains the reported scope mismatch: The handoff captures a generic continuation, whose authority owner resolves agent with exact synthetic scopes rather than the eventual admin-only reload. (src/gateway/server-plugin-in-process-authority.ts:165, 6cb193f681c5)
  • Request-bound capability: The new capability clones the request, preauthorizes it, exposes one dispatch, and routes execution through the existing Gateway request owner without exposing an administrative callback. (src/gateway/server-plugin-in-process-request-continuation.ts:12, b36b0a9c4dca)
  • Authority reaches final-effect guards: Dispatch composes source, invocation, cancellation, and destination checks; the plugin mutation handler carries them through beforePersistentApply and assertInvokerOwned into queued runtime application and reload checkpoints. (src/gateway/server-methods/plugins-mutations.ts:71, b36b0a9c4dca)
  • Behavioral regression coverage: The changed handoff cases distinguish unscoped host-system success from write-only and personal nonadmin rejection before yield; the added dispatcher case independently checks immutable targeting and one-shot execution. (src/agents/tools/plugins-reload-handoff.test.ts:70, b36b0a9c4dca)
  • Supplied canary and proof reuse: The body records an isolated Gateway receiving a Discord/model turn, registration rising from 1 to 2, and the same session invoking the replacement plugin at 4699a42, plus earlier nonadmin and role-downgrade controls. Compared with that head, the authority capability is unchanged and the shared handoff changes are type-only. (src/agents/tools/session-tool-handoff.ts:40, b36b0a9c4dca)
  • Enforced approval remains outstanding: The current-head security-sensitive-review and ci-gate statuses require maintainer approval; the security guard comment explicitly requires /allow-security-sensitive-change for the reviewed SHA. No approval review was returned. (b36b0a9c4dca)

Likely related people:

  • Peter Steinberger: Raw commit d0dcc9d adds src/gateway/server-plugin-in-process-authority.ts:138 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d0dcc9deddc8; files: src/gateway/server-plugin-in-process-authority.ts)
  • RoboClaw: Raw commit 00b330b adds src/agents/tools/plugins-reload-handoff.ts:56 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 00b330babd57; files: src/agents/tools/plugins-reload-handoff.ts)

PR surface

Source +148, Tests +55, Docs +5. Total +208 across 8 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 209 61 +148
Tests 2 78 23 +55
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 292 84 +208

Review metrics

Metric Value Why it matters
Production versus test growth Production +209/-61; tests +78/-23 The production growth provides preauthorization and a fixed, one-shot capability using existing authority and lifecycle owners; tests cover distinct host-system, nonadmin, immutable-target, and duplicate-dispatch failures.

Root-cause cluster

Relationship: same_root_cause
Canonical: #180662
Summary: This PR implements the request-bound repair for the canonical report's manufactured write-only reload ceiling.

Members:

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: The bug interrupts an advanced plugin-maintenance handoff while leaving ordinary conversations and external maintenance paths available.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-24T21:54:09.498Z sha 9a71330a2eb6272bc6b72402f1149bd48d5afece :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-25T08:39:30.343Z sha 9a71330a2eb6272bc6b72402f1149bd48d5afece :: blocked before merge. :: none
  • reviewed 2026-10-25T08:54:18.584Z sha 4699a42 :: blocked before merge. :: none
  • reviewed 2026-10-25T09:01:24.890Z sha 4699a42 :: blocked before merge. :: none

Reviewed October 25, 2026, 8:26 PM ET / October 26, 2026, 00:26 UTC (Revision 5).

@PollyBot13

Copy link
Copy Markdown
Contributor Author

Exact-head shipped-Gateway canary evidence is now in the PR body: real allowed reload and same-session result, authenticated read/write-only personal refusal before yield, and post-capture role downgrade blocking replacement before plugin application. The targeted proof does not claim green CI or replace maintainer security approval.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 25, 2026
@clawsweeper clawsweeper Bot added status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 25, 2026
Retain one fixed reload request through cleanup, preserving scope ceilings,
revocation and final-effect checks. Reject missing authority before yielding.
Keep generic GitHub handoffs on their existing path and prove one-shot dispatch.

Co-authored-by: PollyBot13 <[email protected]>
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 26, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@steipete

Copy link
Copy Markdown
Contributor

/allow-security-sensitive-change

@steipete
steipete merged commit 7c9cb97 into openclaw:main Oct 26, 2026
153 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 Oct 26, 2026
…aw#182929)

Authorize a fixed plugin reload before yielding, then dispatch it once through normal Gateway reauthorization after turn cleanup. Preserve personal scope ceilings, revocation, effect-time guards, and generic GitHub handoffs.

Co-authored-by: PollyBot13 <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 28, 2026
Authorize a fixed plugin reload before yielding, then dispatch it once through normal Gateway reauthorization after turn cleanup. Preserve personal scope ceilings, revocation, effect-time guards, and generic GitHub handoffs.

Co-authored-by: PollyBot13 <[email protected]>

(cherry picked from commit 7c9cb97)

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

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed size: M status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants