Add comprehensive logging to debug slow job completion

- Add timestamps to prepare.ts completion
- Add timestamps and signal handlers to both MCP servers
- Add start/end logging to update-comment-link.ts
- Add final action completion logging step
- Log when composite action steps complete vs job cleanup
This commit is contained in:
claude
2025-07-29 22:41:27 +00:00
parent b570f2eb8e
commit 308512548e
5 changed files with 52 additions and 4 deletions

View File

@@ -111,6 +111,12 @@ runs:
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key != 'use-oauth' && inputs.anthropic_api_key || '' }} ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key != 'use-oauth' && inputs.anthropic_api_key || '' }}
CLAUDE_CREDENTIALS: ${{ inputs.claude_credentials }} CLAUDE_CREDENTIALS: ${{ inputs.claude_credentials }}
- name: Log before Claude Code
if: steps.prepare.outputs.contains_trigger == 'true'
shell: bash
run: |
echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Starting Claude Code base action..."
- name: Run Claude Code - name: Run Claude Code
id: claude-code id: claude-code
if: steps.prepare.outputs.contains_trigger == 'true' if: steps.prepare.outputs.contains_trigger == 'true'
@@ -165,6 +171,13 @@ runs:
VERTEX_REGION_CLAUDE_3_5_SONNET: ${{ env.VERTEX_REGION_CLAUDE_3_5_SONNET }} VERTEX_REGION_CLAUDE_3_5_SONNET: ${{ env.VERTEX_REGION_CLAUDE_3_5_SONNET }}
VERTEX_REGION_CLAUDE_3_7_SONNET: ${{ env.VERTEX_REGION_CLAUDE_3_7_SONNET }} VERTEX_REGION_CLAUDE_3_7_SONNET: ${{ env.VERTEX_REGION_CLAUDE_3_7_SONNET }}
- name: Log after Claude Code
if: steps.prepare.outputs.contains_trigger == 'true' && always()
shell: bash
run: |
echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Claude Code base action completed with status: ${{ steps.claude-code.outcome }}"
echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Starting comment update..."
- name: Update comment with job link - name: Update comment with job link
if: steps.prepare.outputs.contains_trigger == 'true' && steps.prepare.outputs.claude_comment_id && always() if: steps.prepare.outputs.contains_trigger == 'true' && steps.prepare.outputs.claude_comment_id && always()
shell: bash shell: bash
@@ -200,3 +213,10 @@ runs:
else else
echo "⚠️ Claude Code execution completed but no report file was generated" >> $GITHUB_STEP_SUMMARY echo "⚠️ Claude Code execution completed but no report file was generated" >> $GITHUB_STEP_SUMMARY
fi fi
- name: Log action completion
if: always()
shell: bash
run: |
echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Claude Code Action composite steps completed"
echo "[$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ)] Waiting for job cleanup..."

View File

@@ -121,11 +121,14 @@ async function run() {
branchInfo.currentBranch, branchInfo.currentBranch,
); );
core.setOutput("mcp_config", mcpConfig); core.setOutput("mcp_config", mcpConfig);
console.log(`[${new Date().toISOString()}] Prepare step completed successfully`);
} catch (error) { } catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error); const errorMessage = error instanceof Error ? error.message : String(error);
core.setFailed(`Prepare step failed with error: ${errorMessage}`); core.setFailed(`Prepare step failed with error: ${errorMessage}`);
// Also output the clean error message for the action to capture // Also output the clean error message for the action to capture
core.setOutput("prepare_error", errorMessage); core.setOutput("prepare_error", errorMessage);
console.log(`[${new Date().toISOString()}] Prepare step failed with error: ${errorMessage}`);
process.exit(1); process.exit(1);
} }
} }

View File

@@ -358,11 +358,14 @@ async function run() {
throw updateError; throw updateError;
} }
console.log(`[${new Date().toISOString()}] Update comment completed successfully`);
process.exit(0); process.exit(0);
} catch (error) { } catch (error) {
console.error("Error updating comment with job link:", error); console.error("Error updating comment with job link:", error);
console.log(`[${new Date().toISOString()}] Update comment failed`);
process.exit(1); process.exit(1);
} }
} }
console.log(`[${new Date().toISOString()}] Starting update-comment-link.ts`);
run(); run();

View File

@@ -12,7 +12,7 @@ const BRANCH_NAME = process.env.BRANCH_NAME;
const GITHUB_TOKEN = process.env.GITHUB_TOKEN; const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
const GITEA_API_URL = process.env.GITEA_API_URL || "https://api.github.com"; const GITEA_API_URL = process.env.GITEA_API_URL || "https://api.github.com";
console.log(`[GITEA-MCP] Starting Gitea API Operations MCP Server`); console.log(`[GITEA-MCP ${new Date().toISOString()}] Starting Gitea API Operations MCP Server`);
console.log(`[GITEA-MCP] REPO_OWNER: ${REPO_OWNER}`); console.log(`[GITEA-MCP] REPO_OWNER: ${REPO_OWNER}`);
console.log(`[GITEA-MCP] REPO_NAME: ${REPO_NAME}`); console.log(`[GITEA-MCP] REPO_NAME: ${REPO_NAME}`);
console.log(`[GITEA-MCP] BRANCH_NAME: ${BRANCH_NAME}`); console.log(`[GITEA-MCP] BRANCH_NAME: ${BRANCH_NAME}`);
@@ -1268,9 +1268,20 @@ async function runServer() {
await server.connect(transport); await server.connect(transport);
console.log(`[GITEA-MCP] Gitea MCP server connected and ready!`); console.log(`[GITEA-MCP] Gitea MCP server connected and ready!`);
process.on("exit", () => { process.on("exit", () => {
console.log(`[GITEA-MCP] Server shutting down...`); console.log(`[GITEA-MCP ${new Date().toISOString()}] Server shutting down...`);
server.close(); server.close();
}); });
// Add more signal handlers for debugging
process.on("SIGTERM", () => {
console.log(`[GITEA-MCP ${new Date().toISOString()}] Received SIGTERM signal`);
process.exit(0);
});
process.on("SIGINT", () => {
console.log(`[GITEA-MCP ${new Date().toISOString()}] Received SIGINT signal`);
process.exit(0);
});
} }
console.log(`[GITEA-MCP] Calling runServer()...`); console.log(`[GITEA-MCP] Calling runServer()...`);

View File

@@ -15,7 +15,7 @@ const REPO_DIR = process.env.REPO_DIR || process.cwd();
const GITHUB_TOKEN = process.env.GITHUB_TOKEN; const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
const GITEA_API_URL = process.env.GITEA_API_URL || "https://api.github.com"; const GITEA_API_URL = process.env.GITEA_API_URL || "https://api.github.com";
console.log(`[LOCAL-GIT-MCP] Starting Local Git Operations MCP Server`); console.log(`[LOCAL-GIT-MCP ${new Date().toISOString()}] Starting Local Git Operations MCP Server`);
console.log(`[LOCAL-GIT-MCP] REPO_OWNER: ${REPO_OWNER}`); console.log(`[LOCAL-GIT-MCP] REPO_OWNER: ${REPO_OWNER}`);
console.log(`[LOCAL-GIT-MCP] REPO_NAME: ${REPO_NAME}`); console.log(`[LOCAL-GIT-MCP] REPO_NAME: ${REPO_NAME}`);
console.log(`[LOCAL-GIT-MCP] BRANCH_NAME: ${BRANCH_NAME}`); console.log(`[LOCAL-GIT-MCP] BRANCH_NAME: ${BRANCH_NAME}`);
@@ -497,9 +497,20 @@ async function runServer() {
await server.connect(transport); await server.connect(transport);
console.log(`[LOCAL-GIT-MCP] MCP server connected and ready!`); console.log(`[LOCAL-GIT-MCP] MCP server connected and ready!`);
process.on("exit", () => { process.on("exit", () => {
console.log(`[LOCAL-GIT-MCP] Server shutting down...`); console.log(`[LOCAL-GIT-MCP ${new Date().toISOString()}] Server shutting down...`);
server.close(); server.close();
}); });
// Add more signal handlers for debugging
process.on("SIGTERM", () => {
console.log(`[LOCAL-GIT-MCP ${new Date().toISOString()}] Received SIGTERM signal`);
process.exit(0);
});
process.on("SIGINT", () => {
console.log(`[LOCAL-GIT-MCP ${new Date().toISOString()}] Received SIGINT signal`);
process.exit(0);
});
} }
console.log(`[LOCAL-GIT-MCP] Calling runServer()...`); console.log(`[LOCAL-GIT-MCP] Calling runServer()...`);