fix(#1122): delegate forge_ensure_label to forge_create_label - #1124
Conversation
forge_ensure_label() called `gh label create` directly, which fails on GitLab where GH_TOKEN is not set. Replace the hardcoded gh CLI block with a call to forge_create_label(), which already has correct implementations for both GitHub and GitLab forges. The error-handling logic (already-exists suppression, warning sanitization) is no longer needed at this layer — forge_create_label handles errors internally (GitHub uses --force for upsert, GitLab ignores 409 conflicts). Update labels-test.sh to mock forge_create_label instead of gh, and remove tests for behavior now owned by forge_create_label (error handling, repo-var fallback, force-flag check). Rebuild bundled scripts via make script-build. Closes #1122
|
🤖 Finished Review · ✅ Success · Started 6:34 PM UTC · Completed 6:50 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.28 |
|
Risk Assessment: moderate (2/5) DetailsModerate-risk bug fix delegating forge_ensure_label to forge_create_label across 8 shell scripts with net-negative line change. Tier 1 protected_path_count is high (8) but all are same-category scripts. Tier 2 is elevated by high churn in orchestration scripts, but actual changes are minimal and focused. Score unchanged from prior assessment. Previous runRisk Assessment: moderate (2/5) DetailsModerate-risk bug fix delegating forge_ensure_label to forge_create_label across 8 shell scripts with net-negative line change. Tier 1 protected_path_count is high (8) but all are same-category scripts. Tier 2 is elevated by high churn in orchestration scripts, but actual changes are minimal and focused. Score unchanged from prior assessment. Previous run (2)Risk Assessment: moderate (2/5) DetailsLow-risk refactor delegating forge_ensure_label to the existing forge_create_label abstraction. Net-negative line change across 4 files. Tier 2 elevated by high churn in post-code.sh and post-triage.sh (orchestration scripts with many contributors), but actual changes are minimal. Protected path count is high (4) but all are the same category of script. |
ReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Next steps:
Previous run (2)ReviewFindingsCritical
Medium
Next steps:
|
|
🤖 Finished Fix · ✅ Success · Started 6:52 PM UTC · Completed 7:01 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $1.92 |
The PR delegated forge_ensure_label to forge_create_label, but the triage ops files (github, gitlab, jira) only define tracker_create_label. This caused a fatal "command not found" error under set -euo pipefail when post-triage.sh called forge_ensure_label for the deferred label. Add forge_create_label() as a thin wrapper around tracker_create_label() in all three triage ops files. Update the labels.lib.sh header comment to reflect that forge_ensure_label now delegates to forge_create_label (which on GitHub uses --force). Rebuild bundled scripts via make script-build. Addresses #1124
🔧 Fix agent — iteration 1 (bot-triggered)Added forge_create_label() wrappers to all three triage ops files (github, gitlab, jira) to fix a fatal 'command not found' error when post-triage.sh calls forge_ensure_label. Updated the labels.lib.sh header comment to accurately reflect the --force behavioral change. Rebuilt bundled scripts via make script-build. Fixed (2):
Disagreed (1):
Tests: passed Decision points
Next steps:
|
|
🤖 Finished Review · ✅ Success · Started 7:03 PM UTC · Completed 7:23 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.09 |
|
🤖 Finished Fix · ✅ Success · Started 7:25 PM UTC · Completed 7:32 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $1.33 |
Add inline comment documenting that forge_create_label uses --force on GitHub (upsert) and 409-ignore on GitLab. This behavioral change from the previous no-force approach is intentional — mandatory labels are agent-managed, so preserving admin customizations is not a goal. Addresses #1124
🔧 Fix agent — iteration 2 (bot-triggered)Documented the intentional --force behavioral change with an inline comment in labels.lib.sh (propagated to bundled scripts). Disagreed with the protected-path finding (informational, requires human approval) and the error-handling regression finding (consistent with the established forge ops pattern). Fixed (1):
Disagreed (2):
Tests: passed Decision points
Next steps:
|
|
🤖 Finished Review · ✅ Success · Started 7:34 PM UTC · Completed 7:50 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $3.83 |
Superseded by updated review
|
🤖 Finished Retro · ✅ Success · Started 9:29 PM UTC · Completed 9:43 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.00 |
Retro: PR #1124 — delegate forge_ensure_label to forge_create_labelTimeline
Total agent cost: ~$21.33 (code: $3.88, review: $14.20, fix: $3.25) What went well
What could go better
Autonomy assessmentThe human approved with no comments on the same commit the review agent last reviewed. The review agent's remaining findings (medium behavioral change, low error handling) were advisory — the human's approval confirms they were appropriately informational rather than blocking. However, the protected-path constraint correctly required human sign-off for changes under Proposals filed
|
forge_ensure_label() called
gh label createdirectly, which fails on GitLab where GH_TOKEN is not set. Replace the hardcoded gh CLI block with a call to forge_create_label(), which already has correct implementations for both GitHub and GitLab forges.The error-handling logic (already-exists suppression, warning sanitization) is no longer needed at this layer — forge_create_label handles errors internally (GitHub uses --force for upsert, GitLab ignores 409 conflicts).
Update labels-test.sh to mock forge_create_label instead of gh, and remove tests for behavior now owned by forge_create_label (error handling, repo-var fallback, force-flag check). Rebuild bundled scripts via make script-build.
Closes #1122
Post-script verification
agent/1122-forge-ensure-label-fix)c4e059f9f2b8c48e13b3845992b9b774d41b5de7..HEAD)