Flesh out debug logs

This commit is contained in:
Colin McDonnell
2025-12-17 13:11:44 -08:00
parent bd932e7696
commit 1f1c1602c5
9 changed files with 57 additions and 54 deletions
+2 -1
View File
@@ -19,7 +19,7 @@ export const claude = agent({
delete process.env.ANTHROPIC_API_KEY;
const prompt = addInstructions({ payload, prepResults, repo });
log.group("Full prompt", () => log.info(prompt));
log.group("» Full prompt", () => log.info(prompt));
// configure sandbox mode if enabled
const sandboxOptions: Options = payload.sandbox
@@ -63,6 +63,7 @@ export const claude = agent({
// Stream the results
for await (const message of queryInstance) {
log.debug(JSON.stringify(message, null, 2));
const handler = messageHandlers[message.type];
await handler(message as never);
}
+4 -3
View File
@@ -167,7 +167,7 @@ export const cursor = agent({
try {
const fullPrompt = addInstructions({ payload, prepResults, repo });
log.group("Full prompt", () => log.info(fullPrompt));
log.group("» Full prompt", () => log.info(fullPrompt));
// configure sandbox mode if enabled
// in sandbox mode: remove --force flag and rely on cli-config.json sandbox settings
@@ -212,6 +212,7 @@ export const cursor = agent({
try {
const event = JSON.parse(text) as CursorEvent;
log.debug(JSON.stringify(event, null, 2));
// skip empty thinking deltas
if (event.type === "thinking" && event.subtype === "delta" && !event.text) {
@@ -308,7 +309,7 @@ function configureCursorMcpServers({ mcpServers }: ConfigureMcpServersParams) {
}
writeFileSync(mcpConfigPath, JSON.stringify({ mcpServers: cursorMcpServers }, null, 2), "utf-8");
log.info(`MCP config written to ${mcpConfigPath}`);
log.info(`» MCP config written to ${mcpConfigPath}`);
}
/**
@@ -347,5 +348,5 @@ function configureCursorSandbox({ sandbox }: { sandbox: boolean }): void {
};
writeFileSync(cliConfigPath, JSON.stringify(config, null, 2), "utf-8");
log.info(`CLI config written to ${cliConfigPath} (sandbox: ${sandbox})`);
log.info(`» CLI config written to ${cliConfigPath} (sandbox: ${sandbox})`);
}
+1 -1
View File
@@ -162,7 +162,7 @@ export const gemini = agent({
}
const sessionPrompt = addInstructions({ payload, prepResults, repo });
log.group("Full prompt", () => log.info(sessionPrompt));
log.group("» Full prompt", () => log.info(sessionPrompt));
// configure sandbox mode if enabled
// --allowed-tools restricts which tools are available (removes others from registry entirely)
+3 -5
View File
@@ -30,7 +30,7 @@ export const opencode = agent({
configureOpenCode({ mcpServers, sandbox: payload.sandbox ?? false });
const prompt = addInstructions({ payload, prepResults, repo });
log.group("Full prompt", () => log.info(prompt));
log.group("» Full prompt", () => log.info(prompt));
// message positional must come right after "run", before flags
const args = ["run", prompt, "--format", "json"];
@@ -105,9 +105,7 @@ export const opencode = agent({
eventCount++;
// debug log all events to diagnose ordering and missing MCP/bash tool calls
log.debug(
`» event: type=${event.type} data=${JSON.stringify(event).substring(0, 300)}`
);
log.debug(JSON.stringify(event, null, 2));
const timeSinceLastActivity = Date.now() - lastActivityTime;
if (timeSinceLastActivity > 10000) {
@@ -253,7 +251,7 @@ function configureOpenCode({ mcpServers, sandbox }: ConfigureOpenCodeParams): vo
throw error;
}
log.info(`OpenCode config written to ${configPath} (sandbox: ${sandbox})`);
log.info(`» OpenCode config written to ${configPath} (sandbox: ${sandbox})`);
log.debug(`OpenCode config contents:\n${configJson}`);
}