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.
@@ -198,18 +198,38 @@ jobs:
198
198
  PROMPT="You are the Autowork routine for this repository. Read and follow the instructions in .github/prompts/autowork.md exactly. ${SKILLS_PROMPT} You are in Scan mode: check open PRs for review comments to fix, close merged issues, then pick the highest-priority unclaimed issue."
199
199
  fi
200
200
 
201
+ set +e
201
202
  agy -p "$PROMPT" \
202
203
  --model "$MODEL" \
203
204
  --output-format text \
204
205
  --print-timeout "$PRINT_TIMEOUT" \
205
- --dangerously-skip-permissions
206
+ --dangerously-skip-permissions 2>&1 | tee /tmp/agy.log
207
+ AGY_EXIT_CODE="${PIPESTATUS[0]}"
208
+ set -e
209
+
210
+ if [ "$AGY_EXIT_CODE" -ne 0 ]; then
211
+ if grep -qiE "Individual quota reached|quota reached" /tmp/agy.log; then
212
+ RESET_INFO=$(grep -oE "Resets in [^.]+" /tmp/agy.log | head -n 1 || echo "Resets in future window")
213
+ echo "QUOTA_PAUSED=true" >> "$GITHUB_ENV"
214
+ echo "QUOTA_RESET_INFO=$RESET_INFO" >> "$GITHUB_ENV"
215
+ echo "⚠️ LLM quota limit reached ($RESET_INFO). Pausing routine gracefully until next sweep."
216
+ exit 0
217
+ fi
218
+ exit "$AGY_EXIT_CODE"
219
+ fi
206
220
 
207
221
  - name: Emit run summary
208
222
  if: always()
209
223
  run: |
210
- REPORT_FILE=".jonah-fleet/run-report.md"
211
- if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
212
- cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
224
+ if [ "$QUOTA_PAUSED" = "true" ]; then
225
+ echo "### ⏸️ Milestone: Routine Execution Quota-Paused" >> "$GITHUB_STEP_SUMMARY"
226
+ echo "- **Status**: LLM quota reached (\`${QUOTA_RESET_INFO}\`)" >> "$GITHUB_STEP_SUMMARY"
227
+ echo "- **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets." >> "$GITHUB_STEP_SUMMARY"
228
+ else
229
+ REPORT_FILE=".jonah-fleet/run-report.md"
230
+ if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
231
+ cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
232
+ fi
213
233
  fi
214
234
 
215
235
  - name: Emit Fleet Telemetry (Opt-in)
@@ -257,12 +277,47 @@ jobs:
257
277
  RUN_ID: ${{ github.run_id }}
258
278
  SERVER_URL: ${{ github.server_url }}
259
279
  REPOSITORY: ${{ github.repository }}
280
+ QUOTA_PAUSED: ${{ env.QUOTA_PAUSED }}
281
+ QUOTA_RESET_INFO: ${{ env.QUOTA_RESET_INFO }}
260
282
  run: |
261
283
  if [ -z "$ISSUE_NUMBER" ]; then
262
284
  echo "No routine issue to reconcile."
263
285
  exit 0
264
286
  fi
265
287
 
288
+ if [ "$QUOTA_PAUSED" = "true" ]; then
289
+ RESET_STR="${QUOTA_RESET_INFO:-Resets in upcoming window}"
290
+ PAUSE_BODY="### ⏸️ Autonomous Routine Execution Quota-Paused
291
+ - **Routine**: \`autowork\`
292
+ - **Run ID**: [\`${RUN_ID}\`](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})
293
+ - **Trigger**: \`${EVENT_NAME}\`
294
+ - **Status**: LLM quota reached (\`${RESET_STR}\`)
295
+ - **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets.
296
+
297
+ ---
298
+ _Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_"
299
+
300
+ TEMP_BODY=$(mktemp)
301
+ echo "$PAUSE_BODY" > "$TEMP_BODY"
302
+ gh issue edit "$ISSUE_NUMBER" --body-file "$TEMP_BODY"
303
+ rm -f "$TEMP_BODY"
304
+
305
+ PAUSE_COMMENT=$(printf '%s\n' \
306
+ "### ⏸️ Milestone: Routine Execution Quota-Paused" \
307
+ "- **Routine**: \`autowork\`" \
308
+ "- **Status**: LLM quota reached (\`${RESET_STR}\`)" \
309
+ "- **Action Log**: [View GitHub Actions Run](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})" \
310
+ "- **Next Action**: Execution paused cleanly. The routine will resume automatically on the next scheduled sweep." \
311
+ "" \
312
+ "---" \
313
+ "_Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_")
314
+ gh issue comment "$ISSUE_NUMBER" --body "$PAUSE_COMMENT" || true
315
+ gh issue edit "$ISSUE_NUMBER" --add-label "status:quota-paused" --remove-label "status:running"
316
+ gh issue close "$ISSUE_NUMBER" --reason completed
317
+ echo "⏸️ Routine run issue #$ISSUE_NUMBER closed with status:quota-paused."
318
+ exit 0
319
+ fi
320
+
266
321
  REPORT_FILE=".jonah-fleet/run-report.md"
267
322
 
268
323
  if [ -f "$REPORT_FILE" ]; then
@@ -148,11 +148,39 @@ jobs:
148
148
  run: |
149
149
  PROMPT="You are the Dependency Update & Security Check routine. Read and follow .github/prompts/dependency-update-security-check.md exactly. Check dependencies for updates and vulnerabilities, and create or update tracking issues."
150
150
 
151
+ set +e
151
152
  agy -p "$PROMPT" \
152
153
  --model "$MODEL" \
153
154
  --output-format text \
154
155
  --print-timeout "$PRINT_TIMEOUT" \
155
- --dangerously-skip-permissions
156
+ --dangerously-skip-permissions 2>&1 | tee /tmp/agy.log
157
+ AGY_EXIT_CODE="${PIPESTATUS[0]}"
158
+ set -e
159
+
160
+ if [ "$AGY_EXIT_CODE" -ne 0 ]; then
161
+ if grep -qiE "Individual quota reached|quota reached" /tmp/agy.log; then
162
+ RESET_INFO=$(grep -oE "Resets in [^.]+" /tmp/agy.log | head -n 1 || echo "Resets in future window")
163
+ echo "QUOTA_PAUSED=true" >> "$GITHUB_ENV"
164
+ echo "QUOTA_RESET_INFO=$RESET_INFO" >> "$GITHUB_ENV"
165
+ echo "⚠️ LLM quota limit reached ($RESET_INFO). Pausing routine gracefully until next sweep."
166
+ exit 0
167
+ fi
168
+ exit "$AGY_EXIT_CODE"
169
+ fi
170
+
171
+ - name: Emit run summary
172
+ if: always()
173
+ run: |
174
+ if [ "$QUOTA_PAUSED" = "true" ]; then
175
+ echo "### ⏸️ Milestone: Routine Execution Quota-Paused" >> "$GITHUB_STEP_SUMMARY"
176
+ echo "- **Status**: LLM quota reached (\`${QUOTA_RESET_INFO}\`)" >> "$GITHUB_STEP_SUMMARY"
177
+ echo "- **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets." >> "$GITHUB_STEP_SUMMARY"
178
+ else
179
+ REPORT_FILE=".jonah-fleet/run-report.md"
180
+ if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
181
+ cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
182
+ fi
183
+ fi
156
184
 
157
185
  - name: Reconcile Routine Run Issue
158
186
  if: always()
@@ -164,12 +192,47 @@ jobs:
164
192
  RUN_ID: ${{ github.run_id }}
165
193
  SERVER_URL: ${{ github.server_url }}
166
194
  REPOSITORY: ${{ github.repository }}
195
+ QUOTA_PAUSED: ${{ env.QUOTA_PAUSED }}
196
+ QUOTA_RESET_INFO: ${{ env.QUOTA_RESET_INFO }}
167
197
  run: |
168
198
  if [ -z "$ISSUE_NUMBER" ]; then
169
199
  echo "No routine issue to reconcile."
170
200
  exit 0
171
201
  fi
172
202
 
203
+ if [ "$QUOTA_PAUSED" = "true" ]; then
204
+ RESET_STR="${QUOTA_RESET_INFO:-Resets in upcoming window}"
205
+ PAUSE_BODY="### ⏸️ Autonomous Routine Execution Quota-Paused
206
+ - **Routine**: \`dependency-update-security-check\`
207
+ - **Run ID**: [\`${RUN_ID}\`](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})
208
+ - **Trigger**: \`${EVENT_NAME}\`
209
+ - **Status**: LLM quota reached (\`${RESET_STR}\`)
210
+ - **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets.
211
+
212
+ ---
213
+ _Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_"
214
+
215
+ TEMP_BODY=$(mktemp)
216
+ echo "$PAUSE_BODY" > "$TEMP_BODY"
217
+ gh issue edit "$ISSUE_NUMBER" --body-file "$TEMP_BODY"
218
+ rm -f "$TEMP_BODY"
219
+
220
+ PAUSE_COMMENT=$(printf '%s\n' \
221
+ "### ⏸️ Milestone: Routine Execution Quota-Paused" \
222
+ "- **Routine**: \`dependency-check\`" \
223
+ "- **Status**: LLM quota reached (\`${RESET_STR}\`)" \
224
+ "- **Action Log**: [View GitHub Actions Run](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})" \
225
+ "- **Next Action**: Execution paused cleanly. The routine will resume automatically on the next scheduled sweep." \
226
+ "" \
227
+ "---" \
228
+ "_Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_")
229
+ gh issue comment "$ISSUE_NUMBER" --body "$PAUSE_COMMENT" || true
230
+ gh issue edit "$ISSUE_NUMBER" --add-label "status:quota-paused" --remove-label "status:running"
231
+ gh issue close "$ISSUE_NUMBER" --reason completed
232
+ echo "⏸️ Routine run issue #$ISSUE_NUMBER closed with status:quota-paused."
233
+ exit 0
234
+ fi
235
+
173
236
  REPORT_FILE=".jonah-fleet/run-report.md"
174
237
 
175
238
  if [ -f "$REPORT_FILE" ]; then
@@ -137,18 +137,38 @@ jobs:
137
137
  run: |
138
138
  PROMPT="You are the Design Review routine for this repository. Read and follow the instructions in .github/prompts/design-review.md exactly. ${SKILLS_PROMPT}"
139
139
 
140
+ set +e
140
141
  agy -p "$PROMPT" \
141
142
  --model gemini-3.8-flash-high \
142
143
  --output-format text \
143
144
  --print-timeout 50m \
144
- --dangerously-skip-permissions
145
+ --dangerously-skip-permissions 2>&1 | tee /tmp/agy.log
146
+ AGY_EXIT_CODE="${PIPESTATUS[0]}"
147
+ set -e
148
+
149
+ if [ "$AGY_EXIT_CODE" -ne 0 ]; then
150
+ if grep -qiE "Individual quota reached|quota reached" /tmp/agy.log; then
151
+ RESET_INFO=$(grep -oE "Resets in [^.]+" /tmp/agy.log | head -n 1 || echo "Resets in future window")
152
+ echo "QUOTA_PAUSED=true" >> "$GITHUB_ENV"
153
+ echo "QUOTA_RESET_INFO=$RESET_INFO" >> "$GITHUB_ENV"
154
+ echo "⚠️ LLM quota limit reached ($RESET_INFO). Pausing routine gracefully until next sweep."
155
+ exit 0
156
+ fi
157
+ exit "$AGY_EXIT_CODE"
158
+ fi
145
159
 
146
160
  - name: Emit run summary
147
161
  if: always()
148
162
  run: |
149
- REPORT_FILE=".jonah-fleet/run-report.md"
150
- if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
151
- cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
163
+ if [ "$QUOTA_PAUSED" = "true" ]; then
164
+ echo "### ⏸️ Milestone: Routine Execution Quota-Paused" >> "$GITHUB_STEP_SUMMARY"
165
+ echo "- **Status**: LLM quota reached (\`${QUOTA_RESET_INFO}\`)" >> "$GITHUB_STEP_SUMMARY"
166
+ echo "- **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets." >> "$GITHUB_STEP_SUMMARY"
167
+ else
168
+ REPORT_FILE=".jonah-fleet/run-report.md"
169
+ if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
170
+ cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
171
+ fi
152
172
  fi
153
173
 
154
174
  - name: Emit Fleet Telemetry (Opt-in)
@@ -175,12 +195,47 @@ jobs:
175
195
  RUN_ID: ${{ github.run_id }}
176
196
  SERVER_URL: ${{ github.server_url }}
177
197
  REPOSITORY: ${{ github.repository }}
198
+ QUOTA_PAUSED: ${{ env.QUOTA_PAUSED }}
199
+ QUOTA_RESET_INFO: ${{ env.QUOTA_RESET_INFO }}
178
200
  run: |
179
201
  if [ -z "$ISSUE_NUMBER" ]; then
180
202
  echo "No routine issue to reconcile."
181
203
  exit 0
182
204
  fi
183
205
 
206
+ if [ "$QUOTA_PAUSED" = "true" ]; then
207
+ RESET_STR="${QUOTA_RESET_INFO:-Resets in upcoming window}"
208
+ PAUSE_BODY="### ⏸️ Autonomous Routine Execution Quota-Paused
209
+ - **Routine**: \`design-review\`
210
+ - **Run ID**: [\`${RUN_ID}\`](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})
211
+ - **Trigger**: \`${EVENT_NAME}\`
212
+ - **Status**: LLM quota reached (\`${RESET_STR}\`)
213
+ - **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets.
214
+
215
+ ---
216
+ _Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_"
217
+
218
+ TEMP_BODY=$(mktemp)
219
+ echo "$PAUSE_BODY" > "$TEMP_BODY"
220
+ gh issue edit "$ISSUE_NUMBER" --body-file "$TEMP_BODY"
221
+ rm -f "$TEMP_BODY"
222
+
223
+ PAUSE_COMMENT=$(printf '%s\n' \
224
+ "### ⏸️ Milestone: Routine Execution Quota-Paused" \
225
+ "- **Routine**: \`design-review\`" \
226
+ "- **Status**: LLM quota reached (\`${RESET_STR}\`)" \
227
+ "- **Action Log**: [View GitHub Actions Run](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})" \
228
+ "- **Next Action**: Execution paused cleanly. The routine will resume automatically on the next scheduled sweep." \
229
+ "" \
230
+ "---" \
231
+ "_Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_")
232
+ gh issue comment "$ISSUE_NUMBER" --body "$PAUSE_COMMENT" || true
233
+ gh issue edit "$ISSUE_NUMBER" --add-label "status:quota-paused" --remove-label "status:running"
234
+ gh issue close "$ISSUE_NUMBER" --reason completed
235
+ echo "⏸️ Routine run issue #$ISSUE_NUMBER closed with status:quota-paused."
236
+ exit 0
237
+ fi
238
+
184
239
  REPORT_FILE=".jonah-fleet/run-report.md"
185
240
 
186
241
  if [ -f "$REPORT_FILE" ]; then
@@ -148,11 +148,39 @@ jobs:
148
148
  run: |
149
149
  PROMPT="You are the Issues Housekeeping routine for this repository. Read and follow .github/prompts/issues-housekeeping.md exactly. Sweep open issues for staleness, duplicates, priority accuracy, and orphaned claims."
150
150
 
151
+ set +e
151
152
  agy -p "$PROMPT" \
152
153
  --model "$MODEL" \
153
154
  --output-format text \
154
155
  --print-timeout "$PRINT_TIMEOUT" \
155
- --dangerously-skip-permissions
156
+ --dangerously-skip-permissions 2>&1 | tee /tmp/agy.log
157
+ AGY_EXIT_CODE="${PIPESTATUS[0]}"
158
+ set -e
159
+
160
+ if [ "$AGY_EXIT_CODE" -ne 0 ]; then
161
+ if grep -qiE "Individual quota reached|quota reached" /tmp/agy.log; then
162
+ RESET_INFO=$(grep -oE "Resets in [^.]+" /tmp/agy.log | head -n 1 || echo "Resets in future window")
163
+ echo "QUOTA_PAUSED=true" >> "$GITHUB_ENV"
164
+ echo "QUOTA_RESET_INFO=$RESET_INFO" >> "$GITHUB_ENV"
165
+ echo "⚠️ LLM quota limit reached ($RESET_INFO). Pausing routine gracefully until next sweep."
166
+ exit 0
167
+ fi
168
+ exit "$AGY_EXIT_CODE"
169
+ fi
170
+
171
+ - name: Emit run summary
172
+ if: always()
173
+ run: |
174
+ if [ "$QUOTA_PAUSED" = "true" ]; then
175
+ echo "### ⏸️ Milestone: Routine Execution Quota-Paused" >> "$GITHUB_STEP_SUMMARY"
176
+ echo "- **Status**: LLM quota reached (\`${QUOTA_RESET_INFO}\`)" >> "$GITHUB_STEP_SUMMARY"
177
+ echo "- **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets." >> "$GITHUB_STEP_SUMMARY"
178
+ else
179
+ REPORT_FILE=".jonah-fleet/run-report.md"
180
+ if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
181
+ cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
182
+ fi
183
+ fi
156
184
 
157
185
  - name: Reconcile Routine Run Issue
158
186
  if: always()
@@ -164,12 +192,47 @@ jobs:
164
192
  RUN_ID: ${{ github.run_id }}
165
193
  SERVER_URL: ${{ github.server_url }}
166
194
  REPOSITORY: ${{ github.repository }}
195
+ QUOTA_PAUSED: ${{ env.QUOTA_PAUSED }}
196
+ QUOTA_RESET_INFO: ${{ env.QUOTA_RESET_INFO }}
167
197
  run: |
168
198
  if [ -z "$ISSUE_NUMBER" ]; then
169
199
  echo "No routine issue to reconcile."
170
200
  exit 0
171
201
  fi
172
202
 
203
+ if [ "$QUOTA_PAUSED" = "true" ]; then
204
+ RESET_STR="${QUOTA_RESET_INFO:-Resets in upcoming window}"
205
+ PAUSE_BODY="### ⏸️ Autonomous Routine Execution Quota-Paused
206
+ - **Routine**: \`issues-housekeeping\`
207
+ - **Run ID**: [\`${RUN_ID}\`](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})
208
+ - **Trigger**: \`${EVENT_NAME}\`
209
+ - **Status**: LLM quota reached (\`${RESET_STR}\`)
210
+ - **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets.
211
+
212
+ ---
213
+ _Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_"
214
+
215
+ TEMP_BODY=$(mktemp)
216
+ echo "$PAUSE_BODY" > "$TEMP_BODY"
217
+ gh issue edit "$ISSUE_NUMBER" --body-file "$TEMP_BODY"
218
+ rm -f "$TEMP_BODY"
219
+
220
+ PAUSE_COMMENT=$(printf '%s\n' \
221
+ "### ⏸️ Milestone: Routine Execution Quota-Paused" \
222
+ "- **Routine**: \`issues-housekeeping\`" \
223
+ "- **Status**: LLM quota reached (\`${RESET_STR}\`)" \
224
+ "- **Action Log**: [View GitHub Actions Run](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})" \
225
+ "- **Next Action**: Execution paused cleanly. The routine will resume automatically on the next scheduled sweep." \
226
+ "" \
227
+ "---" \
228
+ "_Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_")
229
+ gh issue comment "$ISSUE_NUMBER" --body "$PAUSE_COMMENT" || true
230
+ gh issue edit "$ISSUE_NUMBER" --add-label "status:quota-paused" --remove-label "status:running"
231
+ gh issue close "$ISSUE_NUMBER" --reason completed
232
+ echo "⏸️ Routine run issue #$ISSUE_NUMBER closed with status:quota-paused."
233
+ exit 0
234
+ fi
235
+
173
236
  REPORT_FILE=".jonah-fleet/run-report.md"
174
237
 
175
238
  if [ -f "$REPORT_FILE" ]; then
@@ -148,18 +148,38 @@ jobs:
148
148
  run: |
149
149
  PROMPT="You are the Prompt Optimizer routine for this repository. Read and follow .github/prompts/optimizer.md exactly. Diagnose failures, token anomalies, and review loops, and propose preventative prompt and test fixes."
150
150
 
151
+ set +e
151
152
  agy -p "$PROMPT" \
152
153
  --model "$MODEL" \
153
154
  --output-format text \
154
155
  --print-timeout "$PRINT_TIMEOUT" \
155
- --dangerously-skip-permissions
156
+ --dangerously-skip-permissions 2>&1 | tee /tmp/agy.log
157
+ AGY_EXIT_CODE="${PIPESTATUS[0]}"
158
+ set -e
159
+
160
+ if [ "$AGY_EXIT_CODE" -ne 0 ]; then
161
+ if grep -qiE "Individual quota reached|quota reached" /tmp/agy.log; then
162
+ RESET_INFO=$(grep -oE "Resets in [^.]+" /tmp/agy.log | head -n 1 || echo "Resets in future window")
163
+ echo "QUOTA_PAUSED=true" >> "$GITHUB_ENV"
164
+ echo "QUOTA_RESET_INFO=$RESET_INFO" >> "$GITHUB_ENV"
165
+ echo "⚠️ LLM quota limit reached ($RESET_INFO). Pausing routine gracefully until next sweep."
166
+ exit 0
167
+ fi
168
+ exit "$AGY_EXIT_CODE"
169
+ fi
156
170
 
157
171
  - name: Emit run summary
158
172
  if: always()
159
173
  run: |
160
- REPORT_FILE=".jonah-fleet/run-report.md"
161
- if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
162
- cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
174
+ if [ "$QUOTA_PAUSED" = "true" ]; then
175
+ echo "### ⏸️ Milestone: Routine Execution Quota-Paused" >> "$GITHUB_STEP_SUMMARY"
176
+ echo "- **Status**: LLM quota reached (\`${QUOTA_RESET_INFO}\`)" >> "$GITHUB_STEP_SUMMARY"
177
+ echo "- **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets." >> "$GITHUB_STEP_SUMMARY"
178
+ else
179
+ REPORT_FILE=".jonah-fleet/run-report.md"
180
+ if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
181
+ cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
182
+ fi
163
183
  fi
164
184
 
165
185
  - name: Emit Fleet Telemetry (Opt-in)
@@ -186,12 +206,47 @@ jobs:
186
206
  RUN_ID: ${{ github.run_id }}
187
207
  SERVER_URL: ${{ github.server_url }}
188
208
  REPOSITORY: ${{ github.repository }}
209
+ QUOTA_PAUSED: ${{ env.QUOTA_PAUSED }}
210
+ QUOTA_RESET_INFO: ${{ env.QUOTA_RESET_INFO }}
189
211
  run: |
190
212
  if [ -z "$ISSUE_NUMBER" ]; then
191
213
  echo "No routine issue to reconcile."
192
214
  exit 0
193
215
  fi
194
216
 
217
+ if [ "$QUOTA_PAUSED" = "true" ]; then
218
+ RESET_STR="${QUOTA_RESET_INFO:-Resets in upcoming window}"
219
+ PAUSE_BODY="### ⏸️ Autonomous Routine Execution Quota-Paused
220
+ - **Routine**: \`optimizer\`
221
+ - **Run ID**: [\`${RUN_ID}\`](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})
222
+ - **Trigger**: \`${EVENT_NAME}\`
223
+ - **Status**: LLM quota reached (\`${RESET_STR}\`)
224
+ - **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets.
225
+
226
+ ---
227
+ _Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_"
228
+
229
+ TEMP_BODY=$(mktemp)
230
+ echo "$PAUSE_BODY" > "$TEMP_BODY"
231
+ gh issue edit "$ISSUE_NUMBER" --body-file "$TEMP_BODY"
232
+ rm -f "$TEMP_BODY"
233
+
234
+ PAUSE_COMMENT=$(printf '%s\n' \
235
+ "### ⏸️ Milestone: Routine Execution Quota-Paused" \
236
+ "- **Routine**: \`optimizer\`" \
237
+ "- **Status**: LLM quota reached (\`${RESET_STR}\`)" \
238
+ "- **Action Log**: [View GitHub Actions Run](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})" \
239
+ "- **Next Action**: Execution paused cleanly. The routine will resume automatically on the next scheduled sweep." \
240
+ "" \
241
+ "---" \
242
+ "_Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_")
243
+ gh issue comment "$ISSUE_NUMBER" --body "$PAUSE_COMMENT" || true
244
+ gh issue edit "$ISSUE_NUMBER" --add-label "status:quota-paused" --remove-label "status:running"
245
+ gh issue close "$ISSUE_NUMBER" --reason completed
246
+ echo "⏸️ Routine run issue #$ISSUE_NUMBER closed with status:quota-paused."
247
+ exit 0
248
+ fi
249
+
195
250
  REPORT_FILE=".jonah-fleet/run-report.md"
196
251
 
197
252
  if [ -f "$REPORT_FILE" ]; then
@@ -209,18 +209,38 @@ jobs:
209
209
  PROMPT="${PROMPT} Additional instructions: ${CUSTOM_PROMPT}"
210
210
  fi
211
211
 
212
+ set +e
212
213
  agy -p "$PROMPT" \
213
214
  --model "$MODEL" \
214
215
  --output-format text \
215
216
  --print-timeout "$PRINT_TIMEOUT" \
216
- --dangerously-skip-permissions
217
+ --dangerously-skip-permissions 2>&1 | tee /tmp/agy.log
218
+ AGY_EXIT_CODE="${PIPESTATUS[0]}"
219
+ set -e
220
+
221
+ if [ "$AGY_EXIT_CODE" -ne 0 ]; then
222
+ if grep -qiE "Individual quota reached|quota reached" /tmp/agy.log; then
223
+ RESET_INFO=$(grep -oE "Resets in [^.]+" /tmp/agy.log | head -n 1 || echo "Resets in future window")
224
+ echo "QUOTA_PAUSED=true" >> "$GITHUB_ENV"
225
+ echo "QUOTA_RESET_INFO=$RESET_INFO" >> "$GITHUB_ENV"
226
+ echo "⚠️ LLM quota limit reached ($RESET_INFO). Pausing routine gracefully until next sweep."
227
+ exit 0
228
+ fi
229
+ exit "$AGY_EXIT_CODE"
230
+ fi
217
231
 
218
232
  - name: Emit run summary
219
233
  if: always()
220
234
  run: |
221
- REPORT_FILE=".jonah-fleet/run-report.md"
222
- if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
223
- cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
235
+ if [ "$QUOTA_PAUSED" = "true" ]; then
236
+ echo "### ⏸️ Milestone: Routine Execution Quota-Paused" >> "$GITHUB_STEP_SUMMARY"
237
+ echo "- **Status**: LLM quota reached (\`${QUOTA_RESET_INFO}\`)" >> "$GITHUB_STEP_SUMMARY"
238
+ echo "- **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets." >> "$GITHUB_STEP_SUMMARY"
239
+ else
240
+ REPORT_FILE=".jonah-fleet/run-report.md"
241
+ if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
242
+ cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
243
+ fi
224
244
  fi
225
245
 
226
246
  - name: Emit Fleet Telemetry (Opt-in)
@@ -268,12 +288,47 @@ jobs:
268
288
  RUN_ID: ${{ github.run_id }}
269
289
  SERVER_URL: ${{ github.server_url }}
270
290
  REPOSITORY: ${{ github.repository }}
291
+ QUOTA_PAUSED: ${{ env.QUOTA_PAUSED }}
292
+ QUOTA_RESET_INFO: ${{ env.QUOTA_RESET_INFO }}
271
293
  run: |
272
294
  if [ -z "$ISSUE_NUMBER" ]; then
273
295
  echo "No routine issue to reconcile."
274
296
  exit 0
275
297
  fi
276
298
 
299
+ if [ "$QUOTA_PAUSED" = "true" ]; then
300
+ RESET_STR="${QUOTA_RESET_INFO:-Resets in upcoming window}"
301
+ PAUSE_BODY="### ⏸️ Autonomous Routine Execution Quota-Paused
302
+ - **Routine**: \`autowork\`
303
+ - **Run ID**: [\`${RUN_ID}\`](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})
304
+ - **Trigger**: \`${EVENT_NAME}\`
305
+ - **Status**: LLM quota reached (\`${RESET_STR}\`)
306
+ - **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets.
307
+
308
+ ---
309
+ _Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_"
310
+
311
+ TEMP_BODY=$(mktemp)
312
+ echo "$PAUSE_BODY" > "$TEMP_BODY"
313
+ gh issue edit "$ISSUE_NUMBER" --body-file "$TEMP_BODY"
314
+ rm -f "$TEMP_BODY"
315
+
316
+ PAUSE_COMMENT=$(printf '%s\n' \
317
+ "### ⏸️ Milestone: Routine Execution Quota-Paused" \
318
+ "- **Routine**: \`autowork\`" \
319
+ "- **Status**: LLM quota reached (\`${RESET_STR}\`)" \
320
+ "- **Action Log**: [View GitHub Actions Run](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})" \
321
+ "- **Next Action**: Execution paused cleanly. The routine will resume automatically on the next scheduled sweep." \
322
+ "" \
323
+ "---" \
324
+ "_Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_")
325
+ gh issue comment "$ISSUE_NUMBER" --body "$PAUSE_COMMENT" || true
326
+ gh issue edit "$ISSUE_NUMBER" --add-label "status:quota-paused" --remove-label "status:running"
327
+ gh issue close "$ISSUE_NUMBER" --reason completed
328
+ echo "⏸️ Routine run issue #$ISSUE_NUMBER closed with status:quota-paused."
329
+ exit 0
330
+ fi
331
+
277
332
  REPORT_FILE=".jonah-fleet/run-report.md"
278
333
 
279
334
  if [ -f "$REPORT_FILE" ]; then
@@ -166,18 +166,38 @@ jobs:
166
166
  run: |
167
167
  PROMPT="You are the Autowork routine for this repository. A high-priority bug was filed. Read and follow .github/prompts/autowork.md. ${SKILLS_PROMPT} Your target is issue #${TARGET_ISSUE}. You are in Targeted mode: work issue #${TARGET_ISSUE} directly."
168
168
 
169
+ set +e
169
170
  agy -p "$PROMPT" \
170
171
  --model "$MODEL" \
171
172
  --output-format text \
172
173
  --print-timeout "$PRINT_TIMEOUT" \
173
- --dangerously-skip-permissions
174
+ --dangerously-skip-permissions 2>&1 | tee /tmp/agy.log
175
+ AGY_EXIT_CODE="${PIPESTATUS[0]}"
176
+ set -e
177
+
178
+ if [ "$AGY_EXIT_CODE" -ne 0 ]; then
179
+ if grep -qiE "Individual quota reached|quota reached" /tmp/agy.log; then
180
+ RESET_INFO=$(grep -oE "Resets in [^.]+" /tmp/agy.log | head -n 1 || echo "Resets in future window")
181
+ echo "QUOTA_PAUSED=true" >> "$GITHUB_ENV"
182
+ echo "QUOTA_RESET_INFO=$RESET_INFO" >> "$GITHUB_ENV"
183
+ echo "⚠️ LLM quota limit reached ($RESET_INFO). Pausing routine gracefully until next sweep."
184
+ exit 0
185
+ fi
186
+ exit "$AGY_EXIT_CODE"
187
+ fi
174
188
 
175
189
  - name: Emit run summary
176
190
  if: always()
177
191
  run: |
178
- REPORT_FILE=".jonah-fleet/run-report.md"
179
- if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
180
- cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
192
+ if [ "$QUOTA_PAUSED" = "true" ]; then
193
+ echo "### ⏸️ Milestone: Routine Execution Quota-Paused" >> "$GITHUB_STEP_SUMMARY"
194
+ echo "- **Status**: LLM quota reached (\`${QUOTA_RESET_INFO}\`)" >> "$GITHUB_STEP_SUMMARY"
195
+ echo "- **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets." >> "$GITHUB_STEP_SUMMARY"
196
+ else
197
+ REPORT_FILE=".jonah-fleet/run-report.md"
198
+ if [ -f "$REPORT_FILE" ] && [ -n "$GITHUB_STEP_SUMMARY" ]; then
199
+ cat "$REPORT_FILE" >> "$GITHUB_STEP_SUMMARY"
200
+ fi
181
201
  fi
182
202
 
183
203
  - name: Emit Fleet Telemetry (Opt-in)
@@ -225,12 +245,47 @@ jobs:
225
245
  RUN_ID: ${{ github.run_id }}
226
246
  SERVER_URL: ${{ github.server_url }}
227
247
  REPOSITORY: ${{ github.repository }}
248
+ QUOTA_PAUSED: ${{ env.QUOTA_PAUSED }}
249
+ QUOTA_RESET_INFO: ${{ env.QUOTA_RESET_INFO }}
228
250
  run: |
229
251
  if [ -z "$ISSUE_NUMBER" ]; then
230
252
  echo "No routine issue to reconcile."
231
253
  exit 0
232
254
  fi
233
255
 
256
+ if [ "$QUOTA_PAUSED" = "true" ]; then
257
+ RESET_STR="${QUOTA_RESET_INFO:-Resets in upcoming window}"
258
+ PAUSE_BODY="### ⏸️ Autonomous Routine Execution Quota-Paused
259
+ - **Routine**: \`autowork\`
260
+ - **Run ID**: [\`${RUN_ID}\`](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})
261
+ - **Trigger**: \`${EVENT_NAME}\`
262
+ - **Status**: LLM quota reached (\`${RESET_STR}\`)
263
+ - **Next Action**: Routine execution paused cleanly. Work will resume automatically on the next scheduled sweep after the quota window resets.
264
+
265
+ ---
266
+ _Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_"
267
+
268
+ TEMP_BODY=$(mktemp)
269
+ echo "$PAUSE_BODY" > "$TEMP_BODY"
270
+ gh issue edit "$ISSUE_NUMBER" --body-file "$TEMP_BODY"
271
+ rm -f "$TEMP_BODY"
272
+
273
+ PAUSE_COMMENT=$(printf '%s\n' \
274
+ "### ⏸️ Milestone: Routine Execution Quota-Paused" \
275
+ "- **Routine**: \`autowork\`" \
276
+ "- **Status**: LLM quota reached (\`${RESET_STR}\`)" \
277
+ "- **Action Log**: [View GitHub Actions Run](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})" \
278
+ "- **Next Action**: Execution paused cleanly. The routine will resume automatically on the next scheduled sweep." \
279
+ "" \
280
+ "---" \
281
+ "_Generated by [Antigravity](${SERVER_URL}/${REPOSITORY}/actions/runs/${RUN_ID})_")
282
+ gh issue comment "$ISSUE_NUMBER" --body "$PAUSE_COMMENT" || true
283
+ gh issue edit "$ISSUE_NUMBER" --add-label "status:quota-paused" --remove-label "status:running"
284
+ gh issue close "$ISSUE_NUMBER" --reason completed
285
+ echo "⏸️ Routine run issue #$ISSUE_NUMBER closed with status:quota-paused."
286
+ exit 0
287
+ fi
288
+
234
289
  REPORT_FILE=".jonah-fleet/run-report.md"
235
290
 
236
291
  if [ -f "$REPORT_FILE" ]; then