Skip to content

feat(#5187): provision pipeline labels during enrollment - #5564

Closed
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/5187-provision-labels
Closed

feat(#5187): provision pipeline labels during enrollment#5564
fullsend-ai-coder[bot] wants to merge 1 commit into
mainfrom
agent/5187-provision-labels

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

Add label provisioning during enrollment so newly enrolled repos have all pipeline-critical labels from the start. Each harness YAML now declares the labels its post-scripts require, and the install flow creates them idempotently in the target repo.

Related Issue

Fixes #5187

Changes

  • Add LabelDef struct and labels field to harness.Harness — each agent can declare required labels
  • Add CreateLabel to forge.Client interface with GitHub and GitLab implementations (idempotent — existing labels are not modified)
  • Add scaffold.CollectHarnessLabels() to extract and deduplicate labels from embedded harness YAML files
  • Add label provisioning step to repos.Install() (runs between scaffold commit and variable writes)
  • Add label declarations to code, review, triage, and fix harness files covering all 9 pipeline labels
  • Add FakeClient.CreateLabel for testing
  • Add tests: TestCollectHarnessLabels, TestInstall_ProvisionLabels, TestInstall_LabelCreateError

Testing

  • go build ./... passes
  • go vet passes on affected packages
  • go test passes on all affected packages (scaffold, repos, forge, harness)
  • New tests verify label collection from embedded harness YAML
  • New tests verify labels are provisioned during install and errors propagate correctly
  • scan-secrets passes on all changed files

Checklist

  • PR title follows Conventional Commits
  • Not a breaking change (additive field, new forge method, new install step)

Closes #5187

Post-script verification

  • Branch is not main/master (agent/5187-provision-labels)
  • Secret scan passed (gitleaks — 1863fc6d4268946ee035cac06ced81e173e14a6a..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Pre-commit hooks passed (authoritative run on runner)
  • Tests ran inside sandbox

Each harness YAML now declares the labels its post-scripts require
via a new `labels` field. During `fullsend admin install`, the
install flow reads these declarations from the embedded scaffold
and creates them in the target repo using `CreateLabel` (idempotent
— existing labels are left unchanged).

This ensures that newly enrolled repos have all pipeline-critical
labels (ready-for-review, ready-for-merge, requires-manual-review,
ready-to-code, triaged, rejected, needs-human, fullsend-fix,
fullsend-no-fix) from the start, rather than relying on post-scripts
to create them reactively. The approach is agent-driven — adding a
new agent with new label requirements only requires updating that
agent's harness YAML.

Changes:
- Add LabelDef struct and labels field to harness.Harness
- Add CreateLabel to forge.Client interface (GitHub + GitLab impls)
- Add scaffold.CollectHarnessLabels() to extract labels from
  embedded harness YAML files
- Add label provisioning step to repos.Install() between scaffold
  commit and variable writes
- Add label declarations to code, review, triage, and fix harnesses
- Add tests for label collection and install-time provisioning

Closes #5187
@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner July 24, 2026 09:55
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Jul 24, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Jul 24, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 9:57 AM UTC · Completed 10:13 AM UTC
Commit: b0c0c0c · View workflow run →

@github-actions

Copy link
Copy Markdown

Site preview

Preview: https://a8585b1c-site.fullsend-ai.workers.dev

Commit: b0c0c0c9de9932fc0eb215d2a69d1763db7091b4

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 32.35294% with 46 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/forge/fake.go 0.00% 13 Missing ⚠️
internal/forge/gitlab/issue.go 0.00% 13 Missing ⚠️
internal/forge/github/github.go 0.00% 12 Missing ⚠️
internal/scaffold/labels.go 71.42% 3 Missing and 3 partials ⚠️
internal/repos/install.go 77.77% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@fullsend-ai-review

Copy link
Copy Markdown

Review

Findings

Low

  • [stale-reference] internal/repos/install.go:275 — Duplicate step number after insertion. The PR inserts a new Step 6 (labels) and renumbers the old Step 6 (vars) to Step 7, but does not renumber the existing Step 7 (secrets) to Step 8. After merge there will be two comments reading // Step 7.
    Remediation: Renumber // Step 7: Write repository secrets. to // Step 8: Write repository secrets.

  • [field-ordering-and-comments] internal/forge/fake.go:238CreatedLabels field is positioned before the // Call recorders section but logically belongs within it (all other Created*/Deleted*/Updated* fields appear after that comment). Additionally, the field has a misleading two-line comment: the first line (LabelRecord records a label creation call.) describes the type rather than the field, duplicating the type's own godoc.
    Remediation: Move CreatedLabels into the // Call recorders block alongside other Created* fields. Remove the duplicate type-description comment.


Labels: PR adds label provisioning to the repos install flow and extends the harness schema with a labels field

Comment thread internal/repos/install.go
if len(harnessLabels) > 0 {
progress(repoFullName, "labels", fmt.Sprintf("Provisioned %d pipeline labels", len(harnessLabels)))
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] stale-reference

Duplicate step number after insertion. The PR inserts a new Step 6 (labels) and renumbers the old Step 6 (vars) to Step 7, but does not renumber the existing Step 7 (secrets) to Step 8. After merge there will be two comments reading '// Step 7'.

Suggested fix: Renumber '// Step 7: Write repository secrets.' to '// Step 8: Write repository secrets.'

Comment thread internal/forge/fake.go
@@ -233,6 +238,10 @@ type FakeClient struct {
// Annotations for GetWorkflowRunAnnotations.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[low] field-ordering-and-comments

CreatedLabels field is positioned before the '// Call recorders' section but logically belongs within it (all other Created*/Deleted*/Updated* fields appear after that comment). Additionally, the field has a misleading two-line comment: the first line describes the type rather than the field, duplicating the type's own godoc.

Suggested fix: Move CreatedLabels into the '// Call recorders' block alongside other Created* fields. Remove the duplicate type-description comment.

@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge component/install CLI install and app setup type/feature New capability request labels Jul 24, 2026
@rh-hemartin

Copy link
Copy Markdown
Member

Harnesses will be removed from here, remove their changes (left for @maruiz93 to do as assignee, feel free to use the fix agent).

@rh-hemartin

Copy link
Copy Markdown
Member

As per the discussion we had yesterday on our meeting, we can close this until we decide the refactor the thing.

@rh-hemartin
rh-hemartin deleted the agent/5187-provision-labels branch July 30, 2026 07:24
@fullsend-ai-retro

fullsend-ai-retro Bot commented Jul 30, 2026

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 7:26 AM UTC · Completed 7:49 AM UTC
Commit: b0c0c0c · View workflow run →

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #5564 — provision pipeline labels during enrollment

Outcome: PR closed without merge after human reviewer identified an architectural conflict with ongoing harness extraction work.

Timeline

  1. 2026-07-02 — Plan document docs/plans/agent-extraction-to-agents-repo.md created, documenting the intention to extract all agent files (including harness YAMLs) from the scaffold into fullsend-ai/agents.
  2. 2026-07-16 — Issue #5187 filed by the retro bot: enrollment scaffold should provision pipeline labels.
  3. 2026-07-22 — Triage agent ran on Enrollment scaffold should provision required workflow labels in target repos #5187, labeling it priority/high and noting related issue Support agent setup scripts for one-time prerequisite provisioning #583 (setup_script mechanism).
  4. 2026-07-24 09:37 — Code agent ran ($9.23, 117 turns). Created PR feat(#5187): provision pipeline labels during enrollment #5564 adding labels declarations to harness YAML files under internal/scaffold/fullsend-repo/harness/ and a new CreateLabel forge interface method.
  5. 2026-07-24 09:56–10:13 — Review agent ran ($5.21, 45 turns). Dispatched 4 sub-agents (correctness, style-conventions, intent-coherence, docs-currency) plus a challenger. Approved with 2 low-severity findings (step numbering, field ordering).
  6. 2026-07-24 10:20 — Human reviewer rh-hemartin commented: harnesses will be removed from this location, changes need rework.
  7. 2026-07-24 17:44 — PR #5425 merged, removing scaffold agent fallback infrastructure.
  8. 2026-07-28 — PR #5552 merged, deleting the scaffold harness YAML files that PR feat(#5187): provision pipeline labels during enrollment #5564 modified.
  9. 2026-07-30rh-hemartin closed PR feat(#5187): provision pipeline labels during enrollment #5564 citing a team decision to defer pending the refactor.

Total wasted cost: ~$14.44 ($9.23 code + $5.21 review) on a PR that was architecturally misaligned with a planned refactoring documented 22 days earlier.

Root cause

Neither the code agent nor the review agent discovered docs/plans/agent-extraction-to-agents-repo.md, which explicitly listed the scaffold harness YAML files as targets for deletion. The review agent's intent-coherence sub-agent read ADR 0045 and forge abstraction docs, but did not search docs/plans/ for active migration/refactoring plans affecting the modified paths. The code agent similarly did not fetch the related issue #583 mentioned by the triage summary, which would have provided context about the broader setup_script direction.

Evidence for existing issues (not filing new proposals)

Proposals filed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/install CLI install and app setup ready-for-merge All reviewers approved — ready to merge ready-for-review Triggers review agent dispatch type/feature New capability request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enrollment scaffold should provision required workflow labels in target repos

2 participants