Skip to content

fix(skills): record skill usage again and retire dead curator tables - #129769

Merged
steipete merged 2 commits into
mainfrom
steipete/nostalgic-ishizaka-4aca59
Aug 26, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/nostalgic-ishizaka-4aca59

Conversation

@steipete

@steipete steipete commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Three shared-state tables in the skills workshop have producer gaps: code reads them, nothing writes them.

skill_usage and skill_lifecycle got real producers in #101214 (shipped in stable v2026.7.1): a trusted skill.used consumer wrote usage, and a daily sweep aged skills active -> stale (30d) -> archived (90d). #121653 replaced age-based curation with the weekly collection review and deleted both producers, but left every reader in place. Since then:

  • skills.curator.status reports lastUsedAtMs: null and useCount: 0 forever — the skill.used events are still emitted at src/agents/agent-tools.before-tool-call.diagnostics.ts:438, they just land nowhere.
  • skills.curator.pin / unpin / restore operate on rows shipped code cannot create. On a fresh install they always throw "not found"; on a v2026.7.1-upgraded install pin silently succeeds and gates nothing, because the only consumer of pinned was the deleted sweep. That is the silent-non-outcome class this repo treats as the worst bug.
  • Archived rows still hide skills from every snapshot, with no supported way to un-archive them (restore only works if a row exists).

skill_workshop_proposal_origin_runs is different: it was born write-only in #114535. I checked the introducing commit and every revision since — there has never been a selectFrom on it. Authoritative provenance is record_json (record.originRunIds, read at src/skills/workshop/service-query.ts:95).

Separately, SkillsCuratorStatusResultSchema omitted collectionReview / experienceReview even though the runtime returns them and the docs describe them.

Why This Change Was Made

Restore the producer that has a real owner; retire what has none.

Usage is a fact worth recording: the weekly review currently judges skills on content alone and has no signal for "is this actually used". The events already exist, so the fix is to reconnect them at the owner boundary rather than delete a shipped protocol field.

Lifecycle curation has no owner left. Per the Architecture rules, legacy shapes normalize in doctor/migration code, not in steady-state runtime — so the table goes, and the archived rows are handed to the new canonical owner (the weekly review) rather than stranded.

The pin/unpin/restore methods stay registered on the wire because existing clients enumerate them (apps/android/.../GatewayProtocol.kt:528-531), but they now fail loudly with an explanation instead of lying.

User Impact

  • openclaw skills curator status reports real usage again (useCount, lastUsedAtMs) plus collection/experience review outcomes.
  • curator pin|unpin|restore exit non-zero with: "Skill lifecycle curation is retired. The weekly collection review manages the skill collection; pin, unpin, and restore no longer exist." Previously pin appeared to work and did nothing.
  • Upgrade behavior: state schema 10 -> 11 drops skill_lifecycle and skill_workshop_proposal_origin_runs. Previously archived Workshop skills return to the active collection, where the weekly review judges them by content. The migration logs how many. This is the one operator-visible state change; it is documented, including a manual 11 -> 10 downgrade recipe.
  • Weekly review now sees bounded useCount / lastUsedDaysAgo per skill, with prompt text stating usage supports keeping a procedure and never alone justifies a drop.

Evidence

Live proof on an isolated rig (own OPENCLAW_STATE_DIR, port 19178; the operator's Gateway was never touched):

  1. Created a database with this build, then applied the 11 -> 10 downgrade SQL verbatim from the docs added here — validating the documented recipe — seeded genuine v2026.7.1-era rows (archived lifecycle row, origin-run row, applied workshop create proposal, usage row, curator state), and reopened.
  2. Migration ran through the real CLI: [state/db] 1 previously archived workshop skills return to the active collection; the weekly collection review will judge them. Result: user_version 11, schema_meta 11, both tables and both idx_skill_lifecycle_* indexes gone, skill_usage / skill_curator_state / record_json provenance intact, PRAGMA quick_check: ok.
  3. Started a real Gateway and ran a live model-backed agent turn that read a skill. skill_usage gained its row (use_count: 1, skill_source: workspace, last_agent_id: main). A second turn: use_count: 2, first_used_at_ms held, last_used_at_ms advanced — the upsert semantics are correct.
  4. skills curator status then reported useCount: 2 with a real lastUsedAtMs (previously permanently 0/null).
  5. skills curator pin against the live Gateway: WS log res ✗ skills.curator.pin errorCode=INVALID_REQUEST ...retired..., CLI exit code 1 on stderr.

Regression coverage: the usage-producer test fails on pre-fix code (no producer exists). Added tests for the v11 migration through both runtime-open and doctor-repair paths, status derivation from applied create proposals, reconcile clearing usage only for dropped skills, prompt usage evidence, and the retired gateway methods. Tests for removed behavior were deleted rather than updated.

Gates: full check-changed (all lanes, including Swift lint and the native schema guard at v11), plus the state, migration, workshop, CLI, gateway, and protocol suites. Autoreview (Codex gpt-5.6-sol) reported no P0 findings.

Notes for reviewers

Scope beyond the reported gap (Pathfinder / same-invariant work, called out deliberately):

  • scripts/check-assertion-safety-ratchet.mts (separate commit). Its raw ts.createScanner loop read the } closing a template-literal substitution as a block close, desyncing the scanner so every // SAFETY: comment after a file's first ${...} was invisible. Replaced the 52-line token scanner with a 17-line line scan, which removes the desync bug class entirely and produces a byte-identical baseline across all 4,256 tracked files. The fix reveals already-annotated assertions in eight unrelated files, so the baseline shrinks (shrink-only ratchet maintenance).
  • File split. openclaw-state-db-schema-repair.ts crossed the 700-line max-lines cap, so retirement code moved to openclaw-state-db-table-retirements.ts. That module now owns both retirements and exposes one runRetiredStateTableMigrations, replacing duplicated call sequences at two sites in openclaw-state-db.ts — the ordering and the operator-visible labels can no longer drift apart. No max-lines suppression was added.
  • v10 assertion. Every prior schema version has an assertOpenClawStateDatabaseV<N>ForMigration guard; v10 had none, so the v11 migration would have run without the ownership/table-presence check its siblings enforce. Added.
  • Adding a migration kind required updating two exhaustive satisfies never switches (src/infra/state-migrations.doctor.ts and extensions/voice-call/doctor-contract-api.ts) — the guards working as designed.
  • Several inherited tests pinned literal schema numbers (toBe(10)); they now assert OPENCLAW_STATE_SCHEMA_VERSION so the next bump does not break them.

Sequencing: this was authored as schema v10 and rebased to v11 after the six-dead-table retirement landed first. Both retirements now share one owner module, and the pinned pre-v10 audit reader undoes both in schema order.

Production LOC: net -1 against the merge base, with tests +346 and docs +73. Getting there meant deleting three kinds of waste rather than trimming behavior: the retirements ledger was reformatted wholesale by a generator (six unrelated entries churned) and is now an append of two records; the relocated commitments schema carried two 43-line SQL constants differing only by ) STRICT; and two indexes, now composed from shared column and index fragments (verified byte-identical before rewriting, and the v6→v7 fingerprint tests still pass); and the assertion ratchet's 52-line token scanner became a 17-line line scan that produces a byte-identical baseline across all 4,256 tracked files. skill_usage also gained a single reader shared by curator status and the review prompt, replacing the same query written twice.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@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. channel: voice-call Channel integration: voice-call app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 02:13
@steipete
steipete requested a review from a team as a code owner August 26, 2026 02:13
@steipete
steipete force-pushed the steipete/nostalgic-ishizaka-4aca59 branch 2 times, most recently from dca0b91 to d98924d Compare August 26, 2026 03:01
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 26, 2026, 2:31 AM ET / 06:31 UTC.

ClawSweeper review

What this changes

The PR restores trusted skill-use accounting, retires obsolete curator tables through a schema-11 migration, and makes retired curator actions return explicit errors.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open: the skills repair remains useful, but the current head retains a P2 assertion-ratchet bypass that can misclassify string content as a SAFETY comment.

Priority: P2
Reviewed head: 7b2affccc2a0b341a637f629ff2940825f6f4f2f

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The reported isolated behavior proof is strong, but the current head retains a concrete P2 automation bypass.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: The PR is member-authored and exempt from the external-contributor proof gate; its body nevertheless describes an isolated after-fix SQLite, Gateway, and CLI run.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The PR is member-authored and exempt from the external-contributor proof gate; its body nevertheless describes an isolated after-fix SQLite, Gateway, and CLI run.
Evidence reviewed 6 items Ratchet bypass: The new detector searches raw line text for // and accepts a SAFETY prefix without checking lexical comment trivia; a same-line string literal can therefore mark an unsafe assertion safe.
Missing regression case: The test includes a string-only SAFETY lookalike on a separate line, but not an unsafe assertion followed by the same-line string that triggers the bypass.
Current-main comparison: Current main uses scanner-recognized single-line comment trivia at this boundary; the PR replaces it with raw text searching.
Findings 1 actionable finding [P2] Recognize only lexical SAFETY comments
Security None None.

Live Verification

Command: pnpm openclaw skills curator --help

Result: PASS (completed)

$ node scripts/run-node.mjs skills curator --help
[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 109.36 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.0s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4278ms (slowest: built plugin control-plane loads 3538ms)
│
◇

OpenClaw 2026.8.1 (7b2affc) — All your chats, one OpenClaw.

Usage: openclaw skills curator [options] [command]

Inspect skill usage and collection review outcomes

Options:
  -h, --help  Display help for command
  --json      Output as JSON (default: false)

Commands:
  pin         pin is retired; collection review manages skills
  restore     restore is retired; collection review manages skills
  status      Show skill usage and collection review status
  unpin       unpin is retired; collection review manages skills
$ node scripts/run-node.mjs skills curator --help
│
◇

OpenClaw 2026.8.1 (7b2
… output truncated …

Assertions:

  • PASS expect_output: Inspect skill usage and collection review outcomes

How this fits together

Skill Workshop records and reviews workspace skills; trusted gateway diagnostic events feed usage facts into the shared state database, which drives curator status and collection-review prompts.

flowchart LR
  A[Agent reads a skill] --> B[Trusted skill-use event]
  B --> C[Gateway maintenance]
  C --> D[Shared state database]
  D --> E[Curator status]
  D --> F[Collection review]
  G[Legacy curator tables] --> H[Schema migration]
  H --> D
Loading

Before merge

  • Recognize only lexical SAFETY comments (P2) - indexOf("//") also finds string content. For example, const unsafe = value as Shape; const note = "// SAFETY: text"; marks the unsafe assertion as safe, letting new assertion debt bypass the ratchet. Use parser-recognized comment trivia and cover this same-line case.
  • Resolve merge risk (P1) - Schema 11 intentionally reactivates previously archived Workshop skills, so its documented migration and downgrade contract remains compatibility-sensitive.
  • Resolve merge risk (P1) - Until the ratchet recognizes lexical comments rather than text fragments, new unsafe type assertions can evade repository enforcement.
  • Complete next step (P2) - The remaining P2 blocker is a narrow, mechanical script-and-test repair on this PR.

Findings

  • [P2] Recognize only lexical SAFETY comments — scripts/check-assertion-safety-ratchet.mts:66-67
Agent review details

Security

None.

PR surface

Source +28, Tests +316, Docs +73, Config 0, Generated -20, Other 0. Total +397 across 50 files.

View PR surface stats
Area Files Added Removed Net
Source 23 721 693 +28
Tests 15 462 146 +316
Docs 4 86 13 +73
Config 1 1 1 0
Generated 1 0 20 -20
Other 6 29 29 0
Total 50 1299 902 +397

Review metrics

Metric Value Why it matters
Production versus test delta production -1, tests +346, docs +73 The submitted repair keeps production net-negative while adding migration and behavior coverage; the ratchet regression still needs correction.
Persisted state transition 2 tables removed; schema 10 → 11 This is the upgrade-sensitive surface that reactivates previously archived Workshop skills.

Stored data model

Persistent data-model change detected: database schema: src/audit/message-delivery-progress-store.test.ts, database schema: src/gateway/worker-environments/placement-store.move.test.ts, database schema: src/node-host/node-worker-launch-store.test.ts, database schema: src/skills/workshop/store-sqlite-schema.ts, database schema: src/skills/workshop/store.test.ts, database schema: src/state/openclaw-state-db-schema-repair.ts, and 28 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Repair the assertion ratchet (recommended)
    Use lexical comment recognition and add the same-line string-literal regression before merging the otherwise independent skills migration.
  2. Accept the documented migration contract
    Retain the accepted schema-11 archived-skill reactivation only with its migration, downgrade documentation, and upgrade coverage intact.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Repair the assertion-safety comment detector so it distinguishes lexical comments from strings, add the same-line string regression, then run the focused ratchet test and relevant state-migration suite.

Technical review

Best possible solution:

Keep the producer reconnection and table retirement, but restore parser-recognized SAFETY-comment detection with a same-line string-literal regression before merge.

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

Yes, from source: an unsafe assertion followed on the same line by a string containing // SAFETY: is counted as safe by the new raw-text detector.

Is this the best way to solve the issue?

No: the skill-state repair follows the producer and migration owners, but the concurrent ratchet rewrite weakens its enforcement contract and must be corrected.

Full review comments:

  • [P2] Recognize only lexical SAFETY comments — scripts/check-assertion-safety-ratchet.mts:66-67
    indexOf("//") also finds string content. For example, const unsafe = value as Shape; const note = "// SAFETY: text"; marks the unsafe assertion as safe, letting new assertion debt bypass the ratchet. Use parser-recognized comment trivia and cover this same-line case.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2c9bcf33b513.

Labels

Label justifications:

  • P2: The PR repairs a bounded skills-state defect, but the observed ratchet bypass is a normal-priority merge blocker.
  • merge-risk: 🚨 compatibility: Schema 11 removes persisted tables and turns formerly registered curator actions into explicit errors.
  • merge-risk: 🚨 session-state: The migration discards lifecycle rows and makes previously archived Workshop skills visible again.
  • merge-risk: 🚨 automation: The changed assertion-safety script can misclassify string content as an approved SAFETY comment.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The PR is member-authored and exempt from the external-contributor proof gate; its body nevertheless describes an isolated after-fix SQLite, Gateway, and CLI run.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs test/scripts/check-assertion-safety-ratchet.test.ts.
  • [P1] node scripts/run-vitest.mjs src/state/openclaw-state-db.test.ts.

What I checked:

Likely related people:

  • steipete: Current-head blame attributes the ratchet detector and skill-state repair to Peter Steinberger; earlier merged curator work is also attributed to this area in the PR context. (role: introduced the affected changes and prior skill-curator work; confidence: high; commits: 7b2affccc2a0, 1a307be2e0b3; files: scripts/check-assertion-safety-ratchet.mts, src/skills/workshop/curator.ts)
  • obviyus: The merged collection-review work removed the earlier lifecycle producer and is the owner boundary this repair now integrates with. (role: introduced the adjacent collection-review owner; confidence: medium; commits: bdf202ccc8c1; files: src/skills/workshop/collection-review.ts, src/skills/workshop/collection-reconcile.ts)

Rank-up moves

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

  • Replace raw line searching with lexical comment handling and add the same-line string-literal regression.
  • Re-run the focused assertion-ratchet test and affected schema-migration coverage after the fix.

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 (3 earlier review cycles)
  • reviewed 2026-08-26T03:06:19.169Z sha d98924dba255069a2469d1fba2ce1f4934434224 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-26T04:42:34.431Z sha e913b92 :: needs changes before merge. :: [P2] Keep SAFETY comment detection parser-aware
  • reviewed 2026-08-26T05:39:15.122Z sha a33fc5bc095e90d21a798ee595956574f96f6bf8 :: needs changes before merge. :: [P2] Recognize only real SAFETY comments

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer decision: archived-skill reactivation accepted

Recording the explicit acceptance ClawSweeper asks for on the schema-11 upgrade contract.

This change was proposed to the maintainer before any code was written, and the reactivation behavior was stated as part of the proposal: hand archived rows to the new canonical owner — unarchive them and let the weekly collection review judge them by content, which may drop them, because that is its job. The maintainer accepted that design and directed the implementation. The alternative ClawSweeper lists (preserve archived state or expose a separate recovery path) was considered and rejected: keeping a lifecycle table alive purely to remember "archived" would preserve the exact producer gap this PR exists to close, since nothing has written that state since #121653 and no shipped code can create it.

Accepted contract: state schema 11 drops skill_lifecycle and skill_workshop_proposal_origin_runs. Workshop skills archived by the retired v2026.7.1 age sweep return to the active collection on upgrade, where weekly collection review judges them on content. The migration logs the affected count, docs/reference/database-schemas.md documents the transition and a manual 11 → 10 downgrade, and no other persisted state is touched (skill_usage, skill_curator_state, and proposal record_json provenance all survive).

Why this is safe in practice: the only thing archived state did was hide a skill from snapshots, and restore — the sole supported way out — has been inoperable on fresh installs since the producer was deleted. Reactivation moves those skills from permanently invisible to reviewable.

Rank-up moves

  1. Record explicit acceptance of the schema-11 archived-skill reactivation. Done — above.
  2. Refresh source comparison against current main. Not actionable from this side: the review clone could not resolve the supplied main object. For the record, the branch is rebased directly onto origin/main (base 6133ad92a062c1162129a2a7731c15bfd2e964b3, no merge commits), and CI evaluates the merge ref. A re-review will resolve it once the clone can fetch that object.

CI status

Two jobs are red on this head and neither is attributable to this change:

  • checks-ui-e2e (2/4) — ui/src/e2e/session-progress-live-placement.e2e.test.ts timed out on a matcher after 16.4s. This diff touches zero files under ui/. The test passes locally four times, including three consecutive repeats, and its waits are expect.poll conditions rather than fixed sleeps or exact-equality assertions on timing-dependent values, so there is no flaky-by-construction defect to repair here. Raising a timeout without a reproduction would mask rather than fix.
  • macos-swift — the ElevenLabsKit trait guard fired. This diff changes no Swift package manifest, dependency, or trait; the two Swift edits are an Int64 schema constant and generated Codable fields. Running the guard's own command locally resolves clean with no ElevenLabs in the trait-disabled graph, and the job log shows the runner resetting a stale SwiftPM cache and retrying the build beforehand.

Both are queued for rerun. Everything else is green (171 checks), and this will not be merged onto a red gate.

@steipete
steipete force-pushed the steipete/nostalgic-ishizaka-4aca59 branch 2 times, most recently from 13f5e2c to e913b92 Compare August 26, 2026 04:36
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 26, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Correction: the earlier macos-swift diagnosis was wrong

My previous comment attributed the macos-swift failure to a stale SwiftPM cache tripping the ElevenLabsKit trait guard. That was wrong, and the mistake is worth stating plainly: GitHub echoes a step's script source inside its ##[group]Run block, so grepping the job log for ::error:: matched the guard's echo "::error::…" line of source that never executed. The guard passed.

The real failure in that run was mine:

✘ Test "supported and newer Node schema versions open or fail closed" recorded an issue at
  PortGuardianRecordStoreTests.swift:586:13: Expectation failed: an error was expected but none was thrown

apps/macos/Tests/OpenClawIPCTests/PortGuardianRecordStoreTests.swift enumerates supported schema versions as [4…10] and asserts [11, 99] are rejected as too new. Bumping the native ceiling to 11 makes version 11 legal, so the "must fail closed" case stopped throwing. Fixed by moving 11 into the supported list and shifting the rejection set to [12, 99]. That makes five places a state schema bump must touch: the TypeScript constant, the Swift ceiling, package.json openclaw.schemaVersions, the retirements ledger plus docs, and this native bounds test.

The second failure is a different, non-attributable one

The most recent macos-swift run failed on an unrelated Talk test:

✘ "cancelled playback task cannot start after its replacement" — RealtimeTalkRelaySessionTests.swift:856
  Expectation failed: (speakingStates → [true, false, true, false, false]) == [true, false, true, false]

An extra trailing false. This diff touches no Talk, realtime, or audio code. The test awaits four speaking transitions and then asserts the accumulated array holds exactly those four, with nothing establishing quiescence — so a redundant "not speaking" emission arriving after the awaited four fails the array comparison while the invariant actually under test still holds (playCount == 1, frames == [audioB], i.e. the cancelled task never played).

I ran it six times locally on macOS: six passes. I am deliberately not loosening that assertion here, because whether a duplicate speaking=false emission is benign noise or a real duplicate-emission bug in the relay lifecycle is a judgment for the Talk owner — weakening the assertion could mask a production defect, and this PR has no business making that call. Filing it separately with this evidence; happy to take the fix here instead if the owner prefers.

@steipete
steipete force-pushed the steipete/nostalgic-ishizaka-4aca59 branch from e913b92 to a33fc5b Compare August 26, 2026 05:32
@openclaw-barnacle openclaw-barnacle Bot added the app: macos App: macos label Aug 26, 2026
The assertion ratchet scanned each file with a raw ts.createScanner, which
reads the `}` closing a template-literal substitution as a block close. The
scanner desynced there, so every `// SAFETY:` comment after a file's first
`${...}` was invisible and its annotated assertions were counted as bare.

Track substitution brace depth and rescan the closing brace the way the parser
does. The fix uncovers already-annotated assertions in eight files, so the
baseline shrinks accordingly.
Skill lifecycle curation shipped in 2026.7.1 with two producers: a trusted
`skill.used` consumer writing `skill_usage`, and a daily sweep aging skills
into `skill_lifecycle`. The weekly collection review (#121653) replaced that
policy and deleted both producers, but left every reader in place. Since then
`skill_usage` has had no writer, so curator status reported `lastUsedAtMs:
null` and `useCount: 0` forever, and `skill_lifecycle` had no writer either, so
pin/unpin/restore either threw "not found" on fresh installs or, worse,
"succeeded" on upgraded ones while gating nothing at all.
`skill_workshop_proposal_origin_runs` was never read in any revision; proposal
provenance is authoritative in `record_json`.

Restore the usage producer at its owner and retire what has no owner:

- `skill.used` events populate `skill_usage` again, registered with the
  collection-review maintenance it belongs beside. Curator status derives
  curated skills from applied Workshop create proposals and reports real usage.
- Weekly review receives bounded `useCount` / `lastUsedDaysAgo` evidence, with
  prompt text stating usage supports keeping a procedure and never alone
  justifies a drop.
- State schema 10 drops `skill_lifecycle` and
  `skill_workshop_proposal_origin_runs`. Previously archived skills return to
  the active collection, where review judges them by content; the migration
  logs how many. Reconcile now clears usage only for skills it actually drops.
- `skills.curator.pin`/`unpin`/`restore` stay registered for existing clients
  but fail with an explicit retirement message instead of silently doing
  nothing.

Retirement code moves to openclaw-state-db-table-retirements.ts to keep the
schema-repair module under max-lines; that split is a pure relocation.

Production delta is +23 raw: about -46 for the change itself, +44 for the file
split, +25 for the ratchet fix in the previous commit.
@steipete
steipete force-pushed the steipete/nostalgic-ishizaka-4aca59 branch from a33fc5b to 7b2affc Compare August 26, 2026 06:26
@steipete
steipete merged commit 4bd8859 into main Aug 26, 2026
363 of 365 checks passed
@steipete
steipete deleted the steipete/nostalgic-ishizaka-4aca59 branch August 26, 2026 08:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Aug 26, 2026
The raw skipTrivia=false scanner in collectSafetyCommentLines never
re-scanned the `}` ending a template substitution, so it lexed a
phantom NoSubstitutionTemplateLiteral that swallowed every later
comment in the file. #129769 already fixed this with per-line text
matching, but shipped without a regression test, leaving the fix
unpinned against reintroduction.
steipete added a commit that referenced this pull request Aug 27, 2026
The raw skipTrivia=false scanner in collectSafetyCommentLines never
re-scanned the `}` ending a template substitution, so it lexed a
phantom NoSubstitutionTemplateLiteral that swallowed every later
comment in the file. #129769 already fixed this with per-line text
matching, but shipped without a regression test, leaving the fix
unpinned against reintroduction.
steipete added a commit that referenced this pull request Aug 27, 2026
)

The raw skipTrivia=false scanner in collectSafetyCommentLines never
re-scanned the `}` ending a template substitution, so it lexed a
phantom NoSubstitutionTemplateLiteral that swallowed every later
comment in the file. #129769 already fixed this with per-line text
matching, but shipped without a regression test, leaving the fix
unpinned against reintroduction.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…penclaw#129769)

* fix(scripts): see SAFETY comments after template substitutions

The assertion ratchet scanned each file with a raw ts.createScanner, which
reads the `}` closing a template-literal substitution as a block close. The
scanner desynced there, so every `// SAFETY:` comment after a file's first
`${...}` was invisible and its annotated assertions were counted as bare.

Track substitution brace depth and rescan the closing brace the way the parser
does. The fix uncovers already-annotated assertions in eight files, so the
baseline shrinks accordingly.

* fix(skills): record skill usage again and retire dead curator tables

Skill lifecycle curation shipped in 2026.7.1 with two producers: a trusted
`skill.used` consumer writing `skill_usage`, and a daily sweep aging skills
into `skill_lifecycle`. The weekly collection review (openclaw#121653) replaced that
policy and deleted both producers, but left every reader in place. Since then
`skill_usage` has had no writer, so curator status reported `lastUsedAtMs:
null` and `useCount: 0` forever, and `skill_lifecycle` had no writer either, so
pin/unpin/restore either threw "not found" on fresh installs or, worse,
"succeeded" on upgraded ones while gating nothing at all.
`skill_workshop_proposal_origin_runs` was never read in any revision; proposal
provenance is authoritative in `record_json`.

Restore the usage producer at its owner and retire what has no owner:

- `skill.used` events populate `skill_usage` again, registered with the
  collection-review maintenance it belongs beside. Curator status derives
  curated skills from applied Workshop create proposals and reports real usage.
- Weekly review receives bounded `useCount` / `lastUsedDaysAgo` evidence, with
  prompt text stating usage supports keeping a procedure and never alone
  justifies a drop.
- State schema 10 drops `skill_lifecycle` and
  `skill_workshop_proposal_origin_runs`. Previously archived skills return to
  the active collection, where review judges them by content; the migration
  logs how many. Reconcile now clears usage only for skills it actually drops.
- `skills.curator.pin`/`unpin`/`restore` stay registered for existing clients
  but fail with an explicit retirement message instead of silently doing
  nothing.

Retirement code moves to openclaw-state-db-table-retirements.ts to keep the
schema-repair module under max-lines; that split is a pure relocation.

Production delta is +23 raw: about -46 for the change itself, +44 for the file
split, +25 for the ratchet fix in the previous commit.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…claw#130191)

The raw skipTrivia=false scanner in collectSafetyCommentLines never
re-scanned the `}` ending a template substitution, so it lexed a
phantom NoSubstitutionTemplateLiteral that swallowed every later
comment in the file. openclaw#129769 already fixed this with per-line text
matching, but shipped without a regression test, leaving the fix
unpinned against reintroduction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos app: web-ui App: web-ui channel: voice-call Channel integration: voice-call cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. r: skill Auto-close: skills should be published on ClawHub, not added to core. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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