Skip to content

fix(plugins): preserve runtime scope for deferred CLI actions - #147688

Merged
RomneyDa merged 1 commit into
mainfrom
fix/plugin-cli-action-runtime-scope
Sep 14, 2026
Merged

RomneyDa merged 1 commit into
mainfrom
fix/plugin-cli-action-runtime-scope

Conversation

@RomneyDa

Copy link
Copy Markdown
Member

Summary

  • preserve plugin-instance runtime scope when deferred Commander CLI actions execute
  • install channel runtime state for both setup and full plugin graphs inside the owning instance
  • add a deferred-action regression that reads an instance-scoped runtime store

Why

Maturity run 34681094383 showed the Matrix E2EE CLI scenarios failing because a registered command action executed after plugin registration had left its instance scope. The runtime store then resolved an uninitialized fallback instead of the live plugin instance.

Verification

  • pnpm exec vitest run src/plugins/loader.test.ts src/plugins/loader.runtime-registry.test.ts (231/231)
  • pnpm check:changed
  • autoreview P0-P2: clean

Source run: https://github.com/openclaw/openclaw/actions/runs/34681094383

@clawsweeper

clawsweeper Bot commented Sep 14, 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.

@RomneyDa
RomneyDa marked this pull request as ready for review September 14, 2026 01:44
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Sep 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 14, 2026
@clawsweeper

clawsweeper Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 9:53 PM ET / September 14, 2026, 01:53 UTC.

ClawSweeper review

What this changes

The PR preserves each plugin’s runtime context when CLI actions execute later and initializes both channel setup and runtime graphs within their owning instance.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still has the deferred-action scope gap, and this focused repair has no concrete blocking defect identified.

Priority: P2
Reviewed head: 6397336e779e35568e2761eefb15fe0da577a5df

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with meaningful regression coverage and no identified blocking defect; reported checks were not rerun here.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored PR is exempt from the external-contributor proof gate. Its deferred-action and channel-initialization fixtures are relevant supplemental validation; the linked failed workflow does not demonstrate after-fix Matrix behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored PR is exempt from the external-contributor proof gate. Its deferred-action and channel-initialization fixtures are relevant supplemental validation; the linked failed workflow does not demonstrate after-fix Matrix behavior.
Evidence reviewed 8 items Introduced patch identity: The checkout matches the pinned original PR head. Its raw commit records the supplied merge-base as its parent; the host’s verified test merge preserves base-only changes.
Current-main necessity: Current main still registers the registrar directly without intercepting deferred Commander actions. The two production files are unchanged between the pinned merge-base and fetched main.
Existing runtime and admission owners: The runtime store resolves slots from the invoking instance and otherwise uses a fallback. The patch delegates callbacks to instance.wrap; the existing instance.run checks retirement and revocation before admitting a fresh call and retains asynchronous calls until settlement.
Findings None None.
Security None None.

How this fits together

OpenClaw loads plugin registrations into a shared registry and passes CLI commands to Commander for later execution. Plugin instances own the runtime slots and lifecycle checks those commands need.

flowchart LR
  A[Plugin registration] --> B[Plugin instance]
  B --> C[Scoped CLI registration]
  C --> D[Commander invokes action]
  D --> E[Instance admission check]
  E --> F[Plugin runtime slots]
  B --> G[Setup and runtime graphs]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +53, Tests +15. Total +68 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 65 12 +53
Tests 2 22 7 +15
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 87 19 +68

Review metrics

None.

Technical review

Best possible solution:

Keep deferred plugin actions and both channel graphs bound to their existing instance owner, preserving its runtime slots and lifecycle admission.

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

Yes, from source: register an instance-scoped runtime store, leave registration, then invoke a Commander action that reads it. Current main does not restore the instance for that callback; no runtime reproduction was executed here.

Is this the best way to solve the issue?

Yes. The patch repairs the existing registration boundary and reuses instance admission rather than introducing another runtime owner; the focused fixtures exercise both reported gaps.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs a bounded plugin CLI runtime failure reported by Matrix validation, without evidence of an urgent widespread outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor proof gate. Its deferred-action and channel-initialization fixtures are relevant supplemental validation; the linked failed workflow does not demonstrate after-fix Matrix behavior.

Label justifications:

  • P2: This repairs a bounded plugin CLI runtime failure reported by Matrix validation, without evidence of an urgent widespread outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This member-authored PR is exempt from the external-contributor proof gate. Its deferred-action and channel-initialization fixtures are relevant supplemental validation; the linked failed workflow does not demonstrate after-fix Matrix behavior.

Evidence

What I checked:

  • Introduced patch identity: The checkout matches the pinned original PR head. Its raw commit records the supplied merge-base as its parent; the host’s verified test merge preserves base-only changes. (6397336e779e)
  • Current-main necessity: Current main still registers the registrar directly without intercepting deferred Commander actions. The two production files are unchanged between the pinned merge-base and fetched main. (src/plugins/registry-registrars-operations.ts:188, e7a3d9208228)
  • Existing runtime and admission owners: The runtime store resolves slots from the invoking instance and otherwise uses a fallback. The patch delegates callbacks to instance.wrap; the existing instance.run checks retirement and revocation before admitting a fresh call and retains asynchronous calls until settlement. (src/plugins/plugin-instance.ts:90, 6397336e779e)
  • Commander dependency contract: The introduced program adapter directly depends on Commander’s fluent command and action contracts. Commander 15.0.0 returns command objects from command(), retains the action callback, and later invokes it with the native command receiver and arguments; these contracts support the adapter’s approach. (lib/command.js:556, ba6d13ddb424)
  • Focused regression coverage: The extended CJS and TypeScript fixture registers a runtime store, finishes registration, then parses a deferred command that reads that store. The setup/runtime fixture now checks that both distinct setters execute. These cover the reported mechanisms; tests were inspected but not executed during this read-only review. (src/plugins/loader.runtime-registry.test.ts:103, 6397336e779e)
  • Reported validation and source-run identity: The captured PR body reports 231 passing focused tests and check:changed. Its linked workflow, https://github.com/openclaw/openclaw/actions/runs/34681094383, failed at a different, pre-fix revision; it is motivation rather than after-fix Matrix proof. (182741019dfd)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RomneyDa: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@RomneyDa
RomneyDa merged commit 369f770 into main Sep 14, 2026
254 of 255 checks passed
@RomneyDa
RomneyDa deleted the fix/plugin-cli-action-runtime-scope branch September 14, 2026 06:58
vincentkoc added a commit that referenced this pull request Sep 14, 2026
* commit '8e6fe8e02ddb51bfec4e80071f0f2adcae4cf098': (47 commits)
  refactor: simplify Gateway health response parsing (#147834)
  fix: avoid Gateway stalls when renaming sessions (#147869)
  refactor(plugins): reuse worker optional-method validation (#147925)
  refactor(infra): remove unreachable firewall diagnostic fallback (#147882)
  fix(ui): open attached automations from session hovercards (#147749)
  refactor(reply): share usage-bar numeric coercion (#147863)
  fix(doctor): report warnings for keyed agent configs (#123058)
  perf(plugins): reuse complete registry comparisons (#147893)
  fix(workboard): await lifecycle sweep completion in tests (#147950)
  fix: reduce stalls when browsing large session inventories (#147911)
  refactor(onboard): share custom model definition (#147915)
  feat(ios): collapse completed chat work above replies (#148002)
  fix(voice-call): retain state runtime for deferred streams (#147689)
  test(qa): compare Telegram entities semantically (#147752)
  fix(plugins): preserve runtime scope for deferred CLI actions (#147688)
  test(qa): keep Slack progress marker visible (#147748)
  test(qa): finish channel picker prompts (#147730)
  test(tui): handle auth restriction prompt (#147729)
  fix(qa): retain onboarding prompts across redraw bursts (#147687)
  fix(qa): seed Teams ambiguous timeout deterministically (#147686)
  ...
vincentkoc added a commit to SunnyShu0925/openclaw that referenced this pull request Sep 14, 2026
* commit '069710f909f0a7158777d0fc0bf1eab84e20c699': (45 commits)
  refactor(infra): consolidate update campaign reset ownership (openclaw#146555)
  refactor: simplify Gateway health response parsing (openclaw#147834)
  fix: avoid Gateway stalls when renaming sessions (openclaw#147869)
  refactor(plugins): reuse worker optional-method validation (openclaw#147925)
  refactor(infra): remove unreachable firewall diagnostic fallback (openclaw#147882)
  fix(ui): open attached automations from session hovercards (openclaw#147749)
  refactor(reply): share usage-bar numeric coercion (openclaw#147863)
  fix(doctor): report warnings for keyed agent configs (openclaw#123058)
  perf(plugins): reuse complete registry comparisons (openclaw#147893)
  fix(workboard): await lifecycle sweep completion in tests (openclaw#147950)
  fix: reduce stalls when browsing large session inventories (openclaw#147911)
  refactor(onboard): share custom model definition (openclaw#147915)
  feat(ios): collapse completed chat work above replies (openclaw#148002)
  fix(voice-call): retain state runtime for deferred streams (openclaw#147689)
  test(qa): compare Telegram entities semantically (openclaw#147752)
  fix(plugins): preserve runtime scope for deferred CLI actions (openclaw#147688)
  test(qa): keep Slack progress marker visible (openclaw#147748)
  test(qa): finish channel picker prompts (openclaw#147730)
  test(tui): handle auth restriction prompt (openclaw#147729)
  fix(qa): retain onboarding prompts across redraw bursts (openclaw#147687)
  ...
vincentkoc added a commit to nvtoroy/openclaw that referenced this pull request Sep 14, 2026
* commit '4ddb9ed21245eaca9f243e555a5ec070aaaf0dad': (113 commits)
  fix: avoid Gateway stalls when renaming sessions (openclaw#147869)
  refactor(plugins): reuse worker optional-method validation (openclaw#147925)
  refactor(infra): remove unreachable firewall diagnostic fallback (openclaw#147882)
  fix(ui): open attached automations from session hovercards (openclaw#147749)
  refactor(reply): share usage-bar numeric coercion (openclaw#147863)
  fix(doctor): report warnings for keyed agent configs (openclaw#123058)
  perf(plugins): reuse complete registry comparisons (openclaw#147893)
  fix(workboard): await lifecycle sweep completion in tests (openclaw#147950)
  fix: reduce stalls when browsing large session inventories (openclaw#147911)
  refactor(onboard): share custom model definition (openclaw#147915)
  feat(ios): collapse completed chat work above replies (openclaw#148002)
  fix(voice-call): retain state runtime for deferred streams (openclaw#147689)
  test(qa): compare Telegram entities semantically (openclaw#147752)
  fix(plugins): preserve runtime scope for deferred CLI actions (openclaw#147688)
  test(qa): keep Slack progress marker visible (openclaw#147748)
  test(qa): finish channel picker prompts (openclaw#147730)
  test(tui): handle auth restriction prompt (openclaw#147729)
  fix(qa): retain onboarding prompts across redraw bursts (openclaw#147687)
  fix(qa): seed Teams ambiguous timeout deterministically (openclaw#147686)
  refactor(mcp): load OAuth only when credentials are needed (openclaw#147884)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

1 participant