fix(hub,web): query Codex models via machine RPC instead of session cwd (#1186)

SessionChat fetched Codex models through the session-scoped endpoint,
so the CLI listed models in the session process cwd, where a missing
directory or project-level Codex config could skew or break the result.
Use the machine-scoped endpoint (already used by NewSession) and drop
the now-unused session route and RPC plumbing.

Fixes #1072
This commit is contained in:
weishu
2026-07-27 12:58:22 +08:00
committed by GitHub
parent da6f4cc5b0
commit 54bddd9db1
8 changed files with 4 additions and 76 deletions
+3 -9
View File
@@ -5,7 +5,6 @@ import { queryKeys } from '@/lib/query-keys'
export function useCodexModels(args: {
api: ApiClient | null
sessionId?: string | null
machineId?: string | null
enabled?: boolean
}): {
@@ -13,11 +12,9 @@ export function useCodexModels(args: {
isLoading: boolean
error: string | null
} {
const { api, sessionId, machineId } = args
const enabled = Boolean(args.enabled && api && (sessionId || machineId))
const queryKey = sessionId
? queryKeys.sessionCodexModels(sessionId)
: queryKeys.machineCodexModels(machineId ?? 'unknown')
const { api, machineId } = args
const enabled = Boolean(args.enabled && api && machineId)
const queryKey = queryKeys.machineCodexModels(machineId ?? 'unknown')
const query = useQuery({
queryKey,
@@ -25,9 +22,6 @@ export function useCodexModels(args: {
if (!api) {
throw new Error('API unavailable')
}
if (sessionId) {
return await api.getSessionCodexModels(sessionId)
}
if (machineId) {
return await api.getMachineCodexModels(machineId)
}