Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 15, 2026, 6:57 AM ET / 10:57 UTC. Summary PR surface: Source +11, Tests +162. Total +173 across 2 files. Reproducibility: yes. Source inspection gives a high-confidence path: current main clones Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this focused registry-boundary repair after maintainer acceptance of the mutable Do we have a high-confidence way to reproduce the issue? Yes. Source inspection gives a high-confidence path: current main clones Is this the best way to solve the issue? Yes, pending maintainer compatibility acceptance. Fixing the generic registry wrapper is narrower and more maintainable than a bootstrap-only workaround or field-by-field merge, and the AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e7ee1c55b433. Label changesLabel justifications:
Evidence reviewedPR surface: Source +11, Tests +162. Total +173 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
I like this direction. Reusing the same |
|
Thanks — I added the back-to-back handler regression you suggested and pushed it in 10bfe43. I also updated the PR body with a real plugin-loader proof: two temporary plugins with Focused verification run: |
|
Closing this stale draft PR because it has been open for a long time without merge. I can reopen or resubmit if needed. |
Summary
registerHookhandlers run.pluginConfigto each handler and restore/remove it afterward so config does not leak onto the shared event context.pluginConfig.Test Plan
src/plugins/registry.tstoupstream/main, then rannode scripts/run-vitest.mjs src/plugins/loader.test.ts --testNamePattern "runs consecutive plugin hook handlers" --reporter dot→ failed as expected because the second handler sawAGENTS.md/missing-noteinstead of the first handler's context mutation.node scripts/run-vitest.mjs src/plugins/loader.test.ts --testNamePattern "runs consecutive plugin hook handlers|preserves plugin hook context mutations|injects plugin config" --reporter dot→ 1 test file passed; 3 tests passed, 148 skipped.node_modules/.bin/tsx /tmp/proof-pr89002-hook-context.ts→ real plugin-loader proof passed.node_modules/.bin/oxfmt --write src/plugins/loader.test.tsandgit diff --staged --check→ passed before commit.pnpm check:changed --stagedcould not complete locally because pnpm attempted dependency hydration/removal in this worktree and aborted in non-TTY mode withERR_PNPM_ABORTED_REMOVE_MODULES_DIR_NO_TTY. Earlier directpnpm install --frozen-lockfilealso failed on the known lockfile/dependency hydration issue for@lydell/node-pty-darwin-arm64.Real behavior proof
Behavior addressed: plugin hook handlers could mutate the context object they received, but current main's registry wrapper shallow-copied
evt.context, so later core code and later handlers did not observe context replacements such asbootstrapFiles;pluginConfigstill needs to be visible only to the owning handler and cleaned before the next handler.Real environment tested: local PR worktree on macOS 15.5; Node v22.22.1 via
tsx; two temporary real plugin directories each containingopenclaw.plugin.jsonand a CJS entrypoint were loaded throughloadOpenClawPluginswith the normal plugin loader path, thenagent:bootstrapwas triggered throughtriggerInternalHook.Exact steps or command run after this patch:
node_modules/.bin/tsx /tmp/proof-pr89002-hook-context.tsEvidence after fix:
Observed result after fix: the first real plugin saw its own config and replaced
event.context.bootstrapFiles; the second real plugin saw nopluginConfigleakage but did seeREAL-FIRST.mdandmutation-from-first-real-plugin; the final shared event context retained the mutation and hadpluginConfigPresent=false.What was not tested: the full
pnpm check:changed --stagedgate was not completed locally because pnpm attempted dependency hydration/removal and aborted in non-TTY mode; focused Vitest coverage, formatter/check-diff sanity, and the real plugin-loader proof above were run instead.Risk/Notes
pluginConfigin afinallyblock, so existing context config state is preserved even if a handler throws.agent:bootstrapwhile keeping per-handler config isolated.Closes #75245