|
41 | 41 | owner: context.repo.owner, |
42 | 42 | repo: context.repo.repo, |
43 | 43 | issue_number: context.payload.issue.number, |
44 | | - body: '🤔 **Pi is working on it...**\n\nAnalyzing your request and planning next steps.', |
| 44 | + body: '🤖 **Pi is working on it...**\n\nAnalyzing your request and planning next steps.', |
45 | 45 | }); |
46 | 46 | core.setOutput('comment_id', comment.id); |
47 | 47 | core.info(`Posted progress comment: ${comment.id}`); |
|
99 | 99 | Use `update_comment` on that ID for ALL updates — do NOT use `add_issue_comment`. |
100 | 100 |
|
101 | 101 | **Protocol:** |
102 | | - 1. First update — replace "🤔 Pi is working on it..." with your TODO checklist: |
| 102 | + 1. First update — replace "🤖 Pi is working on it..." with your TODO checklist: |
103 | 103 | ``` |
104 | 104 | update_comment({ |
105 | 105 | comment_id: ${{ steps.initial_comment.outputs.comment_id }}, |
@@ -136,6 +136,32 @@ jobs: |
136 | 136 | - Keep changes minimal and focused on the request — do not refactor unrelated code |
137 | 137 | - NEVER close the issue or PR — leave it open for the user to close after reviewing |
138 | 138 |
|
| 139 | + - name: Post failure comment if agent did not complete |
| 140 | + if: always() && (steps.pi.outputs.success != 'true' || steps.pi.outputs.response == '') |
| 141 | + uses: actions/github-script@v9 |
| 142 | + with: |
| 143 | + script: | |
| 144 | + const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; |
| 145 | + await github.rest.issues.updateComment({ |
| 146 | + owner: context.repo.owner, |
| 147 | + repo: context.repo.repo, |
| 148 | + comment_id: ${{ steps.initial_comment.outputs.comment_id }}, |
| 149 | + body: [ |
| 150 | + '❌ **Pi did not complete successfully.**', |
| 151 | + '', |
| 152 | + '| | |', |
| 153 | + '|---|---|', |
| 154 | + `| Success | \`${{ steps.pi.outputs.success }}\` |`, |
| 155 | + `| Duration | ${{ steps.pi.outputs.duration_seconds }}s |`, |
| 156 | + `| Input tokens | ${{ steps.pi.outputs.input_tokens }} |`, |
| 157 | + `| Output tokens | ${{ steps.pi.outputs.output_tokens }} |`, |
| 158 | + '', |
| 159 | + `[View Actions run](${runUrl}) for details.`, |
| 160 | + '', |
| 161 | + 'Reply with `/pi` to try again.', |
| 162 | + ].join('\n'), |
| 163 | + }); |
| 164 | +
|
139 | 165 | - name: Log agent summary |
140 | 166 | if: always() |
141 | 167 | env: |
|
0 commit comments