Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

fix: enable the Ollama thinking channel for the chat tool loop

Khuram Niaz80b9b77728c2
diff --git a/__tests__/AgentChatMessages.spec.tsx b/__tests__/AgentChatMessages.spec.tsx
index 4931e6c..cd01181 100644
--- a/__tests__/AgentChatMessages.spec.tsx
+++ b/__tests__/AgentChatMessages.spec.tsx
@@ -231,6 +231,20 @@ describe("AgentChatMessages", () => {
expect(screen.queryByRole("link")).not.toBeInTheDocument();
});
+ // think:true means reasoning parts now reach the client. They are the
+ // model's scratchpad, not its answer, and must never render as prose.
+ it("renders nothing for a reasoning part", () => {
+ chat.messages = [
+ assistant([
+ { type: "reasoning", text: "The user pasted a posting, so I omit jobDescription." },
+ { type: "text", text: "Added." },
+ ]),
+ ];
+ render(<AgentChatMessages />);
+ expect(screen.getByText("Added.")).toBeInTheDocument();
+ expect(screen.queryByText(/omit jobDescription/)).not.toBeInTheDocument();
+ });
+
// The transcript no longer parses assistant prose for a SCORES line at all
// — the card comes from the tool part. A model that emits one anyway is
// rendered as the plain text it is.
diff --git a/__tests__/agentChatRoute.spec.ts b/__tests__/agentChatRoute.spec.ts
index 231f377..abaccfd 100644
--- a/__tests__/agentChatRoute.spec.ts
+++ b/__tests__/agentChatRoute.spec.ts
@@ -161,6 +161,9 @@ describe("POST /api/ai/chat", () => {
expect(args.temperature).toBe(0.1);
expect(args.abortSignal).toBeDefined();
expect(args.providerOptions.ollama.options.num_ctx).toBe(APP_CONSTANTS.AGENT_CHAT_NUM_CTX);
+ // qwen3.5 deliberates in the content channel when thinking is off, and
+ // content and a tool call are mutually exclusive. Measured 1/7 vs 7/7.
+ expect(args.providerOptions.ollama.think).toBe(true);
});
it("returns 503 naming Settings when no model is configured, and never guesses one", async () => {
diff --git a/evals/agent-chat/promptfooconfig.yaml b/evals/agent-chat/promptfooconfig.yaml
index 1236906..5c4163d 100644
--- a/evals/agent-chat/promptfooconfig.yaml
+++ b/evals/agent-chat/promptfooconfig.yaml
@@ -24,19 +24,18 @@ providers:
tool_choice: auto
tools: file://./tools.json
- # Local Ollama via its OpenAI-compatible endpoint. reasoning_effort goes in
- # passthrough to clear promptfoo's reasoning-model name check; disabling
- # thinking matches the app, where ollama-ai-provider-v2 sets think:false.
- - id: openai:chat:qwen3.5:9b
+ # Local Ollama via its NATIVE endpoint, which is what the app uses. The
+ # OpenAI-compatible /v1 shim cannot measure this surface: promptfoo's
+ # openai:chat provider checks message.reasoning FIRST and discards
+ # tool_calls when both are present, so every thinking tool call scores as
+ # "no tool call". Verified in promptfoo 0.121.19 and 0.122.0 alike.
+ - id: ollama:chat:qwen3.5:9b
label: ollama-qwen3.5-9b
config:
- apiBaseUrl: http://localhost:11434/v1
- apiKey: ollama
temperature: 0
- max_tokens: 8192
- passthrough:
- reasoning_effort: "none"
- tool_choice: auto
+ # Mirrors the route: providerOptions.ollama.think plus AGENT_CHAT_NUM_CTX.
+ think: true
+ num_ctx: 16384
tools: file://./tools.json
prompts:
diff --git a/src/app/api/ai/chat/route.ts b/src/app/api/ai/chat/route.ts
index c29ea77..1f3c84a 100644
--- a/src/app/api/ai/chat/route.ts
+++ b/src/app/api/ai/chat/route.ts
@@ -186,7 +186,11 @@ export const POST = async (req: NextRequest) => {
temperature: TEMPERATURES.ANALYSIS,
abortSignal: controller.signal,
providerOptions: {
- ollama: { options: { num_ctx: APP_CONSTANTS.AGENT_CHAT_NUM_CTX } },
+ // qwen3.5 is a hybrid-reasoning model and the provider defaults
+ // think to false. With the thinking channel shut it deliberates in
+ // the content channel, and content and a tool call are mutually
+ // exclusive — add_job measured 1/7 with it off, 7/7 with it on.
+ ollama: { think: true, options: { num_ctx: APP_CONSTANTS.AGENT_CHAT_NUM_CTX } },
},
});
// createUIMessageStream emits no start/finish of its own — the merged
diff --git a/src/lib/agent/tools/reviewResume.ts b/src/lib/agent/tools/reviewResume.ts
index 1e84f67..4640e24 100644
--- a/src/lib/agent/tools/reviewResume.ts
+++ b/src/lib/agent/tools/reviewResume.ts
@@ -75,6 +75,9 @@ export function buildReviewResumeTool(ctx: ReviewResumeContext) {
prompt: buildResumeReviewPrompt(pre.data.normalizedText),
temperature: TEMPERATURES.FEEDBACK,
abortSignal: AbortSignal.any(signals),
+ // Deliberately no think:true. This is a plain text generation with
+ // no tools, so reasoning buys nothing and costs 30s on a call that
+ // already runs 30-120s. The chat loop enables it; this does not.
providerOptions: {
ollama: { options: { num_ctx: APP_CONSTANTS.AI_OLLAMA_NUM_CTX } },
},