Skip to content

fix(skills): fork the foreground session for lean experience review - #129282

Merged
obviyus merged 7 commits into
mainfrom
fix/skill-workshop-lean-review
Aug 25, 2026
Merged

obviyus merged 7 commits into
mainfrom
fix/skill-workshop-lean-review

Conversation

@obviyus

@obviyus obviyus commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Skill Workshop experience review ran as an isolated agent with a re-rendered 60k-character transcript, its own bootstrap, and a trimmed tool surface. Every review was a cold request: no prompt-cache reuse, a large re-serialized trajectory, and a reasoning/tool profile that differed from the foreground turn. Autonomous updates could target any workspace skill, size limits allowed 40 KB skills to grow unchecked (one deployed workspace hit a 21 KB SKILL.md), the collection reviewer had to re-list every skill in its plan and read them under a fixed 24k-character budget (a 16-skill workspace failed every pass with "Read every current skill before reconciling"), collection review only recorded successes so a failing pass retried on every Gateway restart, and openclaw skills curator status showed nothing about what the last reviews did.

Why This Change Was Made

  • Warm fork. Experience review now continues the finished turn from the same in-memory session prefix (same session identity, bootstrap, skills prompt, tool schemas, promptCacheKey), appends one short review message, and runs with sessionPersistence: "detached" so nothing it writes reaches the foreground transcript or session record. Only skill_workshop executes; every other tool keeps its schema for cache parity and fails with a next-step message. The gate wraps the core tool list before Code Mode / Tool Search compaction, so catalog-hidden tools stay gated while tool_call/exec remain callable. src/agents/embedded-agent-runner/run/attempt.skills-policy.test.ts asserts identical system-prompt and tool digests between a foreground turn and its review, and that tool_call reaches skill_workshop but not read during review. Code Mode swarm globals (phase, log, agents.run) are the sessions_spawn capability and gate on the same allowlist, so a review cannot emit foreground lifecycle events or launch collectors. The review shares the foreground session, so it no longer retires that session's MCP runtime on run end; it reuses the warm runtime like any turn. Accepted tradeoff: the review inherits foreground tool construction (it creates the session MCP runtime only when the session has none, and spawns per-attempt LSP servers only when configured), because splitting tool construction from the foreground turn would break the cache-parity invariant this PR exists for.
  • One apply owner, rechecked at the write boundary. src/skills/workshop/autonomous-apply.ts decides apply-vs-pending for both the post-review loop and foreground repair: creates and updates to Workshop-authored skills apply; updates to user-authored skills stay pending with a recorded reason. applySkillProposalTransition rechecks path-based ownership under the commit lock for non-operator actors (agent, or no actor), so a claim released after the pre-check cannot let an agent write a user-authored skill; gateway and CLI operators still approve any pending proposal. The user-authored pending write runs under the same commit lock and rereads the row, so an operator apply that lands first is kept. The old auto-apply.ts path and name-based listWorkshopAuthoredSkillNames are deleted.
  • Sparse collection plan and model-relative reads. The collection reviewer returns only write and drop entries; unlisted skills stay untouched, so a 16-skill workspace no longer has to restate 16 keeps. The skill read budget is derived from the model's context window (35%) instead of a fixed 24k characters, with the 10,000-character skill cap still enforced per skill. No windowed read parameters: a skill is read whole or not at all.
  • Weekly cadence. Collection review runs once every 7 days instead of daily (REVIEW_INTERVAL_MS), matching how slowly a skill library actually changes; the attempt is recorded before the model starts, so a failed pass does not retry on every restart.
  • Lean cap. AUTONOMOUS_SKILL_MAX_CHARS = 10,000 in src/skills/workshop/collection-contracts.ts is enforced by the tool and by collection reconcile; an oversized skill may only shrink. Tool description, experience prompt, and collection prompt were rewritten around procedures-not-records, one trigger per branch, and "NOTHING_TO_LEARN is the correct answer for most turns".
  • Detached runs end quietly. A detached run writes no transcript or session record and runs under the foreground session key, so attempt-finalize now skips agent_end side effects for it: plugins do not observe the review as a foreground turn, and a deep review cannot schedule a successor review of itself.
  • Recorded outcomes. Experience review records applied | proposed | nothing | failed with usage; one attempt per turn, drop on error. openclaw skills curator status prints the last collection and experience review outcome.

User Impact

Related: #123866, #128871 both patch skills above the reviewer read budget; this PR caps autonomous skill size and restricts oversized skills to shrink-only rewrites.

Evidence

  • Live gateway (Linux, Telegram, xai provider) at 133ffe3: manual experience review on a real foreground turn → nothing (usage: 0 uncached input, 13,902 cached, 36 output — the forked review hit the foreground prompt cache); manual collection review over the workspace → succeeded; the three oversized skills were rewritten under the cap (21,002 → 9,449; 11,882 → 7,735; 10,300 → 7,413 bytes, originals in skill-workshop/collection-backups/), the rest untouched, and the pre-PR "Read every current skill before reconciling" failure is gone. The next foreground turn's automatic experience review recorded nothing and openclaw skills curator status shows both outcomes. The apply recheck, MCP-runtime change (26e821f), and detached agent_end skip (7e4a506) landed after that run and are covered by the regression tests below.
  • pnpm test src/skills/workshop src/agents/tools/skill-workshop-tool src/gateway/server-methods/skills plus src/agents/embedded-agent-runner/run/attempt.skills-policy.test.ts, src/agents/embedded-agent-runner/run/attempt.tool-search-catalog-abort.test.ts, src/cli/skills-cli.curator.test.ts, src/agents/harness/tool-surface-bridge.test.ts — green. New regression tests (service.test.ts agent-vs-operator apply on a user-authored skill and operator apply kept over a stale pending snapshot; experience-review.apply.test.ts no cleanupBundleMcpOnRunEnd; attempt-phase-lifecycle.test.ts no agent_end for a detached run; code-mode-swarm.test.ts swarm globals refused under the review allowlist) fail on the pre-fix code.
  • Dependent sweep: 46 test files importing the touched modules — green.
  • oxfmt, scripts/run-oxlint.mjs on changed files, git diff --check — clean.
  • pnpm tsgo && pnpm check:test-types on Blacksmith Testbox — clean.
  • Local ClawSweeper review (gpt-5.6-terra, high): 133ffe3 raised two findings (ownership recheck removed from the apply boundary; review retiring the shared session's MCP runtime), fixed in 26e821f; 26e821f raised one (detached review re-entering agent-end scheduling), fixed in 7e4a506; 7e4a506 raised three: pending write racing an operator apply and Code Mode swarm globals bypassing the execution gate, both fixed in e4b4322; "prove detached review does not start configured MCP or LSP runtimes" is skipped as the cache-parity tradeoff stated above (LSP tool schemas come from the LSP runtime; the MCP runtime is session-owned and already warm). Maintainer decision on e4b4322: accepted — a detached review reuses the session MCP runtime and re-spawns configured per-attempt LSP servers exactly like a foreground turn; it still cannot execute them.
  • Unrelated CI on 26e821f/7e4a506: check-lint-core-2 (max-lines in src/gateway/server-methods/models-list-result.ts, unused param in models.test.ts, both from fix: report native Claude CLI models as available #129332) and checks-node-compact-small-8 (doctor-auth.profile-health.test.ts, Claude CLI auth from fix: keep Claude CLI authentication native #129052) fail identically on main run 32857954734; checks-node-compact-small-31 pins plugin SDK export counts (4340 vs 4342) that fix: keep Claude CLI authentication native #129052 moved — this PR touches no src/plugin-sdk file. On e4b4322 the failing set is the same twelve checks-node-compact shards that fail on main run 32857954734 (large-5/12/13/14/15/18/22, small-8/14/20/21/26) plus small-31; check-lint-core-2 passes here. None are fixed here; fix(ci): align Claude native-auth contracts #129357 carries the main fix.
  • LOC (raw numstat): production +712 / −664 (net +48; the four review-fix commits after the live run add +76 / −26); tests + docs +1269 / −1238 (net +31).

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@obviyus
obviyus marked this pull request as ready for review August 25, 2026 11:40
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation r: skill Auto-close: skills should be published on ClawHub, not added to core. gateway Gateway runtime cli CLI command changes agents Agent runtime and tooling extensions: copilot size: XL maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. 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 Aug 25, 2026
Experience review now continues the finished turn's session prefix as a
detached run: same bootstrap, skills prompt, tool schemas, and prompt cache
key, one short review message, and only skill_workshop executes. The
execution gate wraps tools before catalog compaction so Code Mode and Tool
Search hidden tools stay gated while the controls remain callable.

Autonomous apply moves to one owner (autonomous-apply.ts): Workshop-authored
targets apply, user-authored targets stay pending with a recorded reason.
Autonomous skills are capped at 10,000 characters; oversized skills may only
shrink. Collection review records the attempt before the model pass so a
failed daily review does not retry on every restart; experience review
records applied/proposed/nothing/failed with usage, and
`openclaw skills curator status` prints both. Review prompts rewritten around
procedures over records and one trigger per branch.
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 25, 2026, 9:05 AM ET / 13:05 UTC.

ClawSweeper review

What this changes

This PR changes Skill Workshop’s autonomous review and proposal handling, including detached review runs, ownership-aware application, and weekly collection reconciliation.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked by patch quality or review findings - 11 items remain

Keep open: the branch removes a lock-scoped ownership check and can initialize MCP runtime before its Workshop-only execution gate applies.

Priority: P1
Reviewed head: 133ffe38e7d0de90f4f9264ae5d666462f31face
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Two reachable owner-boundary defects make the patch unsuitable to merge.
Proof confidence 🌊 off-meta tidepool Not applicable: The PR is from a member, so external-contributor proof is not required; this does not resolve the functional and authority-boundary defects.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The PR is from a member, so external-contributor proof is not required; this does not resolve the functional and authority-boundary defects.
Evidence reviewed 4 items Removed final ownership recheck: The PR checks ownership before calling the proposal application flow, but the final commit lock no longer rechecks it before mutation; current main retains that lock-scoped guard.
MCP initializes before execution gating: Detached review supplies only toolExecutionAllow, while bundle MCP creation consults toolsAllow and occurs before the catalog applies execution gating.
Current-main ownership and bundle behavior: Current main remains at 147e9da and attributes the relevant ownership and MCP-preparation lines to the recent worker repair.
Findings 2 actionable findings [P1] Recheck ownership inside the commit lock
[P1] Prevent MCP startup before Workshop-only gating
Security Needs attention MCP runtime starts before tool restriction: The branch limits execution after bundle creation, but bundle MCP setup uses the absence of toolsAllow to enable runtime creation. That can cross the intended tool/side-effect boundary before the gate runs.

Live Verification

Command: pnpm openclaw skills curator status

Result: PASS (completed)

pnpm openclaw skills curator status
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129282-AbMTmG/target$ pnpm openclaw skills curator status
$ node scripts/run-node.mjs skills curator status
pnpm openclaw skills curator status
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 105.23 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 14.4s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4258ms (slowest: built plugin control-plane loads 3499ms)
│
◇

OpenClaw 2026.8.1 (133ffe3) — I've seen your commit messages. We'll work on that together.

Last attempt: never
Last success: never
Counts: 0 active, 0 stale, 0 archived
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129282-AbMTmG/target$ pnpm openclaw skills curator status


Assertions:

  • PASS expect_output: Last attempt:

How this fits together

Skill Workshop lets OpenClaw agents review workspace skills and propose updates, which then flow through a locked application path. Detached curator runs construct agent tools before eligible proposals can alter a workspace skill.

flowchart LR
  A[Workspace skills] --> B[Skill Workshop review]
  B --> C[Detached agent run]
  C --> D[Tool preparation]
  D --> E[Proposal record]
  E --> F[Locked application]
  F --> G[Workspace skill update]
Loading

Decision needed

Question Recommendation
Should autonomous collection review intentionally change from daily retries to a weekly cadence that records a failed attempt before model execution? Keep the weekly cadence: Accept weekly reconciliation after upgrade and fresh-install proof confirms operators can understand and recover from recorded failures.

Why: This is a durable operator-facing scheduling and recovery policy change, so correctness fixes alone cannot establish the intended product behavior.

Before merge

  • Recheck ownership inside the commit lock (P1) - The ownership decision now happens before applySkillProposal, but this locked transition no longer verifies that the resolved target remains Workshop-owned before preparing the write. A symlink or target-state change between the early check and this callback can turn a user-authored skill into a mutation target. Restore the resolved-directory ownership predicate inside this lock and cover the transition.
  • Prevent MCP startup before Workshop-only gating (P1) - toolExecutionAllow gates tools only after bundle construction, while MCP creation consults toolsAllow; because this run supplies no toolsAllow, configured MCP runtime can initialize under the copied foreground context before the Workshop-only restriction takes effect. Restrict or reuse the pre-materialization path and add a test proving this detached run never calls MCP runtime creation.
  • Resolve security concern: MCP runtime starts before tool restriction - The branch limits execution after bundle creation, but bundle MCP setup uses the absence of toolsAllow to enable runtime creation. That can cross the intended tool/side-effect boundary before the gate runs.
  • Resolve merge risk (P1) - A target can become user-authored after the early check but before the final write, because the mutation lock no longer validates Workshop ownership.
  • Resolve merge risk (P1) - Configured MCP runtime can be initialized under the foreground sender/session context before the Workshop-only tool gate blocks use.
  • Resolve merge risk (P1) - Automatic collection review changes from daily to weekly and records failed attempts before the model pass, requiring upgrade-path evidence or explicit product acceptance.
  • Complete next step (P2) - Contributor changes are required to restore both owner boundaries, while maintainers must decide the new automatic-review cadence.
  • Improve patch quality - Restore and test lock-scoped ownership validation.
  • Improve patch quality - Prove detached Workshop review cannot initialize MCP before the execution gate.
  • Improve patch quality - Provide upgrade or fresh-install evidence for the new weekly failed-attempt cadence.

Findings

  • [P1] Recheck ownership inside the commit lock — src/skills/workshop/apply-transition.ts:218-226
  • [P1] Prevent MCP startup before Workshop-only gating — src/skills/workshop/experience-review.ts:493-504
  • [medium] MCP runtime starts before tool restriction — src/skills/workshop/experience-review.ts:493
Agent review details

Security

Needs attention: The detached Workshop-only review can initialize configured MCP runtime before the execution restriction is applied.

PR surface

Source -2, Tests -98, Docs +4, Other 0. Total -96 across 61 files.

View PR surface stats
Area Files Added Removed Net
Source 38 677 679 -2
Tests 19 1072 1170 -98
Docs 3 72 68 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 61 1822 1918 -96

Review metrics

Metric Value Why it matters
Autonomous-review default 1 changed: daily to weekly Existing automatic-review installations will retry failed collection review on a different cadence.
Production vs test/docs LOC production +634/-608 (net +26); tests/docs +963/-1163 (net -200) The small net production increase supports new detached-review behavior but remains blocked by the uncovered authority boundaries.

Stored data model

Persistent data-model change detected: database schema: src/agents/tools/skill-workshop-tool-schema.ts, migration/backfill/repair: src/agents/tools/skill-workshop-tool-description.ts, migration/backfill/repair: src/agents/tools/skill-workshop-tool.review.test.ts, migration/backfill/repair: src/skills/workshop/experience-review.test.ts, persistent cache schema: src/agents/embedded-agent-runner/run/attempt.skills-policy.test.ts, serialized state: src/agents/embedded-agent-runner/run/attempt.skills-policy.test.ts, and 26 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Repair the two owner boundaries (recommended)
    Recheck ownership under the final commit lock and prove detached Workshop review cannot create MCP runtime before execution gating.
  2. Accept the cadence change explicitly
    After the correctness repairs, retain the weekly failed-attempt behavior only with explicit maintainer acceptance and upgrade evidence.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Restore lock-scoped ownership validation and prevent bundled MCP initialization for the detached Workshop-only run; add focused regression tests for both boundaries.

Technical review

Best possible solution:

Restore ownership validation inside the final commit lock, prevent MCP creation before the Workshop-only restriction, and prove the revised review cadence across upgrade and fresh-install state.

Do we have a high-confidence way to reproduce the issue?

Yes—source inspection shows both the missing lock-scoped ownership validation and MCP preparation before the execution gate, although no artifact-producing tests were run in this read-only review.

Is this the best way to solve the issue?

No—the branch needs final-lock ownership validation and pre-materialization MCP restriction before it is a safe implementation.

Full review comments:

  • [P1] Recheck ownership inside the commit lock — src/skills/workshop/apply-transition.ts:218-226
    The ownership decision now happens before applySkillProposal, but this locked transition no longer verifies that the resolved target remains Workshop-owned before preparing the write. A symlink or target-state change between the early check and this callback can turn a user-authored skill into a mutation target. Restore the resolved-directory ownership predicate inside this lock and cover the transition.
    Confidence: 0.97
    Late finding: first raised on code an earlier review cycle already covered.
  • [P1] Prevent MCP startup before Workshop-only gating — src/skills/workshop/experience-review.ts:493-504
    toolExecutionAllow gates tools only after bundle construction, while MCP creation consults toolsAllow; because this run supplies no toolsAllow, configured MCP runtime can initialize under the copied foreground context before the Workshop-only restriction takes effect. Restrict or reuse the pre-materialization path and add a test proving this detached run never calls MCP runtime creation.
    Confidence: 0.96
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 147e9da5d8b5.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.
  • remove merge-risk: 🚨 other: Current PR review merge-risk labels are merge-risk: 🚨 compatibility, merge-risk: 🚨 security-boundary.

Label justifications:

  • P1: The PR can violate a write-ownership boundary and initialize configured MCP runtime outside the claimed Workshop-only execution scope.
  • merge-risk: 🚨 compatibility: The PR changes automatic review cadence and failure-recording behavior for existing installations.
  • merge-risk: 🚨 security-boundary: MCP runtime setup can occur before the detached review's tool execution restriction is applied.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The PR is from a member, so external-contributor proof is not required; this does not resolve the functional and authority-boundary defects.

Evidence

Security concerns:

  • [medium] MCP runtime starts before tool restriction — src/skills/workshop/experience-review.ts:493
    The branch limits execution after bundle creation, but bundle MCP setup uses the absence of toolsAllow to enable runtime creation. That can cross the intended tool/side-effect boundary before the gate runs.
    Confidence: 0.96

What I checked:

Likely related people:

  • Peter Steinberger: Recent current-main work owns the final ownership guard and MCP bundle-preparation path implicated here. (role: recent area contributor; confidence: high; commits: 987895a575e8; files: src/skills/workshop/apply-transition.ts, src/agents/embedded-agent-runner/run/attempt-bundle-tools.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-25T12:02:27.551Z sha afa8a8c4d0ce6f68d7b0a82f261af236d6703db0 :: found issues before merge. :: [P1] Restore exact ownership at the final apply boundary | [P1] Do not start MCP servers for a Workshop-only review | [P2] Document the user-authored auto-mode exception
  • reviewed 2026-08-25T12:16:53.503Z sha 4c44986 :: found issues before merge. :: [P1] Revalidate ownership inside the final apply lock | [P1] Prevent MCP runtime startup for detached skill review

Drop the unused isWorkshopOwnedSkillDir export and record the SAFETY
invariant on the review-state map cast (ratchet baseline shrinks by one).
@obviyus
obviyus force-pushed the fix/skill-workshop-lean-review branch from afa8a8c to 4c44986 Compare August 25, 2026 12:09
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 25, 2026
Collection review plans now list only writes and drops; unlisted skills
stay untouched and count as kept. Read receipts and tree hashes are
required only for the skills a plan changes, so a skill the model cannot
read in full is left alone instead of blocking the whole review. The
collection read budget is model-relative with no absolute cap, and the
review runs weekly instead of daily.
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 25, 2026
…P runtime warm

Agents may rewrite only Workshop-authored skills; operators (gateway, CLI)
approve the rest. Recheck ownership under the apply commit lock so a claim
released after the autonomous pre-check cannot let an agent write a
user-authored skill.

The experience review shares the foreground session, so it no longer retires
that session's MCP runtime when the review run ends.
A detached run (skill experience review) writes no transcript or session
record and runs under the foreground session key. Firing agent_end for it let
plugins observe the review as a foreground turn and let a deep review schedule
a successor review of itself.
…g review

Code Mode phase/log/agents.run bypassed the review execution allowlist: swarm
notes reached the foreground session as lifecycle events. The swarm globals now
gate on sessions_spawn through the shared allowlist check.

The user-authored pending write now runs under the proposal commit lock and
rereads the row, so an operator apply that lands first is kept.
@obviyus
obviyus merged commit b0c27e2 into main Aug 25, 2026
242 of 257 checks passed
@obviyus
obviyus deleted the fix/skill-workshop-lean-review branch August 25, 2026 14:57
steipete added a commit that referenced this pull request Aug 25, 2026
`commands-learn.test.ts` duplicated two phrases owned by
`skill-authoring-standards.ts`. #129282 reworded one and removed the other, so
both assertions went stale. The skills-lane PR never selected the auto-reply
suite, so this passed PR CI and first broke on a full main run — the cross-lane
assertion trap `test/AGENTS.md` warns about.

Assert the composition this suite actually owns: that the /learn instruction
contains SKILL_AUTHORING_STANDARDS_PROMPT verbatim. That is stricter than the
two phrase checks and cannot rot when the standards lane edits its wording.

Restoring the guidance #129282 dropped is separate work, in flight as #129425.
steipete added a commit that referenced this pull request Aug 25, 2026
…g standards

#129282 rewrote SKILL_AUTHORING_STANDARDS_PROMPT and updated its own
tests, but the cross-lane assertion in commands-learn.test.ts still
expected the deleted phrases ('first ~60 characters', 'never invent
flags, commands, paths, APIs'), so it passed that PR's CI and broke on
main full runs. Assert the current load-bearing phrases instead
('within the first 60 characters', 'every step comes from the observed
trajectory').
steipete added a commit that referenced this pull request Aug 25, 2026
…tions

#129282 reworded the authoring standards (skill-authoring-standards.ts) but
the learn-command test greps them from the auto-reply lane, so its PR CI
never selected this file and main's compact shards went red for every PR.
Anchor the 60-character description rule with a wording-tolerant match and
replace the removed invention clause with the evidence rule that superseded
it.
steipete added a commit that referenced this pull request Aug 25, 2026
…ndards

Main is red on this lane: #129282 reworded skill-authoring-standards.ts in
the skills lane, so this cross-lane assertion never ran on its PR and now
fails every full run. Minimal heal until the in-lane assertion refactor
(#129534) lands.
steipete added a commit that referenced this pull request Aug 25, 2026
…their lane

main is red on src/auto-reply/reply/commands-learn.test.ts. #129282 reworded
the skill authoring standards ("first ~60 characters" -> "first 60
characters") and dropped the Evidence line's "never invent flags, commands,
paths, APIs, tool behavior, or requirements" clause. It updated the sibling
assertion in skill-authoring-standards.test.ts, but the same strings were
also asserted from the auto-reply lane, which PR change classification never
selects for a skills-only diff — so that PR went green and main broke on the
next full run.

Restore the Evidence clause: the standards tell the model to write only what
the trajectory shows, and without it the prompt no longer says not to invent
flags, commands, paths, or APIs.

Then remove the trap rather than just the symptom. commands-learn.test.ts now
asserts the wiring it actually owns — the command hands the agent
buildLearnPrompt(request) verbatim — and the prompt's wording is asserted only
where it is authored. The one string that lived solely in the command lane
("Make at most one proposal mutation.") moves to learn-prompt.test.ts, so no
coverage is lost and no lane asserts another lane's text.
steipete added a commit that referenced this pull request Aug 25, 2026
`commands-learn.test.ts` copies phrases owned by `skill-authoring-standards.ts`.
The copy has now rotted twice: #129282 reworded one phrase and deleted another,
breaking main until #129370 re-synced the copy. The skills-lane PR never selects
the auto-reply suite, so each break passes PR CI and first surfaces on a full
main run — the cross-lane assertion trap `test/AGENTS.md` warns about.

Assert the composition this suite actually owns: that the /learn instruction
contains SKILL_AUTHORING_STANDARDS_PROMPT verbatim. That implies both phrases
#129370 restored, and cannot rot when the standards lane edits its wording.
steipete added a commit that referenced this pull request Aug 25, 2026
…their lane

main is red on src/auto-reply/reply/commands-learn.test.ts. #129282 reworded
the skill authoring standards ("first ~60 characters" -> "first 60
characters") and dropped the Evidence line's "never invent flags, commands,
paths, APIs, tool behavior, or requirements" clause. It updated the sibling
assertion in skill-authoring-standards.test.ts, but the same strings were
also asserted from the auto-reply lane, which PR change classification never
selects for a skills-only diff — so that PR went green and main broke on the
next full run.

Restore the Evidence clause: the standards tell the model to write only what
the trajectory shows, and without it the prompt no longer says not to invent
flags, commands, paths, or APIs.

Then remove the trap rather than just the symptom. commands-learn.test.ts now
asserts the wiring it actually owns — the command hands the agent
buildLearnPrompt(request) verbatim — and the prompt's wording is asserted only
where it is authored. The one string that lived solely in the command lane
("Make at most one proposal mutation.") moves to learn-prompt.test.ts, so no
coverage is lost and no lane asserts another lane's text.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
…penclaw#129282)

## What Problem This Solves

Skill Workshop experience review ran as an isolated agent with a re-rendered 60k-character transcript, its own bootstrap, and a trimmed tool surface. Every review was a cold request: no prompt-cache reuse, a large re-serialized trajectory, and a reasoning/tool profile that differed from the foreground turn. Autonomous updates could target any workspace skill, size limits allowed 40 KB skills to grow unchecked (one deployed workspace hit a 21 KB `SKILL.md`), the collection reviewer had to re-list every skill in its plan and read them under a fixed 24k-character budget (a 16-skill workspace failed every pass with "Read every current skill before reconciling"), collection review only recorded successes so a failing pass retried on every Gateway restart, and `openclaw skills curator status` showed nothing about what the last reviews did.

## Why This Change Was Made

- **Warm fork.** Experience review now continues the finished turn from the same in-memory session prefix (same session identity, bootstrap, skills prompt, tool schemas, `promptCacheKey`), appends one short review message, and runs with `sessionPersistence: "detached"` so nothing it writes reaches the foreground transcript or session record. Only `skill_workshop` executes; every other tool keeps its schema for cache parity and fails with a next-step message. The gate wraps the core tool list before Code Mode / Tool Search compaction, so catalog-hidden tools stay gated while `tool_call`/`exec` remain callable. `src/agents/embedded-agent-runner/run/attempt.skills-policy.test.ts` asserts identical system-prompt and tool digests between a foreground turn and its review, and that `tool_call` reaches `skill_workshop` but not `read` during review. Code Mode swarm globals (`phase`, `log`, `agents.run`) are the `sessions_spawn` capability and gate on the same allowlist, so a review cannot emit foreground lifecycle events or launch collectors. The review shares the foreground session, so it no longer retires that session's MCP runtime on run end; it reuses the warm runtime like any turn. Accepted tradeoff: the review inherits foreground tool construction (it creates the session MCP runtime only when the session has none, and spawns per-attempt LSP servers only when configured), because splitting tool construction from the foreground turn would break the cache-parity invariant this PR exists for.
- **One apply owner, rechecked at the write boundary.** `src/skills/workshop/autonomous-apply.ts` decides apply-vs-pending for both the post-review loop and foreground repair: creates and updates to Workshop-authored skills apply; updates to user-authored skills stay pending with a recorded reason. `applySkillProposalTransition` rechecks path-based ownership under the commit lock for non-operator actors (agent, or no actor), so a claim released after the pre-check cannot let an agent write a user-authored skill; gateway and CLI operators still approve any pending proposal. The user-authored pending write runs under the same commit lock and rereads the row, so an operator apply that lands first is kept. The old `auto-apply.ts` path and name-based `listWorkshopAuthoredSkillNames` are deleted.
- **Sparse collection plan and model-relative reads.** The collection reviewer returns only `write` and `drop` entries; unlisted skills stay untouched, so a 16-skill workspace no longer has to restate 16 keeps. The skill read budget is derived from the model's context window (35%) instead of a fixed 24k characters, with the 10,000-character skill cap still enforced per skill. No windowed read parameters: a skill is read whole or not at all.
- **Weekly cadence.** Collection review runs once every 7 days instead of daily (`REVIEW_INTERVAL_MS`), matching how slowly a skill library actually changes; the attempt is recorded before the model starts, so a failed pass does not retry on every restart.
- **Lean cap.** `AUTONOMOUS_SKILL_MAX_CHARS = 10,000` in `src/skills/workshop/collection-contracts.ts` is enforced by the tool and by collection reconcile; an oversized skill may only shrink. Tool description, experience prompt, and collection prompt were rewritten around procedures-not-records, one trigger per branch, and "NOTHING_TO_LEARN is the correct answer for most turns".
- **Detached runs end quietly.** A detached run writes no transcript or session record and runs under the foreground session key, so `attempt-finalize` now skips agent_end side effects for it: plugins do not observe the review as a foreground turn, and a deep review cannot schedule a successor review of itself.
- **Recorded outcomes.** Experience review records `applied | proposed | nothing | failed` with usage; one attempt per turn, drop on error. `openclaw skills curator status` prints the last collection and experience review outcome.

## User Impact

- Default `auto` mode: experience review reuses the foreground prompt cache and skips message/other tool execution, so review cost is one bounded continuation instead of a cold re-render.
- Autonomous edits touch only Workshop-authored skills; handwritten skills surface as pending proposals for operator approval.
- Autonomous `SKILL.md` results stay ≤ 10,000 characters.
- Collection review runs weekly and succeeds on larger skill libraries. A workspace with no recorded attempt reviews at the first daily check after Gateway start; an upgraded install keeps its recorded last attempt and reviews once it is older than 7 days. The 10,000-character cap applies to the next autonomous write; existing oversized skills are only ever shrunk.
- `openclaw skills curator status` shows the last collection and experience review outcome, time, and tokens.
- Docs: https://docs.openclaw.ai/tools/self-learning, https://docs.openclaw.ai/tools/skill-workshop

Related: openclaw#123866, openclaw#128871 both patch skills above the reviewer read budget; this PR caps autonomous skill size and restricts oversized skills to shrink-only rewrites.

## Evidence

- Live gateway (Linux, Telegram, `xai` provider) at `133ffe3`: manual experience review on a real foreground turn → `nothing` (usage: 0 uncached input, 13,902 cached, 36 output — the forked review hit the foreground prompt cache); manual collection review over the workspace → `succeeded`; the three oversized skills were rewritten under the cap (21,002 → 9,449; 11,882 → 7,735; 10,300 → 7,413 bytes, originals in `skill-workshop/collection-backups/`), the rest untouched, and the pre-PR "Read every current skill before reconciling" failure is gone. The next foreground turn's automatic experience review recorded `nothing` and `openclaw skills curator status` shows both outcomes. The apply recheck, MCP-runtime change (`26e821f`), and detached agent_end skip (`7e4a506`) landed after that run and are covered by the regression tests below.
- `pnpm test src/skills/workshop src/agents/tools/skill-workshop-tool src/gateway/server-methods/skills` plus `src/agents/embedded-agent-runner/run/attempt.skills-policy.test.ts`, `src/agents/embedded-agent-runner/run/attempt.tool-search-catalog-abort.test.ts`, `src/cli/skills-cli.curator.test.ts`, `src/agents/harness/tool-surface-bridge.test.ts` — green. New regression tests (`service.test.ts` agent-vs-operator apply on a user-authored skill and operator apply kept over a stale pending snapshot; `experience-review.apply.test.ts` no `cleanupBundleMcpOnRunEnd`; `attempt-phase-lifecycle.test.ts` no agent_end for a detached run; `code-mode-swarm.test.ts` swarm globals refused under the review allowlist) fail on the pre-fix code.
- Dependent sweep: 46 test files importing the touched modules — green.
- `oxfmt`, `scripts/run-oxlint.mjs` on changed files, `git diff --check` — clean.
- `pnpm tsgo && pnpm check:test-types` on Blacksmith Testbox — clean.
- Local ClawSweeper review (`gpt-5.6-terra`, high): `133ffe3` raised two findings (ownership recheck removed from the apply boundary; review retiring the shared session's MCP runtime), fixed in `26e821f`; `26e821f` raised one (detached review re-entering agent-end scheduling), fixed in `7e4a506`; `7e4a506` raised three: pending write racing an operator apply and Code Mode swarm globals bypassing the execution gate, both fixed in `e4b4322`; "prove detached review does not start configured MCP or LSP runtimes" is skipped as the cache-parity tradeoff stated above (LSP tool schemas come from the LSP runtime; the MCP runtime is session-owned and already warm). Maintainer decision on `e4b4322`: accepted — a detached review reuses the session MCP runtime and re-spawns configured per-attempt LSP servers exactly like a foreground turn; it still cannot execute them.
- Unrelated CI on `26e821f`/`7e4a506`: `check-lint-core-2` (`max-lines` in `src/gateway/server-methods/models-list-result.ts`, unused param in `models.test.ts`, both from openclaw#129332) and `checks-node-compact-small-8` (`doctor-auth.profile-health.test.ts`, Claude CLI auth from openclaw#129052) fail identically on `main` run 32857954734; `checks-node-compact-small-31` pins plugin SDK export counts (`4340` vs `4342`) that openclaw#129052 moved — this PR touches no `src/plugin-sdk` file. On `e4b4322` the failing set is the same twelve `checks-node-compact` shards that fail on `main` run 32857954734 (`large-5/12/13/14/15/18/22`, `small-8/14/20/21/26`) plus `small-31`; `check-lint-core-2` passes here. None are fixed here; openclaw#129357 carries the `main` fix.
- LOC (raw numstat): production +712 / −664 (net +48; the four review-fix commits after the live run add +76 / −26); tests + docs +1269 / −1238 (net +31).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes docs Improvements or additions to documentation extensions: copilot gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. r: skill Auto-close: skills should be published on ClawHub, not added to core. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant