Fix workspace-scoped Codex skill discovery#3059
Conversation
- Propagate cwd through provider status probes - Add server RPC for workspace skill discovery - Load workspace skills in the composer UI
- Clarify bogus skill as a durable discovery test fixture - Stabilize composer fallback skill array identity
- Skip Codex skill spawning for disabled instances - Move bogus skill fixture out of workspace discovery
- Refresh workspace skill cache on provider and connection changes - Validate Codex skill cwd before spawning the app server - Cover server.listProviderSkills RPC branches
- Track the active workspace key in provider skill state - Reset pending skills when switching workspace targets
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR introduces a new feature for workspace-scoped Codex skill discovery, including a new RPC endpoint, server-side child process spawning, and frontend state management. Despite extensive test coverage, the new capability and runtime behavior changes warrant human review. You can customize Macroscope's approvability policy. Learn more. |
- Keep pending skill lookups scoped to the active workspace key - Surface Codex skill-list timeout errors in the composer - Add regression coverage for stale pending skills
# Conflicts: # apps/server/src/provider/Layers/CursorProvider.ts # apps/web/src/components/chat/ChatComposer.tsx
6acc264 to
9f66820
Compare
# Conflicts: # apps/web/src/environments/runtime/connection.test.ts # apps/web/src/environments/runtime/service.savedEnvironments.test.ts # apps/web/src/environments/runtime/service.threadSubscriptions.test.ts # apps/web/src/localApi.ts # packages/client-runtime/src/wsRpcClient.ts
Co-authored-by: codex <codex@users.noreply.github.com>
9f66820 to
00cebad
Compare
- Keep prior workspace skills visible while refreshes are pending - Add tests for loaded, pending, workspace-switch, and empty states
- Preserve and clear cached workspace skills by query state - Cover pending data, empty data, and workspace switches
Co-authored-by: codex <codex@users.noreply.github.com>
There was a problem hiding this comment.
Effect service review found one convention issue in the changed scope. See the inline comment.
Posted via Macroscope — Effect Service Conventions
There was a problem hiding this comment.
Two new ServerProviderSkillsListError constructions derive the caller-visible message from the underlying cause. Since this error flows through the server.listProviderSkills RPC error channel and into the $ menu UI, the raw underlying text leaks across a caller-visible boundary. The underlying failure is already preserved structurally via cause, so the message should be derived only from stable structural attributes.
Posted via Macroscope — Effect Service Conventions
# Conflicts: # apps/server/src/provider/Layers/CursorProvider.test.ts
3f85340 to
661a9f3
Compare
- Refactor ws route-layer dependency options handling - Keep route-layer wiring aligned with current server flow
Summary
Fix Codex repo-local skill discovery by resolving skills for the active project/worktree cwd instead of relying on the provider status snapshot.
Codex discovers local skills relative to the cwd used for
skills/list, while provider status is global to the provider instance. This PR adds a workspace-scoped provider-skills RPC, uses it in the composer and message timeline, and keeps provider probes explicit about their configured cwd so behavior does not depend on the backend process cwd.What Changed
server.listProviderSkillscontracts, client-runtime query wiring, local API support, and WebSocket handler coverage.ProviderSkillsListerto serve snapshot skills for non-Codex or disabled-Codex providers while using workspace-aware Codexskills/listfor enabled Codex providers.serverConfig.cwdvalues into Codex, Cursor, and Grok provider status probes and ACP discovery.$menu is open or the prompt already contains complete$skillreferences.$menu instead of silently presenting an empty skill set.Why
Fixes #3040.
The cwd fix is necessary but not sufficient on its own. Provider startup and status probes should use the configured server cwd, but the composer needs a workspace-specific skill query because repo-local Codex skills depend on the active project/worktree cwd.
The client state is keyed by environment/provider/cwd so skill suggestions and chips can refresh through the shared query runtime, keep useful same-workspace data visible during refreshes, and avoid showing skills from a previous workspace while a new workspace query is pending.
Validation
pnpm exec vp checkpnpm exec vp run typecheckpnpm exec vp test apps/server/src/provider/ProviderSkillsLister.test.tspnpm exec vp test apps/server/src/server.test.ts -t "server.listProviderSkills"pnpm exec vp test apps/server/src/provider/Layers/CodexProvider.test.ts apps/server/src/provider/Layers/CursorProvider.test.ts apps/server/src/provider/Layers/GrokProvider.test.tspnpm exec vp test apps/web/src/lib/providerWorkspaceSkillsState.test.ts apps/web/src/composer-editor-mentions.test.tspnpm exec vp test apps/web/src/components/chat/MessagesTimeline.test.tsxProof
Note
Medium Risk
Spawns Codex app-server child processes per workspace skill request (mitigated by timeout, caching, and concurrency limits); provider probe cwd changes affect model/skill discovery behavior across workspaces.
Overview
Fixes repo-local Codex skill discovery by listing skills for the active workspace cwd instead of the global provider snapshot or the server process cwd.
Adds
server.listProviderSkills(contracts, WebSocket RPC, client query) backed byProviderSkillsLister: non-Codex or disabled Codex instances return snapshot skills; enabled Codex runs a short-livedcodex app-serverskills/listfor the requested cwd with home prep, 15s timeout, TTL cache, coalescing, and structuredServerProviderSkillsListErrorpayloads (viasanitizeErrorCause).Codex, Cursor, and Grok status probes and ACP discovery now take an explicit
serverConfig.cwdinstead ofprocess.cwd().The web client loads skills through
useProviderWorkspaceSkills(keyed by environment, instance, cwd) in the composer and timeline—lazy when the$menu is open or the prompt has complete$skilltokens—with stale-workspace clearing, snapshot fallback on errors, and menu-visible failures.promptHasComposerSkillReferenceavoids unnecessary fetches.Reviewed by Cursor Bugbot for commit c748279. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix workspace-scoped Codex skill discovery by passing cwd through provider status checks and skill listing
listCodexProviderSkillseffect inCodexProvider.tsthat spawns a Codex app-server child process scoped to a caller-suppliedcwd, initializes it, and requestsskills/listwith a 15s timeout.serverConfig.cwdthroughcheckCodexProviderStatus,checkCursorProviderStatus, andcheckGrokProviderStatusso provider probes run in the workspace directory instead ofprocess.cwd().makeProviderSkillsListerinProviderSkillsLister.ts— a TTL-cached (1s, cap 64), concurrency-limited (4 permits) service that validatescwd, prepares Codex shadow home, and maps failures to structuredServerProviderSkillsListErrorvalues.server.listProviderSkillsWebSocket RPC (requiringAuthOrchestrationReadScope) wired tomakeProviderSkillsListerinws.ts.useProviderWorkspaceSkillsReact hook inproviderWorkspaceSkillsState.tsand wires it intoChatViewandChatComposerso the skill list and composer menu reflect the active workspace rather than the global provider snapshot.Macroscope summarized c748279.