[codex] Fix Codex workspace skill discovery#2953
Conversation
|
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 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 51e474a. Configure here.
| }) | ||
| .catch((error: unknown) => { | ||
| console.warn("Failed to refresh Codex provider for active workspace", error); | ||
| }); |
There was a problem hiding this comment.
Failed workspace refresh not retried
Medium Severity
The Codex workspace refresh effect records its dedupe key before refreshProviders completes. If the RPC fails, the key still matches the active workspace, so the effect skips further attempts and project-local skills can stay wrong until the user changes workspace or another refresh path runs.
Reviewed by Cursor Bugbot for commit 51e474a. Configure here.
There was a problem hiding this comment.
🟢 Low
The checkProvider function at line 152 ignores the input parameter, so any cwd override passed during refresh is discarded. The interface expects checkProvider: (input?: ProviderSnapshotRefreshInput) => Effect.Effect<...> where input?.cwd can override the working directory, but the current implementation captures serverConfig.cwd at instance creation time and discards runtime cwd values. This breaks the refresh contract when a different working directory is requested.
🤖 Copy this AI Prompt to have your agent fix this:
In file apps/server/src/provider/Drivers/OpenCodeDriver.ts around line 139:
The `checkProvider` function at line 152 ignores the `input` parameter, so any `cwd` override passed during refresh is discarded. The interface expects `checkProvider: (input?: ProviderSnapshotRefreshInput) => Effect.Effect<...>` where `input?.cwd` can override the working directory, but the current implementation captures `serverConfig.cwd` at instance creation time and discards runtime `cwd` values. This breaks the refresh contract when a different working directory is requested.
Evidence trail:
- OpenCodeDriver.ts:139-143 — `checkProvider` created with `serverConfig.cwd` baked in
- OpenCodeDriver.ts:152 — `checkProvider: () => checkProvider` ignores input parameter
- makeManagedServerProvider.ts:31-33 — interface expects `(input?: ProviderSnapshotRefreshInput) => Effect.Effect<...>`
- makeManagedServerProvider.ts:130-131 — `resolveRefreshInput` result passed to `input.checkProvider(refreshInput)`
- ServerProvider.ts:6-8 — `ProviderSnapshotRefreshInput` has `readonly cwd?: string | undefined`
- CodexDriver.ts:163-168 — peer driver properly handles cwd override: `refreshInput?.cwd ?? serverConfig.cwd`
- OpenCodeProvider.ts:301-303 — `checkOpenCodeProviderStatus` accepts a `cwd` parameter, confirming relevance
ApprovabilityVerdict: Needs human review This PR enables workspace-scoped skill discovery for Codex by propagating a new You can customize Macroscope's approvability policy. Learn more. |
|
Superseded by #2954, which narrows the scope to Codex skill autocomplete only and removes the suggestion changes. |


Summary
Fix Codex workspace skill discovery and provider skill suggestions in the composer.
Root cause
Codex provider status was probed from the server process cwd, so
codex app-server skills/listdid not receive the active project or worktree cwd. Project-local.agents/skillsentries could be parsed by Codex, but T3 Code's provider snapshot did not include them for the active workspace. The/composer menu also only surfaced slash commands, so provider skills were not discoverable there even when present in provider status.Changes
cwdcontext throughserver.refreshProviders, the WebSocket contract, provider registry refreshes, and managed provider snapshots./composer menu under a Skills group, with selection inserting the$skill-nameinvocation.Related
Related to #2637, but this PR should not automatically close it.
Related to #2048, but this PR only wires the cwd consumer for Codex; Claude project skill discovery remains separate.
Builds on the closed stale approach from #2330, with the cwd coming from the active workspace rather than only the server config cwd.
Includes the slash-menu provider skill surfacing from the open #2650 approach as part of the same end-to-end fix.
Validation
mise exec -- pnpm exec vp checkmise exec -- pnpm exec vp run typecheckmise exec -- pnpm exec vp test run apps/server/src/provider/makeManagedServerProvider.test.ts apps/server/src/provider/Layers/ProviderRegistry.test.ts apps/web/src/localApi.test.ts apps/web/src/components/chat/ComposerCommandMenu.test.ts apps/web/src/components/chat/composerSlashCommandSearch.test.tsNote
Medium Risk
Changes provider refresh RPC shape and Codex probe behavior; scope is bounded with tests but affects live provider snapshots and WS clients.
Overview
Fixes Codex workspace skill discovery by probing provider status against the active project/worktree instead of only the server process cwd.
Server: Adds optional
cwdonserver.refreshProviders(IPC/WS contracts) and threadsProviderSnapshotRefreshInputthrough the provider registry, managed snapshots, and Codex’s app-server probe (skills/listuses the supplied cwd). Managed providers remember the last explicit refresh cwd so periodic background checks keep the same workspace context. Web: When the active workspace root changes, Codex triggers a targeted provider refresh with that cwd. The/composer menu now includes provider skills (with a Skills group) alongside slash commands.Reviewed by Cursor Bugbot for commit 51e474a. Bugbot is set up for automated code reviews on this repo. Configure here.