fix: agents self-assign unassigned issues for max throughput
Workers now pick ANY open issue (assigned to them OR unassigned) and self-assign via Gitea API before starting work. No more empty queues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -149,7 +149,8 @@ all_issues.sort(key=priority)
|
||||
|
||||
for i in all_issues:
|
||||
assignees = [a['login'] for a in (i.get('assignees') or [])]
|
||||
if 'gemini' not in assignees:
|
||||
# Take issues assigned to gemini OR unassigned (self-assign)
|
||||
if assignees and 'gemini' not in assignees:
|
||||
continue
|
||||
|
||||
title = i['title'].lower()
|
||||
@@ -168,6 +169,18 @@ for i in all_issues:
|
||||
|
||||
repo = i['_repo']
|
||||
owner, name = repo.split('/')
|
||||
|
||||
# Self-assign if unassigned
|
||||
if not assignees:
|
||||
try:
|
||||
data = json.dumps({'assignees': ['gemini']}).encode()
|
||||
req2 = urllib.request.Request(
|
||||
f'{base}/api/v1/repos/{repo}/issues/{i["number"]}',
|
||||
data=data, method='PATCH',
|
||||
headers={'Authorization': f'token {token}', 'Content-Type': 'application/json'})
|
||||
urllib.request.urlopen(req2, timeout=5)
|
||||
except: pass
|
||||
|
||||
print(json.dumps({
|
||||
'number': i['number'],
|
||||
'title': i['title'],
|
||||
|
||||
Reference in New Issue
Block a user