Repository navigation
Conversation
7883939 to
2239f85
Compare
2239f85 to
de8afc7
Compare
de8afc7 to
dd4e4ce
Compare
dd4e4ce to
b185ab9
Compare
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open: this PR remains a viable, focused fix for the linked plugin tool availability diagnostic bug, and current main does not already preserve plugin-authored availability. The latest head addresses the prior cycle-recursion blocker, so the remaining decision is maintainer selection of exactly one overlapping implementation and acceptance of the compatibility change. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this PR as superseded by #92411. So I’m closing this here and keeping the remaining discussion on #92411. Review detailsBest possible solution: Close this PR as superseded by #92411. Do we have a high-confidence way to reproduce the issue? Yes, by source inspection: current main drops plugin tool availability during descriptor capture while the evaluator already emits empty-group diagnostics when availability reaches it. The PR body also supplies terminal proof with a negative control, but I did not execute tests in this read-only review. Is this the best way to solve the issue? Yes, with maintainer acceptance of the compatibility change. The focused capture-time warning avoids adding a new planner callback API, and the latest cycle guard removes the prior crash blocker; the remaining question is which overlapping PR maintainers want as canonical. Security review: Security review cleared: No concrete security or supply-chain concern was found; the diff changes in-process TypeScript descriptor validation/logging and tests only. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against be2c4c65abd9. |
|
@clawsweeper re-review — Added a Real behavior proof section: it drives the real |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review — Added the |
|
@clawsweeper re-review — Updated the PR body with a machine-readable |
A plugin-supplied self-referential availability object (e.g. a.anyOf = [a]) made isToolAvailabilityExpression recurse until RangeError, crashing plugin tool registration. Add a recursion-path WeakSet guard so a cycle is treated as a non-expression instead of overflowing the stack. Adds a regression test.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞✅ Reason: structured ClawSweeper close marker: close-required (sha=7027be9cbc99cc57460a50557690a9d735f79458) Closed:
|
What Problem This Solves
When a plugin author registers a tool whose availability declares an empty
anyOf/allOfgroup, the tool is silently dropped from the tool plan with zero feedback (#92361).capturePluginToolDescriptordid not preserve the tool'savailability, so the existing empty-groupunsupported-signaldiagnostic was never evaluated — the author sees their tool simply vanish, with no log line pointing at the misconfiguration. Worse, before the fix the descriptor was even treated as visible despite being broken. This affects anyone authoring openclaw plugins, turning a trivial config typo into a silent, hard-to-diagnose disappearance.Evidence
Live runtime proof drives the real production
capturePluginToolDescriptor(the exact functionresolvePluginTools()calls), then feeds the descriptor through the realbuildToolPlanplanner, crossing two boundaries: a realconsole.warn→process.stderrsink (captured back as bytes) and the visible-vs-hidden planner decision.demo/broken_tool(1 new line), descriptor retainsavailability: {"anyOf":[]}, planner hides the tool with theunsupported-signal"Empty availability anyOf group" diagnostic →RESULT: PASS.tool-descriptor-cache.tsback to pre-fix parent, re-run same proof): 0 stderr lines,availabilitydropped toundefined, tool reported visible with no diagnostics →RESULT: FAIL— the exact [Bug]: Tool availability evaluator silently ignores emptyallOf/anyOfgroups during expression normalization #92361 silent failure the fix removes.vitest run src/plugins/tool-descriptor-cache.test.ts src/tools/planner.test.ts→ 2 files, 15 tests passed (covers availability preservation, the empty-group warn, malformed non-contract fields ignored, and planner hiding the malformed descriptor).Summary
When a plugin tool declares an empty
allOf/anyOfavailability group, the tool is silently hidden with zero feedback to the author (#92361).capturePluginToolDescriptor(src/plugins/tool-descriptor-cache.ts) did not preserve the tool'savailability, so the empty-groupunsupported-signaldiagnostic was never evaluated or surfaced — the author has no idea why the tool vanished.Changes
capturePluginToolDescriptornow preservestool.availabilityon the descriptor.allOf/anyOfgroup emits awarn(reusing the existingToolAvailabilityDiagnostic"Empty availability anyOf/allOf group" message) carrying the pluginId + toolName, so authors get immediate feedback instead of a silently hidden tool.Real behavior proof
Behavior addressed: A plugin tool registered with an empty
anyOf(orallOf) availability group used to vanish from the tool plan with no log line — the author got no signal at registration time. The fix preservesavailabilityon the captured descriptor and emits a registration-timewarnthrough the plugin context logger so the author is told exactly whichpluginId/toolNameis misconfigured.Real environment tested: Node v22.22.0 + tsx 4.22.3 driving the real production
capturePluginToolDescriptor(the exact function plugin tool registration calls atresolvePluginTools()insrc/plugins/tools.ts, wherelogger: context.loggeris now passed). The proof crosses two real boundaries: (1) a realconsole.warn-backed logger whose output lands on the realprocess.stderrlog sink, captured back as bytes; (2) the realbuildToolPlan(src/tools/planner.ts) deciding visible vs. hidden.Exact steps or command run after this patch:
proof.mtsbuilds a plugin tool withavailability: { anyOf: [] }, tapsprocess.stderr.write, callscapturePluginToolDescriptor({ pluginId: "demo", tool, optional: false, logger }), then feeds the resulting descriptor throughbuildToolPlan.Evidence after fix (live terminal):
Negative control (stash
src/plugins/tool-descriptor-cache.tsback to its parent pre-fix state, re-run the sameproof.mts):Pre-fix: stderr stays silent,
availabilityis dropped (undefined), and the tool is even reported as visible — the exact #92361 silent-failure the fix removes. File restored afterward.Observed result after fix: the empty-group warning is emitted to the real stderr sink carrying
demo/broken_tool(one new line), the captured descriptor retains{ "anyOf": [] }, and the planner now hides the tool with theunsupported-signal"Empty availability anyOf group" diagnostic instead of silently swallowing it. Unit suites confirm it too:vitest run src/plugins/tool-descriptor-cache.test.ts src/tools/planner.test.ts→ 2 files, 15 tests passed.What was not tested: end-to-end loading of a real on-disk plugin package through the full plugin loader/cache-write path (the proof drives the registration capture function directly with an in-memory tool); the
allOf-variant message path (only theanyOfempty-group path is exercised at runtime here, though both share the same diagnostic code path and theallOfcase is covered by the unit tests).Scope
Fixes #92361. Focused implementation (preserve availability + registration-time warning). Competing PRs #92411 (XL, scattered) and #93962 (today, AI-assisted) are broader/less focused — barnacle lets the maintainer pick the best-fit version.
Real behavior proof
Behavior addressed: A plugin tool registered with an empty anyOf/allOf availability group used to disappear from the tool plan without any registration-time log signal. This patch preserves the availability descriptor and emits a plugin context warning naming the broken plugin/tool.
Real environment tested: Local Linux runtime with Node v22.22.0 and tsx 4.22.3, driving the real production capturePluginToolDescriptor function used by plugin registration and the real buildToolPlan planner. The proof crosses the real console.warn to process.stderr sink and the planner visible/hidden decision.
Exact steps or command run after this patch: In the PR head worktree fork/fix/surface-empty-availability-group-92361, ran node --import tsx proof.mts. The script builds a plugin tool with availability { anyOf: [] }, taps process.stderr.write, calls capturePluginToolDescriptor({ pluginId: "demo", tool, optional: false, logger }), then feeds the descriptor through buildToolPlan.
Evidence after fix: Live terminal capture from node --import tsx proof.mts:
Negative control terminal capture after restoring the parent pre-fix tool-descriptor-cache.ts showed zero stderr lines, availability undefined, tool visible true, and RESULT: FAIL.
Observed result after fix: The empty-group warning is emitted to the real stderr sink with demo/broken_tool, the captured descriptor retains {"anyOf":[]}, and the planner hides the tool with the unsupported-signal diagnostic "Empty availability anyOf group" instead of silently treating it as visible. The related vitest command passed 15 tests.
What was not tested: Full end-to-end loading of a real on-disk plugin package through the plugin loader/cache-write path was not run; the proof drives the registration capture function directly with an in-memory tool. The allOf runtime variant was not separately exercised in the live proof, though it shares the diagnostic path and is covered by unit tests.