fix(validate-repo): flag a missing Agent label at onboarding #378

Merged
joshtronic merged 1 commit from fix/validate-repo-agent-label into master 2026-07-11 21:39:24 +00:00
Collaborator

Adds an onboarding check for the repo-level Agent greenlight label to bin/validate-repo.sh.

What

  • New forgejo_repo_has_label <repo> <name> (lib/forgejo.sh) with distinct exit codes: 0 present · 1 absent · 2 indeterminate (API read failed) — so the caller can tell "missing, flag it" from "couldn't check, skip it."
  • validate-repo.sh emits an advisory checklist line. A missing Agent label is safe since #375 (the gate fails closed), so it never flips the readiness exit code — but it shows as an unchecked (advisory) box so onboarding notices a repo that will silently do no issue work.
  • The check is API-based and lives in validate-repo.sh, not validate_repo_local — that stays pure local-clone reads for the per-tick hot path.

Tests

bin/test-forgejo.sh: present / absent / indeterminate. make test green; shellcheck clean; ran end-to-end against a live repo.

Note

Opened as a WIP draft on purpose so the live review loop doesn't rework it overnight — drop the WIP: prefix (or just merge) once you've reviewed.

Closes #376

Adds an onboarding check for the repo-level `Agent` greenlight label to `bin/validate-repo.sh`. ## What - New `forgejo_repo_has_label <repo> <name>` (`lib/forgejo.sh`) with distinct exit codes: **0** present · **1** absent · **2** indeterminate (API read failed) — so the caller can tell "missing, flag it" from "couldn't check, skip it." - `validate-repo.sh` emits an **advisory** checklist line. A missing `Agent` label is safe since #375 (the gate fails closed), so it never flips the readiness exit code — but it shows as an unchecked `(advisory)` box so onboarding *notices* a repo that will silently do no issue work. - The check is API-based and lives in `validate-repo.sh`, **not** `validate_repo_local` — that stays pure local-clone reads for the per-tick hot path. ## Tests `bin/test-forgejo.sh`: present / absent / indeterminate. `make test` green; shellcheck clean; ran end-to-end against a live repo. ## Note Opened as a **WIP draft on purpose** so the live review loop doesn't rework it overnight — drop the `WIP:` prefix (or just merge) once you've reviewed. Closes #376
fix(validate-repo): flag a missing Agent label at onboarding
All checks were successful
Lint / check-sync (push) Successful in 5s
Lint / check-sync (pull_request) Successful in 4s
e66e05b665
bin/validate-repo.sh printed the readiness checklist but never checked
whether the repo DEFINES the `Agent` greenlight label. Since #375 a
missing label is safe (the gate fails closed, so the grind claims
nothing), but it stays a silent footgun: a repo meant to be agentic that
lacks the label just does no issue work, with no signal.

Add forgejo_repo_has_label <repo> <name> (lib/forgejo.sh) with distinct
exit codes -- present / absent / indeterminate -- so the caller can tell
"missing, flag it" from "couldn't read labels, skip." validate-repo.sh
emits an ADVISORY line from it: it never flips the readiness exit code
(the label is orthogonal to local scaffolding and its absence is now
safe), but a missing label shows as an unchecked "(advisory)" box so
onboarding notices. The check is API-based and deliberately lives in
validate-repo.sh, NOT validate_repo_local -- that stays pure local-clone
reads for the per-tick hot path.

Tests: forgejo_repo_has_label present/absent/indeterminate in
bin/test-forgejo.sh.

Closes #376

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q4YUVfbfUWdUwifGJ2TvkP
igor changed title from WIP: fix(validate-repo): flag a missing Agent label at onboarding to fix(validate-repo): flag a missing Agent label at onboarding 2026-07-11 21:31:00 +00:00
Author
Collaborator

🤖 Review — APPROVE (automated)

CI for e66e05b6: success

Adds an advisory onboarding check for the repo-level Agent label. Small, focused, well-tested; CI green. Approving.

Verified:

  • forgejo_repo_has_label exit-code contract is correct: _fj GET failure short-circuits to return 2 (indeterminate) via || return 2; otherwise the function inherits jq -e's status — any(.[]; .name==$n) yields true→0 (present) / false→1 (absent). Empty array [] correctly yields absent (1). Matches the three test cases exactly.
  • The indeterminate test (_fj() { return 22; }) properly exercises the read-failure path — command substitution surfaces the nonzero status, so it can't be misread as "absent." Good that this distinction is tested; conflating it would be the dangerous bug.
  • validate-repo.sh preserves readiness via return $status; the advisory branch only prints a checklist line and never mutates the exit code, consistent with the "#375 fails closed, so a missing label is safe" claim.
  • Correctly kept out of validate_repo_local (the local-clone hot path) since it's the one API read — matches the description.
  • Checklist/description all correspond to real diff content. Scope is tight (~50 lines across 3 files).

Minor follow-up (non-blocking):

  • /repos/{repo}/labels may paginate (Forgejo default page limit). If a repo defines more labels than one page and Agent sorts past it, this could report a false "absent." Low risk for an advisory onboarding check that never flips readiness, but worth a limit= param or pagination note if label lists ever grow.

No security, correctness, or honesty concerns. Note the title still lacks the WIP: prefix the description mentions — cosmetic, and the author flags it for manual drop before merge.


Independent review by the harness on claude-opus-4-8 (effort: high). The human reviewer is requested once Igor has reviewed; a human still merges.

### 🤖 Review — `APPROVE` _(automated)_ CI for `e66e05b6`: **success** Adds an advisory onboarding check for the repo-level `Agent` label. Small, focused, well-tested; CI green. Approving. **Verified:** - `forgejo_repo_has_label` exit-code contract is correct: `_fj GET` failure short-circuits to `return 2` (indeterminate) via `|| return 2`; otherwise the function inherits `jq -e`'s status — `any(.[]; .name==$n)` yields true→0 (present) / false→1 (absent). Empty array `[]` correctly yields absent (1). Matches the three test cases exactly. - The indeterminate test (`_fj() { return 22; }`) properly exercises the read-failure path — command substitution surfaces the nonzero status, so it can't be misread as "absent." Good that this distinction is tested; conflating it would be the dangerous bug. - `validate-repo.sh` preserves readiness via `return $status`; the advisory branch only prints a checklist line and never mutates the exit code, consistent with the "#375 fails closed, so a missing label is safe" claim. - Correctly kept out of `validate_repo_local` (the local-clone hot path) since it's the one API read — matches the description. - Checklist/description all correspond to real diff content. Scope is tight (~50 lines across 3 files). **Minor follow-up (non-blocking):** - `/repos/{repo}/labels` may paginate (Forgejo default page limit). If a repo defines more labels than one page and `Agent` sorts past it, this could report a false "absent." Low risk for an advisory onboarding check that never flips readiness, but worth a `limit=` param or pagination note if label lists ever grow. No security, correctness, or honesty concerns. Note the title still lacks the `WIP:` prefix the description mentions — cosmetic, and the author flags it for manual drop before merge. --- <sub>Independent review by the harness on `claude-opus-4-8` (effort: high). The human reviewer is requested once Igor has reviewed; a human still merges.</sub> <!-- review sha=e66e05b66598dcaf7c256e92239fc4c9e2df774d verdict=APPROVE ci=success -->
igor added spent time 2026-07-11 21:37:45 +00:00
35 seconds
joshtronic approved these changes 2026-07-11 21:39:21 +00:00
joshtronic deleted branch fix/validate-repo-agent-label 2026-07-11 21:39:24 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
2 participants
Notifications
Total time spent: 35 seconds
igor
35 seconds
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
joshtronic/igor!378
No description provided.