Skip to content

feat(#5844): make repos install/uninstall the single path for GitLab - #5845

Merged
ggallen merged 1 commit into
mainfrom
agent/5844-gitlab-repos-install-uninstall
Aug 3, 2026
Merged

ggallen merged 1 commit into
mainfrom
agent/5844-gitlab-repos-install-uninstall

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

Phase 4 of GitLab integration — make repos install and repos uninstall the single installation path for GitLab repos, eliminating separate admin gitlab commands.

Key changes:

  • Remove the "GitLab scaffold generation is not yet implemented" error from repos install
  • Add forge-aware install/uninstall logic: GitLab repos get different variables (FULLSEND_CREDENTIAL_MODE, FULLSEND_FORGE, etc.), no WIF/secrets, and GitLab CI scaffold files
  • New internal/cli/repos_gitlab.go with helper functions for bot token setup, pipeline schedule creation, and cleanup
  • Add --gitlab-bot-token flag for free-tier GitLab instances without project access token support
  • Fix \b word-boundary in GL ref patterns to prevent false positives on head_ref:/base_ref:
  • Add CreateProjectAccessToken, ListProjectAccessTokens, RevokeProjectAccessToken, and IsEnterprise methods to the GitLab client

Testing

  • Updated checkInstallComponents tests to include forgeName parameter
  • Added GitLab-specific install tests (fresh install, no WIF required, forge-aware vars/secrets)
  • Added checkInstallComponents tests for GitLab (fully installed, no secrets needed, missing variable)
  • Added ref pattern false positive tests for both workflow ref and shim ref patterns
  • Added cleanupGitLabPipelineSchedules and cleanupGitLabBotToken tests
  • All internal/repos/..., internal/scaffold/..., internal/forge/... tests pass
  • Pre-existing CLI test failures (TestStartFetchService_*, TestPostScriptEnv_*) are unrelated to this change

Closes #5844

Post-script verification

  • Branch is not main/master (agent/5844-gitlab-repos-install-uninstall)
  • Secret scan passed (gitleaks — c1a87a55225209ebfd7e561316618cca4bb344c7..HEAD)
  • PR body secret scan passed (gitleaks — no-git)

@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team August 3, 2026 02:36
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Aug 3, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:37 AM UTC · Completed 2:53 AM UTC
Commit: cbd2cea · View workflow run →

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Review

Findings

Low

  • [edge-case] internal/cli/repos_gitlab.go:175 — In cleanupGitLabBotToken, if multiple active fullsend-bot tokens exist and revoking one fails but a subsequent one succeeds, revoked is set to true. The user sees "Revoked bot access token" with no indication that an orphaned token remains. Individual failure warnings are printed via StepWarn.

  • [logic-error] internal/cli/repos.go:717 — In the GitLab post-install loop, a GetRepo failure causes pipeline schedule setup to be skipped but does not increment postInstallFailed. The bot token (the critical piece) was already set up successfully. The StepWarn informs the user, but the install summary counts this repo as fully installed despite lacking pipeline schedules.

  • [missing-test] internal/repos/install_test.go — No integration-level test exercises the full BatchInstall() function through the GitLab path. Individual GitLab Install() tests cover the single-repo path well, but the batch orchestrator's GitLab-specific logic (forge resolution, runner tag propagation, forge-aware checkInstallComponents) is only tested indirectly.

  • [fail-open] internal/cli/repos.go:1048 — When *gl.LiveClient type assertion fails during uninstall, cleanupGitLabBotToken is skipped. The FULLSEND_FORGE_TOKEN CI/CD variable is deleted but the underlying project access token remains active with Maintainer-level API scope for up to 1 year. Pipeline schedule cleanup still proceeds via the forge.Client interface. The inline comment documents this limitation.

  • [fail-open] internal/cli/repos_gitlab.go:29 — When ListProjectAccessTokens fails during setupGitLabBotToken, the error is logged as a warning and the function proceeds to create a new token without revoking existing ones. This is intentional fail-forward behavior for free-tier instances that return 403.

Previous run

Review

Findings

Low

  • [logic-error] internal/cli/repos.go:712 — In the GitLab post-install loop, a GetRepo failure causes the entire post-install to be skipped (including bot token setup), even though setupGitLabBotToken does not need targetRepo. Since bot token setup is described as critical ("the repo is non-functional without FULLSEND_FORGE_TOKEN"), a transient GetRepo failure unnecessarily prevents bot token setup. The GetRepo result (targetRepo.DefaultBranch) is only used for setupGitLabPipelineSchedules.

  • [yaml-injection] internal/scaffold/installfiles.go:98 — Runner tags are interpolated into scaffold YAML templates via strings.ReplaceAll. The formatRunnerTags function uses Go's %q formatting which provides adequate escaping, but validateDefaultValue only rejects empty tag segments without enforcing a character allowlist. Adding ^[a-zA-Z0-9._-]+$ validation per tag would provide defense-in-depth.

  • [edge-case] internal/cli/repos_gitlab.go:122 — In cleanupGitLabBotToken, if multiple active fullsend-bot tokens exist and revoking one fails but a subsequent one succeeds, revoked is set to true. The user sees "Revoked bot access token" with no indication that an orphaned token remains. Individual failure warnings are printed via StepWarn.

  • [missing-test] internal/repos/install_test.go — No integration-level test exercises the full BatchInstall() function through the GitLab path. Individual GitLab Install() tests cover the single-repo path well, but the batch orchestrator's GitLab-specific logic (forge resolution, runner tag propagation, forge-aware checkInstallComponents) is only tested indirectly.

  • [fail-open] internal/cli/repos.go:1040 — When *gl.LiveClient type assertion fails during uninstall, cleanupGitLabBotToken is skipped. The FULLSEND_FORGE_TOKEN CI/CD variable is deleted but the underlying project access token remains active with Maintainer-level API scope for up to 1 year. Pipeline schedule cleanup still proceeds via the forge.Client interface. The inline comment documents this limitation.

  • [fail-open] internal/cli/repos_gitlab.go:31 — When ListProjectAccessTokens fails during setupGitLabBotToken, the error is logged as a warning and the function proceeds to create a new token without revoking existing ones. This is intentional fail-forward behavior for free-tier instances that return 403.

Previous run (2)

Review

Findings

Low

  • [edge-case] internal/cli/repos_gitlab.go:122 — In cleanupGitLabBotToken, if multiple active fullsend-bot tokens exist and revoking one fails but a subsequent one succeeds, revoked is set to true, potentially masking orphaned tokens. Individual failure warnings are printed but the summary message may give a false sense of completeness.

  • [error-handling-idiom] internal/repos/uninstall.go — requiredVarsForForge, UninstallVarsForForge, UninstallSecretsForForge, requiredSecretsForForge, and ScaffoldPathsForForge use bare if/else that silently falls through to GitHub defaults for unrecognized forge values, while installVarsForForge and BuildScaffoldFiles use exhaustive switch statements with a default error case.

  • [misleading-output] internal/cli/repos_gitlab.go:100 — cleanupGitLabPipelineSchedules reports "Removed N pipeline schedule(s)" where N is len(toDelete) — the count of schedules targeted for deletion, not the count actually deleted. When DeletePipelineSchedule calls fail, the summary overstates removals.

  • [missing-test] internal/repos/install_test.go — No integration-level test exercises the full BatchInstall() function through the GitLab path. Individual GitLab install functions are well-tested but the end-to-end flow through BatchInstall with a GitLab-forge manifest is untested.

  • [fail-open] internal/cli/repos.go:1040 — When *gl.LiveClient type assertion fails during uninstall, cleanupGitLabBotToken is skipped. The FULLSEND_FORGE_TOKEN CI/CD variable is deleted but the underlying project access token remains active with Maintainer-level API scope for up to 1 year. The inline comment acknowledges this limitation.

  • [fail-open] internal/cli/repos_gitlab.go:31 — When ListProjectAccessTokens fails during setupGitLabBotToken, the error is logged as a warning and the function proceeds to create a new token without revoking old ones. This is intentional (fail-forward for free-tier instances that return 403).

  • [excessive-token-scope] internal/cli/repos_gitlab.go:48 — Project access token created with api scope and Maintainer (level 40) access. The code comment documents the justification: CI/CD variable management, pipeline schedule creation, and merge request operations.

  • [token-lifetime] internal/cli/repos_gitlab.go:45 — Project access token created with 1-year expiry, no automated rotation. Re-install serves as ad-hoc rotation by revoking existing tokens before creating new ones.

  • [yaml-injection] internal/scaffold/installfiles.go:98 — Runner tags are interpolated into scaffold YAML via strings.ReplaceAll. The formatRunnerTags function uses Go's %q formatting which escapes newlines and quotes, mitigating YAML injection in practice. Tags are set by admins via repos set-default.

  • [scope-creep] internal/scaffold/fullsend-repo-gitlab/.gitlab/ci/fullsend-agent.yml — Adds __RUNNER_TAGS__ placeholder to GitLab scaffold templates. The issue says "Changes to scaffold templates — they stay as-is" under NOT in scope, but the runner image stays as-is and the issue's Requirements section calls for CollectGitLabPerRepoInstallFiles(runnerTags) which necessitates template placeholders.

  • [stale-doc] docs/plans/repos-command-consolidation.md:104 — Scenario 12 states "GitLab repo — Not yet implemented. Return a clear error." This PR implements GitLab repo support, removing that error.

Previous run (3)

Review

Findings

Medium

  • [error-handling] internal/cli/repos.go:700 — GitLab post-install bot token and pipeline schedule failures are logged as warnings but the install is reported as successful. If setupGitLabBotToken fails, the repo will have scaffold files and CI/CD variables but no FULLSEND_FORGE_TOKEN, making agent pipelines non-functional at runtime. Unlike the GitHub path where secret writes are part of the atomic Install() flow and abort on failure, the GitLab bot token setup is a separate post-install step that swallows errors. The operator does receive warning output, but the install summary counts the repo as "installed".

Low

  • [missing-test] internal/repos/install_test.go — No integration-level test exercises the full BatchInstall() function through the GitLab path (Forge=ForgeGitLab). Individual helpers (installVarsForForge, BuildScaffoldFiles, checkInstallComponents) are tested, and the Install() function is tested directly for GitLab, but the batch orchestrator flow is only tested with ForgeGitHub.

  • [fail-open] internal/cli/repos.go — When *gl.LiveClient type assertion fails during uninstall, cleanupGitLabBotToken is skipped. The FULLSEND_FORGE_TOKEN CI/CD variable is deleted (as part of gitlabUninstallVars), but the underlying project access token remains active with Maintainer-level API scope for up to 1 year. The inline comment acknowledges this limitation.

  • [fail-open] internal/cli/repos_gitlab.go:31 — When ListProjectAccessTokens fails during setupGitLabBotToken, the error is logged as a warning and the function proceeds to create a new token without revoking old ones. This can leave orphaned active tokens. The behavior is intentional (fail-forward for free-tier instances that return 403).

  • [excessive-token-scope] internal/cli/repos_gitlab.go:48 — Project access token created with api scope and Maintainer (level 40) access. The code comment documents the justification: CI/CD variable management, pipeline schedule creation, and merge request operations. GitLab does not offer a finer-grained scope.

  • [token-lifetime] internal/cli/repos_gitlab.go:45 — Project access token created with 1-year expiry, no automated rotation. Re-install serves as ad-hoc rotation by revoking existing tokens before creating new ones.

  • [edge-case] internal/cli/repos_gitlab.go:122 — In cleanupGitLabBotToken, if multiple active fullsend-bot tokens exist and revoking one fails but a subsequent one succeeds, revoked is set to true and the function prints "Revoked bot access token", potentially masking orphaned tokens. Individual failures are reported via StepWarn.

  • [yaml-injection] internal/scaffold/installfiles.go:98 — Runner tags are interpolated into scaffold YAML via strings.ReplaceAll. The formatRunnerTags function uses Go's %q formatting which escapes newlines and quotes, mitigating YAML injection in practice. Tags are set by admins via repos set-default. Adding character validation in validateDefaultValue to restrict tags to [a-zA-Z0-9._-] would provide defense-in-depth.

  • [scope-creep] internal/config/config.go — Adds Forge field to perRepoConfig and ConfigForge() to the PerRepoConfigReader interface. Not in the issue's file list, but a logical necessity for forge-aware config resolution.

  • [naming-convention] internal/repos/uninstall.go — UninstallVarsForForge, UninstallSecretsForForge, ScaffoldPathsForForge are exported while install counterparts (installVarsForForge, installSecretsForForge) are unexported. The asymmetry is intentional — uninstall functions are called cross-package from internal/cli.

  • [error-handling-idiom] internal/repos/uninstall.go — requiredVarsForForge, UninstallVarsForForge etc. use bare if/else that silently falls through to GitHub defaults for unrecognized forge values, while installVarsForForge and BuildScaffoldFiles use exhaustive switch statements with a default error case.

  • [stale-doc] docs/plans/repos-command-consolidation.md:104 — Scenario 12 states "GitLab repo — Not yet implemented. Return a clear error." This PR removes that error and adds full GitLab install/uninstall support.

  • [stale-doc] docs/plans/repos-management.md:461 — GitLabForgeInfra struct definition shows only the URL field. This PR adds RunnerTags []string.

Previous run (4)

Review

Findings

Low

  • [missing-test] internal/repos/install_test.go — No integration-level test exercises the full Install() function through the GitLab path (Forge=ForgeGitLab). Individual helpers (installVarsForForge, BuildScaffoldFiles, checkInstallComponents) are tested, but the orchestrator flow — including the ReuseSecrets bypass for WIF validation, GitLab-specific variable writes, and secret-step skip — is only tested with ForgeGitHub.

  • [fail-open] internal/cli/repos.go — When *gl.LiveClient type assertion fails during uninstall, cleanupGitLabBotToken is skipped. The FULLSEND_FORGE_TOKEN CI/CD variable is deleted (as part of gitlabUninstallVars), but the underlying project access token remains active with Maintainer-level API scope for up to 1 year. The inline comment acknowledges this limitation.

  • [fail-open] internal/cli/repos_gitlab.go:31 — When ListProjectAccessTokens fails during setupGitLabBotToken, the error is logged as a warning and the function proceeds to create a new token without revoking old ones. This can leave orphaned active tokens. The behavior is intentional (fail-forward for free-tier instances that return 403).

  • [excessive-token-scope] internal/cli/repos_gitlab.go:48 — Project access token created with api scope and Maintainer (level 40) access. The code comment documents the justification: CI/CD variable management, pipeline schedule creation, and merge request operations. GitLab does not offer a finer-grained scope.

  • [token-lifetime] internal/cli/repos_gitlab.go:45 — Project access token created with 1-year expiry, no automated rotation. Re-install serves as ad-hoc rotation by revoking existing tokens before creating new ones.

Previous run (5)

Review

Findings

Low

  • [missing-test] internal/repos/install_test.go — No integration-level test exercises the full Install() function through the GitLab path (Forge=ForgeGitLab). Individual helpers (installVarsForForge, BuildScaffoldFiles, checkInstallComponents) are tested, but the orchestrator flow — including the ReuseSecrets bypass for WIF validation, GitLab-specific variable writes, and secret-step skip — is only tested with ForgeGitHub.

  • [fail-open] internal/cli/repos.go — When *gl.LiveClient type assertion fails during uninstall, cleanupGitLabBotToken is skipped. The FULLSEND_FORGE_TOKEN CI/CD variable is deleted (as part of gitlabUninstallVars), but the underlying project access token remains active with Maintainer-level API scope for up to 1 year. The inline comment acknowledges this limitation.

  • [fail-open] internal/cli/repos_gitlab.go:31 — When ListProjectAccessTokens fails during setupGitLabBotToken, the error is logged as a warning and the function proceeds to create a new token without revoking old ones. This can leave orphaned active tokens. The behavior is intentional (fail-forward for free-tier instances that return 403).

  • [excessive-token-scope] internal/cli/repos_gitlab.go:48 — Project access token created with api scope and Maintainer (level 40) access. The code comment documents the justification: CI/CD variable management, pipeline schedule creation, and merge request operations. GitLab does not offer a finer-grained scope.

  • [token-lifetime] internal/cli/repos_gitlab.go:45 — Project access token created with 1-year expiry, no automated rotation. Re-install serves as ad-hoc rotation by revoking existing tokens before creating new ones.

Previous run (6)

Review

Findings

Low

  • [missing-test] internal/repos/install_test.go — No integration-level test exercises the full Install() function through the GitLab path (Forge=ForgeGitLab). Individual helpers (installVarsForForge, BuildScaffoldFiles, checkInstallComponents) are tested, but the orchestrator flow — including the ReuseSecrets bypass for WIF validation, GitLab-specific variable writes, and secret-step skip — is only tested with ForgeGitHub.

  • [error-handling] internal/cli/repos_gitlab.go:91 — In setupGitLabPipelineSchedules, when ListPipelineSchedules fails (listErr != nil), the function silently skips cleanup of existing schedules and proceeds to create new ones. On re-install, this can leave orphaned schedules running alongside the new ones.

  • [fail-open] internal/cli/repos.go:1041 — When *gl.LiveClient type assertion fails during uninstall, cleanupGitLabBotToken is skipped. The FULLSEND_FORGE_TOKEN CI/CD variable is deleted, but the underlying project access token remains active with Maintainer-level API scope for up to 1 year. The inline comment acknowledges this limitation.

  • [fail-open] internal/cli/repos_gitlab.go:31 — When ListProjectAccessTokens fails during setupGitLabBotToken, the error is silently swallowed and the function proceeds to create a new token without revoking old ones. This can leave orphaned active tokens. The behavior is intentional (fail-forward for free-tier instances that return 403).

  • [excessive-token-scope] internal/cli/repos_gitlab.go:46 — Project access token created with api scope and Maintainer (level 40) access. The code comment documents the justification: CI/CD variable management, pipeline schedule creation, and merge request operations. GitLab does not offer a finer-grained scope.

  • [token-lifetime] internal/cli/repos_gitlab.go:43 — Project access token created with 1-year expiry, no automated rotation. Re-install serves as ad-hoc rotation by revoking existing tokens before creating new ones.

  • [secret-handling] internal/cli/repos_gitlab.go:25 — --gitlab-bot-token flag value may appear in process listings. FULLSEND_GITLAB_BOT_TOKEN env var support is provided as a safer alternative.

  • [export-consistency] internal/repos/uninstall.go — UninstallVarsForForge, UninstallSecretsForForge, and ScaffoldPathsForForge are exported while their install counterparts (installVarsForForge, installSecretsForForge) are unexported. The asymmetry is intentional — uninstall functions are called cross-package from internal/cli.

Previous run (7)

Review

Findings

High

  • [incorrect-variable-value] docs/guides/infrastructure/infrastructure-reference.md:250 — The GitLab per-repo variables section states FULLSEND_CREDENTIAL_MODE is set to "oidc", but the code (installVarsForForge in internal/repos/install.go) sets it to "variable". This is factually incorrect and would mislead operators inspecting or manually configuring GitLab repos.
    Remediation: Change the value from "oidc" to "variable".

  • [incorrect-variable-list] docs/guides/infrastructure/infrastructure-reference.md:249 — The GitLab per-repo variables section lists FULLSEND_MINT_URL, but the code does not install this variable for GitLab repos. The section also omits FULLSEND_LAST_POLL_AT_FAST, FULLSEND_LAST_POLL_AT_FULL, and FULLSEND_LABEL_STATE that the code does install.
    Remediation: Remove FULLSEND_MINT_URL from the GitLab variables list and add the missing variables with brief descriptions.

Medium

  • [incomplete-teardown-instructions] docs/guides/getting-started/operations.md:60 — Manual GitLab teardown lists FULLSEND_MINT_URL (not installed for GitLab) and omits 7 variables set during install: FULLSEND_LABEL_STATE, FULLSEND_LAST_POLL_AT_FAST, FULLSEND_LAST_POLL_AT_FULL, FULLSEND_DISPATCHED_KEYS_FAST, FULLSEND_DISPATCHED_KEYS_FULL, FULLSEND_FAILED_KEYS_FAST, FULLSEND_FAILED_KEYS_FULL. An operator following these instructions would leave orphaned CI/CD variables.
    Remediation: Remove FULLSEND_MINT_URL and add the missing variables, or simplify to "Delete all CI/CD variables prefixed with FULLSEND_".

  • [missing-code-defaults-entry] docs/guides/infrastructure/layered-config-reference.md:234 — The new forge field was added to the per-field merge rules table but is missing from the Code defaults reference table.
    Remediation: Add a row: | forge | "" (GitHub) |.

Low

  • [ambiguous-cross-reference] docs/guides/getting-started/operations.md:64 — The sentence "run fullsend mint unenroll instead of step 3" follows two forge-specific teardown sections, each with their own step 3. The reference is ambiguous.
    Remediation: Qualify the reference, e.g., "instead of GitHub step 3 above".

  • [scope-creep] docs/guides/getting-started/repo-management.md — Documentation for the manifest bootstrap feature was removed, but the feature implementation remains in internal/cli/repos.go with three supporting tests. The feature is still discoverable via CLI help and the --direct flag example in docs/cli/repos.md, but the dedicated bootstrap section has been dropped.

  • [missing-test] internal/repos/install_test.go — No integration-level test exercises the full Install() function through the GitLab path (Forge=ForgeGitLab). Individual helpers are tested but the orchestrator flow is only tested with ForgeGitHub.

  • [edge-case] internal/cli/repos_gitlab.go:41 — The project access token expiration uses time.Now().AddDate(1, 0, 0). Leap years mean this can be 366 days, exceeding GitLab's default 365-day maximum. The fallback token path handles the failure gracefully.

  • [fail-open] internal/cli/repos.go:1041 — When *gl.LiveClient type assertion fails during uninstall, cleanupGitLabBotToken is skipped. The FULLSEND_FORGE_TOKEN CI/CD variable is deleted, but the underlying project access token remains active with Maintainer-level API scope for up to 1 year. The inline comment acknowledges this limitation.

  • [excessive-token-scope] internal/cli/repos_gitlab.go:44 — Project access token created with api scope and Maintainer (level 40) access. Code comment documents the justification.

  • [token-lifetime] internal/cli/repos_gitlab.go:41 — Project access token created with 1-year expiry, no automated rotation. Re-install serves as ad-hoc rotation by revoking existing tokens before creating new ones.

  • [secret-handling] internal/cli/repos_gitlab.go:23 — --gitlab-bot-token flag value may appear in process listings. FULLSEND_GITLAB_BOT_TOKEN env var support is provided as a safer alternative.

  • [yaml-injection] internal/scaffold/installfiles.go:102 — Runner tags interpolated into YAML via string replacement. Go's %q formatting provides adequate escaping; input comes from operator-controlled manifest.

  • [undocumented-env-var-fallback] docs/cli/repos.md:130 — The --gitlab-bot-token flag documentation does not mention the FULLSEND_GITLAB_BOT_TOKEN environment variable fallback.

  • [export-consistency] internal/repos/install.go:289 — installVarsForForge/installSecretsForForge are unexported while their uninstall counterparts (UninstallVarsForForge, etc.) are exported. The asymmetry is intentional (uninstall functions are called cross-package).

  • [scope-creep] internal/scaffold/fullsend-repo-gitlab/.gitlab/ci/fullsend-agent.yml — Issue's NOT-in-scope says "Changes to scaffold templates — they stay as-is." Three scaffold templates were modified for __RUNNER_TAGS__, but this is a necessary prerequisite for the runner tags feature described in requirements.

  • [scope-creep] internal/config/config.go — Config/manifest changes (Forge field, runner_tags) not in issue's "Files to modify" list but plausibly required infrastructure for forge-aware install.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (8)

Review

Findings

High

  • [logic-error] internal/cli/repos.go:700 — Missing continue after failed *gl.LiveClient type assertion in the install post-install loop. When fc.Client.(*gl.LiveClient) fails (line 700), glClient is nil and the code logs "bot token setup skipped" (line 702) but falls through to call setupGitLabBotToken and setupGitLabPipelineSchedules with a nil glClient. The uninstall path (lines 1041–1044) correctly uses continue after the same assertion failure.
    Remediation: Add continue after the printer.StepWarn(...) inside the if !ok block, matching the uninstall path pattern.

Medium

  • [scope-creep] docs/cli/repos.md — Documentation for the manifest bootstrap feature was removed (from docs/cli/repos.md and docs/guides/getting-started/repo-management.md), but the feature implementation remains functional in internal/cli/repos.go:494–502 with three supporting tests. This creates a working feature with no documentation. Removing GitHub-facing documentation is not authorized by issue feat(repos): make repos install/uninstall the single path for GitLab (Phase 4) #5844.
    Remediation: Restore the removed documentation or remove the bootstrap feature entirely (code + tests) if deprecation is intended.

Low

  • [fail-open] internal/cli/repos.go:1040 — When *gl.LiveClient type assertion fails during uninstall, cleanupGitLabBotToken is skipped. The FULLSEND_FORGE_TOKEN CI/CD variable is deleted, but the underlying project access token remains active with Maintainer-level API scope for up to 1 year. The inline comment acknowledges this limitation.

  • [missing-test] internal/repos/install_test.go — No integration-level test exercises the full Install() function through the GitLab path (Forge=ForgeGitLab). Individual helpers are tested but the orchestrator flow is only tested with ForgeGitHub.

  • [incomplete-variable-reference] docs/guides/infrastructure/infrastructure-reference.md:232 — Per-Repo Mode Secrets/Variables section only lists GitHub-specific variables. GitLab per-repo mode uses a different variable set with no GitHub-style secrets.

  • [incomplete-teardown-instructions] docs/guides/getting-started/operations.md:51 — Manual per-repo teardown section references .github/workflows paths and GitHub-style secrets only.

  • [excessive-token-scope] internal/cli/repos_gitlab.go:44 — Project access token created with api scope and Maintainer access level. Code comment documents justification.

  • [token-lifetime] internal/cli/repos_gitlab.go:41 — Project access token created with 1-year expiry, no automated rotation. On re-install, old tokens are revoked before creating new ones.

  • [secret-handling] internal/cli/repos_gitlab.go — --gitlab-bot-token flag value may appear in process listings. PR adds FULLSEND_GITLAB_BOT_TOKEN env var support as an alternative.

  • [yaml-injection] internal/scaffold/installfiles.go:102 — Runner tags interpolated into YAML via string replacement. Go's %q formatting provides adequate escaping; input comes from operator-controlled manifest.

  • [missing-config-reference] docs/guides/infrastructure/layered-config-reference.md — forge.gitlab.runner_tags is a manifest-level field (documented in docs/cli/repos.md under repos set-default) rather than a per-repo config field.

  • [import-formatting] internal/forge/gitlab/ci.go — Blank line separates strings import from standard library group.

  • [regex-pattern-consistency] internal/repos/forge_config.go — Comment explaining \b word boundary is correct but could be more specific.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (9)

Review

Findings

Medium

  • [scope-creep] internal/cli/repos.go:487 — The PR removes the manifest bootstrap feature (auto-creating repos.yaml when it doesn't exist and positional repos are provided), deletes four related tests, and removes corresponding documentation from docs/cli/repos.md and docs/guides/getting-started/repo-management.md. This behavior change is not authorized by issue feat(repos): make repos install/uninstall the single path for GitLab (Phase 4) #5844 — the issue scope is making GitLab repos work through repos install/uninstall, not removing existing GitHub-facing features. See also: [breaking-api] — users who relied on this greenfield workflow will now get an error.
    Remediation: Revert the bootstrap removal. If removing bootstrap is desired, track it in a separate issue.

  • [fail-open] internal/cli/repos.go:1019 — In the GitLab post-uninstall cleanup path, when the *gl.LiveClient type assertion fails, cleanupGitLabBotToken is skipped. The FULLSEND_FORGE_TOKEN CI/CD variable is deleted by the main uninstall loop (it's in gitlabUninstallVars), but the underlying project access token remains active on the GitLab instance with Maintainer-level API scope until it expires (up to 1 year). The code correctly logs a warning and handles pipeline schedule cleanup, but the orphaned credential is a cleanup gap.
    Remediation: Warn the operator that manual token revocation is needed, and document this limitation.

  • [scope-creep] internal/forge/gitlab/ci.go:724 — DetectRunnerTags method (~50 lines of production code + ~60 lines of tests) is added but never called anywhere in the codebase. The issue explicitly excludes this under "NOT in scope: Runner tag auto-detection — dropped, users set via repos set-default forge.gitlab.runner_tags."
    Remediation: Remove DetectRunnerTags and its three test functions.

  • [stale-config-reference] docs/guides/infrastructure/layered-config-reference.md:72 — The per-field merge rules table enumerates all per-repo config fields but does not include the new forge field added to perRepoConfig by this PR. The field uses scalar override merge semantics with a code default of "" (auto-detected).
    Remediation: Add a row: | forge | string | Scalar override | "" (auto-detected) |.

Low

  • [fail-open] internal/cli/repos.go:684 — Type assertion glClient, _ := fc.Client.(*gl.LiveClient) silently discards the ok boolean. The downstream functions handle nil glClient gracefully, but the failure is not logged — unlike the uninstall path at line 1018 which logs a StepWarn.

  • [excessive-token-scope] internal/cli/repos_gitlab.go:42 — The project access token is created with api scope and Maintainer access level. While api is the practical minimum for the required operations (MR interactions, pipelines, CI/CD variables, repository content), the justification should be documented in a code comment.

  • [scope-creep] internal/config/interfaces.go:71 — Forge field added to perRepoConfig, ConfigForge() method, and PerRepoConfigReader interface extension are not called by any code in this PR. Forward-looking infrastructure that follows existing patterns.

  • [token-lifetime] internal/cli/repos_gitlab.go:41 — Project access token created with 1-year expiry and no rotation mechanism. Consider documenting the expiry policy and adding a warning in repos status when tokens near expiry.

  • [secret-handling] internal/cli/repos_gitlab.go:54 — --gitlab-bot-token flag value may appear in process listings (/proc/*/cmdline). Consider supporting an environment variable alternative (e.g., FULLSEND_GITLAB_BOT_TOKEN), similar to how --gitlab-token supports GITLAB_TOKEN.

  • [breaking-api] internal/config/interfaces.go:70 — PerRepoConfigReader interface adds ConfigForge() method. Internal package — no external consumers affected.

  • [missing-test] internal/repos/install_test.go — No integration-level test exercises the full Install() function through the GitLab path (Forge=ForgeGitLab). Individual helper functions are tested, but the orchestrator Install() flow is only tested with ForgeGitHub.

  • [incomplete-variable-reference] docs/guides/infrastructure/infrastructure-reference.md:232 — Per-Repo Mode Secrets/Variables section only lists GitHub-specific variables. GitLab per-repo mode uses a different variable set (FULLSEND_CREDENTIAL_MODE, FULLSEND_FORGE, etc.) with no GitHub-style secrets. The section has no qualifier indicating it is GitHub-specific.

  • [incomplete-teardown-instructions] docs/guides/getting-started/operations.md:51 — Manual per-repo teardown section references .github/workflows paths and GitHub-style secrets. Now that GitLab is fully supported, add a qualifier or GitLab variant.


Labels: PR adds GitLab support to repos install/uninstall path — a feature addition with documentation and CI template changes


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (10)

Review

Findings

Medium

  • [behavioral-regression] internal/repos/install.go:294 — installVarsForForge for GitHub unconditionally includes FULLSEND_GCP_REGION in the returned map, even when cfg.InferenceRegion is empty. The base branch conditionally added this variable only when InferenceRegion != "". Running repos install without --inference-region will now write an empty-string FULLSEND_GCP_REGION variable, potentially overwriting an existing non-empty value (e.g., "us-central1").
    Remediation: Restore the conditional logic — only include FULLSEND_GCP_REGION in the map when cfg.InferenceRegion != "".

  • [fail-open] internal/cli/repos.go:1017 — In the GitLab post-uninstall cleanup path, when the type assertion fc.Client.(*gl.LiveClient) fails, the code logs a warning but does not continue. Execution falls through to cleanupGitLabBotToken with a nil glClient, which silently returns nil without revoking the project access token. The CI/CD variable FULLSEND_FORGE_TOKEN is deleted (via gitlabUninstallVars), but the underlying project access token remains active in GitLab's token registry for up to 1 year.
    Remediation: Add continue after the warning when the type assertion fails.

  • [breaking-api] internal/cli/repos.go:489 — Removed manifest bootstrap behavior: previously repos install with positional repos and no existing manifest would bootstrap a new repos.yaml. Users who relied on this greenfield workflow will now get an error. The documentation updates reflect this removal, but release notes should call out the behavior change.
    Remediation: Document as a behavior change in release notes.

Low

  • [fail-open] internal/cli/repos_gitlab.go:49 — When glClient is nil (type assertion failed in install path) and no --gitlab-bot-token is provided, setupGitLabBotToken returns ("", nil) — success with an empty token. No FULLSEND_FORGE_TOKEN variable is created, but install reports success.

  • [missing-test] internal/repos/install_test.go — No test cases for the ForgeGitLab path in Install()/BuildScaffoldFiles(). The GitLab-specific variable configuration and WIF skip logic have no integration-level test coverage.

  • [breaking-api] internal/config/interfaces.go:70 — PerRepoConfigReader interface adds ConfigForge() string method. This is in an internal/ package so no external callers are affected, but all in-repo implementations must implement the new method.

  • [naming-convention] internal/cli/repos_gitlab.go:8 — Minor constant naming inconsistency: fullsendBotTokenName vs gitlabAccessLevelMaintainer follow different naming patterns.

  • [code-organization] internal/repos/forge_config.go:17 — GitLab ref patterns add \b word boundary but GitHub patterns do not. A comment explaining why the word boundary is needed (to avoid matching head_ref: in jq templates) would help future maintainers.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR
Previous run (11)

Review

Findings

Critical

  • [logic-error] internal/repos/uninstall.go:167 — The Forge field is not set in the ResolvedConfig struct literal passed to uninstallRepoResources. The Uninstall function resolves forgeName from the manifest but omits it from the struct: ResolvedConfig{Owner: owner, Repo: repo, ForgeConfig: fc}. Since uninstallRepoResources reads cfg.Forge to select which variables, secrets, and scaffold paths to delete, the field defaults to empty string. All *ForForge("") helpers return GitHub defaults. GitLab repos will be uninstalled with GitHub's variable/secret/path lists — deleting wrong variables, attempting to delete nonexistent GitHub secrets, and removing GitHub workflow paths instead of GitLab scaffold paths. See also: [fail-open] finding at this location.
    Remediation: Include the Forge field: ResolvedConfig{Owner: owner, Repo: repo, Forge: forgeName, ForgeConfig: fc}

High

  • [fail-open] internal/repos/uninstall.go:167 — Same root cause as the critical finding: because Forge is empty, UninstallVarsForForge("") returns GitHub's uninstallVariables which does NOT include FULLSEND_FORGE_TOKEN. The bot PAT (Maintainer-level api scope) stored in FULLSEND_FORGE_TOKEN will NOT be deleted on uninstall, leaving a live credential in the GitLab project. See also: [logic-error] finding at this location.
    Remediation: Same fix — include Forge: forgeName in the ResolvedConfig struct literal.

  • [stale-doc] docs/guides/getting-started/repo-management.md:332 — The "GitLab scaffold limitation" section (lines 332–343) states repos install only supports GitHub repos and GitLab repos will fail with "GitLab scaffold generation is not yet implemented." This error is removed in this PR. The documentation now incorrectly claims GitLab install is unsupported.
    Remediation: Remove or rewrite the "GitLab scaffold limitation" section.

Medium

  • [token-lifecycle] internal/forge/gitlab/ci.go:737 — CreateProjectAccessToken does not set expires_at in the API request body, despite the doc comment claiming "The token expires 365 days from creation." Self-managed GitLab instances on older versions may create non-expiring project access tokens with Maintainer-level api scope.
    Remediation: Set expires_at to time.Now().AddDate(1, 0, 0).Format("2006-01-02").

  • [edge-case] internal/cli/repos_gitlab.go:34 — setupGitLabBotToken calls CreateProjectAccessToken unconditionally without checking if a "fullsend-bot" token already exists. Partial install followed by repair creates duplicate active tokens — orphaned credentials with Maintainer-level access.
    Remediation: List existing tokens first and revoke duplicates before creating.

  • [edge-case] internal/cli/repos_gitlab.go:87 — setupGitLabPipelineSchedules creates schedules unconditionally without checking for existing fullsend schedules. Re-install creates duplicate schedules causing double pipeline frequency.
    Remediation: List existing schedules and skip if fullsend schedules already exist.

Low

  • [missing-test] internal/repos/uninstall.go — No GitLab-specific uninstall tests added. The critical missing-Forge bug would have been caught by a test exercising GitLab uninstall.

  • [error-handling-gap] internal/cli/repos.go:1019 — In uninstall post-cleanup, if the *gl.LiveClient type assertion fails, glClient is nil and cleanupGitLabBotToken silently returns nil with no warning.


Labels: PR adds GitLab support to the repos install/uninstall CLI path with Go code changes.


Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added component/install CLI install and app setup go Pull requests that update go code labels Aug 3, 2026
@ggallen
ggallen force-pushed the agent/5844-gitlab-repos-install-uninstall branch from cbd2cea to a56d4bd Compare August 3, 2026 03:19
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Review · ⚠️ Cancelled · Started 3:20 AM UTC · Ended 3:27 AM UTC
Commit: a56d4bd · View workflow run →

@ggallen
ggallen force-pushed the agent/5844-gitlab-repos-install-uninstall branch from a56d4bd to 5249c59 Compare August 3, 2026 03:26
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 3:27 AM UTC · Completed 3:44 AM UTC
Commit: 5249c59 · View workflow run →

fullsend-ai-review[bot]

This comment was marked as outdated.

@ggallen
ggallen force-pushed the agent/5844-gitlab-repos-install-uninstall branch from 5249c59 to a5c569e Compare August 3, 2026 03:53
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 3:54 AM UTC · Completed 4:14 AM UTC
Commit: a5c569e · View workflow run →

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added feature Feature-category issue awaiting human prioritization documentation labels Aug 3, 2026
@ggallen
ggallen force-pushed the agent/5844-gitlab-repos-install-uninstall branch from a5c569e to 54dd351 Compare August 3, 2026 04:26
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Review · ❌ Terminated · Started 4:27 AM UTC · Ended 4:46 AM UTC
Commit: 54dd351 · View workflow run →

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

Site preview

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

Commit: b2b00d6104e80d4df0a5dac8bf452bba9bb5ffe6

@codecov

codecov Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 4:27 AM UTC · Completed 4:46 AM UTC
Commit: 54dd351 · View workflow run →

@ggallen
ggallen force-pushed the agent/5844-gitlab-repos-install-uninstall branch from 54dd351 to bf734f7 Compare August 3, 2026 08:39
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 8:43 AM UTC · Completed 9:02 AM UTC
Commit: bf734f7 · View workflow run →

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Review · ⚠️ Cancelled · Started 12:28 PM UTC · Ended 12:39 PM UTC
Commit: b4f053a · View workflow run →

@ggallen
ggallen force-pushed the agent/5844-gitlab-repos-install-uninstall branch from b4f053a to c3f6f33 Compare August 3, 2026 12:38
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 12:39 PM UTC · Completed 12:55 PM UTC
Commit: c3f6f33 · View workflow run →

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 3, 2026
@ggallen
ggallen force-pushed the agent/5844-gitlab-repos-install-uninstall branch from c3f6f33 to c50e9a2 Compare August 3, 2026 13:00
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:01 PM UTC · Completed 1:15 PM UTC
Commit: c50e9a2 · View workflow run →

fullsend-ai-review[bot]

This comment was marked as outdated.

Signed-off-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Greg Allen <gallen@redhat.com>
@ggallen
ggallen force-pushed the agent/5844-gitlab-repos-install-uninstall branch from c50e9a2 to b2b00d6 Compare August 3, 2026 13:21
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 1:22 PM UTC · Completed 1:40 PM UTC
Commit: b2b00d6 · View workflow run →

Comment thread internal/cli/repos_gitlab.go Resolved
Comment thread internal/cli/repos.go Resolved
Comment thread internal/cli/repos.go Resolved
Comment thread internal/cli/repos_gitlab.go Resolved
@ggallen
ggallen added this pull request to the merge queue Aug 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 3, 2026
@ggallen
ggallen added this pull request to the merge queue Aug 3, 2026
Merged via the queue into main with commit d41ac6c Aug 3, 2026
24 of 26 checks passed
@ggallen
ggallen deleted the agent/5844-gitlab-repos-install-uninstall branch August 3, 2026 14:53
@fullsend-ai-retro

fullsend-ai-retro Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 2:55 PM UTC · Completed 3:17 PM UTC
Commit: b2b00d6 · View workflow run →

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #5845 — GitLab repos install/uninstall

Workflow: Issue #5844 → triage → code → PR #5845 → 11 review iterations → human fixes → merge (12h total)

Review quality: Strong

The review agent found genuinely important bugs across 11 iterations:

  • CRITICAL: Missing Forge field in uninstall — GitLab repos would use GitHub variable lists
  • HIGH: Missing continue after type assertion failure — nil glClient fell through to downstream calls
  • HIGH: Incorrect docs — infrastructure-reference.md stated wrong FULLSEND_CREDENTIAL_MODE value
  • MEDIUM: Behavioral regression — FULLSEND_GCP_REGION written unconditionally (was conditional)
  • MEDIUM: Scope-creep — dead DetectRunnerTags code and unintentional bootstrap removal
  • MEDIUM: Bot token failure not tracked as install failure

All findings were confirmed correct by the human reviewer (ggallen). The human added no correctness findings beyond what the bot found.

Fix agent: Completely blocked

All 5 fix dispatches failed with "Human-authored PR without fullsend-fix label" because the guard-rail regex checks for [bot] suffix but the code agent's login is app/fullsend-ai-coder. The human manually fixed all 7+ review findings over ~10 hours. New evidence for #1569 / #5536: 5 consecutive identical failures, zero fix agent output.

Repeated findings

Four low-severity finding categories were re-raised across multiple iterations after human acknowledgment: fail-open (orphaned tokens), excessive-token-scope, token-lifetime, yaml-injection. New evidence for #1013 / #2816: 20+ duplicate inline comments. New evidence for #5265: human acknowledgments not incorporated.

Piecemeal discovery

The HIGH-severity missing-continue bug was found on the 4th review iteration, not the 1st, despite the code being present from the initial PR. A MEDIUM-severity error-handling issue was found on the 8th+ iteration, after the bot had already approved. New evidence for #4970.

Cost

89 total workflow runs: 1 triage + 1 code + 10 review + 5 fix (all failed) + 72 source repo CI. The 5 fix failures contributed no value. New evidence for #5811 (skip fix dispatch at routing level).

Autonomy readiness

The review agent's approval aligned with the human reviewer's assessment — the human approved 12 minutes after the bot's final approval and added no additional findings. If the fix agent had been operational, the pipeline could have resolved this PR with minimal human intervention for this class of change (well-tested Go code).

Proposals filed

This branch was successfully deployed

1 active deployment
site-preview — b2b00d61 Deployed Aug 3, 2026 by github-actions[bot]
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 documentation feature Feature-category issue awaiting human prioritization go Pull requests that update go code ready-for-merge All reviewers approved — ready to merge ready-for-review Triggers review agent dispatch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(repos): make repos install/uninstall the single path for GitLab (Phase 4)

1 participant