Skip to content

Commit ca44973

Browse files
authored
Merge pull request #10115 from continuedev/nate/fix-hub-continue-dev-url
Fix cn check workers failing silently
2 parents 2aa4035 + c09caac commit ca44973

File tree

1 file changed

+11
-31
lines changed

1 file changed

+11
-31
lines changed

extensions/cli/src/commands/check/checkWorker.ts

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88

99
import * as fs from "fs";
1010

11-
import type { ChatHistoryItem } from "core/index.js";
12-
1311
import {
1412
initializeServices,
1513
getService,
14+
services,
1615
SERVICE_NAMES,
1716
} from "../../services/index.js";
1817
import type { ModelServiceState } from "../../services/types.js";
1918
import { streamChatResponse } from "../../stream/streamChatResponse.js";
20-
import { constructSystemMessage } from "../../systemMessage.js";
2119

2220
import type { DiffContext } from "./diffContext.js";
2321
import { captureWorktreeDiff } from "./worktree.js";
@@ -133,14 +131,6 @@ export async function runCheckWorker(): Promise<void> {
133131
throw new Error("Failed to initialize model service");
134132
}
135133

136-
// Build system message
137-
const systemMessage = await constructSystemMessage(
138-
"auto",
139-
config.options.rule,
140-
undefined,
141-
true, // headless
142-
);
143-
144134
// Build the check prompt
145135
const checkPrompt = buildCheckPrompt(config.diffContext);
146136

@@ -153,30 +143,20 @@ export async function runCheckWorker(): Promise<void> {
153143
agentInstructions = loadLocalAgentInstructions(config.agentSource);
154144
}
155145

156-
// Construct initial chat history
157-
const chatHistory: ChatHistoryItem[] = [];
158-
159-
if (systemMessage) {
160-
chatHistory.push({
161-
message: { role: "user", content: systemMessage },
162-
contextItems: [],
163-
});
164-
}
146+
// Build the user prompt parts and add to ChatHistoryService
147+
// so streamChatResponse picks them up via refreshChatHistoryFromService
148+
const chatHistorySvc = services.chatHistory;
165149

150+
const promptParts: string[] = [];
166151
if (agentInstructions) {
167-
chatHistory.push({
168-
message: {
169-
role: "user",
170-
content: `## Agent Instructions\n\n${agentInstructions}`,
171-
},
172-
contextItems: [],
173-
});
152+
promptParts.push(`## Agent Instructions\n\n${agentInstructions}`);
174153
}
154+
promptParts.push(checkPrompt);
175155

176-
chatHistory.push({
177-
message: { role: "user", content: checkPrompt },
178-
contextItems: [],
179-
});
156+
const userMessage = promptParts.join("\n\n");
157+
chatHistorySvc.addUserMessage(userMessage);
158+
159+
const chatHistory = chatHistorySvc.getHistory();
180160

181161
// Collect agent text output
182162
let agentOutput = "";

0 commit comments

Comments
 (0)