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 (workspace-scoped skill discovery) with a new RPC endpoint, new client-side state management hook with caching, and changes to how multiple providers discover skills. The aggregate scope and new runtime behavior 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
Summary
Fix Codex repo-local skill discovery in the composer by resolving skills for the active project/worktree cwd, instead of relying on the global provider status snapshot.
The bug showed up because Codex discovers local skills relative to the cwd used for the
skills/listcall. A provider-level status snapshot is not tied to the currently selected project/worktree, so desktop/web surfaces could show only global/provider skills even though running Codex directly from the repository correctly finds.agents/skillsor.codex/skills.This also removes backend
process.cwd()leakage from Codex/Grok/Cursor provider probes. Provider checks now receive an explicit fallback cwd, so probe behavior does not accidentally depend on where the T3 backend process happened to be launched.What Changed
server.listProviderSkillsRPC with typed contracts, client runtime wiring, and WebSocket handler coverage.skills/listwith the requested project/worktree cwd.skills/listcall does not leave the composer loading indefinitely.$suggestions and inline skill chip metadata use repo-local skill data.$menu instead of presenting them as an empty skill set.Why
Fixes #3040. Unsure when or where exactly this started happening, for me I merged in quite a large batch of upstream commits at once when it started happening.
The cwd fix is necessary but not sufficient on its own. Passing the correct cwd to provider startup and probes makes provider execution predictable, but the composer still needs a workspace-specific skill query because the provider status snapshot is global/provider-scoped rather than project-scoped.
serverConfig.cwdremains fine for provider configuration. The important change is that every Codex CLI interaction that depends on local repository context, includingskills/list, receives the cwd for the active project/worktree instead of falling back to the backend process cwd or a stale provider snapshot.The extra client-side state exists so skill suggestions and inline skill chips can use workspace-scoped data, refresh when the active environment/workspace changes, and avoid showing stale local skills from a previous cwd while a new workspace query is pending.
Validation
./node_modules/.bin/vp check./node_modules/.bin/vp run typecheck./node_modules/.bin/vp test apps/server/src/server.test.ts./node_modules/.bin/vp test apps/web/src/lib/providerWorkspaceSkillsState.test.tsChecklist
Note
Medium Risk
Spawns Codex app-server on skill list with cwd validation and new WS surface area; provider probe cwd changes affect Codex/Cursor/Grok status checks.
Overview
Adds
server.listProviderSkillsend-to-end (contracts, WS RPC, client runtime) so the composer can load workspace-scoped provider skills instead of only the global provider status snapshot.For Codex, enabled instances validate/normalize the requested project cwd, prepare Codex home, and call app-server
skills/listwith that cwd via newlistCodexProviderSkills. Non-Codex drivers and disabled Codex still return snapshot skills. Codex, Cursor, and Grok provider status probes now take an explicitcwd(fromServerConfigin drivers) instead ofprocess.cwd().The web layer adds
useProviderWorkspaceSkills(cached fetch, pending/empty behavior on cwd switches) and wiresChatComposerskill menus and inline chips to it.Reviewed by Cursor Bugbot for commit 6acc264. 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
server.listProviderSkillsRPC endpoint that returns skills for a specific provider instance and workspacecwd, with special handling for Codex providers.cwd, resolves the Codex home layout, and applies a 15s timeout; failures produce structuredServerProviderSkillsListErrorresponses.checkCodexProviderStatus,checkCursorProviderStatus,checkGrokProviderStatus) now accept an explicitcwdparameter instead of usingprocess.cwd().useProviderWorkspaceSkillsReact hook in providerWorkspaceSkillsState.ts with LRU caching (max 100 entries) and cache invalidation on environment/provider changes.Macroscope summarized 6acc264.