Skip to content

Commit 1f4a3a5

Browse files
committed
fix(tui): fetch agent token directly instead of pre-check in fetch access
The canFetchRuntimeToken pre-check swallows all errors and returns false, which incorrectly showed "no managed OAuth credential" even when one was configured. For the fetch access screen (explicit user action), call fetchRuntimeToken directly and let real errors surface in the error phase. The pre-check remains in the invoke flow where silent skip is desired.
1 parent d1417fc commit 1f4a3a5

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

src/cli/tui/screens/fetch-access/useFetchAccessFlow.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import { isMacOS, isWindows } from '../../../../lib/utils/platform';
22
import { getErrorMessage } from '../../../errors';
33
import type { ResourceInfo, TokenFetchResult } from '../../../operations/fetch-access';
4-
import {
5-
canFetchRuntimeToken,
6-
fetchGatewayToken,
7-
fetchRuntimeToken,
8-
listAgents,
9-
listGateways,
10-
} from '../../../operations/fetch-access';
4+
import { fetchGatewayToken, fetchRuntimeToken, listAgents, listGateways } from '../../../operations/fetch-access';
115
import { spawn } from 'node:child_process';
126
import { useCallback, useEffect, useRef, useState } from 'react';
137

@@ -20,15 +14,8 @@ async function fetchAgentAccess(resource: ResourceInfo): Promise<TokenFetchResul
2014
};
2115
}
2216

23-
const canFetch = await canFetchRuntimeToken(resource.name);
24-
if (!canFetch) {
25-
return {
26-
url: '',
27-
authType: 'CUSTOM_JWT',
28-
message: 'CUSTOM_JWT agent, but no managed OAuth credential is configured. Provide a token manually when invoking.',
29-
};
30-
}
31-
17+
// For CUSTOM_JWT agents, attempt token fetch directly.
18+
// Errors (missing credential, bad config) surface in the error phase.
3219
const tokenResult = await fetchRuntimeToken(resource.name);
3320
return {
3421
url: '',

0 commit comments

Comments
 (0)