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 Plus 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 workspace-scoped skill discovery feature with a new RPC endpoint, significant state management changes across server/web/mobile, and runtime behavior modifications affecting how skills are resolved and displayed. The scope and new capability introduction 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>
- Match session driver names only against driver semantics - Resolve session, thread, and selected routing values only as instance IDs - Fall through stale instances without guessing during registry loading
- Map removed canonical default instance IDs through remaining driver entries - Preserve exact instance precedence and avoid guessing custom slugs - Cover shared and web started-thread lock recovery
- Assert bounded diagnostics before and after RPC serialization - Share provider snapshots across focused and router tests - Reuse the lister function without an extra request span
- Fail workspace skill probes when Codex requires authentication - Cover structured provider-skill errors with the mock app server
- Prioritize session and persisted thread instances for timeline lookup - Cover draft provider changes with focused web regression tests
# Conflicts: # apps/server/src/ws.ts # apps/web/src/components/ChatView.logic.ts # apps/web/src/localApi.ts # packages/client-runtime/src/state/server.ts # packages/contracts/src/ipc.ts
There was a problem hiding this comment.
One Effect service convention issue found in the new server module. Everything else in the changed Effect code (structured ServerProviderSkillsListError attributes, cause preservation, namespace imports of effect/* subpaths, dependency acquisition via yield* in makeProviderSkillsLister) looks consistent with the conventions.
Posted via Macroscope — Effect Service Conventions
- Load complete draft skill tokens at shared text boundaries - Activate mobile skill lookup before the menu paints - Use namespace imports for local Effect services
- Tolerate concurrent shadow-home symlink creation - Render completed composer skills at shared boundaries - Cover parallel preparation and browser token segments
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c79ac8d. Configure here.
| enabled: providerWorkspaceSkillsLookupEnabled, | ||
| connectionAvailable: props.connectionStateLabel === "connected", | ||
| fallbackSkills: selectedProviderFallbackSkills, | ||
| }); |
There was a problem hiding this comment.
Mobile composer skills ignore draft
Medium Severity
Thread detail drives both the feed and composer from one useProviderWorkspaceSkills call whose provider instance is resolved with the session instance ahead of the draft model. After an active session, changing the next-turn model picker updates the composer UI, but workspace skill lookup and chips still target the session’s Codex instance instead of the draft selection.
Reviewed by Cursor Bugbot for commit c79ac8d. Configure here.
|
Closing in favor of #2829 (orchestration V2). #2829 deletes the V1 orchestration layer this PR builds on — This is not a judgement on the change itself. Several of these are real gaps we still want fixed; the base just moved out from under them. Once #2829 merges, please rebase onto |


Summary
Fix Codex repo-local skill discovery by resolving skills for the active project or worktree cwd instead of relying on the provider-wide status snapshot.
The implementation adds a workspace-scoped provider-skills RPC and a shared web/mobile resolution policy so composer suggestions and rendered skill chips refresh for the correct workspace without leaking stale skills across workspace, environment, or provider changes.
What Changed
server.listProviderSkillscontracts, a focused provider-skills RPC handler, WebSocket and local API routing, and environment-query wiring keyed by environment, provider instance, and cwd.ProviderSkillsListerto return snapshot skills for non-Codex or disabled Codex providers and run Codexskills/listin the validated workspace cwd for enabled Codex providers.$menu, complete draft skill tokens, and sent user skill references activate the shared lookup for composer and feed metadata.$menu or existing complete$skillreferences, treating whitespace, punctuation, and end-of-input as shared completion boundaries for both lookup and web chip rendering, and load timeline skills only when a sent user prompt contains a complete skill reference; mobile promotes active skill triggers before the menu paints, while web and mobile new-worktree drafts deliberately use snapshot fallback until their cwd exists and never probe the base checkout for repo-local skills.Why
Fixes #3040.
Codex discovers repo-local skills relative to the cwd supplied to
skills/list, but a provider status snapshot is global to the provider instance. A workspace-scoped query is therefore required to show the correct skills for each project and worktree, especially while switching between workspaces or refreshing under failure.Validation
pnpm exec vp checkcompleted with 0 errors and 9 existing React warnings,pnpm exec vp run typecheckcompleted with all 15 tasks passing, andpnpm exec vp run lint:mobilepassed.5735and server13775showed all 4 repo-local skills for the selectedcodex-skillscheckout, retained them across lazy-menu reopen, rendered complete end-of-input and punctuation-terminated skill references correctly, decorated sent timeline references with the session-bound provider, and avoided probing a future-worktree draft until its cwd existed.$ios-debugger-agentreference into a native inline skill attachment, and produced a non-empty live simulator stream.git diff --check upstream/main...HEADpassed after merging the current upstreammain.Proof
Note
Medium Risk
Touches Codex app-server probes, WebSocket RPC, and cross-platform skill state; bounded caching and lazy loading limit blast radius, but cwd/home preparation and auth failures are user-visible in composer/timeline.
Overview
Fixes repo-local Codex skills showing up in the wrong workspace by listing skills against the active project/worktree cwd instead of the global provider status snapshot.
Server: Adds
server.listProviderSkillswith a sharedProviderSkillsListerthat validates cwd, prepares Codex home, runs Codexskills/listwith timeouts and process cleanup, returns snapshot skills for non-Codex/disabled Codex, and emits bounded structured errors. Successful lookups are cached briefly with request coalescing and bounded concurrency; shadow-home symlink creation tolerates concurrent winners.checkCodexProviderStatusnow uses the configured server cwd, not the backend process cwd.Clients: Web and mobile use
useProviderWorkspaceSkillsand shared@t3tools/client-runtimepolicy (snapshot retention, fallback on empty/error, disconnect handling). Workspace RPCs run lazily—when the$menu is open or a complete$skilltoken appears (whitespace, punctuation, or end-of-input)—including timeline decoration for sent user messages.@t3tools/shared/skillInlineTokenstightens boundaries so paths like$HOMEare not skill chips. Future worktree drafts keep snapshot fallback until a real cwd exists.UI: Composer and timeline skill pickers/chips use workspace skills; skill lookup errors stay visible alongside fallback skills. Provider instance selection is centralized so timeline decoration follows session/thread model, not unsaved draft picker changes.
Reviewed by Cursor Bugbot for commit c79ac8d. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix workspace-scoped Codex skill discovery by adding a live skills RPC endpoint and UI integration
listCodexProviderSkillsto spawn a Codex app-server scoped to a suppliedcwdand return parsed skills; unauthenticated state surfaces as a typedCodexProviderSkillsUnauthenticatedError.server.listProviderSkillsWebSocket RPC method (withAuthOrchestrationReadScopeenforcement) backed by a bounded, concurrency-limited cache that coalesces in-flight requests and caches only successes.useProviderWorkspaceSkillshooks on web and mobile that issue the new RPC, gate loading behind inline skill token detection and connection availability, and fall back to provider snapshot skills.@t3tools/shared/skillInlineTokenspackage with stricter boundary rules: tokens must be followed by end-of-string, whitespace, or sentence punctuation, so$HOME/.codexand$value;are no longer matched.resolveProviderInstanceSelection(shared via@t3tools/client-runtime/state/provider-workspace-skills) and wires it throughChatView,ChatComposer,ThreadComposer, andThreadDetailScreen.CodexHomeLayout.ensureSymlinkwhere concurrent materialization of the same shadow home would fail; it now succeeds if the existing symlink already points to the target.checkCodexProviderStatusnow requires a caller-suppliedcwdinstead of usingprocess.cwd(), which is a breaking change for any direct callers outside this PR.Macroscope summarized c79ac8d.