store: Refactor: issue-poller.sh — replaced 5 of 6 Haiku+MCP calls with direct curl+jq Gitea API calls

This commit is contained in:
Cal Corum 2026-03-03 15:25:29 -06:00
parent 2c230760bb
commit 455771e5e1

View File

@ -0,0 +1,52 @@
---
id: 436e133f-2c31-488a-9810-fb6ca5b45250
type: solution
title: "Refactor: issue-poller.sh — replaced 5 of 6 Haiku+MCP calls with direct curl+jq Gitea API calls"
tags: [issue-poller, gitea-api, curl, jq, cost-optimization, automation, claude-scheduled, refactor]
importance: 0.8
confidence: 0.8
created: "2026-03-03T21:25:29.636362+00:00"
updated: "2026-03-03T21:25:29.636362+00:00"
---
# Issue-Poller Refactor: Haiku → curl+jq
## Project
claude-scheduled / issue-poller automation
## File
`~/.config/claude-scheduled/issue-poller.sh`
## Motivation
- Haiku spawned for simple CRUD operations was slow (~60-90s discovery phase) and expensive (~$0.80-1.00/run)
- The MCP wrapper for list_repo_issues was causing an infinite loop (see related bug fix memory)
## What Was Replaced (5 of 6 calls)
| Old (Haiku+MCP) | New (curl+jq) | Endpoint |
|---|---|---|
| Auth check | gitea_get /user | GET /api/v1/user |
| List issues | gitea_get /repos/{owner}/{repo}/issues?type=issues | GET with type filter |
| Label race-check | gitea_get issue + jq | GET issue JSON |
| Add label | gitea_post labels | POST /issues/{id}/labels |
| Post-worker label swap | gitea_delete + gitea_post | DELETE + POST labels |
## What Was Kept (1 call)
- Feasibility check — genuinely needs AI reasoning to determine if an issue is actionable
## Helper Functions Added
```bash
gitea_get() # curl GET wrapper with auth
gitea_post() # curl POST wrapper with JSON body
gitea_delete() # curl DELETE wrapper
ensure_label() # search existing labels before creating (prevents duplicates)
add_label() # add label to issue
remove_label() # remove label from issue
```
## Token Source
`~/.config/claude-scheduled/secrets`
## Performance Improvement
- Discovery phase: ~60-90s → ~2s
- Cost savings: ~$0.80-1.00/run