Skip to content

Commit cf985f2

Browse files
committed
test: answer reasoning prompt in endpoint retries
1 parent afdd008 commit cf985f2

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

src/lib/onboard.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3651,7 +3651,6 @@ async function handleNimLocalSelection(
36513651
return "selected";
36523652
}
36533653

3654-
/** Handles hosted and compatible remote provider selection, credentials, model prompts, and validation. */
36553654
async function handleRemoteProviderSelection(
36563655
args: RemoteProviderSelectionArgs,
36573656
state: SetupNimSelectionState,
@@ -3940,7 +3939,6 @@ async function handleRemoteProviderSelection(
39403939
return "selected";
39413940
}
39423941

3943-
/** Configures the selected inference provider and returns the sandbox-facing model route state. */
39443942
async function setupNim(
39453943
gpu: ReturnType<typeof nim.detectGpu>,
39463944
sandboxName: string | null = null,

src/lib/onboard/reasoning-mode.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export type ReasoningModeDeps = {
1313
};
1414

1515
export type ReasoningModeExitDeps = ReasoningModeDeps & {
16-
error: (message: string) => void;
17-
exit: (code: number) => never;
16+
error?: (message: string) => void;
17+
exit?: (code: number) => never;
1818
};
1919

2020
const REASONING_ENV = "NEMOCLAW_REASONING";
@@ -35,7 +35,9 @@ export async function configureCustomOpenAiReasoningMode(deps: ReasoningModeDeps
3535
if (existing) {
3636
const normalized = normalizeReasoningMode(existing);
3737
if (!normalized) {
38-
throw new Error(`${REASONING_ENV} must be "true" or "false" for OpenAI-compatible endpoints.`);
38+
throw new Error(
39+
`${REASONING_ENV} must be "true" or "false" for OpenAI-compatible endpoints.`,
40+
);
3941
}
4042
env[REASONING_ENV] = normalized;
4143
if (deps.isNonInteractive()) {
@@ -62,7 +64,9 @@ export async function configureCustomOpenAiReasoningModeOrExit(
6264
try {
6365
await configureCustomOpenAiReasoningMode(deps);
6466
} catch (err) {
65-
deps.error(` ${err instanceof Error ? err.message : String(err)}`);
66-
deps.exit(1);
67+
const error = deps.error ?? console.error;
68+
const exit = deps.exit ?? process.exit;
69+
error(` ${err instanceof Error ? err.message : String(err)}`);
70+
exit(1);
6771
}
6872
}

test/onboard-compatible-reasoning-mode.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ while [ "$#" -gt 0 ]; do
3939
*) url="$1"; shift ;;
4040
esac
4141
done
42-
if [ "\${NEMOCLAW_REASONING:-}" != "true" ]; then
43-
body='{"error":{"message":"reasoning mode was not set before validation"}}'
44-
status="400"
45-
elif echo "$url" | grep -q '/responses$'; then
42+
if echo "$url" | grep -q '/responses$'; then
4643
body='{"id":"resp_123","output":[{"type":"message","content":[{"type":"output_text","text":"OK"}]}]}'
4744
status="200"
4845
elif echo "$url" | grep -q '/chat/completions$'; then

0 commit comments

Comments
 (0)