diff --git a/.github/workflows/amber-issue-handler.yml b/.github/workflows/amber-issue-handler.yml index c08d71136..d061c5d8c 100755 --- a/.github/workflows/amber-issue-handler.yml +++ b/.github/workflows/amber-issue-handler.yml @@ -57,7 +57,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 @@ -103,11 +107,15 @@ 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*: "}' \ - "$SLACK_WEBHOOK_URL" + TITLE=$(gh issue view ${{ steps.issue.outputs.number }} --repo ${{ github.repository }} --json title --jq '.title') + PAYLOAD=$(jq -nc --arg text "โ“ *Question about * + + + <$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. Then call AskUserQuestion. 4. Implement the fix. Write tests if the area has existing test coverage. @@ -119,9 +127,20 @@ jobs: --- ๐Ÿค– [Ambient Session]() 6. Add the `ambient-code:managed` label to the PR. - 7. Ensure CI passes. If it fails, investigate and fix. - 8. Do not merge. Leave the PR open for human review. - 9. When you comment on the PR, include this footer at the end: + 7. After creating the PR, send a Slack notification with a brief summary + of what you changed. Use Slack mrkdwn link format: . Example: + ```bash + TITLE=$(gh issue view ${{ steps.issue.outputs.number }} --repo ${{ github.repository }} --json title --jq '.title') + PAYLOAD=$(jq -nc --arg text "๐Ÿ”ง *PR created for * + ยท + + <1-2 sentence summary of what you changed>" '{text: $text}') + curl -X POST -H 'Content-type: application/json' --data "$PAYLOAD" "$SLACK_WEBHOOK_URL" + ``` + Only send if SLACK_WEBHOOK_URL is set. + 8. Ensure CI passes. If it fails, investigate and fix. + 9. Do not merge. Leave the PR open for human review. + 10. When you comment on the PR, include this footer at the end: _๐Ÿค– [Session]()_ ## Session URL @@ -140,7 +159,7 @@ jobs: wait: 'true' timeout: '0' environment-variables: >- - {"SLACK_WEBHOOK_URL": "${{ secrets.SLACK_WEBHOOK_URL }}", "PLATFORM_HOST": "${{ secrets.PLATFORM_HOST }}"} + {"SLACK_WEBHOOK_URL": "${{ secrets.SLACK_WEBHOOK_URL }}", "PLATFORM_HOST": "${{ secrets.PLATFORM_HOST }}", "GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"} - name: Post-session update comment if: steps.existing.outputs.skip != 'true' @@ -228,6 +247,13 @@ jobs: echo "type=pr" >> $GITHUB_OUTPUT 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<> $GITHUB_OUTPUT + IS_FORK=$(gh pr view "$NUMBER" --repo "${{ github.repository }}" --json isCrossRepository --jq '.isCrossRepository') echo "is_fork=$IS_FORK" >> $GITHUB_OUTPUT @@ -238,6 +264,14 @@ jobs: else echo "type=issue" >> $GITHUB_OUTPUT 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<> $GITHUB_OUTPUT + echo "is_fork=false" >> $GITHUB_OUTPUT # Check for existing ambient-code:managed PR for this issue and get its session ID @@ -304,14 +338,18 @@ 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*: "}' \ - "$SLACK_WEBHOOK_URL" + TITLE=$(gh pr view ${{ steps.context.outputs.number }} --repo ${{ github.repository }} --json title --jq '.title') + PAYLOAD=$(jq -nc --arg text "๐Ÿšจ *Need help with <${{ steps.context.outputs.url }}|PR #${{ steps.context.outputs.number }} โ€” $TITLE>* + + + <$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" ``` The environment variables SLACK_WEBHOOK_URL, PLATFORM_HOST, AGENTIC_SESSION_NAMESPACE, @@ -344,11 +382,15 @@ 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*: "}' \ - "$SLACK_WEBHOOK_URL" + TITLE=$(gh issue view ${{ steps.context.outputs.number }} --repo ${{ github.repository }} --json title --jq '.title') + PAYLOAD=$(jq -nc --arg text "โ“ *Question about <${{ steps.context.outputs.url }}|#${{ steps.context.outputs.number }} โ€” $TITLE>* + + + <$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. Then call AskUserQuestion. 4. Implement the fix. Write tests if the area has existing test coverage. @@ -360,9 +402,20 @@ jobs: --- ๐Ÿค– [Ambient Session]() 6. Add the `ambient-code:managed` label to the PR. - 7. Ensure CI passes. If it fails, investigate and fix. - 8. Do not merge. Leave the PR open for human review. - 9. When you comment on the PR, include this footer at the end: + 7. After creating the PR, send a Slack notification with a brief summary + of what you changed. Use Slack mrkdwn link format: . Example: + ```bash + TITLE=$(gh issue view ${{ steps.context.outputs.number }} --repo ${{ github.repository }} --json title --jq '.title') + PAYLOAD=$(jq -nc --arg text "๐Ÿ”ง *PR created for <${{ steps.context.outputs.url }}|#${{ steps.context.outputs.number }} โ€” $TITLE>* + ยท + + <1-2 sentence summary of what you changed>" '{text: $text}') + curl -X POST -H 'Content-type: application/json' --data "$PAYLOAD" "$SLACK_WEBHOOK_URL" + ``` + Only send if SLACK_WEBHOOK_URL is set. + 8. Ensure CI passes. If it fails, investigate and fix. + 9. Do not merge. Leave the PR open for human review. + 10. When you comment on the PR, include this footer at the end: _๐Ÿค– [Session]()_ ## Session URL @@ -381,7 +434,7 @@ jobs: wait: 'true' timeout: '0' environment-variables: >- - {"SLACK_WEBHOOK_URL": "${{ secrets.SLACK_WEBHOOK_URL }}", "PLATFORM_HOST": "${{ secrets.PLATFORM_HOST }}"} + {"SLACK_WEBHOOK_URL": "${{ secrets.SLACK_WEBHOOK_URL }}", "PLATFORM_HOST": "${{ secrets.PLATFORM_HOST }}", "GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"} # Custom prompt: @ambient-code โ€” pass user's text - name: Run custom prompt @@ -406,7 +459,7 @@ jobs: wait: 'true' timeout: '0' environment-variables: >- - {"SLACK_WEBHOOK_URL": "${{ secrets.SLACK_WEBHOOK_URL }}", "PLATFORM_HOST": "${{ secrets.PLATFORM_HOST }}"} + {"SLACK_WEBHOOK_URL": "${{ secrets.SLACK_WEBHOOK_URL }}", "PLATFORM_HOST": "${{ secrets.PLATFORM_HOST }}", "GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"} - name: Post check run on PR if: >- @@ -739,11 +792,16 @@ 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: . + + TITLE=$(gh pr view {number} --repo {REPO} --json title --jq '.title') + PAYLOAD=$(jq -nc --arg text "๐Ÿšจ *Need help with * + - 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*: "}}' \\ - "$SLACK_WEBHOOK_URL" + <$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."""