Skip to content

fix(harness): report broken plugin manifests and accept the default layout - #889

Open
chrisknvidia wants to merge 9 commits into
mainfrom
fix/christopherk/harness-plugin-format-acceptance
Open

chrisknvidia wants to merge 9 commits into
mainfrom
fix/christopherk/harness-plugin-format-acceptance

Conversation

@chrisknvidia

@chrisknvidia chrisknvidia commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

The plugin panel of harness-check could not tell a broken plugin manifest from a missing one, and it only looked at the default folders when deciding whether Claude Code or OpenClaw would pick up a bundle without a manifest they read. That gave wrong answers in a few cases: a Claude Code plugin with a manifest that is not valid JSON, or with no usable name, was shown as loading from its default folders; a bundle whose only default content is a root .mcp.json or .lsp.json was shown as not found; and OpenClaw was shown as refusing a default-layout bundle that has no JSON manifest.

This change adds per-format facts for a manifest that is present but cannot be read (invalid_<fmt>), plus unparsed_claude, nameless_claude and default_layout. Claude Code gets two new rules, CC-PLUGIN-MANIFEST-INVALID and CC-PLUGIN-MANIFEST-NAME, and CC-PLUGIN-EMPTY now counts a root .mcp.json or .lsp.json. The Claude manifest is also read the lenient way Claude Code reads it, so a byte order mark or a stray non-UTF-8 byte is not reported as broken. For OpenClaw, OW-PLUGIN-FORMAT accepts the default layout, a broken .claude-plugin, .codex-plugin or .cursor-plugin manifest is reported as OW-PLUGIN-MANIFEST-INVALID, and OW-PLUGIN-CODEX-MCP is removed, so MCP servers are reported the same for Codex-format and Claude-format bundles. These five rules carry confidence medium.

Validation:

  • pytest tests/harness -q: 200 passed.
  • tests/harness/test_plugin_compat.py: 66 passed; with the source change reverted, 39 of them fail.
  • ruff check and ruff format --check on the changed Python files: clean.

This is one of four independent pull requests that together fix wrong answers in the plugin panel of harness-check. The others are #888 (manifest path and the false schema line), #890 (flat .mcp.json and the "adds nothing" note), #891 (untested component kinds). Each stands on its own and they can land in any order. They touch the same files, so after one lands the others need a rebase.

…ayout

The plugin panel of harness-check now tells a broken manifest apart from a
missing one. Claude Code is shown as not loading a plugin whose
.claude-plugin/plugin.json cannot be read as JSON or has no usable name, and
as loading a bundle whose only default content is a root .mcp.json or
.lsp.json. OpenClaw is shown as installing a default-layout bundle without a
manifest it reads and as refusing one with a broken manifest, and the rule
OW-PLUGIN-CODEX-MCP is removed.

Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
devin-ai-integration[bot]

This comment was marked as resolved.

Signed-off-by: Christopher Kevin <christopherk@nvidia.com>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 3 new potential issues.

Devin Review

Comment thread src/skillevaluator/harness/plugin.py Resolved
Comment thread src/skillevaluator/harness/plugin.py Resolved
try:
return json.loads(source, parse_int=float)
except json.JSONDecodeError:
return json5.loads(source)

@devin-ai-integration devin-ai-integration Bot Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 JSON5 parsers disagree on escaped keys

json5.loads accepts an unquoted \u0031 key. OpenClaw’s JSON5 parser rejects it because the escape decodes to a leading digit.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SkillEvaluator Review]

Thanks @chrisknvidia for this contribution.

Value and readiness: Distinct broken-manifest and default-layout statuses are useful. The JSON decoder still accepts non-JSON constants. Existing OpenClaw entry-point selection, oversized manifest selection, and JSON5 divergence concerns remain. CHANGELOG.md conflicts. Please address the finding below before final review.

Material findings: 1 P2

  • P2 Reject nonstandard JSON constants in Claude manifests (src/skillevaluator/harness/plugin.py:194)

PIC tradeoffs: None raised in this draft.

Verification and gaps: Inspected the current diff and related code, tests, and GitHub checks. CI: Green. No local contributor execution.

Reviewed head: a40fb59c713c93a0b4c258e8c36bcef742ff6d0b

@@ -102,20 +192,44 @@ def plugin_facts(root: Path) -> dict[str, Any]:
data = json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError, UnicodeDecodeError, RecursionError):
facts["manifest_invalid"] = True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Reject nonstandard JSON constants in Claude manifests

The default Python decoder accepts bare NaN and Infinity even though JavaScript JSON.parse rejects them. A manifest such as {"name":"demo","description":NaN} can bypass the broken-manifest result. Reject these constants in the strict and Claude BOM/UTF-8-tolerant decode paths, with a regression for each.

Resolve the CHANGELOG conflict: main released 1.2.1 and gained its own Unreleased > Fixed section, so this change's entry is appended there.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SkillEvaluator Review]

Thanks @chrisknvidia for this contribution.

Value and readiness: Directionally right: broken Claude Code manifests are told apart from missing ones, plugin names are checked, BOM-prefixed manifests keep their declared components, and the OpenClaw panel reads the first present Codex, Cursor or Claude manifest as JSON5. 62 of its 91 new tests fail against main's source. Not ready for the maintainers and PIC yet: your earlier P2 is unfixed, two Devin findings are still open, and the new OW-PLUGIN-MANIFEST-UNCHECKED rule has no test.
Prior findings: 6 of 10 earlier threads are fixed (already resolved). Still open: plugin.py:194 (rng1995, P2): JSON with NaN or Infinity is still accepted (json.loads with default constants at lines 192 and 141; {"name":"demo","description":NaN} is read as a valid Claude manifest), and the root-manifest strict check at plugin.py:213 has the same gap; plugin.py:228 (Devin): the index.js and openclaw.plugin.json native entrypoints are ignored, so a bundle with .github/plugin/plugin.json, settings.json and index.js is reported as loading on OpenClaw; plugin.py:214 (Devin): the root plugin.json read has no 256 KiB cap, unlike the selected client manifests; plugin.py:159 (Devin): escaped JSON5 keys, which I think is negligible and the maintainers can accept.
Material findings: 4 inline: P2 src/skillevaluator/harness/plugin.py:162 The nesting-limit path and OW-PLUGIN-MANIFEST-UNCHECKED are never exercised by a test; P3 src/skillevaluator/harness/plugin.py:195 Codex, Cursor, Copilot and Hermes rows still call a broken manifest missing; four invalid_* facts are unused; P3 src/skillevaluator/harness/profiles/openclaw.yaml:40 OW-PLUGIN-CODEX-MCP is removed on documentation alone, bundled with the manifest fixes; P3 src/skillevaluator/harness/plugin.py:221 New .exists() probes raise on an unreadable folder.
PIC tradeoffs: New base runtime dependency json5 (>=0.17.3,<1, pure Python, Apache-2.0) is imported at module load, so by every CLI start, to read one advisory panel input; the PR description does not mention it. Removing the probe-backed OW-PLUGIN-CODEX-MCP rule moves Codex-format OpenClaw bundles with MCP from degraded to loads. Merge order with #888, #890 and #891: #890 deletes DECLARED_COMPONENT_KEYS, which _declares_components here still reads, so a clean rebase gives a NameError.
Verification and gaps: Read the whole PR delta, all 10 threads, the interdiff against the last reviewed head a40fb59 (CHANGELOG context only; I merged main into the branch to clear a CHANGELOG conflict) and the sibling PR diffs. tests/harness gave 221 passed in a scrubbed environment, with 4 failures only because json5 is not installed in my review environment and I stubbed it, so all json5 behavior (parser exception surface, timing on 256 KiB input, BOM and escaped keys) is unverified locally. CI: one red job, Tests (Python 3.13), where test_old_runs_without_statistics_render_unchanged failed across a minute boundary (a wall-clock flake in code this PR does not touch); 3.12 and 3.14 pass, and I re-ran the failed job.

Reviewed head: 88e23b12af1d479c35b734faa53b621319184ed1

return json5.loads(source)
except (OSError, ValueError):
return _UNPARSED
except RecursionError:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] The nesting-limit path and OW-PLUGIN-MANIFEST-UNCHECKED have no test

_openclaw_manifest returns _PARSE_LIMIT here on RecursionError, and openclaw.yaml:43 turns it into a new degraded rule, but no test reaches it. Coverage of tests/harness/test_plugin_compat.py over plugin.py misses lines 162-164 (this handler), 150 (the selected manifest is not a regular file) and 100-101 (the OSError arm of _is_file). The one nesting test that exists, test_plugin_json_nested_past_the_parser_recursion_limit_is_an_invalid_manifest, writes 200,000 levels = 400,000 bytes, so OpenClaw stops at the 256 KiB cap and reports OW-PLUGIN-MANIFEST-INVALID; it never reaches the recursion handler. A 50,000-level manifest (about 100 KB) does, and gives degraded / OW-PLUGIN-MANIFEST-UNCHECKED.

Add tests for the new rule and the not-a-file branch (both pass against this head):

def test_openclaw_marks_a_manifest_nested_past_the_parser_limit_as_unchecked(tmp_path: Path):
    nested = '{"name": "demo", "x": ' + "[" * 50_000 + "]" * 50_000 + "}"
    assert len(nested.encode()) < PLUGIN_CONFIG_MAX_BYTES
    root = _manifest(_plugin(tmp_path / "p", None, components=("skills",)), ".codex-plugin/plugin.json", nested)
    assert _status(root)["openclaw"] == ("degraded", ["OW-PLUGIN-MANIFEST-UNCHECKED"])


def test_openclaw_rejects_a_selected_manifest_that_is_not_a_file(tmp_path: Path):
    root = _plugin(tmp_path / "p", None, components=("skills",))
    (root / ".codex-plugin" / "plugin.json").mkdir(parents=True)
    assert _status(root)["openclaw"] == ("not_loaded", ["OW-PLUGIN-MANIFEST-INVALID"])

data = json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError, UnicodeDecodeError, RecursionError):
facts["manifest_invalid"] = True
facts[f"invalid_{fmt}"] = True

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Only the Claude Code and OpenClaw rows use the new invalid_<fmt> facts

A .codex-plugin/plugin.json holding {"name": "demo", still gives the Codex row CX-PLUGIN-FORMAT ("... this one has none of them"); .github/plugin/plugin.json and root plugin.json give the same wording from CP-PLUGIN-FORMAT and HM-PLUGIN-FORMAT. That is the broken-versus-missing confusion this PR fixes for Claude Code and OpenClaw. The only shipped rule that reads an invalid_* fact is claude-code.yaml:35 (invalid_claude); invalid_codex, invalid_cursor, invalid_copilot and invalid_root_json are set here and read only by tests.

Either give those rows a matching ...-MANIFEST-INVALID rule (or make their format message say the manifest is present but unreadable), or keep the PR title and description to the two rows that changed and drop the unused facts.

rules:
- {id: OW-PLUGIN-FORMAT, when: "not (fmt_claude or fmt_codex or fmt_cursor or fmt_agent_v1 or fmt_root_json)", effect: not_loaded, outcome: rejected, message: "OpenClaw installs bundles with a JSON plugin manifest (.claude-plugin, .codex-plugin, .cursor-plugin or plugin.json); Hermes plugin.yaml plugins are not found.", fix: "Add .claude-plugin/plugin.json.", confidence: medium}
- {id: OW-PLUGIN-CODEX-MCP, when: "fmt_codex and not (fmt_claude or fmt_agent_v1) and components.mcp > 0", effect: degraded, outcome: registered, message: "MCP servers of Codex-format bundles start, but their tools never reached the model.", fix: "Also ship .claude-plugin/plugin.json.", confidence: high}
- {id: OW-PLUGIN-FORMAT, when: "not (openclaw_selected_manifest or openclaw_agent_manifest or openclaw_default_layout)", effect: not_loaded, outcome: rejected, message: "OpenClaw bundle discovery found no supported manifest or default component marker.", fix: "Add .claude-plugin/plugin.json or a default marker such as hooks/hooks.json or settings.json.", confidence: medium}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Removing OW-PLUGIN-CODEX-MCP rests on documentation, not on the probes that created it

On main this rule (confidence: high, added in #543) says MCP servers of Codex-format bundles start but "their tools never reached the model", and the profile header attributes the pinned results to proxy-captured canary probes. This PR deletes the rule, which moves such bundles from degraded to loads, citing only that OpenClaw documents MCP for every bundle format (comment in test_codex_format_mcp_is_a_note_not_a_degraded_row_on_openclaw). As far as bundle-mcp.ts at the pinned tag shows, the loader has no per-format exclusion, which supports the new reading, but it does not explain the earlier probe result. #891 treats the same kind of disagreement as an explicit disputed outcome and keeps OW-PLUGIN-CODEX-MCP, so the two PRs also conflict here.

Please record the new evidence (for example a re-run probe) in the PR, or leave a note-level finding that states the probe and documentation disagree, and land the removal separately from the manifest fixes so it does not ride on them.

Comment thread src/skillevaluator/harness/plugin.py Outdated
facts["any_manifest"] = any(v for k, v in facts.items() if k.startswith("fmt_"))
facts["default_dirs"] = any((root / d).is_dir() for d in DEFAULT_DIRS)
facts["default_layout"] = facts["default_dirs"] or any(_is_file(root / f) for f in DEFAULT_FILES)
selected = next((rel for rel in OPENCLAW_CLIENT_MANIFESTS if (root / rel).exists()), "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] New .exists() probes raise on an unreadable folder

plugin_facts probes the selected OpenClaw manifest here and the default-layout markers at line 228 with unguarded Path.exists(). On Python 3.12, a plugin folder whose .codex-plugin is mode 000 makes plugin_facts raise PermissionError (repro: a folder holding .claude-plugin/plugin.json and an unreadable .codex-plugin/plugin.json). The same input returns normally on #888's head, which adds _is_file/_is_dir helpers that read such paths as absent. Please reuse them here, or switch these calls after #888 lands, so the crash #888 fixes does not come back.

Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
devin-ai-integration[bot]

This comment was marked as resolved.

Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
Signed-off-by: Christopher Kevin <christopherk@nvidia.com>
devin-ai-integration[bot]

This comment was marked as resolved.

Signed-off-by: Christopher Kevin <christopherk@nvidia.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

Devin Review

target = (root / entry).resolve(strict=True).relative_to(root)
except (OSError, RuntimeError, ValueError):
return False
return PluginRootReader(root).kind(PurePosixPath(*target.parts)) == "file"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Fallback excludes hard-linked targets

_openclaw_native_fallback_is_file rejects in-plugin targets with multiple hard links. PluginRootReader.kind classifies them as special, although the reference describes any in-plugin regular target as eligible.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Signed-off-by: Christopher Kevin <christopherk@nvidia.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants