Repository navigation
test(skills): pin Skill Workshop behavior at real entry points before plugin extraction - #173557
Conversation
… plugin extraction
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR adds Skill Workshop characterization tests across core entry points before a proposed plugin extraction. Example: A background review proposes an update to contract-release in propose mode.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored PR open: the current head resolves both earlier findings and adds useful extraction contracts; no new blocking defect was found. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAgent turns, commands, CLI requests, and Gateway calls reach Workshop owners that manage learned skills, drafts, versions, and notices consumed by chat and the Control UI. flowchart LR
A[Operator requests and agent turns] --> B[Core entry points]
B --> C[Workshop owners]
C --> D[Skills drafts and versions]
C --> E[Change history and notices]
E --> F[Chat and Control UI]
Technical reviewBest possible solution: Retain contracts at stable entry points and keep timing checks in the existing scheduler and review suites. Do we have a high-confidence way to reproduce the issue? This PR characterizes existing behavior rather than fixing a runtime defect; source inspection confirms the exercised boundaries, and no tests were executed during this read-only review. Is this the best way to solve the issue? The approach preserves existing owners and protects entry-point wiring without introducing production seams; controlled-clock timing coverage is the appropriate complement to Gateway effect tests. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0801814cff93. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceTests +4688. Total +4688 across 16 files. Added test files: 13. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed October 29, 2026, 5:17 AM ET / 09:17 UTC (Revision 3). |
…erization # Conflicts: # test/vitest/vitest.database-worker-core-paths.mjs
…erization # Conflicts: # test/vitest/vitest.database-worker-core-paths.mjs
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 60bee20.
|
…7661) Related: #173605 ## What Problem This Solves Fixes: the `diffs` plugin adds its tool guidance to every system prompt, including runs where the `diffs` tool is denied and ACP runs, which have no OpenClaw tools. Plugins also had no way to give tool guidance that appears only while their tool is callable: Codex, Agents API and Copilot each hard-coded the Skill Workshop text instead. ## User Impact - A run that cannot call `diffs` no longer gets diffs guidance in its prompt. - Plugin authors can set `promptGuidance` on `api.registerTool(...)`. The guidance appears on every bundled harness only while one of the registration's tools is callable, including tools found through Tool Search. - `plugins.entries.<id>.hooks.allowPromptInjection: false` still keeps the tool and drops only its guidance, as the diffs docs describe. - No config change or migration. The Skill Workshop guidance is unchanged. ## Why This Change Was Made One owner, `listToolPromptGuidance(callableToolNames)`, now decides which tool guidance a run gets. It covers core tools (Skill Workshop) and plugin tool registrations. The embedded system prompt and the Codex, Agents API and Copilot harnesses all call it with their callable tool names. Plugin sections are ordered by plugin id, so plugin load order does not change prompt bytes. - `diffs` moves its guidance from an unconditional `before_prompt_build` hook to `promptGuidance` on its tool registration. - A registration with `promptGuidance` must name its tools. Otherwise the guidance can never be gated, so registration fails with a diagnostic. - `buildSkillWorkshopPromptSection` and `SKILL_WORKSHOP_TOOL_NAME` in `openclaw/plugin-sdk/agent-harness-runtime` stay exported unchanged and are marked deprecated, with no removal date. No bundled plugin uses them now. On public ClawHub (checked 2026-10-29) the only users are the first-party `@openclaw/codex` and `@openclaw/copilot` releases, which this PR moves to the new helper; no third-party plugin uses them. About 17% of ClawHub plugins had partial or failed static analysis, so usage there is unknown. What disappeared: the three harness copies of the Workshop gate and the unconditional diffs `before_prompt_build` hook. Diff against `main`: production +98/-30 (the new owner, the registration option, its rejection and opt-out, and the deprecated SDK wrappers), tests +112/-25, docs +17/-2. This is the first step from the #173605 audit: build hooks with a second consumer before any Workshop move. Here the consumers are `diffs` and Skill Workshop. ## Evidence | Check | Result | | --- | --- | | New owner tests (`src/agents/tool-prompt-guidance.test.ts`): guidance shown when the tool is visible or deferred, absent when denied; order independent of load order; unnamed registration rejected | pass. The gating test fails when the callable check is removed. | | Opt-out test: `allowPromptInjection=false` keeps the tool, drops its guidance, records a warning | passes | | Workshop contract test from #173557 (`system-prompt.workshop-contract.test.ts`), unedited | passes | | `system-prompt.test.ts` (includes deferred Code Mode Workshop case) | passes | | Codex, Agents API, Copilot harness prompt tests | 194 pass | | diffs plugin tests | pass | | `tsgo:core`, `tsgo:extensions`, `tsgo:core:test`, `tsgo:extensions:test` | pass | | Extension boundary checks (`no-src-outside-plugin-sdk`, `no-relative-outside-package`), `plugin-sdk:check-exports` | pass | | `plugin-sdk:api:diff` | 1 export added (`listToolPromptGuidance`), 0 removed; 7 declarations gain an optional field | | oxfmt, oxlint, `git diff --check` | pass | Not run: a live model turn on each harness. The harness tests assert the rendered instructions. Merge danger: two-way door. Blast radius: system prompt text for runs with `diffs` or Skill Workshop; additive plugin SDK option. Co-authored-by: Ayaan Zaidi <[email protected]>
… plugin extraction (openclaw#173557) ## What Problem This Solves Skill Workshop is moving from core into a bundled, enabled-by-default plugin (openclaw#173605). Its current tests mostly call Workshop internals directly, so they can't show that behavior stays the same after the code moves. ## User Impact None. This PR adds tests only: no production changes. ## Why This Change Was Made These are characterization tests: each one pins the behavior an operator sees today at the entry point they use. They import only modules that stay in core after the move (the agent tool set, the Gateway dispatcher, the CLI program, the command pipeline, the skills loader, Doctor, Gateway maintenance, the Gateway server, and the Control UI app), never Workshop modules. The same files are meant to pass unchanged before and after the cutover. Refreshed on current `main`. Updated to intended changes since the first draft: - The CLI archive hint now names `--agent`. - The tool has `draft` and `discard`. - Doctor exports retired proposals to `.drafts/`, and moves earlier `.archive/.retired-proposals/` exports there too. - Background reviews call `skill_workshop` directly, without Tool Search (openclaw#173889). - Channel notices carry the Learned marker (openclaw#182329). - The `/learn` tests now pin how the request reaches the agent, not the full prompt wording, which Workshop owns. New contracts: - **Propose mode and drafts:** a review in `propose` mode can only save drafts and cannot discard them; the foreground lists, views and discards drafts (tool). `skills.workshop.list`/`read` return on-disk drafts for `operator.read`; `applyDraft` and `discardDraft` are `operator.admin` only, and apply refuses a mismatched skill name (RPC). A real-Gateway review in `propose` mode saves one draft, changes no skill and posts no notice (e2e). The Control UI shows drafts as a diff against the live skill and sends `applyDraft`/`discardDraft` (UI e2e). - **`/learn drafts`:** with no drafts it answers without a model turn; otherwise it rewrites the turn over the selected drafts, narrowed by skill name, with the focus text. - **`/learn` and memory plugins:** with a selected memory plugin's learning tools, one turn routes to both skills and memory; with `skill_workshop` denied it learns into memory alone; with both denied it replies with the combined refusal. - **Review timing and admission:** the 30-second quiet period and the recheck of current config and tool policy when a review becomes due are timer contracts. They are covered with a controlled clock in the scheduler and review unit tests, which move with the Workshop code. The real-Gateway e2e checks only effects, and waits for the review's Gateway root work to settle before it asserts that nothing changed. - **Daily maintenance:** an oversized, settled learned skill is dieted as one `curator` change that `restore` undoes. Unused-skill cleanup does not run in `propose` mode or when tool policy denies `skill_workshop`. ## Evidence Local runs on this branch (the Gateway e2e and unit tests after merging `main` at `2592002ce0ede`): | Area | Result | | --- | --- | | Tool, RPC, CLI, `/learn`, config, Doctor, skill loading, maintenance (10 files) | 64 tests pass | | Real-Gateway review (e2e file) | 9 pass | | Scheduler and review unit tests (controlled clock) | all pass; the 2 new tests fail when the quiet-period restart or the due-time config read is removed | | Control UI (app e2e) | 5 pass | `pnpm tsgo:core:test`, oxfmt, type-aware oxlint and `git diff --check` pass on the changed files. Merge danger: two-way door. Blast radius: tests only. Tracking issue: openclaw#173605 Co-authored-by: Ayaan Zaidi <[email protected]>
…nclaw#187661) Related: openclaw#173605 ## What Problem This Solves Fixes: the `diffs` plugin adds its tool guidance to every system prompt, including runs where the `diffs` tool is denied and ACP runs, which have no OpenClaw tools. Plugins also had no way to give tool guidance that appears only while their tool is callable: Codex, Agents API and Copilot each hard-coded the Skill Workshop text instead. ## User Impact - A run that cannot call `diffs` no longer gets diffs guidance in its prompt. - Plugin authors can set `promptGuidance` on `api.registerTool(...)`. The guidance appears on every bundled harness only while one of the registration's tools is callable, including tools found through Tool Search. - `plugins.entries.<id>.hooks.allowPromptInjection: false` still keeps the tool and drops only its guidance, as the diffs docs describe. - No config change or migration. The Skill Workshop guidance is unchanged. ## Why This Change Was Made One owner, `listToolPromptGuidance(callableToolNames)`, now decides which tool guidance a run gets. It covers core tools (Skill Workshop) and plugin tool registrations. The embedded system prompt and the Codex, Agents API and Copilot harnesses all call it with their callable tool names. Plugin sections are ordered by plugin id, so plugin load order does not change prompt bytes. - `diffs` moves its guidance from an unconditional `before_prompt_build` hook to `promptGuidance` on its tool registration. - A registration with `promptGuidance` must name its tools. Otherwise the guidance can never be gated, so registration fails with a diagnostic. - `buildSkillWorkshopPromptSection` and `SKILL_WORKSHOP_TOOL_NAME` in `openclaw/plugin-sdk/agent-harness-runtime` stay exported unchanged and are marked deprecated, with no removal date. No bundled plugin uses them now. On public ClawHub (checked 2026-10-29) the only users are the first-party `@openclaw/codex` and `@openclaw/copilot` releases, which this PR moves to the new helper; no third-party plugin uses them. About 17% of ClawHub plugins had partial or failed static analysis, so usage there is unknown. What disappeared: the three harness copies of the Workshop gate and the unconditional diffs `before_prompt_build` hook. Diff against `main`: production +98/-30 (the new owner, the registration option, its rejection and opt-out, and the deprecated SDK wrappers), tests +112/-25, docs +17/-2. This is the first step from the openclaw#173605 audit: build hooks with a second consumer before any Workshop move. Here the consumers are `diffs` and Skill Workshop. ## Evidence | Check | Result | | --- | --- | | New owner tests (`src/agents/tool-prompt-guidance.test.ts`): guidance shown when the tool is visible or deferred, absent when denied; order independent of load order; unnamed registration rejected | pass. The gating test fails when the callable check is removed. | | Opt-out test: `allowPromptInjection=false` keeps the tool, drops its guidance, records a warning | passes | | Workshop contract test from openclaw#173557 (`system-prompt.workshop-contract.test.ts`), unedited | passes | | `system-prompt.test.ts` (includes deferred Code Mode Workshop case) | passes | | Codex, Agents API, Copilot harness prompt tests | 194 pass | | diffs plugin tests | pass | | `tsgo:core`, `tsgo:extensions`, `tsgo:core:test`, `tsgo:extensions:test` | pass | | Extension boundary checks (`no-src-outside-plugin-sdk`, `no-relative-outside-package`), `plugin-sdk:check-exports` | pass | | `plugin-sdk:api:diff` | 1 export added (`listToolPromptGuidance`), 0 removed; 7 declarations gain an optional field | | oxfmt, oxlint, `git diff --check` | pass | Not run: a live model turn on each harness. The harness tests assert the rendered instructions. Merge danger: two-way door. Blast radius: system prompt text for runs with `diffs` or Skill Workshop; additive plugin SDK option. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Skill Workshop is moving from core into a bundled, enabled-by-default plugin (#173605). Its current tests mostly call Workshop internals directly, so they can't show that behavior stays the same after the code moves.
User Impact
None. This PR adds tests only: no production changes.
Why This Change Was Made
These are characterization tests: each one pins the behavior an operator sees today at the entry point they use. They import only modules that stay in core after the move (the agent tool set, the Gateway dispatcher, the CLI program, the command pipeline, the skills loader, Doctor, Gateway maintenance, the Gateway server, and the Control UI app), never Workshop modules. The same files are meant to pass unchanged before and after the cutover.
Refreshed on current
main. Updated to intended changes since the first draft:--agent.draftanddiscard..drafts/, and moves earlier.archive/.retired-proposals/exports there too.skill_workshopdirectly, without Tool Search (fix(skills): keep background reviews out of saturated token budgets #173889)./learntests now pin how the request reaches the agent, not the full prompt wording, which Workshop owns.New contracts:
proposemode can only save drafts and cannot discard them; the foreground lists, views and discards drafts (tool).skills.workshop.list/readreturn on-disk drafts foroperator.read;applyDraftanddiscardDraftareoperator.adminonly, and apply refuses a mismatched skill name (RPC). A real-Gateway review inproposemode saves one draft, changes no skill and posts no notice (e2e). The Control UI shows drafts as a diff against the live skill and sendsapplyDraft/discardDraft(UI e2e)./learn drafts: with no drafts it answers without a model turn; otherwise it rewrites the turn over the selected drafts, narrowed by skill name, with the focus text./learnand memory plugins: with a selected memory plugin's learning tools, one turn routes to both skills and memory; withskill_workshopdenied it learns into memory alone; with both denied it replies with the combined refusal.curatorchange thatrestoreundoes. Unused-skill cleanup does not run inproposemode or when tool policy deniesskill_workshop.Evidence
Local runs on
mainate125921a28ebb(merged):/learn, config, Doctor, skill loading, maintenance (10 files)pnpm tsgo:core:test, oxfmt, type-aware oxlint andgit diff --checkpass on the changed files.Merge danger: two-way door. Blast radius: tests only.
Tracking issue: #173605