somratpro Claude Haiku 4.5 commited on
Commit
863a768
Β·
1 Parent(s): 7c90063

Reset stale agent runs before startup to prevent stack overflow

Browse files

Paperclip's startup recovery does recursive DFS on the issue graph.
Deeply nested stalled-task chains cause RangeError on restart.
Marking orphaned running runs as failed before launch prevents the
recovery code from firing entirely.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. start.sh +3 -0
start.sh CHANGED
@@ -212,6 +212,9 @@ cleanup() {
212
  }
213
  trap cleanup SIGTERM SIGINT
214
 
 
 
 
215
  # ── Launch Paperclip ──────────────────────────────────────────────────────────
216
  echo "Starting Paperclip..."
217
  node --import ./server/node_modules/tsx/dist/loader.mjs server/dist/index.js &
 
212
  }
213
  trap cleanup SIGTERM SIGINT
214
 
215
+ # Reset stale running agent runs β€” prevents stack overflow in startup recovery
216
+ su - postgres -c "psql paperclip -c \"UPDATE agent_run SET status='failed' WHERE status='running';\"" >/dev/null 2>&1 || true
217
+
218
  # ── Launch Paperclip ──────────────────────────────────────────────────────────
219
  echo "Starting Paperclip..."
220
  node --import ./server/node_modules/tsx/dist/loader.mjs server/dist/index.js &