[object Object]

← back to Chief Of Operations

remove auto_claim tk-take path entirely; queue --write prints one-line summary (225 MB log fix) — TK-12235

a27b564588c8e15983caf6a831bae2b3333c5a37 · 2026-09-25 10:08:08 -0700 · Steve Abrams

Files touched

Diff

commit a27b564588c8e15983caf6a831bae2b3333c5a37
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri Sep 25 10:08:08 2026 -0700

    remove auto_claim tk-take path entirely; queue --write prints one-line summary (225 MB log fix) — TK-12235
---
 chief_ops.py | 37 +++++++++----------------------------
 1 file changed, 9 insertions(+), 28 deletions(-)

diff --git a/chief_ops.py b/chief_ops.py
index 2d2efaa..4c0cec1 100755
--- a/chief_ops.py
+++ b/chief_ops.py
@@ -146,33 +146,10 @@ def ticket_queue(write=False):
     return result
 
 def auto_claim():
-    # TK-12235: the ticket front desk (tk claim / POST /api/claim, lease-based) is now the ONE claimer.
-    # Chief-of-ops only labelled tickets without working them (held TK-11889 for 8 days), so auto-claim
-    # is off unless state/AUTOCLAIM_ON exists. Queue ranking below still runs for the board.
-    if not (STATE/'AUTOCLAIM_ON').exists():
-        ticket_queue(write=True)
-        return {'ok':True,'action':'disabled','reason':'auto-claim off (TK-12235); touch state/AUTOCLAIM_ON to re-enable'}
-    q=ticket_queue(write=True)
-    if not q.get('ok'): return {'ok':False,'error':q.get('error','queue unavailable')}
-    claimed_path=STATE/'claimed.json'
-    current=None
-    if claimed_path.exists():
-        try: current=json.loads(claimed_path.read_text()).get('ticket')
-        except Exception: current=None
-    if current:
-        active=next((x for x in q['items'] if x['id']==current), None)
-        if active and active.get('status') in ('open','doing') and active.get('assignee')==OPS_AGENT:
-            return {'ok':True,'action':'hold','ticket':current,'reason':'already claimed and active'}
-    candidate=next((x for x in q['items'] if x.get('status')=='open'), None)
-    if not candidate:
-        return {'ok':True,'action':'none','reason':'no open ticket; blocked work remains surfaced','blocked_count':q.get('blocked_count',0)}
-    rc,out,err=cmd([str(TK),'take',candidate['id'],'-a',OPS_AGENT], timeout=10)
-    if rc:
-        return {'ok':False,'action':'claim-failed','ticket':candidate['id'],'error':err or out}
-    STATE.mkdir(exist_ok=True)
-    claimed_path.write_text(json.dumps({'ticket':candidate['id'],'claimed_at':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime()),'title':candidate['title']},indent=2)+'\n')
-    return {'ok':True,'action':'claimed','ticket':candidate['id'],'title':candidate['title'],'score':candidate['score']}
-
+    # TK-12235: the ticket front desk (tk claim / POST /api/claim, lease-based) is the ONE claimer.
+    # Chief-of-ops only labelled tickets without working them (held TK-11889 for 8 days, 10k "hold"
+    # log lines), so the tk-take path is removed entirely -- no re-enable switch that could bypass leases.
+    return {'ok':True,'action':'disabled','reason':'claiming moved to the ticket front desk (TK-12235)'}
 
 def check():
     status={}
@@ -228,7 +205,11 @@ def main():
     ap=argparse.ArgumentParser(); ap.add_argument('action', choices=['check','arrange','queue','claim','watch-exo','serve'], nargs='?', default='check'); ap.add_argument('--port',type=int,default=9896); ap.add_argument('--write',action='store_true'); a=ap.parse_args()
     if a.action=='check': print(json.dumps(check(), indent=2)); return
     if a.action=='arrange': print(json.dumps(arrange(), indent=2)); return
-    if a.action=='queue': print(json.dumps(ticket_queue(write=True), indent=2)); return
+    if a.action=='queue':
+        q=ticket_queue(write=True)
+        # --write (the 60s supervisor loop) prints a one-line summary; the full queue lives in state/queue.json.
+        # Dumping the whole JSON every minute grew state/supervisor.log to 225 MB (TK-12235).
+        print(json.dumps({k:q.get(k) for k in ('ok','generated_at','total','dw_count','blocked_count','error') if k in q}) if a.write else json.dumps(q, indent=2)); return
     if a.action=='claim': print(json.dumps(auto_claim(), indent=2)); return
     if a.action=='watch-exo': print(json.dumps(watch_exo(), indent=2)); return
     print(f'Chief of Operations on http://127.0.0.1:{a.port}', flush=True); ThreadingHTTPServer(('127.0.0.1',a.port), Handler).serve_forever()

← 07be05e auto_claim off by default (TK-12235): front desk is the sing  ·  back to Chief Of Operations  ·  steve_todo.py: one to-do list of blocked tickets grouped by 2445d45 →