feat(dispatch): add Forge issue polling to dispatch watch #6

Open
opened 2026-02-21 17:04:34 +00:00 by Charon · 0 comments
Member

Problem

core ai dispatch watch --agent-id clotho only processes tickets already in the local queue/ directory. It does not poll Forge for new issues labeled with the agent ID.

Two bugs

  1. No Forge polling in watch looprunCycle() only reads from queue/ dir, never queries the Forge API for issues labeled with --agent-id. The flag is accepted but unused.

  2. Missing forge_token in ticket JSONpoll-forge.sh creates tickets without forge_token field, so the Go runner cannot report back to Forge issues. The token should be read from FORGE_TOKEN_PROD env var or ai-work/.env and injected into each ticket.

Expected Behaviour

core ai dispatch watch --agent-id clotho --interval 15m should:

  1. On each cycle, query Forge API for open issues labeled with the agent-id across accessible repos
  2. Create ticket JSON files in queue/ for new issues (dedup against queue/active/done)
  3. Include forge_token from env/config in each ticket JSON
  4. Process the queue as it currently does
  5. Report results back to Forge issues via API comments

Reference

  • Working shell implementation: ~/ai-work/poll-forge.sh on darbs
  • Go dispatch code: cmd/ai/cmd_dispatch.go
  • Forge API: GET /api/v1/repos/{owner}/{repo}/issues?state=open&labels={agent-id}

Acceptance Criteria

  • --agent-id flag used to filter Forge issues by label
  • forge_token sourced from env or config and included in ticket JSON
  • Dedup: skip issues already in queue/active/done
  • reportToForge works with the injected token
  • poll-forge.sh can be retired
## Problem `core ai dispatch watch --agent-id clotho` only processes tickets already in the local `queue/` directory. It does not poll Forge for new issues labeled with the agent ID. ### Two bugs 1. **No Forge polling in watch loop** — `runCycle()` only reads from `queue/` dir, never queries the Forge API for issues labeled with `--agent-id`. The flag is accepted but unused. 2. **Missing `forge_token` in ticket JSON** — `poll-forge.sh` creates tickets without `forge_token` field, so the Go runner cannot report back to Forge issues. The token should be read from `FORGE_TOKEN_PROD` env var or `ai-work/.env` and injected into each ticket. ## Expected Behaviour `core ai dispatch watch --agent-id clotho --interval 15m` should: 1. On each cycle, query Forge API for open issues labeled with the agent-id across accessible repos 2. Create ticket JSON files in `queue/` for new issues (dedup against queue/active/done) 3. Include `forge_token` from env/config in each ticket JSON 4. Process the queue as it currently does 5. Report results back to Forge issues via API comments ## Reference - Working shell implementation: `~/ai-work/poll-forge.sh` on darbs - Go dispatch code: `cmd/ai/cmd_dispatch.go` - Forge API: `GET /api/v1/repos/{owner}/{repo}/issues?state=open&labels={agent-id}` ## Acceptance Criteria - [ ] `--agent-id` flag used to filter Forge issues by label - [ ] `forge_token` sourced from env or config and included in ticket JSON - [ ] Dedup: skip issues already in queue/active/done - [ ] `reportToForge` works with the injected token - [ ] `poll-forge.sh` can be retired
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: core/cli#6
No description provided.