Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d9c6fd2b1 | |||
| 008021df1c |
+19
-9
@@ -1,3 +1,4 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { access, constants } from "node:fs/promises";
|
||||
import * as core from "@actions/core";
|
||||
import { createMcpConfig } from "../mcp/config.ts";
|
||||
@@ -16,7 +17,6 @@ export class ClaudeAgent implements Agent {
|
||||
startTime: 0,
|
||||
};
|
||||
|
||||
|
||||
constructor(config: AgentConfig) {
|
||||
if (!config.apiKey) {
|
||||
throw new Error("Claude agent requires an API key");
|
||||
@@ -74,7 +74,6 @@ export class ClaudeAgent implements Agent {
|
||||
core.info("Running Claude Code...");
|
||||
|
||||
try {
|
||||
|
||||
const claudePath = `${process.env.HOME}/.local/bin/claude`;
|
||||
console.log(boxString(prompt, { title: "Prompt" }));
|
||||
const args = [
|
||||
@@ -152,8 +151,7 @@ export class ClaudeAgent implements Agent {
|
||||
} catch (error: any) {
|
||||
try {
|
||||
core.endGroup();
|
||||
} catch {
|
||||
}
|
||||
} catch {}
|
||||
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
||||
return {
|
||||
success: false,
|
||||
@@ -196,12 +194,26 @@ function processJSONChunk(chunk: string, agent?: ClaudeAgent): void {
|
||||
])
|
||||
);
|
||||
|
||||
// Check if MCP servers are expected but failed
|
||||
// Check for failed MCP servers and show debug logs
|
||||
if (parsedChunk.mcp_servers?.length > 0) {
|
||||
const failedServers = parsedChunk.mcp_servers.filter((server: any) => server.status === "failed");
|
||||
const failedServers = parsedChunk.mcp_servers.filter(
|
||||
(server: any) => server.status === "failed"
|
||||
);
|
||||
if (failedServers.length > 0) {
|
||||
const failedNames = failedServers.map((server: any) => server.name).join(", ");
|
||||
throw new Error(`MCP servers failed to start: ${failedNames}. This indicates a configuration or environment issue that prevents GitHub integration from working.`);
|
||||
|
||||
// Try to read MCP server debug logs
|
||||
let debugInfo = "";
|
||||
try {
|
||||
const logContent = readFileSync("/tmp/mcp-server.log", "utf-8");
|
||||
core.error("MCP Server Debug Log:");
|
||||
core.error(logContent);
|
||||
debugInfo = " (see debug log above)";
|
||||
} catch (logError) {
|
||||
debugInfo = ` (could not read debug log: ${logError instanceof Error ? logError.message : String(logError)})`;
|
||||
}
|
||||
|
||||
throw new Error(`MCP servers failed to start: ${failedNames}${debugInfo}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -279,7 +291,6 @@ function processJSONChunk(chunk: string, agent?: ClaudeAgent): void {
|
||||
core.info(` └─ bash_command: ${input.bash_command}`);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,7 +311,6 @@ function processJSONChunk(chunk: string, agent?: ClaudeAgent): void {
|
||||
|
||||
case "result":
|
||||
if (parsedChunk.subtype === "success") {
|
||||
|
||||
core.info(
|
||||
tableString([
|
||||
["Cost", `$${parsedChunk.total_cost_usd?.toFixed(4) || "0.0000"}`],
|
||||
|
||||
@@ -25500,6 +25500,7 @@ var core4 = __toESM(require_core(), 1);
|
||||
var core2 = __toESM(require_core(), 1);
|
||||
|
||||
// agents/claude.ts
|
||||
var import_node_fs = require("node:fs");
|
||||
var import_promises = require("node:fs/promises");
|
||||
var core = __toESM(require_core(), 1);
|
||||
|
||||
@@ -25514,7 +25515,7 @@ function createMcpConfig(githubInstallationToken) {
|
||||
{
|
||||
mcpServers: {
|
||||
minimal_github_comment: {
|
||||
command: "node",
|
||||
command: `${actionPath}/mcp/debug-server.sh`,
|
||||
args: [`${actionPath}/mcp/server.ts`],
|
||||
env: {
|
||||
GITHUB_INSTALLATION_TOKEN: githubInstallationToken,
|
||||
@@ -25859,10 +25860,21 @@ function processJSONChunk(chunk, agent) {
|
||||
])
|
||||
);
|
||||
if (parsedChunk.mcp_servers?.length > 0) {
|
||||
const failedServers = parsedChunk.mcp_servers.filter((server) => server.status === "failed");
|
||||
const failedServers = parsedChunk.mcp_servers.filter(
|
||||
(server) => server.status === "failed"
|
||||
);
|
||||
if (failedServers.length > 0) {
|
||||
const failedNames = failedServers.map((server) => server.name).join(", ");
|
||||
throw new Error(`MCP servers failed to start: ${failedNames}. This indicates a configuration or environment issue that prevents GitHub integration from working.`);
|
||||
let debugInfo = "";
|
||||
try {
|
||||
const logContent = (0, import_node_fs.readFileSync)("/tmp/mcp-server.log", "utf-8");
|
||||
core.error("MCP Server Debug Log:");
|
||||
core.error(logContent);
|
||||
debugInfo = " (see debug log above)";
|
||||
} catch (logError) {
|
||||
debugInfo = ` (could not read debug log: ${logError instanceof Error ? logError.message : String(logError)})`;
|
||||
}
|
||||
throw new Error(`MCP servers failed to start: ${failedNames}${debugInfo}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ export function createMcpConfig(githubInstallationToken: string) {
|
||||
{
|
||||
mcpServers: {
|
||||
minimal_github_comment: {
|
||||
command: "node",
|
||||
command: `${actionPath}/mcp/debug-server.sh`,
|
||||
args: [`${actionPath}/mcp/server.ts`],
|
||||
env: {
|
||||
GITHUB_INSTALLATION_TOKEN: githubInstallationToken,
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Wrapper script to capture MCP server logs for debugging
|
||||
LOG_FILE="/tmp/mcp-server.log"
|
||||
|
||||
echo "=== MCP Server Debug Wrapper Starting ===" >> "$LOG_FILE"
|
||||
echo "Timestamp: $(date)" >> "$LOG_FILE"
|
||||
echo "Working directory: $(pwd)" >> "$LOG_FILE"
|
||||
echo "Environment variables:" >> "$LOG_FILE"
|
||||
env | grep -E "(GITHUB_|MCP_|NODE_)" >> "$LOG_FILE"
|
||||
echo "Node.js version: $(node --version)" >> "$LOG_FILE"
|
||||
echo "Arguments: $@" >> "$LOG_FILE"
|
||||
echo "=== Starting MCP Server ===" >> "$LOG_FILE"
|
||||
|
||||
# Execute the actual MCP server, capturing both stdout and stderr
|
||||
exec node "$@" 2>&1 | tee -a "$LOG_FILE"
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pullfrog/action",
|
||||
"version": "0.0.17",
|
||||
"version": "0.0.19",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"index.js",
|
||||
|
||||
Reference in New Issue
Block a user