Skip to content

fix(ci): align Claude native-auth contracts - #129357

Closed
roboclaw-bot wants to merge 1 commit into
mainfrom
roboclaw/fix-main-ci-auth-baselines
Closed

roboclaw-bot wants to merge 1 commit into
mainfrom
roboclaw/fix-main-ci-auth-baselines

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #129355

What Problem This Solves

Fixes the remaining repository-wide CI failures after Claude CLI credential ownership moved to the native runtime: the public Plugin SDK export budget missed two retained compatibility types, and Doctor still modeled copied Claude profiles.

Parallel main repairs already own the stale Gateway auth-status and model-list lint cleanup; this branch no longer duplicates those changes.

Why This Change Was Made

The explicit Plugin SDK export budget now records the two source-compatibility types retained with the deprecated no-read Claude credential reader through v2026.10. Doctor no longer constructs retired OpenClaw-owned Claude credentials, while static and custom CLI-profile health coverage remains.

This preserves #129052's boundary: Claude CLI owns native login and OpenClaw does not read, persist, refresh, or infer native Claude credentials. It also preserves the released compatibility reader instead of silently shrinking the public SDK surface.

User Impact

Unrelated PRs can satisfy repository-wide CI again. There is no production runtime behavior change.

Evidence

Failing first on current main

Passing on exact head 1fae86a6d9a8f2ad4f9ac036e289885e512291d8

  • pnpm plugin-sdk:surface:check: 4,342 public exports, passed.
  • node scripts/run-vitest.mjs src/commands/doctor-auth.profile-health.test.ts: 22/22 passed.
  • Focused oxfmt, oxlint, and git diff --check: passed.
  • Fresh full-branch Codex autoreview: clean, no accepted/actionable findings; overall correctness 0.99.

Screenshots are not applicable: these are headless SDK and Doctor CI contracts, proven by exact test and CI output.

Production: +0/-0. Tests: +2/-101 (net -99). Tooling: +2/-1 (net +1). Overall: +4/-102 (net -98). The explicit tooling budget increase records two already-public, time-bounded compatibility types through v2026.10; it does not expand the SDK surface.

Candidate commit 4156e57cac9fc7f816f46ad6ccfafb31c6100570 was independently reviewed rather than cherry-picked.

Worked on by

Co-authored-by: Tak Hoffman [email protected]

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

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review August 25, 2026 13:42
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts commands Command implementations labels Aug 25, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Superseded by #129346. Exact-head CI on this narrow repair exposed the remaining owner defect: native Claude login availability had no truthful prepared-runtime producer after credential-file ownership moved to Claude CLI. The canonical PR fixes that producer and now also retains the v2026.10 compatibility types with the explicit 4,342 export budget and required Tak Hoffman attribution.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Reopened as the canonical minimal repair. #129332 has now landed the separate native model-availability fix on main, so this PR only carries the remaining deterministic repository-wide CI contract repairs: the explicit 4,342 Plugin SDK budget and retirement of copied-credential status/doctor fixtures.

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 25, 2026, 11:00 AM ET / 15:00 UTC.

ClawSweeper review

What this changes

The PR raises the Plugin SDK export budget and removes Doctor tests that model OpenClaw-owned Claude CLI credentials.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for maintainer handling: the Doctor fixture cleanup is aligned, but raising the SDK budget would preserve two unreleased type reexports as a future public contract despite the active removal direction in #129346.

Priority: P2
Reviewed head: 1fae86a6d9a8f2ad4f9ac036e289885e512291d8

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The fixture cleanup is focused, but the proposed SDK budget ratchet needs correction before the patch is merge-ready.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored, headless CI-contract PR is exempt from the external-contributor proof gate; its body records focused terminal validation.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored, headless CI-contract PR is exempt from the external-contributor proof gate; its body records focused terminal validation.
Evidence reviewed 7 items Unreleased type exports: The current SDK barrel exports the two Claude credential types alongside the retained null-only reader; no production caller uses the types.
Native-auth compatibility contract: The retained reader explicitly returns null without reading credentials and is scheduled for removal after v2026.10, while the two type exports are separate source surface.
Release provenance: The latest stable tag does not contain provider-auth-claude-compat.ts, establishing that these types were not reachable from the latest shipped release.
Findings 1 actionable finding [P2] Remove the unreleased Claude type reexports
Security None None.

Live Verification

Command: pnpm plugin-sdk:surface:check

Result: PASS (completed)

pnpm plugin-sdk:surface:check
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129357-9uZWKL/target$ pnpm plugin-sdk:surface:check
$ node --max-old-space-size=8192 --import tsx scripts/plugin-sdk-surface-report.mts --check
pnpm plugin-sdk:surface:check
all SDK entrypoints:
  entrypoints: 336
  exports: 7302
  callable exports: 4385
  deprecated exports: 1260
  deprecated callable exports: 774
  unique entrypoint-qualified exports: 7302
public package SDK entrypoints:
  entrypoints: 147
  exports: 4342
  callable exports: 2581
  deprecated exports: 1134
  deprecated callable exports: 683
  unique entrypoint-qualified exports: 4342
local-only SDK entrypoints:
  entrypoints: 189
  exports: 2960
  callable exports: 1804
  deprecated exports: 126
  deprecated callable exports: 91
  unique entrypoint-qualified exports: 2960
deprecated public subpaths: 10
deprecated barrel subpaths: 2
public wildcard reexports: 50
package-exported forbidden subpaths: 0
node scripts/run-vitest.mjs src/commands/doctor-auth.profile-health.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129357-9uZWKL/target$ pnpm plugin-sdk:surface:check
$ node --max-old-space-size=8192 --import tsx scripts/plugin-sdk-surface-report.mts --check
all SDK entrypoints:
  entrypoints: 336
  exports: 7302
  callable exports: 4385
  deprecated exports: 1260
  deprecated callable exports: 774
  unique entrypoint-qualified exports: 7302
public package SDK entrypoints:
  entrypoints: 147
  exports: 4342
  callable exports: 2581
  deprecated exports: 1134
  deprecated callable exports: 683
  unique entrypoint-qualified exports: 4342
local-only SDK entrypoints:
  entrypoints: 189
  exports: 2960
  callable exports: 1804
  deprecated exports: 126
  deprecated callable exports: 91
  unique entrypoint-qualified exports: 2960
deprecated public subpaths: 10
deprecated barrel subpaths: 2
public wildcard reexports: 50
package-exported forbidden subpaths: 0
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129357-9uZWKL/target$ node scripts/run-vitest.mjs src/commands/doctor-auth.profile-health.test.ts
[test] starting test/vitest/vitest.commands.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129357-9uZWKL/target

 ✓  commands  src/commands/doctor-auth.profile-health.test.ts (22 tests) 2658ms
     ✓ maps expired stored auth profiles to structured findings without refreshing  423ms
     ✓ prints malformed API-key profile diagnostics  302ms

 Test Files  1 passed (1)
      Tests  22 passed (22)
   Start at  15:01:22
   Duration  10.13s (transform 5.92s, setup 793ms, import 6.40s, tests 2.66s, environment 0ms)

[test] passed 1 Vitest shard in 14.53s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129357-9uZWKL/target$

Assertions:

  • PASS expect_output: public package SDK entrypoints
  • PASS expect_output: Test Files

How this fits together

The Plugin SDK exposes compatibility types to plugin authors, while Doctor inspects stored authentication profiles. CI checks the exported SDK surface and verifies Doctor’s profile-health behavior against the native Claude CLI ownership boundary.

flowchart LR
  A[Plugin SDK exports] --> B[SDK surface scanner]
  B --> C[CI export budget]
  D[Stored auth profiles] --> E[Doctor health checks]
  E --> F[Doctor regression tests]
  C --> G[Repository CI]
  F --> G[Repository CI]
Loading

Before merge

  • Remove the unreleased Claude type reexports (P2) - Raising this ceiling ships ClaudeCliCredential and ClaudeCliCredentialReadOptions as new Plugin SDK surface even though they are absent from the latest stable tag. Keep the null-only reader if needed, but remove the two type reexports and retain the 4340 budget; this also aligns with the active removal direction in fix(anthropic): native Claude models show incorrect availability #129346.
  • Resolve merge risk (P1) - Merging the 4342 budget would turn two unshipped Claude credential types into a future Plugin SDK compatibility commitment, contrary to the removal path already proposed in fix(anthropic): native Claude models show incorrect availability #129346.
  • Resolve merge risk (P1) - Exact-head required CI is still in progress, and the branch is behind current main; merge readiness is not established.
  • Complete next step (P2) - This member-owned, maintainer-labeled PR conflicts with an open overlapping repair and needs scope reconciliation rather than a competing automated patch.

Findings

  • [P2] Remove the unreleased Claude type reexports — scripts/plugin-sdk-surface-report.mts:315-316
Agent review details

Security

None.

PR surface

Tests -99, Other +1. Total -98 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 2 101 -99
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 1 +1
Total 2 4 102 -98

Review metrics

Metric Value Why it matters
Production versus test delta production +0/-0; tests +2/-101; tooling +2/-1 The runtime is unchanged; the only non-test addition is a CI budget increase that needs the SDK-contract correction above.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/commands/doctor-auth.profile-health.test.ts, unknown-data-model-change: src/commands/doctor-auth.profile-health.test.ts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Merge-risk options

Maintainer options:

  1. Retire the unreleased type surface (recommended)
    Remove the two Claude credential type reexports and keep the null-only compatibility reader, so the SDK budget remains 4340 before the next stable release.
  2. Pause behind the broader repair
    Wait for fix(anthropic): native Claude models show incorrect availability #129346 to land if it remains the canonical owner of both the type removal and stale-fixture cleanup.

Technical review

Best possible solution:

Remove the two unreleased type reexports while retaining the null-only reader, keep the budget at 4340, and retain the narrow Doctor fixture cleanup only if it is not already supplied by the canonical native-auth repair.

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

Yes—source-reproducible: the current SDK barrel has two extra exported types while main’s budget is 4340, and the PR body provides the corresponding failed CI logs; this read-only review did not run the checks.

Is this the best way to solve the issue?

No—the Doctor cleanup is appropriate, but the budget increase is not the best fix because the types were absent from the latest stable release and should be removed before first shipment.

Full review comments:

  • [P2] Remove the unreleased Claude type reexports — scripts/plugin-sdk-surface-report.mts:315-316
    Raising this ceiling ships ClaudeCliCredential and ClaudeCliCredentialReadOptions as new Plugin SDK surface even though they are absent from the latest stable tag. Keep the null-only reader if needed, but remove the two type reexports and retain the 4340 budget; this also aligns with the active removal direction in fix(anthropic): native Claude models show incorrect availability #129346.
    Confidence: 0.96

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

Labels

Label changes:

  • add P2: This is a bounded CI and SDK-contract repair with limited direct user impact.
  • add merge-risk: 🚨 compatibility: Increasing the public SDK budget would make unreleased Claude credential types part of the next shipped compatibility surface.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.

Label justifications:

  • P2: This is a bounded CI and SDK-contract repair with limited direct user impact.
  • merge-risk: 🚨 compatibility: Increasing the public SDK budget would make unreleased Claude credential types part of the next shipped compatibility surface.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.

Evidence

What I checked:

Likely related people:

  • obviyus: Authored the merged native Claude CLI ownership change that this PR follows up. (role: introduced native-auth compatibility surface; confidence: high; commits: 750a64e7cd4a; files: src/plugin-sdk/provider-auth.ts, src/plugin-sdk/provider-auth-claude-compat.ts)
  • steipete: Recent history of the Doctor profile-health path includes Claude CLI expiry handling work. (role: recent doctor/auth area contributor; confidence: medium; commits: c6adbd233b04; files: src/commands/doctor-auth.ts, src/commands/doctor-auth.profile-health.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

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 (1 earlier review cycle)
  • reviewed 2026-08-25T13:46:53.260Z sha 5647ab3926e2c2c8f6905de9e124204bd3b1296f :: needs maintainer review before merge. :: none

@roboclaw-bot
roboclaw-bot force-pushed the roboclaw/fix-main-ci-auth-baselines branch from 5647ab3 to 034fd42 Compare August 25, 2026 14:01
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Rebased onto current main after #129332 landed the separate native model-availability repair. Exact focused proof and full-branch autoreview are clean on 034fd42724cac410a1ec9c62e69c80fc5695800a.

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Exact-head CI found two current-main lint regressions from newly landed #129332 plus one remaining stale copied-profile Gateway auth-status fixture. The latest head fixes those without a baseline ratchet: model-list auth logic is moved unchanged into its owner, the obsolete fixture is removed, and the exact failed lint stripe now passes with zero findings.

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@roboclaw-bot
roboclaw-bot force-pushed the roboclaw/fix-main-ci-auth-baselines branch from a2f4151 to 60755c0 Compare August 25, 2026 14:17
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Reconciled against current main after #129358, #129364, and #129369 landed parallel Claude fixture repairs. The exact head now keeps only the remaining budget, doctor, and #129332 lint-owner fixes; focused proof and full-branch autoreview are clean.

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Record the two retained Claude CLI compatibility type exports and retire status and doctor fixtures that modeled OpenClaw-owned Claude credentials after native ownership moved to the CLI runtime.

Co-authored-by: Tak Hoffman <[email protected]>
@roboclaw-bot
roboclaw-bot force-pushed the roboclaw/fix-main-ci-auth-baselines branch from 60755c0 to 1fae86a Compare August 25, 2026 14:52
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed gateway Gateway runtime size: M labels Aug 25, 2026
obviyus added a commit that referenced this pull request Aug 25, 2026
…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: #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 #129332) and `checks-node-compact-small-8` (`doctor-auth.profile-health.test.ts`, Claude CLI auth from #129052) fail identically on `main` run 32857954734; `checks-node-compact-small-31` pins plugin SDK export counts (`4340` vs `4342`) that #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; #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).
@steipete

Copy link
Copy Markdown
Contributor

Closing as superseded on main: #129383 (c94b0bd) fixed the Plugin SDK gate by removing two unused, unshipped Claude compatibility type exports while preserving the shipped reader and the strict 4,340-export budget; #129375 (8a93f68) removed the stale copied-Claude-credential Doctor fixtures while preserving static and custom profile-health coverage. Independently reran the SDK surface gate (4,340 exports, pass) and the Doctor profile-health suite (23 tests, pass).

@steipete steipete closed this Aug 26, 2026
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).
@RomneyDa
RomneyDa deleted the roboclaw/fix-main-ci-auth-baselines branch October 22, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR scripts Repository scripts size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Current-main Claude auth contract drift breaks repository CI

2 participants