From 54090b9013b0a5550de9a3361a8971f6ad9090e3 Mon Sep 17 00:00:00 2001 From: Ambient Code Bot Date: Tue, 7 Apr 2026 08:48:32 -0500 Subject: [PATCH 1/4] fix: read issue comments for full context The issue body may be sparse with important context in comments. Explicitly instruct the agent to use `gh issue view --comments`. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/amber-issue-handler.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/amber-issue-handler.yml b/.github/workflows/amber-issue-handler.yml index 5f85cc279..b4d1e7fd4 100644 --- a/.github/workflows/amber-issue-handler.yml +++ b/.github/workflows/amber-issue-handler.yml @@ -82,7 +82,7 @@ jobs: ## Instructions - 1. Read the issue and understand the problem. + 1. Read the issue body and all comments for full context (`gh issue view --comments`). 2. Explore the codebase to find the relevant code. 3. Create a plan for how to fix the issue. If there is any ambiguity — unclear requirements, multiple valid approaches, missing context — you @@ -275,7 +275,7 @@ jobs: ## Instructions - 1. Read the issue and understand the problem. + 1. Read the issue body and all comments for full context (`gh issue view --comments`). 2. Explore the codebase to find the relevant code. 3. Create a plan for how to fix the issue. If there is any ambiguity — unclear requirements, multiple valid approaches, missing context — you From 28b8163ac95c1bcc46f71c1eecc00e5ac0d2b8f4 Mon Sep 17 00:00:00 2001 From: Ambient Code Bot Date: Tue, 7 Apr 2026 09:17:54 -0500 Subject: [PATCH 2/4] feat: improve Slack notification formatting - Use Slack mrkdwn link format () instead of raw URLs - Include issue/PR title in notifications - PR created notification includes a brief summary of changes - Question notification shows the actual question prominently - Need-help notification explains what was tried and why stuck Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/amber-issue-handler.yml | 35 ++++++++++++++--------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/amber-issue-handler.yml b/.github/workflows/amber-issue-handler.yml index b4d1e7fd4..7acab716e 100644 --- a/.github/workflows/amber-issue-handler.yml +++ b/.github/workflows/amber-issue-handler.yml @@ -88,10 +88,11 @@ jobs: unclear requirements, multiple valid approaches, missing context — you MUST ask for clarification. IMPORTANT: Before calling AskUserQuestion, ALWAYS send a Slack notification first (the session stops streaming when - AskUserQuestion is called, so the notification must go out before): + AskUserQuestion is called, so the notification must go out before). + Use Slack mrkdwn link format: . Example: ```bash curl -X POST -H 'Content-type: application/json' \ - --data '{"text":"I have a question about #${{ steps.issue.outputs.number }}\n*Issue*: https://github.com/${{ github.repository }}/issues/${{ steps.issue.outputs.number }}\n*Session*: '"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'\n*Question*: "}' \ + --data '{"text":"❓ *Question about *\n\n\n<'"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'|View Session>"}' \ "$SLACK_WEBHOOK_URL" ``` Only send if SLACK_WEBHOOK_URL is set. Then call AskUserQuestion. @@ -101,10 +102,11 @@ jobs: AGENTIC_SESSION_NAME environment variable): 6. Add the `ambient-code:managed` label to the PR. - 7. After creating the PR, send a Slack notification: + 7. After creating the PR, send a Slack notification with a brief summary + of what you changed. Use Slack mrkdwn link format: . Example: ```bash curl -X POST -H 'Content-type: application/json' \ - --data '{"text":"PR created for #${{ steps.issue.outputs.number }}\n*PR*: \n*Session*: '"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'"}' \ + --data '{"text":"🔧 *PR created for *\n · <'"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'|View Session>\n\n<1-2 sentence summary of what you changed>"}' \ "$SLACK_WEBHOOK_URL" ``` Only send if SLACK_WEBHOOK_URL is set. @@ -241,13 +243,14 @@ jobs: ## Slack Notifications - When you need human attention — whether you hit the circuit breaker (3 retries), - you're stuck and can't proceed, or you use the AskUserQuestion tool — send a - Slack notification: + When you need human attention — circuit breaker, stuck, or before calling + AskUserQuestion — send a Slack notification. IMPORTANT: Always send BEFORE + calling AskUserQuestion (the session stops streaming on that call). + Use Slack mrkdwn link format: . Example: ```bash curl -X POST -H 'Content-type: application/json' \ - --data '{"text":"I need human attention\n*PR*: ${{ steps.context.outputs.url }}\n*Session*: '"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'\n*Reason*: "}' \ + --data '{"text":"🚨 *Need help with <${{ steps.context.outputs.url }}|PR #${{ steps.context.outputs.number }}>*\n\n\n<'"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'|View Session>"}' \ "$SLACK_WEBHOOK_URL" ``` @@ -281,10 +284,11 @@ jobs: unclear requirements, multiple valid approaches, missing context — you MUST ask for clarification. IMPORTANT: Before calling AskUserQuestion, ALWAYS send a Slack notification first (the session stops streaming when - AskUserQuestion is called, so the notification must go out before): + AskUserQuestion is called, so the notification must go out before). + Use Slack mrkdwn link format: . Example: ```bash curl -X POST -H 'Content-type: application/json' \ - --data '{"text":"I have a question about #${{ steps.context.outputs.number }}\n*Issue*: ${{ steps.context.outputs.url }}\n*Session*: '"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'\n*Question*: "}' \ + --data '{"text":"❓ *Question about <${{ steps.context.outputs.url }}|#${{ steps.context.outputs.number }}>*\n\n\n<'"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'|View Session>"}' \ "$SLACK_WEBHOOK_URL" ``` Only send if SLACK_WEBHOOK_URL is set. Then call AskUserQuestion. @@ -294,10 +298,11 @@ jobs: AGENTIC_SESSION_NAME environment variable): 6. Add the `ambient-code:managed` label to the PR. - 7. After creating the PR, send a Slack notification: + 7. After creating the PR, send a Slack notification with a brief summary + of what you changed. Use Slack mrkdwn link format: . Example: ```bash curl -X POST -H 'Content-type: application/json' \ - --data '{"text":"PR created for #${{ steps.context.outputs.number }}\n*PR*: \n*Session*: '"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'"}' \ + --data '{"text":"🔧 *PR created for <${{ steps.context.outputs.url }}|#${{ steps.context.outputs.number }}>*\n · <'"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'|View Session>\n\n<1-2 sentence summary of what you changed>"}' \ "$SLACK_WEBHOOK_URL" ``` Only send if SLACK_WEBHOOK_URL is set. @@ -611,10 +616,12 @@ jobs: ## Slack Notifications - When you need human attention — circuit breaker, stuck, or using AskUserQuestion — send: + When you need human attention — circuit breaker, stuck, or before calling + AskUserQuestion — send a Slack notification. IMPORTANT: Always send BEFORE + calling AskUserQuestion. Use Slack mrkdwn link format: . curl -X POST -H 'Content-type: application/json' \\ - --data '{{"text":"I need human attention\\n*PR*: https://github.com/{REPO}/pull/{number}\\n*Session*: '"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'\\n*Reason*: "}}' \\ + --data '{{"text":"🚨 *Need help with *\\n\\n\\n<'"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'|View Session>"}}' \\ "$SLACK_WEBHOOK_URL" Only send if SLACK_WEBHOOK_URL is set.""" From d1267bbd789915a629e7c047474c37505eecd0a8 Mon Sep 17 00:00:00 2001 From: Ambient Code Bot Date: Wed, 8 Apr 2026 20:50:49 +0000 Subject: [PATCH 3/4] fix: use jq for batch Slack notification and include PR title Address CodeRabbit review: the batch PR fixer's Slack notification template was the last remaining instance using raw --data JSON, which is vulnerable to JSON injection from unescaped text and omits the PR title. Switched to jq -nc pattern consistent with all other notification templates. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/amber-issue-handler.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/amber-issue-handler.yml b/.github/workflows/amber-issue-handler.yml index 2b787ba6e..657dc0bda 100644 --- a/.github/workflows/amber-issue-handler.yml +++ b/.github/workflows/amber-issue-handler.yml @@ -701,9 +701,12 @@ jobs: AskUserQuestion — send a Slack notification. IMPORTANT: Always send BEFORE calling AskUserQuestion. Use Slack mrkdwn link format: . - curl -X POST -H 'Content-type: application/json' \\ - --data '{{"text":"🚨 *Need help with *\\n\\n\\n<'"$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME"'|View Session>"}}' \\ - "$SLACK_WEBHOOK_URL" + TITLE=$(gh pr view {number} --repo {REPO} --json title --jq '.title') + PAYLOAD=$(jq -nc --arg text "🚨 *Need help with * + + + <$PLATFORM_HOST/projects/$AGENTIC_SESSION_NAMESPACE/sessions/$AGENTIC_SESSION_NAME|View Session>" '{{text: $text}}') + curl -X POST -H 'Content-type: application/json' --data "$PAYLOAD" "$SLACK_WEBHOOK_URL" Only send if SLACK_WEBHOOK_URL is set.""" From 8338b7ede4c3bd42ab53bec01ca536a1c877e485 Mon Sep 17 00:00:00 2001 From: Ambient Code Bot Date: Wed, 8 Apr 2026 21:20:52 +0000 Subject: [PATCH 4/4] fix: use heredoc syntax for title in GITHUB_OUTPUT Titles with newlines or percent characters can corrupt step outputs when written with plain echo. Switch to the GitHub Actions heredoc/delimiter syntax for all three title output locations. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/amber-issue-handler.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/amber-issue-handler.yml b/.github/workflows/amber-issue-handler.yml index 657dc0bda..61e0f7087 100644 --- a/.github/workflows/amber-issue-handler.yml +++ b/.github/workflows/amber-issue-handler.yml @@ -50,7 +50,11 @@ jobs: NUMBER="${{ github.event.issue.number }}" TITLE=$(gh issue view "$NUMBER" --repo "${{ github.repository }}" --json title --jq '.title') echo "number=$NUMBER" >> $GITHUB_OUTPUT - echo "title=$TITLE" >> $GITHUB_OUTPUT + { + echo "title<> $GITHUB_OUTPUT - name: Check for existing PR id: existing @@ -194,7 +198,11 @@ jobs: echo "url=https://github.com/${{ github.repository }}/pull/$NUMBER" >> $GITHUB_OUTPUT TITLE=$(gh pr view "$NUMBER" --repo "${{ github.repository }}" --json title --jq '.title') - echo "title=$TITLE" >> $GITHUB_OUTPUT + { + echo "title<> $GITHUB_OUTPUT IS_FORK=$(gh pr view "$NUMBER" --repo "${{ github.repository }}" --json isCrossRepository --jq '.isCrossRepository') echo "is_fork=$IS_FORK" >> $GITHUB_OUTPUT @@ -208,7 +216,11 @@ jobs: echo "url=https://github.com/${{ github.repository }}/issues/$NUMBER" >> $GITHUB_OUTPUT TITLE=$(gh issue view "$NUMBER" --repo "${{ github.repository }}" --json title --jq '.title') - echo "title=$TITLE" >> $GITHUB_OUTPUT + { + echo "title<> $GITHUB_OUTPUT echo "is_fork=false" >> $GITHUB_OUTPUT