Repository navigation
refactor: await bundled skill command discovery - #169089
Conversation
Expose async skill-command preparation through the existing SDK entries and migrate bundled Discord, Mattermost, Slack, and Telegram callers. Retain deprecated synchronous SDK methods through the next Plugin SDK major with bounded warnings.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: needs changes before merge. What this changesThis PR makes bundled channel skill-command discovery asynchronous while retaining deprecated synchronous Plugin SDK methods. Example: Telegram prepares the native skill menu for agent main.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Needs changes before merge - 2 items remain Keep this PR open: the worker-backed migration is useful, but the previously reported remote-workspace startup regression remains. Priority: P1 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherChannel registration passes agent configuration to shared skill discovery, which selects eligible skills and returns command descriptors for native menus. flowchart TD
A[Agent configuration] --> B[Channel registration]
B --> C[Shared skill preparation]
C --> D[Library database worker]
C --> E[Workspace skill owner]
D --> F[Command descriptors]
E --> F
F --> G[Native menus]
Technical reviewBest possible solution: Use shared worker-backed preparation while preserving Gateway-only native menus for remote workspaces and remote discovery for agent tasks. Do we have a high-confidence way to reproduce the issue? Source establishes the regression with native skills enabled and a remote binding whose loadSkills rejects or has stopped; no runtime reproduction was executed in this read-only review. Is this the best way to solve the issue? Reusing asynchronous preparation is appropriate, but bundled menus must retain their existing source selection and failure isolation. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ea576bd11d8c. Provenance checked
TestingProof path: none. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +53, Tests +14, Docs +14, Other +6. Total +87 across 41 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (6 earlier review cycles)
Reviewed October 11, 2026, 11:33 AM ET / 15:33 UTC (Revision 7). |
Await worker-backed skill command preparation in bundled Discord, Slack, Mattermost, and Telegram command registration and dispatch. Telegram bot construction waits for native registration to settle. Expose the existing preparation APIs through the narrow Plugin SDK entrypoints and deprecate synchronous list helpers with bounded migration warnings. Retain released synchronous contracts through the next SDK major; document the async replacements and exact replacement-pair surface allowances. The synchronous external host tool-surface API still retains the selection kernel's lexical T1 implementation. This cutover removes bundled channel discovery from that path without adding a cache, database, worker protocol, or synchronous fallback.
What Problem This Solves
Bundled channel command registration still uses synchronous skill discovery, forcing managed skill-library SQLite reads onto the Gateway main thread.
User Impact
Discord, Slack, Mattermost, and Telegram await skill command discovery through the existing worker-backed preparation owner. Released synchronous Plugin SDK methods remain supported and deprecated; plugin authors should await the documented preparation methods.
Why This Change Was Made
Export the existing
prepareSkillCommandsForAgentsandprepareSkillCommandsForWorkspacethrough the narrow skill SDK entrypoints, then migrate all bundled native command registration/dispatch callers in the same change. Telegram bot construction awaits registration completion. There is one selection owner and no new database, cache, worker protocol, or sync fallback.The released
listSkillCommandsForAgents/listSkillCommandsForWorkspacecontracts retain their immediate array result during the deprecation window and emit a bounded migration warning. Three public callable export instances are replacement pairs (two entrypoints), not new capabilities. The approved global allowances increase by exactly three exports, three callables, and three deprecated slots (3,669/2,130/158 → 3,672/2,133/161), matching those replacement pairs; per-entrypoint allowances identify the retained contracts. No spare budget margin or new capability is added. The mock baseline change is a canonical one-entry shrink after documenting the existing Mattermost isolation.Evidence
Both implementation and the follow-up static metadata repair received clean independent Codex reviews (two rounds total). Formatting and diff checks pass. All bundled references to the old native discovery calls have been migrated; external compatibility exports remain.
Final head
c0aeabb8a57246fe0e0b1f66d2bc6ab0530d1e74integrates main throughb1f3eac43cf663c3daf3c170f4587d104f2f2bbe. Earlier integrations inherited the landed UI Knip cleanup and combined independent SDK allowances. The final integration only conflicted in generated worker inventory, which was regenerated canonically; the automatic Discord fixture merge preserves the async discovery expectations and main's test cleanup. The skills owner/caller delta is unchanged by integration. The Telegram lazy loader remains byte-identical to main. An attempted explicit export projection was removed after proving the Knip findings already exist on the baseline. The measurements at235180427416df7cc4d4a6fc6d7dd05a9e3b5126remain source-equivalent for the changed skill owner.Remote full
pnpm buildpassed (4m30s). The focused selection covering every changed/mock-dependent suite passed: 50 files across 13 Vitest shards, 1,572 seconds total. The SDK surface check passed (6s), as did the SDK API comparison (332s): no entrypoints added or removed, and exactly three async export instances added (command-auth-native.prepareSkillCommandsForAgents, plus both preparation functions inskill-commands-runtime). Integrated candidate and baseline builds also passed (68s and 66s), plus 81 Telegram tests (131s), type-aware core/Telegram lint, export-collision checks, Madge, worker inventory, and T1/dialect ratchets. Discord, Mattermost, Slack, and Telegram cold-entrypoint profiles passed. On the final merged head, all 30 Discord provider tests passed (40s), SDK surface (6s) and runtime API guardrails (25s) passed, core/extension type-aware lint passed (18s/140s), export collisions passed (32s), Madge passed (19s), and worker inventory/T1/dialect ratchets passed. Full-tree Knip reports exactly the seven independently proven baseline findings listed below; production and script scans report zero. The shared harness ran three valid alternating pairs (M,C,M,C,M,C) on baseline23ad242958a4dd4601660e3933dc6e663c89c7a1versus measured candidate235180427416df7cc4d4a6fc6d7dd05a9e3b5126. The later conflict-only integrations preserve the measured skill-owner behavior. Values are median [min–max]:Warmed duration ratio is 1.0048; pre-run CPU idle was at least 99.875%. All six runs passed calibration, 13 turns, child completion, cron, compaction, shutdown, and cleanup. These measurements are neutral within the turn noise floor; no query reduction is claimed.
The subsystem operation counts are identical in all six runs: first-turn
skillLibrary.readis 2 requests / 4 statements andskills.workshop.changes.listis 1 request / 1 statement; neither appears in the warmed window. First-turn median falls from 1,201 statements / 192 requests to 1,009 / 184. Connect increases from 898 / 50 to 1,067 / 53 because deferred lifecycle work moves between adjacent windows; connect+first statements fall from 2,099 to 2,080 (boot+connect+first: 4,132 to 4,113). Boot (2,033 / 66), control (13 / 3), cron (552 / 125), compaction (180 / 33), and shutdown (102 / 14) are unchanged; the second turn falls from 1,495 / 353 to 1,485 / 349. Moving reads to a worker is not claimed as a query saving. The measured T1 inventory is 616 → 616 overall; after integrating current main it is 612 → 612 (b1f3eac→ final head), with 1 → 1 insrc/skills/libraryin both comparisons: the released synchronous host tool-surface API still requiresselection-read.kernel.ts. Bundled native command discovery stops using that synchronous path; complete lexical removal is a separate host tool-surface SDK cutover. No authority or bookkeeping check was removed in this slice.At the measured head, QA passes and the sole required CI failure is the unrelated UI test
Control UI chat panel layout > preserves live content and saved geometry across main, dock, focus, and narrow layouts: a 30-second wait for the terminal canvas to become visible atui/src/e2e/chat-panel-layout.e2e.test.ts:379. The identical test/line/hidden-canvas timeout occurs on scheduled main run 38147604740 at6233a19ea75bbcd079ec4dbe4660bfef9b9321ed. This PR changes no UI source. Required CI passed on integrated head657462bcb70609282190a828f818262c984fcb67(CI run 38152681341); the final source-only removal of the ineffective lazy-loader projection reuses that passing CI under the campaign's relaxed landing policy, with final-head focused tests and static gates independently rerun. Final-head CI is not claimed as passing.Earlier CI at
020681ac7a6d14373a79e6c5496d53741b3d0607had two inherited QA failures:subagent-empty-completion-recovery(profile 2/4) andsubagent-completion-direct-fallback(profile 4/4), both timing out after 180 seconds waiting for config restart readiness. The same scenarios fail with the same timeout on scheduled main run 38143525086 at96a5e338a79d0c0f8c809f23b43b29eb6072efd5(jobs114482207562and114482207612). Their owners are outside this PR. These earlier failures are retained as history, not reported as passing.Knip inherited findings are proven on the exact baseline
23ad242958a4dd4601660e3933dc6e663c89c7a1: the same six exports inextensions/telegram/src/bot-native-commands.runtime.ts(ensureConfiguredBindingRouteReady,getAgentScopedMediaLocalRoots,getSessionEntryAsync,recordDeliveredCommandExchange,resolveChunkMode,resolveStorePath) andloadSubagentMaintenanceCandidatesInDatabaseinsrc/agents/subagents/registry/subagent-registry.store.sqlite.ts. Production and script scans report zero. Their source/consumer graph is unchanged by this PR; no ignore or baseline suppression was added.No schema, migration, update, or service lifecycle policy change. Release-note context: third-party plugins should await the skill command preparation APIs; synchronous command list helpers are deprecated until the next Plugin SDK major.
LOC: 40 files, +225/−138, including bundled caller and test-fixture migration and wrapper manifest registration.