Skip to content

Commit 52ce4ce

Browse files
committed
ci(pi-assistant): simplify retry to failure comment with re-trigger instruction
1 parent b184f9f commit 52ce4ce

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

.github/workflows/pi-assistant.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
owner: context.repo.owner,
4242
repo: context.repo.repo,
4343
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.',
4545
});
4646
core.setOutput('comment_id', comment.id);
4747
core.info(`Posted progress comment: ${comment.id}`);
@@ -99,7 +99,7 @@ jobs:
9999
Use `update_comment` on that ID for ALL updates — do NOT use `add_issue_comment`.
100100
101101
**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:
103103
```
104104
update_comment({
105105
comment_id: ${{ steps.initial_comment.outputs.comment_id }},
@@ -136,6 +136,32 @@ jobs:
136136
- Keep changes minimal and focused on the request — do not refactor unrelated code
137137
- NEVER close the issue or PR — leave it open for the user to close after reviewing
138138
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+
139165
- name: Log agent summary
140166
if: always()
141167
env:

0 commit comments

Comments
 (0)