[codex] Fix Codex workspace skill autocomplete#2954
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 |
|
Superseded by #2955, which keeps the same scoped Codex skill autocomplete fix on the requested pabloszx/ branch prefix. |
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:
- apps/server/src/provider/Drivers/OpenCodeDriver.ts lines 139-152 (REVIEWED_COMMIT): `checkProvider` pre-built with `serverConfig.cwd`, then passed as `() => checkProvider` ignoring input
- apps/server/src/provider/makeManagedServerProvider.ts lines 31-33 (REVIEWED_COMMIT): interface expects `checkProvider: (input?: ProviderSnapshotRefreshInput) => Effect.Effect<...>`
- apps/server/src/provider/makeManagedServerProvider.ts lines 130-131 (REVIEWED_COMMIT): framework passes resolved `refreshInput` to `input.checkProvider(refreshInput)`
- apps/server/src/provider/Services/ServerProvider.ts lines 6-8 (REVIEWED_COMMIT): `ProviderSnapshotRefreshInput` defines `readonly cwd?: string | undefined`
- apps/server/src/provider/Drivers/CodexDriver.ts lines 163-168 (REVIEWED_COMMIT): sibling driver correctly accepts `refreshInput?.cwd ?? serverConfig.cwd`
- apps/server/src/provider/Layers/OpenCodeProvider.ts lines 301-304 (REVIEWED_COMMIT): `checkOpenCodeProviderStatus` takes `cwd` as a parameter, so dynamic values are supported
Summary
Fix Codex
$skillautocomplete for project/worktree-local skills.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, leaving$create-stand similar skill queries with no matches.Changes
cwdcontext throughserver.refreshProviders, the WebSocket contract, provider registry refreshes, and managed provider snapshots.$skill autocomplete has the right skill list.Related
Related to #2637, but this PR intentionally does not change
/command suggestions or close that issue.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.
Supersedes draft #2953 with a narrower
$autocomplete-only scope.Validation
mise exec -- pnpm exec vp checkmise 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.tsmise exec -- pnpm exec vp run --filter t3 --filter @t3tools/web --filter @t3tools/contracts typecheckNote: full
mise exec -- pnpm exec vp run typecheckcurrently fails on freshorigin/mainin unrelatedapps/desktopEffect diagnostics (effect/Scoperesolution and any-in-requirements errors), before any changed package fails.Note
Fix Codex workspace skill autocomplete by passing cwd through provider refresh
cwdfield to theProviderSnapshotRefreshInputtype and threads it through the refresh call chain: RPC schema →ProviderRegistry→makeManagedServerProvider→checkCodexProviderStatus.makeManagedServerProvidernow acceptscheckProvideras a function (instead of a plain Effect) and persists the last explicit refresh input so background rechecks reuse the samecwd.ChatViewgains auseEffectthat triggers a one-time Codex provider refresh with the active workspacecwdwhenever the active provider is Codex and a workspace root is set, ensuring project-local skills are resolved correctly.ServerProviderShape.refreshchanges from a plain Effect to a function accepting optional input; all driver and test call sites are updated accordingly.📊 Macroscope summarized 957ecf6. 14 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.