Skip to content

Commit 83bdafa

Browse files
authored
Add retry when claude code action got timeout after 3 mins (#301)
*Description of changes:* Add retry when claude code action got timeout after 3 mins By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent a5914f2 commit 83bdafa

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

.github/workflows/awsapm.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,31 +51,48 @@ jobs:
5151
aws-region: ${{ vars.AWS_REGION || 'us-east-1' }}
5252

5353
# Step 1: Prepare AWS MCP configuration and investigation prompt
54+
# Add attemp to mitigate Cluade Code Action time-out issue
55+
# - https://github.com/anthropics/claude-code-action/issues/693
5456
- name: Prepare Investigation Context
5557
id: prepare
5658
uses: aws-actions/application-observability-for-aws@v1
5759
with:
5860
bot_name: "@awsapm"
5961
cli_tool: "claude_code"
6062

61-
# Step 2: Execute investigation with Claude Code
62-
- name: Run Claude Investigation
63+
# Step 2: Execute investigation with Claude Code (with retry on timeout)
64+
- name: Run Claude Investigation - Attempt 1
6365
id: claude
66+
continue-on-error: true
6467
uses: anthropics/claude-code-base-action@beta
68+
timeout-minutes: 3
6569
with:
6670
use_bedrock: "true"
71+
# Set to any Bedrock Model ID
72+
model: "us.anthropic.claude-sonnet-4-5-20250929-v1:0"
73+
prompt_file: ${{ steps.prepare.outputs.prompt_file }}
74+
mcp_config: ${{ steps.prepare.outputs.mcp_config_file }}
75+
allowed_tools: ${{ steps.prepare.outputs.allowed_tools }}
76+
77+
# Retry if first attempt fails or times out
78+
- name: Run Claude Investigation - Attempt 2
79+
id: claude-retry
80+
if: steps.claude.outcome == 'failure'
81+
uses: anthropics/claude-code-base-action@beta
82+
timeout-minutes: 3
83+
with:
84+
use_bedrock: "true"
6785
model: "us.anthropic.claude-sonnet-4-5-20250929-v1:0"
6886
prompt_file: ${{ steps.prepare.outputs.prompt_file }}
6987
mcp_config: ${{ steps.prepare.outputs.mcp_config_file }}
7088
allowed_tools: ${{ steps.prepare.outputs.allowed_tools }}
7189

72-
# Step 3: Post results back to GitHub issue/PR (reuse the same action)
90+
# Step 3: Post results back to GitHub issue/PR
7391
- name: Post Investigation Results
74-
if: always() # Run even if Claude step fails
92+
if: always()
7593
uses: aws-actions/application-observability-for-aws@v1
7694
with:
77-
bot_name: "@awsapm"
7895
cli_tool: "claude_code"
7996
comment_id: ${{ steps.prepare.outputs.awsapm_comment_id }}
80-
output_file: ${{ steps.claude.outputs.execution_file }}
81-
output_status: ${{ steps.claude.outputs.conclusion }}
97+
output_file: ${{ steps.claude.outputs.execution_file || steps.claude-retry.outputs.execution_file }}
98+
output_status: ${{ steps.claude.outputs.conclusion || steps.claude-retry.outputs.conclusion }}

0 commit comments

Comments
 (0)