Skip to content

fix(tools): surface unsupported-signal diagnostics in buildToolPlan - #93715

Closed
lzyyzznl wants to merge 1 commit into
openclaw:mainfrom
lzyyzznl:fix/issue-92361-availability-empty-group
Closed

lzyyzznl wants to merge 1 commit into
openclaw:mainfrom
lzyyzznl:fix/issue-92361-availability-empty-group

Conversation

@lzyyzznl

Copy link
Copy Markdown
Contributor

Summary

  • Empty allOf/anyOf availability groups in tool descriptors were
    silently moving tools to the hidden plan with zero observable signal.
    Plugin authors had no way to know their descriptor was malformed.
  • Root cause: buildToolPlan consumed unsupported-signal diagnostics
    from the evaluator without surfacing them. The evaluator already
    correctly classifies empty groups as authoring errors — the planner
    just never logged them.
  • Fix: emit console.warn in buildToolPlan when a tool is hidden
    due to unsupported-signal diagnostics. No new API, no callback
    system — the evaluator stays pure, the planner stays deterministic.
  • Source +9, Tests +38. Total +47 across 2 files.

Fixes #92361

Linked context

Real behavior proof

Behavior addressed: Malformed tool descriptors with empty
availability groups now produce a visible console.warn at the
planner boundary instead of silently hiding the tool.

Real setup tested: Linux 4.19.112-2.el8.x86_64, Node.js v24.13.1,
OpenClaw PR branch @ 1e247a0, tsx for runtime probing, vitest.

Exact steps or command run after fix:

./node_modules/.bin/tsx -e "
import { buildToolPlan } from './src/tools/planner.ts';

const plan = buildToolPlan({
  descriptors: [{
    name: 'demo_tool',
    description: 'Test tool',
    inputSchema: { type: 'object' as const },
    owner: { kind: 'core' as const },
    executor: { kind: 'core' as const, executorId: 'demo_tool' },
    availability: { anyOf: [] },
  }],
});
console.log('Visible:', plan.visible.length);
console.log('Hidden:', plan.hidden.length);
"

After-fix evidence:

Tool "demo_tool" hidden (unsupported-signal): Empty availability anyOf group
Visible: 0
Hidden: 1

The console.warn fires with the tool name and diagnostic messages.
The tool is still correctly hidden (no change to planner semantics).

Observed result after the fix: Descriptor authors immediately see
which tool has a malformed availability expression at registration time.

What was not tested: Full gateway startup with a real plugin that
has empty availability groups. The planner operates on in-memory
descriptors and has no platform-specific logic.

Tests and validation

# Planner + availability tests (17 passed, 2 new):
node scripts/run-vitest.mjs src/tools/planner.test.ts src/tools/availability.test.ts

New test cases:

  1. warns when a tool is hidden due to unsupported-signal diagnostics
    — verifies console.warn is called with tool name and message
  2. does not warn for runtime availability conditions — verifies
    auth-missing and other runtime conditions do NOT trigger the warn

Risk / scope

  • User-visible behavior: No — descriptors are a developer contract,
    not runtime user-facing.
  • Config/environment/migration: No
  • Security/auth/network: No
  • Highest risk: console.warn output goes to stderr and could be
    noisy in tests that don't suppress it.
  • Mitigation: unsupported-signal only fires for malformed
    descriptors (empty allOf/anyOf), which are authoring errors that
    should be fixed. Runtime conditions like auth-missing do not
    trigger it.

Current review state

Empty allOf/anyOf availability groups were silently moving tools to
the hidden plan with no observable signal.  The evaluator correctly
detects these as authoring errors (unsupported-signal), but the
planner consumed the diagnostics without surfacing them.

Add a console.warn in buildToolPlan when hidden-tool diagnostics
include unsupported-signal, so descriptor authoring errors are
visible at gateway startup / descriptor registration time.

Fixes #92361

Co-Authored-By: Claude <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added size: XS proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 16, 2026
@lzyyzznl

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 16, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

ClawSweeper review: did not complete due to Codex infrastructure failure. Reviewed June 16, 2026, 1:21 PM ET / 17:21 UTC.

Summary
Review failed before ClawSweeper could summarize the requested change.

PR surface: Source +13, Tests +33. Total +46 across 2 files.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Review metrics: none identified.

Merge readiness
Not assessed.
Failure reason: invalid structured output.

This is a ClawSweeper/Codex infrastructure failure, not a PR readiness or patch-quality verdict.
Keep any merge decision on the normal maintainer review path until ClawSweeper can complete a fresh review.

Risk before merge

  • [P1] No close action taken because the review did not complete.

Maintainer options:

  1. Decide the mitigation before merge
    Retry the Codex review after fixing the execution failure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • Review did not complete, so no work-lane recommendation was made.
Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

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

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

AGENTS.md: unclear because the file could not be read completely.

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

Evidence reviewed

PR surface:

Source +13, Tests +33. Total +46 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 13 0 +13
Tests 1 34 1 +33
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 47 1 +46

What I checked:

  • failure reason: invalid structured output.
  • codex failure detail: Codex review failed for this PR with exit 0 and wrote invalid JSON or schema-invalid output to /home/runner/work/clawsweeper/clawsweeper/artifacts/event/codex/93715.json: decision.rootCauseCluster fixed_by_candidate requires a canonical pull request.
  • codex stderr: No stderr captured.
  • codex stdout: "command":"git blame -L 40,67 -- src/tools/planner.ts; git show -s --format='%H%n%cI%n%an%n%s' 61b104c","sha":"61b104cf73860aa3c45f6883f1f9e1febe464342"}],"likelyOwners":[{"person":"vincentkoc","role":"introduced behavior","reason":"Introduced the tool planner and availability evaluator on current main through the merged Codex dynamic-tool PR.","commits":["61b104cf73860aa3c45f6883f1f9e1febe464342"],"files":["src/tools/planner.ts","src/tools/availability.ts","src/tools/types.ts"],"confidence":"high"},{"person":"Pick-cat","role":"adjacent contributor","reason":"Authored the still-open related PR that explores the same availability diagnostic surface and plugin-boundary alternatives, though that branch is not merged.","commits":["52b174ad85a6498a89f95844755847ea005aa82b"],"files":["src/tools/planner.ts","src/plugins/tools.ts","src/plugins/tool-descriptor-cache.ts"],.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
How this review workflow works
  • 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.

@vincentkoc vincentkoc self-assigned this Jun 16, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Closing this implementation for the same reason as #93709. buildToolPlan() is a repeated planning path, and this patch adds a console.warn side effect there, so the same malformed descriptor can warn on every plan build.

The underlying issue #92361 is valid and already names the correct boundary: surface malformed availability once during descriptor registration or another lifecycle-owned validation step, while keeping the evaluator and planner pure. A repair at that boundary remains welcome; this planner-time implementation is not landable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

proof: supplied External PR includes structured after-fix real behavior proof. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Tool availability evaluator silently ignores empty allOf/anyOf groups during expression normalization

3 participants