[object Object]

← back to Ticket System

Add bounded ticket runner override

7a35be1d9afaf05e7c208a090c0d897489538d79 · 2026-09-02 14:13:41 -0700 · Steve Abrams

Files touched

Diff

commit 7a35be1d9afaf05e7c208a090c0d897489538d79
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Sep 2 14:13:41 2026 -0700

    Add bounded ticket runner override
---
 server.js | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/server.js b/server.js
index fdcd1fe6..37400235 100644
--- a/server.js
+++ b/server.js
@@ -14,6 +14,18 @@ const RUN_SH = path.join(__dirname, 'run-ticket.sh');           // opens an iTer
 const DTD_RUN = path.join(__dirname, 'dtd-run.js');             // batched panel.sh sweep
 const RUN_PROFILES = new Set(['claude-sonnet', 'claude-opus', 'claude-haiku', 'codex', 'local-qwen-27b', 'local-qwen-14b']);
 const DEFAULT_RUN_PROFILE = 'claude-sonnet';
+const RUN_PROFILE_OVERRIDE = path.join(os.tmpdir(), 'ticket-run-profile-override.json');
+
+// A bounded operator override wins over stale browser localStorage. The file is
+// intentionally self-expiring, so no cleanup job is required to restore the
+// normal default after a short Codex-only launch window.
+function effectiveRunProfile(requested) {
+  try {
+    const override = JSON.parse(fs.readFileSync(RUN_PROFILE_OVERRIDE, 'utf8'));
+    if (RUN_PROFILES.has(override.profile) && Date.parse(override.until) > Date.now()) return override.profile;
+  } catch {}
+  return String(requested || DEFAULT_RUN_PROFILE);
+}
 // IDRE / REFRE / resolveList now live in ./lib.js (co-located with resolveId).
 const json = (res, code, obj) => { res.writeHead(code, { 'Content-Type': 'application/json' }); res.end(JSON.stringify(obj)); };
 function readJson(req, cb) { let b = ''; req.on('data', d => { b += d; if (b.length > 1e6) req.destroy(); }); req.on('end', () => { try { cb(JSON.parse(b || '{}')); } catch { cb(null); } }); }
@@ -354,7 +366,7 @@ http.createServer((req, res) => {
     if (execBlockedForRemote(req, res)) return;
     return readJson(req, body => {
       if (!body) return json(res, 400, { error: 'bad json' });
-      const profile = String(body.profile || DEFAULT_RUN_PROFILE);
+      const profile = effectiveRunProfile(body.profile);
       if (!RUN_PROFILES.has(profile)) return json(res, 400, { error: 'invalid run profile' });
       const map = tickets(); const ids = resolveList(body.ids, map);
       const launched = [], skipped = [];

← 811c80f2 Add five-word viewer summaries  ·  back to Ticket System  ·  Use shared path for runner override ca25bd19 →