jonah-fleet 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -196,18 +196,38 @@ jobs:
196
196
  run: |
197
197
  PROMPT="You are the Autowork routine for this repository. A PR was recently merged. Read and follow .github/prompts/autowork.md. ${SKILLS_PROMPT} You are in Scan mode: converge on open PRs, close merged issues, and pick the next unblocked priority issue."
198
198
 
199
+ set +e
199
200
  agy -p "$PROMPT" \
200
201
  --model "$MODEL" \
201
202
  --output-format text \
202
203
  --print-timeout "$PRINT_TIMEOUT" \
203
- --dangerously-skip-permissions
204
+ --dangerously-skip-permissions 2>&1 | tee /tmp/agy.log
205
+ AGY_EXIT_CODE="${PIPESTATUS[0]}"
206
+ set -e
207
+
208
+ if [ "$AGY_EXIT_CODE" -ne 0 ]; then
209
+ if grep -qiE "Individual quota reached|quota reached" /tmp/agy.log; then
210
+ RESET_INFO=$(grep -oE "Resets in [^.]+" /tmp/agy.log | head -n 1 || echo "Resets in future window")
211
+ echo "QUOTA_PAUSED=true" >> "$GITHUB_ENV"
212
+ echo "QUOTA_RESET_INFO=$RESET_INFO" >> "$GITHUB_ENV"
213
+ echo "⚠️ LLM quota limit reached ($RESET_INFO). Pausing routine gracefully until next sweep."
214
+ exit 0
215
+ fi
216
+ exit "$AGY_EXIT_CODE"
217
+ fi
204
218
 
205
219
  - name: Emit run summary
206
220
  if: always() && steps.pick.outputs.skip != 'true'
207
221
  run: |
208
- REPORT_FILE=".jonah-fleet/run-report.md"
209
- if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
210
- cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
222
+ if [ "$QUOTA_PAUSED" = "true" ]; then
223
+ echo "### ⏸️ Milestone: Routine Execution Quota-Paused" >> "$GITHUB_STEP_SUMMARY"
224
+ echo "- **Status**: LLM quota reached (\`${QUOTA_RESET_INFO}\`)" >> "$GITHUB_STEP_SUMMARY"
225
+ echo "- **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets." >> "$GITHUB_STEP_SUMMARY"
226
+ else
227
+ REPORT_FILE=".jonah-fleet/run-report.md"
228
+ if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
229
+ cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
230
+ fi
211
231
  fi
212
232
 
213
233
  - name: Emit Fleet Telemetry (Opt-in)
@@ -255,12 +275,47 @@ jobs:
255
275
  RUN_ID: ${{ github.run_id }}
256
276
  SERVER_URL: ${{ github.server_url }}
257
277
  REPOSITORY: ${{ github.repository }}
278
+ QUOTA_PAUSED: ${{ env.QUOTA_PAUSED }}
279
+ QUOTA_RESET_INFO: ${{ env.QUOTA_RESET_INFO }}
258
280
  run: |
259
281
  if [ -z "$ISSUE_NUMBER" ]; then
260
282
  echo "No routine issue to reconcile."
261
283
  exit 0
262
284
  fi
263
285
 
286
+ if [ "$QUOTA_PAUSED" = "true" ]; then
287
+ RESET_STR="${QUOTA_RESET_INFO:-Resets in upcoming window}"
288
+ PAUSE_BODY="### ⏸️ Autonomous Routine Execution Quota-Paused
289
+ - **Routine**: \`autowork\`
290
+ - **Run ID**: [\`${RUN_ID}\`](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})
291
+ - **Trigger**: \`${EVENT_NAME}\`
292
+ - **Status**: LLM quota reached (\`${RESET_STR}\`)
293
+ - **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets.
294
+
295
+ ---
296
+ _Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_"
297
+
298
+ TEMP_BODY=$(mktemp)
299
+ echo "$PAUSE_BODY" > "$TEMP_BODY"
300
+ gh issue edit "$ISSUE_NUMBER" --body-file "$TEMP_BODY"
301
+ rm -f "$TEMP_BODY"
302
+
303
+ PAUSE_COMMENT=$(printf '%s\n' \
304
+ "### ⏸️ Milestone: Routine Execution Quota-Paused" \
305
+ "- **Routine**: \`autowork\`" \
306
+ "- **Status**: LLM quota reached (\`${RESET_STR}\`)" \
307
+ "- **Action Log**: [View GitHub Actions Run](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})" \
308
+ "- **Next Action**: Execution paused cleanly. The routine will resume automatically on the next scheduled sweep." \
309
+ "" \
310
+ "---" \
311
+ "_Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_")
312
+ gh issue comment "$ISSUE_NUMBER" --body "$PAUSE_COMMENT" || true
313
+ gh issue edit "$ISSUE_NUMBER" --add-label "status:quota-paused" --remove-label "status:running"
314
+ gh issue close "$ISSUE_NUMBER" --reason completed
315
+ echo "⏸️ Routine run issue #$ISSUE_NUMBER closed with status:quota-paused."
316
+ exit 0
317
+ fi
318
+
264
319
  REPORT_FILE=".jonah-fleet/run-report.md"
265
320
 
266
321
  if [ -f "$REPORT_FILE" ]; then
@@ -274,11 +274,25 @@ jobs:
274
274
  PROMPT="$PROMPT Tracking run log issue: #${ROUTINE_ISSUE_NUMBER}."
275
275
  fi
276
276
 
277
+ set +e
277
278
  agy -p "$PROMPT" \
278
279
  --model "$MODEL" \
279
280
  --output-format text \
280
281
  --print-timeout "$PRINT_TIMEOUT" \
281
- --dangerously-skip-permissions
282
+ --dangerously-skip-permissions 2>&1 | tee /tmp/agy.log
283
+ AGY_EXIT_CODE="${PIPESTATUS[0]}"
284
+ set -e
285
+
286
+ if [ "$AGY_EXIT_CODE" -ne 0 ]; then
287
+ if grep -qiE "Individual quota reached|quota reached" /tmp/agy.log; then
288
+ RESET_INFO=$(grep -oE "Resets in [^.]+" /tmp/agy.log | head -n 1 || echo "Resets in future window")
289
+ echo "QUOTA_PAUSED=true" >> "$GITHUB_ENV"
290
+ echo "QUOTA_RESET_INFO=$RESET_INFO" >> "$GITHUB_ENV"
291
+ echo "⚠️ LLM quota limit reached ($RESET_INFO). Pausing routine gracefully until next sweep."
292
+ exit 0
293
+ fi
294
+ exit "$AGY_EXIT_CODE"
295
+ fi
282
296
 
283
297
  - name: Handle Review Failure & PR Notification
284
298
  if: failure() && steps.guard.outputs.skip != 'true'
@@ -303,9 +317,15 @@ jobs:
303
317
  - name: Emit run summary
304
318
  if: always() && steps.guard.outputs.skip != 'true'
305
319
  run: |
306
- REPORT_FILE=".jonah-fleet/run-report.md"
307
- if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
308
- cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
320
+ if [ "$QUOTA_PAUSED" = "true" ]; then
321
+ echo "### ⏸️ Milestone: Routine Execution Quota-Paused" >> "$GITHUB_STEP_SUMMARY"
322
+ echo "- **Status**: LLM quota reached (\`${QUOTA_RESET_INFO}\`)" >> "$GITHUB_STEP_SUMMARY"
323
+ echo "- **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets." >> "$GITHUB_STEP_SUMMARY"
324
+ else
325
+ REPORT_FILE=".jonah-fleet/run-report.md"
326
+ if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
327
+ cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
328
+ fi
309
329
  fi
310
330
 
311
331
  - name: Emit Fleet Telemetry (Opt-in)
@@ -332,12 +352,56 @@ jobs:
332
352
  RUN_ID: ${{ github.run_id }}
333
353
  SERVER_URL: ${{ github.server_url }}
334
354
  REPOSITORY: ${{ github.repository }}
355
+ PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number || inputs.pr_number }}
356
+ QUOTA_PAUSED: ${{ env.QUOTA_PAUSED }}
357
+ QUOTA_RESET_INFO: ${{ env.QUOTA_RESET_INFO }}
335
358
  run: |
336
359
  if [ -z "$ISSUE_NUMBER" ]; then
337
360
  echo "No routine issue to reconcile."
338
361
  exit 0
339
362
  fi
340
363
 
364
+ if [ "$QUOTA_PAUSED" = "true" ]; then
365
+ RESET_STR="${QUOTA_RESET_INFO:-Resets in upcoming window}"
366
+ PAUSE_BODY="### ⏸️ Autonomous Routine Execution Quota-Paused
367
+ - **Routine**: \`peer-review\`
368
+ - **Run ID**: [\`${RUN_ID}\`](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})
369
+ - **Trigger**: \`${EVENT_NAME}\`
370
+ - **Status**: LLM quota reached (\`${RESET_STR}\`)
371
+ - **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets.
372
+
373
+ ---
374
+ _Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_"
375
+
376
+ TEMP_BODY=$(mktemp)
377
+ echo "$PAUSE_BODY" > "$TEMP_BODY"
378
+ gh issue edit "$ISSUE_NUMBER" --body-file "$TEMP_BODY"
379
+ rm -f "$TEMP_BODY"
380
+
381
+ PAUSE_COMMENT=$(printf '%s\n' \
382
+ "### ⏸️ Milestone: Routine Execution Quota-Paused" \
383
+ "- **Routine**: \`peer-review\`" \
384
+ "- **Status**: LLM quota reached (\`${RESET_STR}\`)" \
385
+ "- **Action Log**: [View GitHub Actions Run](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})" \
386
+ "- **Next Action**: Execution paused cleanly. The routine will resume automatically on the next scheduled sweep." \
387
+ "" \
388
+ "---" \
389
+ "_Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_")
390
+ gh issue comment "$ISSUE_NUMBER" --body "$PAUSE_COMMENT" || true
391
+ gh issue edit "$ISSUE_NUMBER" --add-label "status:quota-paused" --remove-label "status:running"
392
+ gh issue close "$ISSUE_NUMBER" --reason completed
393
+
394
+ if [ -n "$PR_NUMBER" ]; then
395
+ gh pr comment "$PR_NUMBER" --body "⏸️ **Peer Review Routine Notice**: LLM quota was reached (${RESET_STR}). The automated review has paused gracefully and will resume automatically on the next scheduled scan sweep once the quota window resets.
396
+
397
+ ---
398
+ _Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_" || true
399
+ fi
400
+
401
+ echo "⏸️ Routine run issue #$ISSUE_NUMBER closed with status:quota-paused."
402
+ exit 0
403
+ fi
404
+
341
405
  REPORT_FILE=".jonah-fleet/run-report.md"
342
406
 
343
407
  if [ -f "$REPORT_FILE" ]; then