Skip to content

Commit ef7b665

Browse files
saju01steipete
andauthored
fix(cli): inspect skill workshop policy for each agent (#124283)
Co-authored-by: Peter Steinberger <[email protected]>
1 parent 75d80fc commit ef7b665

2 files changed

Lines changed: 45 additions & 32 deletions

File tree

‎src/cli/plugins-cli.inspect.test.ts‎

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -197,38 +197,45 @@ describe("plugins cli inspect", () => {
197197
expect(runtimeErrors.at(-1)).toContain("Plugin not found: missing-plugin");
198198
});
199199

200-
it("explains a policy-hidden built-in Skill Workshop at the legacy inspect surface", async () => {
200+
it.each([
201+
{ label: "an implicit agent", agentIds: ["main"], entries: undefined },
202+
{
203+
label: "a multi-agent roster",
204+
agentIds: ["main", "venus"],
205+
entries: { main: {}, venus: {} },
206+
},
207+
])("explains policy-hidden Skill Workshop for $label", async ({ agentIds, entries }) => {
201208
const config: OpenClawConfig = {
202209
tools: { profile: "messaging" },
210+
...(entries ? { agents: { ownership: "explicit" as const, entries } } : {}),
203211
};
204212
pluginCliConfigMock.mockReturnValue(config);
205-
workshopMocks.detectToolPolicyDiagnostic.mockReturnValue({
206-
agentId: "main",
207-
source: "tools.profile",
208-
detail: 'tools.profile: "messaging" does not include "skill_workshop".',
209-
fix: 'Add tools.alsoAllow: ["skill_workshop"].',
210-
message:
211-
'Skill Workshop is active, but "skill_workshop" is hidden for agent "main": tools.profile: "messaging" does not include "skill_workshop". Add tools.alsoAllow: ["skill_workshop"].',
212-
});
213-
buildPluginSnapshotReportMock.mockReturnValue({
214-
plugins: [],
215-
diagnostics: [],
216-
});
213+
workshopMocks.detectToolPolicyDiagnostic.mockImplementation(
214+
({ agentId }: { agentId: string }) => ({
215+
agentId,
216+
message:
217+
`Skill Workshop is active, but "skill_workshop" is hidden for agent "${agentId}": ` +
218+
'tools.profile: "messaging" does not include "skill_workshop". ' +
219+
'Add tools.alsoAllow: ["skill_workshop"].',
220+
}),
221+
);
222+
buildPluginSnapshotReportMock.mockReturnValue({ plugins: [], diagnostics: [] });
217223

218224
await expect(runPluginsCommand(["plugins", "inspect", "skill-workshop"])).rejects.toThrow(
219225
"__exit__:1",
220226
);
221227

222-
expect(runtimeErrors.at(-1)).toContain(
223-
"Skill Workshop is built into OpenClaw, not a plugin; configure it under skills.workshop.",
224-
);
225-
expect(workshopMocks.detectToolPolicyDiagnostic).toHaveBeenCalledWith({
226-
config,
227-
workshopEnabled: true,
228-
});
229-
expect(runtimeErrors.at(-1)).toContain(
230-
'tools.profile: "messaging" does not include "skill_workshop".',
231-
);
232-
expect(runtimeErrors.at(-1)).toContain('Add tools.alsoAllow: ["skill_workshop"].');
228+
const output = runtimeErrors.at(-1);
229+
expect(output).toContain("Skill Workshop is built into OpenClaw, not a plugin");
230+
expect(output).toContain('tools.profile: "messaging" does not include "skill_workshop".');
231+
expect(output).toContain('Add tools.alsoAllow: ["skill_workshop"].');
232+
for (const agentId of agentIds) {
233+
expect(workshopMocks.detectToolPolicyDiagnostic).toHaveBeenCalledWith({
234+
config,
235+
workshopEnabled: true,
236+
agentId,
237+
});
238+
expect(output).toContain(`hidden for agent "${agentId}"`);
239+
}
233240
});
234241
});

‎src/cli/plugins-inspect-command.ts‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// `openclaw plugins inspect`: renders plugin registry shape, capabilities, policy, diagnostics, and install records.
22
import { getTerminalTableWidth, renderTable } from "../../packages/terminal-core/src/table.js";
33
import { theme } from "../../packages/terminal-core/src/theme.js";
4+
import { listAgentIds } from "../agents/agent-scope-config.js";
45
import { getRuntimeConfig } from "../config/config.js";
56
import type { PluginInstallRecord } from "../config/types.plugins.js";
67
import {
@@ -242,17 +243,22 @@ export async function runPluginsInspectCommand(
242243
if (id === "skill-workshop") {
243244
const { detectSkillWorkshopToolPolicyDiagnostic } =
244245
await import("../skills/workshop/tool-policy-diagnostic.js");
245-
const diagnostic = detectSkillWorkshopToolPolicyDiagnostic({
246-
config: cfg,
247-
// Invoking the legacy inspect id is explicit Workshop intent even when
248-
// autonomous capture is off; report manual-tool availability too.
249-
workshopEnabled: true,
250-
});
246+
// An explicit multi-agent roster has no single default diagnostic owner.
247+
const agentIds = listAgentIds(cfg);
251248
const lines = [
252249
"Skill Workshop is built into OpenClaw, not a plugin; configure it under skills.workshop.",
253250
];
254-
if (diagnostic) {
255-
lines.push(diagnostic.message);
251+
for (const agentId of agentIds.length > 0 ? agentIds : [undefined]) {
252+
const diagnostic = detectSkillWorkshopToolPolicyDiagnostic({
253+
config: cfg,
254+
// Invoking the legacy inspect id is explicit Workshop intent even when
255+
// autonomous capture is off; report manual-tool availability too.
256+
workshopEnabled: true,
257+
...(agentId ? { agentId } : {}),
258+
});
259+
if (diagnostic) {
260+
lines.push(diagnostic.message);
261+
}
256262
}
257263
failPluginInspect(lines.join("\n"), opts.json);
258264
return;

0 commit comments

Comments
 (0)