agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

setup-labels API is GitHub-only and uses an inconsistent label set

Open raphaelbarreiros opened this issue 6 months ago • 2 comments

Environment

  • ao --version: 0.4.0 (also reproduces on 0.5.0 / main by code inspection at packages/web/src/app/api/setup-labels/route.ts)
  • OS: macOS 26.3.1, arm64
  • Node: v24.14.1

Summary

packages/web/src/app/api/setup-labels/route.ts is intended to pre-create the agent labels every project needs, but three issues make it unusable in practice for non-GitHub trackers and inconsistent with the rest of the orchestrator.

Three problems in 50 lines

1. Hardcoded to gh CLI without plugin dispatch.

The route shells out directly to gh label create --repo <project.repo> with no GH_HOST override. Effects per tracker:

Tracker setup-labels works?
tracker-github yes (matches the hardcoded gh)
tracker-gitlab no — gh doesn't speak GitLab; scm-gitlab/tracker-gitlab use glab
tracker-forgejo no — gh with no GH_HOST won't reach a Forgejo host
tracker-linear no — gh doesn't speak Linear

The route bypasses the Tracker plugin abstraction entirely. The Tracker interface in @aoagents/ao-core/types.ts declares no label-management method, so there is no clean dispatch point today.

2. Label set inconsistent with services.ts.

The route creates: agent:backlog, agent:in-progress, agent:blocked, agent:done.

But pollBacklog / labelIssuesForVerification / relabelReopenedIssues in packages/web/src/lib/services.ts read and write a different set: agent:backlog, agent:in-progress, agent:done, merged-unverified.

Result: agent:blocked is created but never referenced by the orchestrator; merged-unverified is required by the verification flow but the route never creates it.

3. No caller wires the route up.

grep -rn "setup-labels" finds no UI button, CLI subcommand, or auto-trigger. The endpoint is dead from a UX perspective — operators would have to curl -X POST it manually, and even then, only GitHub projects would benefit.

Steps to reproduce (Forgejo example)

  1. Configure a project with tracker.plugin: forgejo (Forgejo repo + host).
  2. Ensure none of agent:backlog, agent:in-progress, agent:done, merged-unverified exist as repo labels on the Forgejo repo.
  3. ao start, then open an issue on Forgejo and add label agent:backlog (Forgejo accepts it as an ad-hoc string even without a repo-level entry).
  4. Hit curl http://localhost:3001/api/backlog to start the lazy poller.
  5. Observe the orchestrator throw Unable to resolve Forgejo label IDs for: agent:in-progress on every poll cycle when it tries to claim the issue.
  6. Try curl -X POST http://localhost:3001/api/setup-labels. The route claims success but gh label create either fails or hits github.com — never the Forgejo host.

Expected vs. actual

Expected. A documented or in-product flow for creating the orchestrator's required labels on whatever tracker the project uses. The route (or its successor) should dispatch through registry.get("tracker", project.tracker.plugin) and create labels via the right API per provider.

Actual. Route shells gh directly with no GH_HOST — only github.com works. agent:blocked is created but never used; merged-unverified is required but never created. No caller invokes the route, so even GitHub users only benefit by hitting it by hand.

Relevant ao doctor output

Results: 17 PASS, 0 WARN, 0 FAIL, 0 FIXED
Environment looks healthy enough to run Agent Orchestrator.

Note: doctor does not currently check tracker labels — orthogonal to this issue but adds to the silent-failure surface.

Suggested fix shape

  1. Add ensureLabels(labels: LabelSpec[]): Promise<void> (or createLabel + getLabels primitives) to the Tracker interface in @aoagents/ao-core.
  2. Implement per plugin:
    • tracker-github via gh label create with GH_HOST
    • tracker-gitlab via glab or GitLab REST
    • tracker-forgejo via POST /repos/{owner}/{repo}/labels (already wired through the existing forgejoApi helper)
    • tracker-linear no-op or skip (Linear doesn't have repo labels)
  3. Refactor /api/setup-labels to dispatch via the registry instead of shelling gh directly.
  4. Reconcile the canonical label set against services.ts usage (either drop agent:blocked or wire it up; add merged-unverified).
  5. Wire a CLI command (ao setup labels) and/or a dashboard button. Consider auto-running on first orchestrator boot in a project that's missing required labels.

Notes

Encountered while testing #1674 (Forgejo plugin rescue) against a real Forgejo instance. The bug is not introduced by that PR — the route exists unchanged on origin/main and tracker-gitlab would hit the same wall.

raphaelbarreiros avatar May 06 '26 13:05 raphaelbarreiros

@prod-blip new issue from a non-collaborator.

OrcInc avatar May 12 '26 17:05 OrcInc

Hi @raphaelbarreiros , thanks for filing this, it is really detailed and useful. I'm a contributor on AO and trying to get a sense of how it's working for folks using it in real workflows. Would love to hear a bit more about your experience and happy to hop on a quick 15-min call if that's easier. Here’s my calendly link https://calendly.com/atulpandey-iift1618/30min

Also, the contributors meet on Discord every day at 10pm IST: https://discord.gg/6KgeUjbe — drop in if you're around, good place to see what's being worked on and shape direction directly.

prod-blip avatar May 14 '26 06:05 prod-blip