Skip to content

fix(#6718): add stages to root CI and skip workflow creation - #6724

Merged
ggallen merged 2 commits into
mainfrom
agent/6718-fix-gitlab-stages-workflow
Aug 28, 2026
Merged

fix(#6718): add stages to root CI and skip workflow creation#6724
ggallen merged 2 commits into
mainfrom
agent/6718-fix-gitlab-stages-workflow

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

  • Add fullsend stages to root stages: array: When an existing .gitlab-ci.yml defines stages:, GitLab's deep merge (which only applies to hash maps) silently drops the stages from the included fullsend-pipeline.yml. mergeStages() now appends dispatch, poll, and agent directly to the root file's stages: array, with deduplication.
  • Stop creating workflow: block when none exists: Previously mergeWorkflow() unconditionally created a workflow: block with only fullsend's three rules (merge_request_event, schedule, api), which gated all pipelines and broke push-triggered CI. Now when no workflow: block exists, it is left absent — fullsend's jobs self-filter via their own rules: entries.
  • Add removeStages() for clean uninstall: UnmergeGitLabCI now removes fullsend's stages during uninstall, matching the symmetry of include and workflow rule removal.

Testing

  • Updated TestMergeGitLabCI_ExistingWithoutWorkflow to verify no workflow block is created and fullsend stages are appended
  • Added TestMergeGitLabCI_StagesAddedToExistingArray — verifies stages are appended to existing array
  • Added TestMergeGitLabCI_StagesDeduplicatesExisting — verifies no duplicate stages
  • Added TestMergeGitLabCI_NoWorkflowBlockCreatedWhenAbsent — verifies no workflow block when absent
  • Added TestMergeGitLabCI_NoStagesKeyLeftAlone — verifies no stages key created when absent
  • Added TestMergeGitLabCI_StagesIdempotent — verifies idempotency with all stages present
  • Added TestUnmergeGitLabCI_RemovesFullsendStages — verifies stage removal preserves user stages
  • Added TestUnmergeGitLabCI_RemovesStagesKeyWhenEmpty — verifies stages key removed when empty
  • Updated TestMergeGitLabCI_PreservesComments to also check stage addition
  • All existing tests continue to pass

Closes #6718

Post-script verification

  • Branch is not main/master (agent/6718-fix-gitlab-stages-workflow)
  • Secret scan passed (gitleaks — 6ca76244aaaa69a95badee6a064341689f879aaf..HEAD)
  • PR body secret scan passed (gitleaks — no-git)

@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner August 28, 2026 03:35
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Aug 28, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 28, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 3:37 AM UTC · Completed 3:52 AM UTC

Commit: a32b037 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.56

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/repos/gitlabci.go 94.44% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@fullsend-ai-review fullsend-ai-review Bot added the risk/low PR risk: low label Aug 28, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 28, 2026

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Score unchanged at 2 vs prior assessment: Tier 1 signals are identical (3 files, 272 lines, 0.33 test ratio, bot author), gitlabci.go gained one additional 30d commit but fix-commit rate and file age remain consistent with active stabilization; well-scoped high-priority bug fix with clear acceptance criteria keeps composite at moderate.

Previous run

Risk Assessment: moderate (2/5)

Details

Score increased from 1 to 2 vs prior assessment: PR now touches 3 files with 272 lines changed, test ratio dropped from 0.50 to 0.33, and gitlabci.go is a young file (~90 days) with 67% fix-commit rate in 90 days indicating active stabilization; still a well-scoped bug fix but the expanded scope and regression history on a maturing file warrant moderate rather than low risk.

Previous run (2)

Risk Assessment: low (1/5)

Details

Low-risk focused bug fix: 2 files changed with 50% test coverage ratio, no protected or security-sensitive paths, scoped precisely to the reported issue; the only notable signal is prior regression history on the file and lack of a rollback mechanism, but the strong test additions and narrow scope keep overall risk low.

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 28, 2026

Copy link
Copy Markdown

Looks good to me

Previous run

Looks good to me

Previous run (2)

Review

Findings

Medium

  • [stale-teardown-instructions] docs/guides/getting-started/operations.md:76 — The manual GitLab teardown instructions enumerate items to remove from .gitlab-ci.yml (include entry, workflow rules, auto_cancel block) but do not mention the fullsend stages (dispatch, poll, agent) that MergeGitLabCI now appends to the root stages: array. Users performing manual removal will leave orphaned stage entries.
    Remediation: Add "the fullsend stages (dispatch, poll, agent)" to the manual removal checklist.

Low

  • [stale-behavioral-description] docs/guides/getting-started/operations.md:78 — The Note states "During install, fullsend sets workflow.auto_cancel.on_new_commit: none when no existing value is present." After this PR, mergeWorkflow() is a no-op when no workflow: block exists, so auto_cancel is only configured when the repo already has a workflow block. The note's wording implies it is always set during install, which is no longer accurate for repos without a pre-existing workflow: block.
    Remediation: Qualify the note to mention this only applies when a workflow: block already exists.

  • [naming-consistency] internal/repos/gitlabci.go:398 — The loop variable s in removeStages (for _, s := range fullsendStages) is less descriptive than the stage variable used in the corresponding mergeStages function for the same fullsendStages iteration. For internal consistency between the paired functions, stage would be more aligned.
    Remediation: Rename s to stage in the removeStages loop.


Labels: PR fixes GitLab CI installation merge logic (stages and workflow block handling)

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment component/install CLI install and app setup type/bug Confirmed defect in existing behavior labels Aug 28, 2026
@ggallen ggallen added the fullsend-fix Enables automatic bot-triggered fix runs on human-authored PRs label Aug 28, 2026
@ggallen

ggallen commented Aug 28, 2026

Copy link
Copy Markdown
Member

/fsi-fix - Rebase, fix all review issues, respond to and resolve all conversations.

@ggallen

ggallen commented Aug 28, 2026

Copy link
Copy Markdown
Member

/fs-fix - Rebase, fix all review issues, respond to and resolve all conversations.

@fullsend-ai-coder

fullsend-ai-coder Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 1:08 PM UTC · Completed 1:15 PM UTC

Commit: a32b037 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $1.55

fullsend-ai-coder Bot added a commit that referenced this pull request Aug 28, 2026
- Add fullsend stages (dispatch, poll, agent) to the manual GitLab
  teardown checklist in operations.md [stale-teardown-instructions]
- Qualify the auto_cancel note to clarify it only applies when a
  workflow: block already exists [stale-behavioral-description]
- Rename loop variable s to stage in removeStages for consistency
  with mergeStages [naming-consistency]

Addresses review feedback on #6724
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 Fix agent — iteration 1 (human-triggered)

Addressed all 3 review findings: updated manual teardown checklist to include fullsend stages, qualified the auto_cancel note for repos without a workflow: block, and renamed loop variable for naming consistency between mergeStages and removeStages.

Fixed (3):

  1. stale-teardown-instructions: manual GitLab teardown checklist missing fullsend stages (docs/guides/getting-started/operations.md): Added the fullsend stages (dispatch, poll, agent) to the manual removal checklist in the GitLab teardown instructions
  2. stale-behavioral-description: auto_cancel note implies it is always set during install (docs/guides/getting-started/operations.md): Qualified the auto_cancel note to clarify it only applies when the repo's .gitlab-ci.yml already contains a workflow: block
  3. naming-consistency: loop variable s in removeStages inconsistent with mergeStages (internal/repos/gitlabci.go): Renamed loop variable s to stage in removeStages to match the naming used in mergeStages

Tests: passed

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push
    Updated by fullsend fix agent

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown

Site preview

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

Commit: ec5be0fbd5e5175b6d0327170efe4dbb32130d4e

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 28, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:17 PM UTC · Completed 1:32 PM UTC

Commit: 8aa04b4 · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.00

@fullsend-ai-review fullsend-ai-review Bot added risk/moderate PR risk: moderate and removed risk/low PR risk: low labels Aug 28, 2026
fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added ready-for-merge All reviewers approved — ready to merge and removed requires-manual-review Review requires human judgment labels Aug 28, 2026
MergeGitLabCI had two bugs that broke existing CI when installing
fullsend into repos with an existing .gitlab-ci.yml:

1. Stages not added to root file: GitLab's deep merge only applies
   to hash maps — stages: is a YAML array and is overwritten, not
   merged (gitlab-org/gitlab#29980). When the root file already
   defined stages:, fullsend's stages (dispatch, poll, agent) from
   the included pipeline file were silently dropped. Added
   mergeStages() to append fullsend's stages directly to the root
   file's stages: array with deduplication.

2. Workflow block created when none exists: mergeWorkflow()
   unconditionally created a workflow: block with only fullsend's
   three rules, which gated all pipelines and killed push-triggered
   CI. Changed mergeWorkflow() to leave the workflow: block absent
   when none exists — fullsend's jobs self-filter via their own
   rules: entries.

Also added removeStages() to UnmergeGitLabCI for clean uninstall,
and removed the now-unused buildWorkflowNode() function.

Note: golangci-lint was not available in the sandbox. go vet and
gofmt passed. pre-commit could not fetch remote hook repos
(HTTP 403); hooks were run directly (gofmt, go vet) and passed.

Closes #6718
- Add fullsend stages (dispatch, poll, agent) to the manual GitLab
  teardown checklist in operations.md [stale-teardown-instructions]
- Qualify the auto_cancel note to clarify it only applies when a
  workflow: block already exists [stale-behavioral-description]
- Rename loop variable s to stage in removeStages for consistency
  with mergeStages [naming-consistency]

Addresses review feedback on #6724
@ggallen
ggallen force-pushed the agent/6718-fix-gitlab-stages-workflow branch from 8aa04b4 to ec5be0f Compare August 28, 2026 13:38
@ggallen
ggallen enabled auto-merge August 28, 2026 13:39
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 28, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:40 PM UTC · Completed 1:56 PM UTC

Commit: ec5be0f · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $5.67

Merged via the queue into main with commit 6bdc0fd Aug 28, 2026
42 checks passed
@ggallen
ggallen deleted the agent/6718-fix-gitlab-stages-workflow branch August 28, 2026 14:01
@fullsend-ai-retro

fullsend-ai-retro Bot commented Aug 28, 2026

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 2:03 PM UTC · Completed 2:17 PM UTC

Commit: ec5be0f · View workflow run →

Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $4.60

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #6724 — add stages to root CI and skip workflow creation

This PR fixed two GitLab CI merge-logic bugs (#6718): stages not added to the root .gitlab-ci.yml array, and an unwanted workflow: block being created when none existed. The full agent pipeline ran cleanly with one rework cycle.

Timeline

Time (UTC) Event Cost
03:04 Issue #6718 filed by triage bot (split from #6717)
03:17–03:24 Triage (run 33138428259): confirmed both bugs, applied labels $0.80
03:24–03:35 Code (run 33138772529): created PR with fix + 8 tests $2.37
03:35–03:52 Review #1 (run 33139329081): found 3 issues (1 medium, 2 low) $4.56
13:06–13:15 Fix (run 33173893269): addressed all 3 findings $1.55
13:15–13:32 Review #2 (run 33174585750): approved $5.00
13:38 Human rebased branch (force-push, no code change)
13:39 Human approved
13:38–13:56 Review #3 (run 33176354922): approved (rebase-triggered) $5.67
14:01 Merged
Total $19.95

What went well

  • Triage quality: Accurately confirmed both bugs by reading the source, proposed test cases, and applied correct labels — all in 7 minutes.
  • Code agent quality: Produced a solid fix with good test coverage (6 new tests + 2 updated) in ~10 minutes. The core logic changes (mergeStages, conditional workflow creation, removeStages for uninstall) were correct.
  • Review quality: All 3 findings were legitimate and actionable — stale teardown docs, inaccurate behavioral description, naming inconsistency.
  • Fix agent efficiency: Addressed all 3 findings in 9 minutes at $1.55.
  • 94.4% patch coverage reported by Codecov.

Observations and existing-issue evidence

  1. Code agent missed doc updates despite explicit AGENTS.md guidance — 2 of 3 review findings (stale teardown instructions and stale auto_cancel description in operations.md) were caused by the code agent not grepping docs/ for references when changing CLI behavior, as instructed in AGENTS.md. This is supporting evidence for #4866 (code agent doc-update compliance) and #6030 (doc-update guidance for CLI changes).

  2. Rebase-triggered redundant review — Review docs: Add codebase context problem document and trim CLAUDE.md #3 ($5.67) was triggered by a human rebase that changed no code. Supporting evidence for #4401 (detect rebase-only force-pushes and skip re-review).

  3. Review used COMMENTED instead of CHANGES_REQUESTED — The review agent found 3 issues including a medium-severity finding but submitted as COMMENTED rather than CHANGES_REQUESTED, meaning branch protection would not block merge. Supporting evidence for #870 and #1453 (medium findings should block or escalate).

  4. Duplicate initial review dispatch — Run 33139330077 was a cancelled duplicate of the initial review. Supporting evidence for #1452 (deduplicate review dispatches for same HEAD SHA).

Assessment

The pipeline worked as designed. The single rework cycle was caused by the code agent missing doc updates (a known gap with existing tracking issues), and the review agent correctly caught the misses. The main structural inefficiency was the $5.67 spent on a rebase-triggered re-review. All improvement opportunities identified are already tracked by existing open issues. No new proposals are warranted.

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 fullsend-fix Enables automatic bot-triggered fix runs on human-authored PRs ready-for-merge All reviewers approved — ready to merge ready-for-review Triggers review agent dispatch risk/moderate PR risk: moderate type/bug Confirmed defect in existing behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(gitlab): MergeGitLabCI drops stages and creates unwanted workflow block

1 participant