[fix] show moderation status on plain clawhub inspect#1488
[fix] show moderation status on plain clawhub inspect#1488edenfunf wants to merge 2 commits intoopenclaw:mainfrom
Conversation
|
@edenfunf is attempting to deploy a commit to the Amantus Machina Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR fixes a gap where running Two issues were found:
Confidence Score: 3/5Safe to merge for the human-readable path, but JSON output still incomplete and a minor contradictory-display edge case exists. The core fix is correct and well-tested. However, the packages/clawdhub/src/cli/commands/inspect.ts —
|
Running `clawhub inspect <skill>` without any version flags never printed the security verdict, even though the API always returns a `moderation` object in the skill response. The existing `printSecuritySummary` call was gated behind `versionResult?.version`, which is only populated when `--version`, `--tag`, `--files`, or `--file` is passed. The skill-level moderation data (verdict, isSuspicious, isMalwareBlocked, updatedAt, engineVersion) was fetched but silently discarded every time. Fix: add `printModerationSummary` and call it in the `else if (shouldPrintMeta)` branch so the security status is always visible on a basic inspect, without requiring a version-specific flag.
verdict is optional in ApiV1SkillResponseSchema, so a response where isSuspicious is true but verdict is absent would have printed "Security: CLEAN" followed by "Suspicious: yes" — a contradictory pair. Fall back to the boolean flags instead of hardcoding "clean": moderation.verdict ?? (isMalwareBlocked ? "malicious" : isSuspicious ? "suspicious" : "clean") The booleans are always present (non-optional) so this is always consistent.
00bc665 to
95aa9c0
Compare
|
Thanks for the thoughtful fix here — the behavior you pointed out makes sense. We’re going to close this one for now because we don’t want to add more default output to plain So this is less about the implementation and more about the product choice: we’d rather keep the default inspect output lean unless we decide to introduce a more explicit security-focused view later. Appreciate the contribution. |
What's the problem?
Running
clawhub inspect <skill>without any flags never shows the security status, even though the API always returns it.If you try with
--version 1.2.3you'll see the security block — but that requires knowing a version number upfront. For a quick sanity check, you shouldn't have to do that.Related to #1483.
Why does it happen?
The existing
printSecuritySummarycall is gated behindversionResult?.version:versionResultis only populated when--version,--tag,--files, or--fileis passed. Without those flags it staysnull, and the skill'smoderationobject — which the API always returns — is fetched but never displayed.What I changed
Added a
printModerationSummaryfunction that reads the skill-levelmoderationobject (verdict,isSuspicious,isMalwareBlocked,updatedAt,engineVersion) and prints it in theelse if (shouldPrintMeta)branch, so the security line is always visible on a basic inspect:When no moderation data comes back from the API the block is a no-op, so existing behaviour for older responses is unchanged.
How I verified it
inspect.test.ts:Security: CLEAN, no suspicious/malware lines