Repository navigation
feat(skills): add personal libraries for shared Gateways - #134068
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
69fef28 to
4f97aac
Compare
4f97aac to
1f8f162
Compare
|
@clawsweeper re-review Please review the refreshed personal skill-library candidate at ZIP import validation remains a known merge blocker pending the canonical fs-safe 0.6.0 integration and explicit dependency-cooldown exception. This requests review only. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs real behavior proof before merge. Reviewed September 1, 2026, 4:06 PM ET / 20:06 UTC. ClawSweeper reviewWhat this changesThe PR adds authenticated, profile-owned skill libraries with immutable revisions, session selection, ZIP and ClawHub imports, and delivery to agents and workers. Merge readiness⛔ Blocked until stronger real behavior proof is added - 6 items remain Keep open: the ZIP-import admission path lets one authorized profile exhaust all pending upload slots and deny imports to other authorized profiles. Priority: P2 Review scores
Verification
How this fits togetherSkill libraries are created or imported through authenticated Gateway and CLI entry points, stored as immutable revisions, then selected into sessions and materialized for agents or workers. ZIP imports first reserve a temporary upload row before publishing a library revision. flowchart LR
A[Authenticated operator] --> B[Gateway or CLI]
B --> C[Skill library service]
C --> D[ZIP upload reservation]
D --> E[Immutable library revision]
E --> F[Session selection]
F --> G[Agent and worker resources]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The introduced shared upload quota allows a permitted profile to deny another permitted profile’s import capacity. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep a bounded global import limit only with per-profile admission or reserved capacity, and add a two-profile regression proving one profile cannot deny another a begin request. Do we have a high-confidence way to reproduce the issue? Yes: use two operator.write profiles, leave 32 valid begin requests pending from the first, then issue begin from the second; the unscoped query deterministically rejects it for up to one hour. Is this the best way to solve the issue? No: the feature’s per-profile authorization model is undermined by a shared unpartitioned reservation quota; per-profile capacity protection at upload admission is the owner-level repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b49119b44f41. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
Use the published platform-package boundary and remove copied native assets. Keep CLI bootstrap imports lazy, preserve sealed-worker defaults, and align archive fixtures and current-main contracts with the stricter dependency.
|
@clawsweeper re-review Updated to the maintainer-requested fs-safe 0.7.0 and its platform packages. The original-name ZIP rejection now passes through the actual Gateway and CLI; valid complete bundles, profile isolation, and commit replay also pass. Full build, configured changed checks, focused tests, and P0-scoped review are green. The PR body records clean package-install proof and exact-head hosted CI as pending. The latest review’s archive finding is addressed by the canonical dependency admission check, existing physical traversal tests with and without directory records, and the exact ../SKILL.md Gateway proof. The PR body also cites the maintainer agent’s direct pinned Codex source inspection for selection and dynamic-tool forwarding; the reviewer’s unavailable sibling checkout is not relied on as proof. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
## What Problem This Solves Fixes: Web UI (`chat.send`) turns that stall before replying still end with "⚠️ This turn was interrupted because it stopped making progress. Please try again." instead of the automatic recovery that channel DMs get since openclaw#161069. ## User Impact - When a Web UI turn stalls before replying, the user now gets the recovered answer instead of the retry notice. The stalled run ends as aborted, and the answer arrives as its own run in the same chat, the same way any queued Web UI follow-up arrives. If the recovery also stalls, the existing notice is sent once. - The recovery keeps its normal tools, except that Skill Workshop can't write to the skill library during a recovery. It answers "send a fresh message" instead. - Group-thread participant turns keep the notice. That is now the only exception, and it's stated in the docs. ## Why This Change Was Made openclaw#161069 kept the notice for Web UI turns because the recovery run had no owner that would deliver its answer ([maintainer decision](openclaw#161069 (comment))). Provenance of that owner: - openclaw#116649 binds every queued `chat.send` reply to its originating Gateway admission, so a late answer never goes out through a later same-session dispatcher. - openclaw#129001 added `createSourceRetry`, which gives a front-requeued run of the same source a fresh owner, and the `pending` state: a source that never handed its request to the queue keeps its own terminal, so a finished run gets no duplicate or late reply. - The recovery run inherited the stalled turn's still-`pending` owner, so its answer was dropped (`terminal-not-recorded`). The fix: - **The stalled turn hands its request to the recovery through the source's existing `createSourceRetry`.** A `pending` source that hands off is settled, so the original can never deliver once the retry exists, and the recovery owns the only delivery. The relaxed `pending` case is reachable only through the stall continuation, which runs after the stale watchdog aborted the source before any output. `createSourceRetry` has two callers: - the follow-up source retry in `followup-delivery.ts`, which only sees owners that already queued (`deliver`/`drop`); - the stall continuation. - **The openclaw#161069 early return is narrowed.** Only a source that explicitly declares no owner (`drop`) keeps the notice. - **Library authoring is not carried into the recovery.** Every authenticated Web UI human turn mints a library-authoring grant (`prepareGatewaySkillAuthoring`), and every run binds it at admission. By design (openclaw#134068) the grant refuses a replacement run, and the recovery is a new run, so it doesn't inherit the grant. Before this change the recovery failed with "Personal authoring cannot move to a replacement run" instead of answering. - Rule: a recovery run never inherits skill-library authoring. Whatever the original grant's target, the recovery gets an expired personal grant. The Workshop tool can't fall back to the workspace tool (`createSkillWorkshopTool`), and every call returns `AUTHORITY_EXPIRED` asking for a fresh message. All other tools stay available, and no access is widened. - Alternatives considered: - The existing per-run `conversationToolPolicy` replaces the configured group policy instead of adding to it, so using it as a deny list could widen access in group sessions. - Minting a fresh grant would relax openclaw#134068's replacement-run guard. Hermes (sibling framework) returns its timeout result through each turn's own reply path on every surface. This PR follows that idea of one reply owner per source. Hermes has no auto-continuation to borrow. ### Group threads: left for a follow-up Group-thread participant turns keep the notice. Participant reply options set `onQueuedFollowupReplyBatch: undefined` (openclaw#141411), which openclaw#116649's `in` check turns into a `drop` owner, so every queued participant reply is dropped. Omitting that key makes the recovery reach the group: in a qa-channel run the group got `STALLED-TURN-RECOVERED-OK` instead of the notice. The same run showed a second group message, arriving while the recovery ran, ending `skipped:reply-operation-active` with no reply. Participant reply options also clear `turnAdoptionLifecycle`, so a participant turn on a busy session never reaches queue policy (`allowGatewayQueueResolution` in `dispatch-from-config.lifecycle.ts`). Fixing that needs its own change to participant admission, so this PR doesn't enable group recovery. ## Bounded cost - **Recovery runs at most once per stalled turn.** `continueStalledTurn` is armed only for direct turns and called once from the aborted-dispatch finisher. The recovery runs on the follow-up runner, which never arms it, so if the recovery also stalls the existing notice is sent and nothing else starts. Tested: "sends the Web UI notice, not a second recovery, when the recovery also stalls" (2 model turns total, empty queue). - **One delivery per handed-off source.** After `createSourceRetry` from `pending`, the original owner is settled and refuses both delivery and further retries. Tested: "gives a pending source's only delivery to the retry it hands off to". - **No recovery where its answer would be dropped.** Tested: "leaves the notice with a group-thread participant whose source declares no reply owner". - **No wider tool access.** Tested: "never lets a personal/workspace-target recovery author skills while keeping its other tools". No tools are disabled. ## Evidence - **Real Gateway `chat.send`.** A QA Gateway child, mock-openai with the stalled-turn fixture, `QA_DIAGNOSTIC_STUCK_SESSION_ABORT_MS=30000`, and an operator `GatewayClient` (TUI pattern) recording `chat` broadcasts: - Before (`80290b4`): `+56.4s state=error "⚠️ This turn was interrupted because it stopped making progress. Please try again."`, then `aborted`. 5 mock requests, none guided. - After: `+58.6s aborted` for the stalled run, then `+59.5s state=final` under the recovery's own run id with the recovered answer. 6 mock requests: 5 stalled, 1 guided success. The answer is persisted in `chat.history`. - An intermediate run without the authoring change: the recovery was delivered through the new owner but failed with the authoring error. That run is what found the issue. - **Unit tests:** - The two Web UI tests in `agent-runner.stalled-turn.test.ts` fail on `main` (`continueStalledTurn` returned `false`) and pass now. - The owner, drop and authoring tests pass. - Wall times: `agent-runner.stalled-turn.test.ts` + `followup-delivery.test.ts`: 51 s (75 tests; plus `skill-workshop-tool.test.ts` 19 tests). `chat-send-late-followup.test.ts`: 2 s (6 tests). - `node scripts/check-changed.mjs` passes (typecheck, lint, guards). - **Head `c1bca05` (delivery path unchanged since):** the stalled run ends `aborted` at +59.1s, then `state=final` with the recovered answer under the recovery's run id at +60.1s. 6 mock requests, 1 guided. The answer is persisted in `chat.history`. LOC vs `origin/main`: production +36/−6, tests +130/−5, docs +1/−1. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #133602.
Shared-Gateway teammates can now own complete reusable skill libraries without host access. Sessions pin immutable revisions, so later edits or sharing changes cannot silently replace a selected skill. This PR also updates fs-safe to exact 0.7.0 and repairs the filesystem, authoring, editor, and generated-client defects found during maintainer review.
Earlier authorization, node-worker, persistence and package evidence.
Merged as 75bcd267, from validated source head
93fbd9f4488f9c332b2d54f07580841a1b468da8. Cleanup removes 111 net production lines after the three-line passive-health repair. The final runtime build and both real Gateway/node-worker scenarios passed (2/2,226.97s); 49 health/inventory tests and 27 installer tests passed. Exact-head CI passed, including the Apple checks recovered through the existing same-run GitHub-hosted retry route. Detailed proof and limits. Outstanding post-merge follow-up: the newer review identifies monopolization of the global pending ZIP-upload pool by one profile; the recorded live proof does not cover this case, and no fix or policy acceptance is claimed. Earlier validation below retains its original commit identities. No changelog entry is included; release context remains below.Behavior and ownership
Libraries belong to authenticated profiles. Explicit sharing grants discovery and use without edit access; administrator transfer preserves identity and authorship. Solo administrators keep the existing workspace workflow. The feature uses the existing Skills UI, CLI, Skill Workshop, and execution transports. Bundles preserve supporting text, binary bytes, and executable flags. Attach, detach, and refresh take effect at the next safe turn.
The persistence checkpoint accepted in #133602 covers four lazy additive STRICT tables and immutable filesystem bundle artifacts. Artifact publication completes before the synchronous authorization/CAS metadata commit. State/agent schema versions remain 15/19. There is no new configuration option or protocol-version bump. This remains one trusted Gateway domain, not hostile-tenant isolation.
Authoring uses the requester's host-validated live authority. Callable capabilities remain in private host grant state; requests retain the exact admission across body parsing, tool execution, and publication. New-session Workshop preparation happens before acknowledgment and stays under the session writer barrier. Cleanup follows the accepted allocation's placement owner even after cancellation. Each turn prepares its complete bundle once; two cross-turn delivery caches and duplicate bundle verification were removed.
The editor now preserves drafts when discard is declined or a save/import is busy. Its supporting-file selector, conflict recovery, narrow layouts, and private/read-only views have browser proof below. Preview fixtures use the canonical request handler, preventing concurrent sockets from sharing one response.
Repairs found during integration
SkillsStatusParams. Closed schemas now retain private nominal identity through TypeBox clones; Swift property naming checks identity and shape. Duplicate names remain ambiguous, existing union names remain intact, and the terminal catalog request explicitly aliases its locator. Regeneration changes exactly eight type lines across the four approval variants. All 857 serialized protocol schemas are byte-identical before and after this repair. A real dictionary initializer failed to compile before the fix and compiles and round-trips afterward.Earlier validation (retained evidence)
Runtime validation commit:
7aba28a22dacdeaf073452761b03fcd9c6cad8a8, integrated with immutable main6a11089d4b0ed7df871650b806f71d96ad25908c. The complete runtime CI run 33523707270 passed. The documentation-only publication head must also satisfy the normal native hosted gates before merge.7aba28a22dacdeaf073452761b03fcd9c6cad8a8: read-only open, older preference write/read, session-label edit, reopen, exact records, old pins, complete bytes, and executable modes. Two entries, four revisions, seven events, one upload, and two pins survived.81ad66a7; later changes do not touch UI source. Covers dirty/busy dismissal, ZIP/support-file import, sharing, session selections, and 375px layouts.48fe0f5cfor nominal clone identity, unchanged JSON schema, and session catalog validation. Swift dictionary initializer compile and runtime round-trip passed; permanent coverage exercises all four terminal approval variants. The focused SwiftPM package used the exact protocol target sources: the old generated types failed compilation; the corrected types passed all 15 compatibility tests, including four approval variants.e77c004c, then three separate-process persistence cases and ten Gateway/node cases on treee6e82d72. The SIGKILL test first exceeded its unchanged 120-second deadline during concurrent compiler work; its isolated rerun passed in 51 seconds. No assertion or timeout changed.b348a684(one platform-specific skip): snapshots, filesystem guards, media, CLI output, browser downloads, WhatsApp identity, and Google Meet exports. Its hosted CI completed successfully.pnpm buildpassed on7aba28a2, including CLI bootstrap, 64 plugin builds, 53 built control-plane module checks, and UI asset validation. Startup JS is 345,224 bytes gzip against the unchanged 349,244-byte limit. All configured check stages are covered by the retained full run, corrected-file lint, and remaining canonical commands: type, dead-code, boundary, storage, import, and pairing guards pass; 1,035 macOS tooling tests pass; pinned SwiftLint 0.65.0 reports no violations. The initially failed full invocation is retained as a failure, not relabeled green.7aba28a2: allowed shared-session pin versus denied private/unpinned access; actual helper execution from node-owned materialization; authenticated Bob create/read/update; owner denial, mid-turn refresh, removal, cancellation, replacement and reclaim. All 36,201 tracked sources, dependency metadata and build fingerprints unchanged; all 79 observed children stopped.7aba28a2Gateway with two authenticated synthetic profiles. The physical 209-byte../SKILL.mdZIP is rejected before publication; foreign append/commit/read requests are denied; the valid 979-byte bundle preserves exact text, binary bytes and executable flags; commit replay is idempotent. Gateway shutdown, all CLI joins, source identity and build fingerprints verified.The initial integration check passed all type, dead-code, runtime, package, and boundary checks, then failed on one missing pair of braces in a worker fixture. That lint error is corrected. A subsequent unused-export finding was fixed by deleting the runtime getter; all three canonical dead-code scans now pass without exclusions. The final full run passed its type and structural stages, then found two new-schema lint issues (symbol description and JSON-test syntax); those are corrected and the affected lint plus the remaining selected stages are recorded separately. Fresh complete P0-scoped Codex autoreview of final tree
48fe0f5creturned no findings in three complete chunks; this is scoped review, not an all-priority correctness certificate. The first filesystem CI run exposed 28 failures across eight jobs, repaired before the green run above. The superseded Linux gate was cancelled, not counted as a pass; its lease and sync checkout were closed.Dependency and installed-package proof
The actual physical
../SKILL.mdZIP was accepted and normalized by fs-safe 0.5.6; 0.7.0 rejects it withArchiveSecurityErrorbefore extraction. No filesystem escape was observed. Permanent shared-facade cases and real authenticated Gateway rejection proof cover this change. ClawHub fixtures now exercise valid physical ZIP records with an understated entry count; the canonical preflight owns that limit, removing eight duplicate production lines.Runtime and compiled-test builds preserve fs-safe's package boundary so nested pnpm installs resolve the matching optional binary. Removed the native-copy helper and loader rewrite; sealed portable workers explicitly use guarded JavaScript. No native-mode override, dependency patch, or manual dependency-directory edit was used for proof. This incorporates #132240's platform-package integration.
Clean Linux Node 24.19.0 installs passed for npm global, pinned pnpm 12.1 global, Bun 1.4 global, and a fresh local npm project with
--omit=optional. All four used the same canonical21e77e0dtarball (SHA-25614946abe54c45eeda99e32a0081db08704f9cad242ef6a2a1d61c83a85f4eb7a). All 28 commands passed: installed SDK write/create/hash and actual CLI version/help; default native mode off; explicit native mode loaded the exact GNU 0.7.0 package in all three managers; omission installed and loaded zero native binaries. The owned Testbox run completed and was stopped. This is Linux package proof at that stated source, supplemented by the integrated build and final hosted CI.The first verifier incorrectly assumed Bun installed only one libc variant and npm applied
--omit=optionalto global trees. Direct Bun source and npm source established the actual contracts. The corrected proof checks the loaded binary and uses a fresh local npm project for absence. Failed receipts remain retained. The eight exact-version release-age exclusions are removable after September 7, 2026 at 16:29:50 UTC.Live execution and persistence limits
Earlier actual Claude Code 2.1.236 / Agent SDK 0.3.241 proof completed fresh-chat and warm-second-turn create/read/update through host MCP in the same native session and process: eight Messages requests, six MCP calls, independent CLI byte/revision checks, and Bob's private-read denials. Fresh chat and first-Goal authoring also passed through the public CLI with two authenticated synthetic profiles. Supporting files included binary bytes and executable metadata. These use synthetic provider decisions, not live model billing/auth or cloud-provisioning claims. Separate real Gateway/node WebSocket suites passed on macOS and Linux. All owned proof processes were closed.
The refreshed persistence baseline is genuine feature-absent main
6a11089d, built with its own frozen dependencies, matching SQLite worker and SQL assets. All 7,260 source/SQL/lock digests were independently checked against Git. This proves source-runtime compatibility, not packaged stable-release downgrade compatibility. The older intermediate5835fbeareader rejectssession_pending_inputs.consumed_event_id, added by main in #133457; main explicitly documents that limitation indocs/reference/database-schemas.md. The same failure occurs using only old validation and main SQL without library changes. Its failed receipts remain retained; this PR does not change that schema or weaken validation. Separate-process restart and actual SIGKILL-before-pointer-commit recovery proof also remains recorded.The original independent source-blind run classified all 54 subchecks (45 pass, three fail, five blocked, one out of scope). The two editor failures were fixed and 19 affected/nearby follow-up checks passed; fs-safe 0.7.0 resolves the raw-ZIP rejection gap. No separate zero-profile/merged-profile UI fixture, public expired-authoring-handle probe, ambiguous ordinary-agent scenario, or host-wide ClawHub side-effect audit is claimed.
The latest ClawSweeper review found no remaining source defect and requested inspectable allowed/denied authority, worker-delivery, persistence and published-package evidence. The linked final-head trace addresses those requests and both rank-up moves, with exact source boundaries and limitations. The maintainer's explicit instructions and #133602's persistence checkpoint cover feature and dependency scope. The earlier Claude delivery documentation finding is also fixed. Exact-head hosted checks and the native landing workflow remain mandatory.
Direct dependency inspection includes pinned Codex 0.151.0 skill selection, dynamic-tool argument/result/cancellation handling, published Claude SDK process/MCP contracts, fs-safe's published implementation, and TypeBox's clone behavior. Existing host seams remain authoritative.
Before and after
These are inspected synthetic-only captures from isolated real-Gateway flows. “Before” shows the pre-repair feature candidate. No assets are committed, and existing attachments are retained.
attachment-1304308149.mp4
Earlier scope accounting and follow-ups
Against integrated main, production is +8,012/−460 (net +7,552; excluding 50 moved lines each way gives +7,962/−410). Tests are +6,096/−722; test support +2,084/−10; tooling/manifests +65/−70; generated output +418/−1; lockfile +81/−7. Growth implements the approved ownership/storage boundary, UI/CLI, complete resource delivery, and live host-bound authoring. The generator repair adds nominal identity without changing wire schemas; test support, generated files, lockfiles, and tooling are counted separately.
Named follow-ups: preserve modified tracked lockfiles in checksum-based Testbox sync; personal pending drafts for
/learn; convert fractionalmediaMaxMbto whole bytes at its existing owner; replace the accurate RPC-name hint in publication receipts with the session-menu action. These are separate from the repaired invariants above.Workshop reads return a requested whole UTF-8 artifact capped at 16,000 characters plus at most 32 supporting filenames. Binary/oversized content gives an explicit UI/CLI route. This bounded allowance serves requested guidance, not automatic prompt injection.
Docs: skills, authoring, Workshop, CLI.