[object Object]

← back to NEW SKU Viewer

fix(server): gate auto-YOLO-mode behind YOLO_MODE_AUTOSTART env var

d99c7a162b161daa177fd430b73bade7b1bcf620 · 2026-05-19 21:53:18 -0700 · Steve Abrams

Previously every pm2 restart unconditionally fired startYoloMode() 60s
after boot — a 10-cycle 30-min-interval scan loop hammering
http://45.61.58.125:9830/api/import/auto-scraper with zero operator
consent. Combined with the unauthed POST /api/yolo-mode bound to
0.0.0.0:3030, this meant every restart silently launched a multi-hour
scrape against prod.

Now gated behind YOLO_MODE_AUTOSTART=1 env var. POST /api/yolo-mode still
works for manual on-demand triggering. Default is OFF.

Surfaced by tick 177 session #102 Teal mechanical refactor pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit d99c7a162b161daa177fd430b73bade7b1bcf620
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue May 19 21:53:18 2026 -0700

    fix(server): gate auto-YOLO-mode behind YOLO_MODE_AUTOSTART env var
    
    Previously every pm2 restart unconditionally fired startYoloMode() 60s
    after boot — a 10-cycle 30-min-interval scan loop hammering
    http://45.61.58.125:9830/api/import/auto-scraper with zero operator
    consent. Combined with the unauthed POST /api/yolo-mode bound to
    0.0.0.0:3030, this meant every restart silently launched a multi-hour
    scrape against prod.
    
    Now gated behind YOLO_MODE_AUTOSTART=1 env var. POST /api/yolo-mode still
    works for manual on-demand triggering. Default is OFF.
    
    Surfaced by tick 177 session #102 Teal mechanical refactor pass.
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 server.js | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/server.js b/server.js
index 23ee108..6b8d6aa 100644
--- a/server.js
+++ b/server.js
@@ -535,11 +535,16 @@ app.listen(PORT, '0.0.0.0', () => {
     scanAllVendors().catch(console.error);
   }, 5000);
   
-  // Auto-start YOLO mode for continuous testing
-  setTimeout(() => {
-    console.log('🚨 AUTO-STARTING YOLO MODE for overnight testing...');
-    startYoloMode().catch(console.error);
-  }, 60000); // Start YOLO mode after 1 minute
+  // Auto-start YOLO mode for continuous testing — gated behind env var so
+  // pm2 restarts don't unconditionally launch the 10-cycle scan loop.
+  if (process.env.YOLO_MODE_AUTOSTART === '1') {
+    setTimeout(() => {
+      console.log('🚨 AUTO-STARTING YOLO MODE (YOLO_MODE_AUTOSTART=1)…');
+      startYoloMode().catch(console.error);
+    }, 60000);
+  } else {
+    console.log('ℹ️  YOLO auto-start disabled (set YOLO_MODE_AUTOSTART=1 to re-enable). POST /api/yolo-mode still works.');
+  }
 });
 
 // Error handling

← 098e8b6 public: wire sort <select> + density slider with localStorag  ·  back to NEW SKU Viewer  ·  (newest)