Skip to content

test(skills): pin Skill Workshop behavior at real entry points before plugin extraction - #173557

Merged
obviyus merged 9 commits into
mainfrom
test/workshop-characterization
Oct 29, 2026
Merged

obviyus merged 9 commits into
mainfrom
test/workshop-characterization

Conversation

@obviyus

@obviyus obviyus commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

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:

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 main at e125921a28ebb (merged):

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: #173605

@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes agents Agent runtime and tooling size: XL labels Oct 15, 2026
@obviyus
obviyus marked this pull request as ready for review October 15, 2026 23:52
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Existing behavior saves a draft without changing the live skill or posting a Learned notice.
  • After: Behavior stays unchanged, with Gateway coverage checking those effects after review settlement.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Substantive production-path characterization and resolved prior findings support the patch; supplied execution evidence remains reported harness results.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-only PR reports Gateway, CLI, filesystem, scheduler, and browser harness runs; the reviewed diff changes no shipped behavior requiring separate live proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: A future Workshop extraction could preserve internal tests while breaking operator entry points.
Reason: The maintainer-authored change establishes useful baseline contracts without committing to the separate extraction design.

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
Reviewed head: 74c77ffc9a36a32d2d520e8612ba04cfec308c5d

Before merge

None.

Findings

None.

Agent review details

How this fits together

Agent 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]
Loading

Technical review

Best 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

  • Existing scheduler and review test suites keeps the original intent (cfee851: The versioned learning loop established direct writes, background reviews, and undoable changes; the added tests preserve those responsibilities.)
  • Database-worker test routing keeps the original intent (3a33369: SQLite consumers require fork hosts with the host-owned broker; the added suites join that existing routing owner.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Introduced scope: The pinned introduction contains tests and test routing only; it changes no shipped runtime, public API, configuration, or persisted model. (74c77ffc9a36)
  • Earlier timing finding resolved: The latest commit removes elapsed-time Gateway assertions, tests quiet-period restart with a controlled clock, and exercises due-time configuration admission through the existing default scheduler. (src/skills/workshop/experience-review-scheduler.test.ts:148, 74c77ffc9a36)
  • Earlier settlement finding resolved: The propose-mode scenario observes the closing provider request and then waits for Gateway root work to reach zero before checking drafts, unchanged skills, and absent notices; the production review admission spans its awaited notice finalizer. (src/gateway/gateway-review.workshop-contract.e2e.test.ts:794, 74c77ffc9a36)
  • Separate extraction proposal: [Feature]: Move Skill Workshop from core into a bundled plugin #173605 remains a parked extraction proposal and identifies this PR as preparatory characterization coverage rather than the cutover.
  • Current-main context: The inspected scheduler, review admission, skill-source composition, Gateway handlers, and CLI owner match fetched main; the new principal characterization suites are absent there. (src/skills/workshop/experience-review.ts:115, 0801814cff93)
  • Feature history and ownership: Merged history connects obviyus to the versioned learning loop and propose-mode implementation, and Peter Steinberger to scheduler and runtime refactors. REST commit patches verify retained authored lines. Some historical blobs are unavailable locally, preventing full blame traversal. (src/skills/workshop/experience-review.ts:315, b073ac5c3308)

PR surface

Tests +4688. Total +4688 across 16 files. Added test files: 13.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 16 4688 0 +4688
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 4688 0 +4688

Review metrics

Metric Value Why it matters
Production versus test growth Production +0; tests +4684; test routing +4 Growth establishes extraction-resistant entry-point coverage, including real filesystem effects, Gateway dispatch, review lifecycle, and browser interactions.

Root-cause cluster

Relationship: partial_overlap
Canonical: #173605
Summary: The linked issue owns the extraction program; this PR supplies its preparatory behavior contracts.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is preparatory test maintenance with no shipped behavior change or reported urgent user failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-16T00:09:57.750Z sha dafe56b :: needs changes before merge. :: [P2] Match the loader assertion to the existing home-path contract | [P2] Replace fixed review-timer sleeps with controlled-clock coverage
  • reviewed 2026-10-29T08:49:16.495Z sha 43f0b66 :: needs changes before merge. :: [P2] Replace elapsed-time review checks with controlled-clock coverage | [P2] Await review settlement before checking that no notice was posted

Reviewed October 29, 2026, 5:17 AM ET / 09:17 UTC (Revision 3).

…erization

# Conflicts:
#	test/vitest/vitest.database-worker-core-paths.mjs
@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed P2 Normal backlog priority with limited blast radius. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 29, 2026
@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 29, 2026
@obviyus
obviyus merged commit 60bee20 into main Oct 29, 2026
139 of 140 checks passed
@obviyus
obviyus deleted the test/workshop-characterization branch October 29, 2026 10:15
@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 60bee20.

  • Problem: Skill Workshop is moving into a plugin ([Feature]: Move Skill Workshop from core into a bundled plugin #173605), and its tests mostly call Workshop internals, so they could not show that behavior stays the same after the move.
  • Fix: characterization tests at the entry points that stay in core: the tool set, the Gateway dispatcher, the CLI, /learn, Doctor, maintenance, a real Gateway and the Control UI. Review timing (quiet period, due-time config and policy recheck) is covered with a controlled clock in the scheduler and review unit tests.
  • Proof: the Gateway review e2e passes 9/9 locally, the contract and unit suites pass, CI is green on the exact head, and ClawSweeper marked it ready.

obviyus added a commit that referenced this pull request Oct 30, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
… 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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui cli CLI command changes gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant