Skip to content

feat(#7771): add GitLab webhook dispatcher CI scaffold - #8021

Merged
ggallen merged 2 commits into
mainfrom
agent/7771-gitlab-dispatcher-scaffold
Oct 3, 2026
Merged

ggallen merged 2 commits into
mainfrom
agent/7771-gitlab-dispatcher-scaffold

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

Adds a webhook dispatcher job to the GitLab .fullsend scaffold. The job runs only for trigger pipelines. It pins identity (source=trigger) before using any credential, then hands GitLab's native TRIGGER_PAYLOAD file to fullsend poll --input-driver gitlab-webhook. Agent launches still go through CreatePipelineWithInputs (source=api). The ADR 0131 20-input contract, no_one_allowed, and the Developer-level poller credential are unchanged.

Related Issue

GitLab webhook: dispatcher CI scaffold for signed pipeline-input dispatch.

Changes

  • New .gitlab/ci/fullsend-dispatcher.yml
    • Defines the fullsend webhook dispatcher job in the dispatch stage, with tags: __CONTROL_RUNNER_TAGS__.
    • Rules: the CI_DEBUG_TRACE deny comes first. After that, only trigger pipelines on the protected default branch are admitted.
  • New .gitlab/ci/scripts/run-dispatcher-job.sh, in order:
    • Re-checks the debug-trace guard.
    • Runs pin-ci-job-identity.sh with FULLSEND_ADMIT_SOURCE=trigger, which pins project, pipeline, source, host, and protected default branch. It fails closed if the pinned values are empty.
    • Requires TRIGGER_PAYLOAD to be a readable regular file. The path is passed through unchanged and the script never reads the payload.
    • Selects the poller role token and clears sibling role secrets.
    • Runs fullsend poll --input-driver gitlab-webhook with the pinned project, URL, and ref. The script uses no variables[...], /trigger/pipeline, or curl.
  • fullsend-pipeline.yml
    • Adds a dispatcher include gated on $CI_PIPELINE_SOURCE == "trigger", behind the debug deny.
    • Stages are now dispatch, poll, agent.
    • Sources stay separate: schedule → poll, trigger → dispatcher, api → agent. A trigger pipeline runs only the dispatcher.
  • Root .gitlab-ci.yml: adds a trigger workflow rule on the protected default branch, after the debug-trace deny. Inputs are unchanged (still exactly 20).
  • internal/repos
    • Registers both new paths in the remote scaffold list, the uninstall scaffold list, and the auxiliary script probe list.
    • fullsendStages is dispatch, poll, agent. GitLab rejects a config whose job stage is missing, so dispatch is a current stage again and the obsolete-stage list is now empty. The obsolete-stage strip code is kept, and its tests now run with a historical override.
    • The trigger workflow rule is merged on install/converge (already-enrolled roots get it and the stage added) and removed on uninstall.
  • Docs: updated the GitLab configuration guide, the operations uninstall/manual-setup lists, and the role-credential job table (dispatcher → Poller).

Notes for reviewers

  • Same-ref converge does not probe-repair the dispatcher template YAML. This matches the existing poll/agent templates; templates ship on install and ref upgrade. The dispatcher script is probe-repaired.
  • Uninstall removes any dispatch stage from the root CI file, including one the user defined themselves. The previous obsolete-stage cleanup did the same.

Testing

  • New internal/scaffold/gitlab_dispatcher_test.go:
    • Checks job structure and rule order, and script ordering (debug guard → pin → token → invoke).
    • Checks wrapper source separation and that the root keeps exactly 20 inputs.
    • Checks install collection, including tag substitution.
    • Runs the script behaviourally: debug-trace values abort before the pin; schedule, api, push, and web sources are denied; a missing or non-regular payload is rejected; and the payload handoff and token scoping are exact.
  • Updated internal/repos tests:
    • Merge adds the dispatch stage and trigger rule (ordered and idempotent).
    • hasFullsendEntries requires both.
    • Unmerge removes both.
    • Converge backfills a root that is missing them.
    • Updated the install/uninstall/remote-scaffold registration lists.
  • go test ./internal/repos/... ./internal/scaffold/... passes. go vet on the same packages passes.
  • Pre-existing failures in internal/cli (TestStartFetchService_*, TestPostScriptEnv_NoSchema*) also fail on a clean tree and are unrelated.
  • pre-commit itself could not run in the sandbox: fetching hook repos from GitHub failed TLS verification. I ran the hook equivalents directly on the changed files and all passed:
    • gofmt, go vet, shellcheck (-x -e SC1091,SC2001,SC2016), YAML parse
    • trailing-whitespace / EOF / conflict-marker checks
    • hack/lint-docs-links, hack/lint-broken-symlinks, lychee (offline), gitleaks via scan-secrets, gitlint
  • make lint passes (could not run in sandbox; see above)
  • Tests added/updated for new or modified logic

Process disclosure: one edit, adding paths to internal/repos/remote_scaffold.go, was made with a Python heredoc rather than the editor tool. The resulting content was checked and is covered by tests.

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • Commits are signed off (DCO) — not applicable to autonomous agent commits
  • I wrote this contribution myself and can explain all changes in it — autonomous agent contribution; requires human review

🤖 Generated with Claude Code


Closes #7771

Post-script verification

  • Branch is not main/master (agent/7771-gitlab-dispatcher-scaffold)
  • Secret scan passed (gitleaks — 6a4e4908accd03beca00236cf70818dbddd3dbe8..HEAD)
  • PR body secret scan passed (gitleaks — no-git)

Add a trigger-only dispatcher job to the GitLab .fullsend scaffold so
a pipeline-trigger webhook can launch the gitlab-webhook input driver
on the control project.

- fullsend-dispatcher.yml: "fullsend webhook dispatcher" job in the
  dispatch stage on __CONTROL_RUNNER_TAGS__. It denies CI_DEBUG_TRACE
  first, then admits only trigger pipelines on the protected default
  branch.
- run-dispatcher-job.sh: re-checks debug trace, pins project,
  pipeline, source=trigger, host and protected default branch via
  pin-ci-job-identity.sh before any credential use. It then requires
  the native TRIGGER_PAYLOAD file, selects the Developer-level poller
  role token, clears sibling secrets, and runs `fullsend poll
  --input-driver gitlab-webhook`. Agent launches still go through
  CreatePipelineWithInputs (source=api); no pipeline variables.
- fullsend-pipeline.yml: trigger-gated dispatcher include and
  stages dispatch, poll, agent so trigger pipelines run only the
  dispatcher. Root .gitlab-ci.yml admits trigger pipelines on the
  protected default branch after the debug-trace deny; the 20-input
  ADR 0131 contract is unchanged.
- internal/repos: register the new template and script for install,
  converge probe and uninstall. "dispatch" is a current stage again
  and the trigger workflow rule is merged on install/converge and
  removed on uninstall.

Tests cover source separation, debug-trace denial, payload handoff,
input-contract preservation, registration and cleanup.

Closes #7771

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team October 3, 2026 02:01
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Oct 3, 2026
@fullsend-ai-review

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

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:03 AM UTC · Completed 2:22 AM UTC

Commit: 707b348 · View workflow run →

Runtime: pi · Model: openai/gpt-6.1-sol → gpt-6.1-sol · Effort: high · Cost: $4.02

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Site preview

Preview: https://06cd307a-site.fullsend-ai.workers.dev

Commit: 8b68e1d70b2ce040c8d322c94fbfd793dc8ac516

@codecov

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Oct 3, 2026
@fullsend-ai-review

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

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Additive GitLab webhook dispatcher scaffold authored by a bot with no protected path or dependency changes, aligning with linked issue scope despite moderate churn in touched GitLab CI files.

Previous run

Risk Assessment: moderate (2/5)

Details

Additive GitLab webhook dispatcher scaffold authored by a bot with no protected path or dependency changes, aligning with linked issue scope despite moderate churn in touched GitLab CI files.

@fullsend-ai-review

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

Copy link
Copy Markdown

Looks good to me

Previous run

Review

Findings

Medium

  • [logic-error] internal/repos/uninstall.go:124 — Presence probing registers the dispatcher script but not fullsend-dispatcher.yml, and content-drift checking skips missing files. At an unchanged ref, convergence can update the wrapper to include the dispatcher and repair its script without delivering the YAML, leaving trigger pipelines with a missing local include. Deleting only the template also goes undetected. The new convergence test checks script delivery but not template delivery.
    Remediation: Probe the dispatcher template as a managed component and repair it when missing. Add unchanged-ref rollout and template-only deletion tests that assert YAML delivery.

  • [api-contract] internal/repos/remote_scaffold.go:22 — The unconditional remote-fetch list now requires both newly added dispatcher files. Previously complete pre-dispatcher pins lack those paths, so upgrading the administrative CLI causes GitLab install/convergence to fail when fetching their scaffold. The tests populate every entry in the new list and do not cover an older pin.
    Remediation: Determine dispatcher requirements from the fetched wrapper: preserve pre-dispatcher scaffolds without synthesizing newer content, and require both files when the wrapper references them. Align presence probing with the selected version and add an older-pin regression test.


Labels: The PR adds GitLab webhook dispatch CI scaffolding and its managed installation lifecycle.


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/dispatch Workflow dispatch and triggers component/ci CI pipelines and checks component/install CLI install and app setup labels Oct 3, 2026
@fullsend-ai-coder

fullsend-ai-coder Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 2:24 AM UTC · Completed 2:35 AM UTC

Commit: 707b348 · View workflow run →

Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.37

Deliver the GitLab dispatcher template and make dispatcher requirements
follow the selected scaffold version:

- probe fullsend-dispatcher.yml (with its script) as managed components
  when the installed pipeline wrapper includes it, and report expected
  but missing dispatcher files as content drift so an unchanged-ref
  rollout delivers the YAML along with the rewritten wrapper
- fetch the dispatcher files from a pinned ref only when its wrapper
  references them, so pre-dispatcher pins still install and converge
- add template-only deletion, unchanged-ref rollout, probe, and
  older-pin regression tests

Note: pre-commit could not fetch hook repositories (TLS failure in the
sandbox); gofmt, go vet, whitespace checks and scan-secrets were run
directly. internal/cli has sandbox-dependent test failures unrelated to
this change.

Addresses #8021

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 Fix agent — iteration 1 (bot-triggered)

Addressed both review findings. Dispatcher template and script are now probed as managed components when the wrapper references them, and missing dispatcher files are reported as drift so unchanged-ref rollouts deliver them. The remote GitLab scaffold fetch requires the dispatcher files only when the fetched wrapper references them, so older pins keep working. internal/repos and internal/scaffold tests pass. internal/cli has sandbox-dependent failures (fetch service and post-script env tests) in code this change does not touch. pre-commit could not fetch its hook repositories in the sandbox, so gofmt, go vet, whitespace checks and the secret scan were run directly.

Fixed (2):

  1. Presence probing and drift checking never deliver the dispatcher YAML template (logic-error) (internal/repos/uninstall.go): Added gitlabDispatcherPaths (template plus script). ProbeComponents now probes both as managed components when the installed pipeline wrapper references the dispatcher, so template-only deletion is detected and repaired. CheckFileContentDrift also reports an expected-but-missing dispatcher file as drift, so an unchanged-ref rollout delivers the YAML together with the rewritten wrapper. Added template-only deletion, unchanged-ref rollout, and probe tests, and extended the existing reinstated-stage test to assert template delivery.
  2. Unconditional remote-fetch list requires dispatcher files that older pins lack (api-contract) (internal/repos/remote_scaffold.go): The remote GitLab fetch now reads the pipeline wrapper first and fetches the dispatcher template and script only when the wrapper references the template. Pre-dispatcher pins install and converge without synthesized newer content. A wrapper that references the dispatcher still requires both files and fails the fetch if either is missing. Probing is aligned with the selected version: the dispatcher files are probed only when the wrapper references them. Added older-pin and referenced-but-missing regression tests.

Tests: passed

CI inspections (4):

  1. test (passing, success): Project unit test job passed on the reviewed head.
  2. functional-tests (passing, success): Functional tests passed.
  3. e2e (passing, success): E2E tests passed.
  4. codecov/patch (passing, success): Patch coverage gate passed.

Conflict update: skipped; strategy none; forge MERGEABLE; target main

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

@fullsend-ai-review

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

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:37 AM UTC · Completed 2:48 AM UTC

Commit: 8b68e1d · View workflow run →

Runtime: pi · Model: openai/gpt-6.1-sol → gpt-6.1-sol · Effort: high · Cost: $1.27

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Oct 3, 2026
@ggallen
ggallen added this pull request to the merge queue Oct 3, 2026
Merged via the queue into main with commit 57ef113 Oct 3, 2026
54 checks passed
@ggallen
ggallen deleted the agent/7771-gitlab-dispatcher-scaffold branch October 3, 2026 03:19
csoceanu pushed a commit to csoceanu/fullsend that referenced this pull request Oct 4, 2026
…test

TestConverge_GitLab_PreservesReinstatedDispatchStage fails on main
with "no inference authentication selected for acme/api". This is a
semantic merge conflict: fullsend-ai#8021 added the test with a Manifest that
sets no inference.auth, and fullsend-ai#8015 (merged afterwards) made converge
require an explicit inference-auth selection via
RequireInferenceAuth.

Set Defaults: testInferenceDefaults() on the test's Manifest, the
same helper fullsend-ai#8015 applied to the other converge tests. It selects
vertex-wif, which matches the GCP secrets the test already seeds.
The test's assertions about preserving and backfilling the dispatch
stage are unchanged.

Verified with go test ./internal/repos/... (all pass), gofmt, and
go vet. golangci-lint on internal/repos reports only existing
findings in files this change does not touch.

Note: pre-commit could not fetch remote hook repos (TLS failure in
the sandbox); the applicable hooks (gofmt, go vet,
lint-broken-symlinks, pre-commit-hooks file checks) were run
directly and passed, and gitleaks coverage came from scan-secrets.

Closes fullsend-ai#8042

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fullsend-ai-coder Bot added a commit that referenced this pull request Oct 26, 2026
…ions

The webhook-dispatch rollout is complete (the dispatcher scaffold
landed in #8021, the last active-scaffold change in #8548), so the
converge-time compatibility paths for retired GitLab forms are no
longer needed.

Removed:
- StripObsoleteGitLabWorkflowRules and StripObsoleteGitLabStages, their
  converge steps, the empty obsoleteGitLabStages list, and the
  stage-reference scanner (stageReferencedByJob, nodeResolvesToStage,
  collectJobKeys, mergeTargetResolvesToStage) only they used.
- Converge deletion of a leftover fullsend-dispatch.yml
  (gitlabRetiredScaffoldPaths) and the wrapper-include checks guarding
  it. A leftover stub is now reported as an ordinary orphan.
- The status/probe/upgrade fallback that read the version marker from
  a leftover fullsend-dispatch.yml.
- Tests and docs that covered only those retired forms.

Preserved: install, the CI_DEBUG_TRACE rule backfill, the typed
pipeline-input root migration, status for current installs, and
uninstall. Uninstall still deletes a leftover fullsend-dispatch.yml
and still removes the obsolete merge_request_event rule from a
fullsend-owned workflow block. User-owned CI configuration is never
rewritten.

Not changed: dropLegacyRunnerTags. It backs the still-supported
gitlab.runner_tags manifest alias, which refills agent_runner_tags on
load. It is not a scaffold/stage/rule migration path, and removing the
alias would be a separate user-config change.

Pre-commit could not fetch its hook repositories in the sandbox (TLS
verification failure); the applicable hooks (check-yaml,
end-of-file-fixer, trailing-whitespace, detect-private-key,
check-merge-conflict, mixed-line-ending, gofmt, go vet, gitleaks,
lychee, docs-link, symlink and ADR lints) were run directly and pass.

BREAKING CHANGE: converge no longer migrates GitLab repos last
converged before #7707: it does not strip the obsolete
merge_request_event workflow rule, does not delete a leftover
.gitlab/ci/fullsend-dispatch.yml (reported as an orphan instead), and
status no longer reads that file's version marker. Converge such repos
with an earlier release first, or remove those leftovers manually (or
via uninstall).

Closes #8031

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jflowers pushed a commit to jflowers/fullsend-ai-fullsend that referenced this pull request Oct 26, 2026
…fold migrations

The webhook-dispatch rollout is complete (the dispatcher scaffold
landed in fullsend-ai#8021, the last active-scaffold change in fullsend-ai#8548), so the
converge-time compatibility paths for retired GitLab forms are no
longer needed.

Removed:
- StripObsoleteGitLabWorkflowRules and StripObsoleteGitLabStages, their
  converge steps, the empty obsoleteGitLabStages list, and the
  stage-reference scanner (stageReferencedByJob, nodeResolvesToStage,
  collectJobKeys, mergeTargetResolvesToStage) only they used.
- Converge deletion of a leftover fullsend-dispatch.yml
  (gitlabRetiredScaffoldPaths) and the wrapper-include checks guarding
  it. A leftover stub is now reported as an ordinary orphan.
- The status/probe/upgrade fallback that read the version marker from
  a leftover fullsend-dispatch.yml.
- Tests and docs that covered only those retired forms.

Preserved: install, the CI_DEBUG_TRACE rule backfill, the typed
pipeline-input root migration, status for current installs, and
uninstall. Uninstall still deletes a leftover fullsend-dispatch.yml
and still removes the obsolete merge_request_event rule from a
fullsend-owned workflow block. User-owned CI configuration is never
rewritten.

Not changed: dropLegacyRunnerTags. It backs the still-supported
gitlab.runner_tags manifest alias, which refills agent_runner_tags on
load. It is not a scaffold/stage/rule migration path, and removing the
alias would be a separate user-config change.

Pre-commit could not fetch its hook repositories in the sandbox (TLS
verification failure); the applicable hooks (check-yaml,
end-of-file-fixer, trailing-whitespace, detect-private-key,
check-merge-conflict, mixed-line-ending, gofmt, go vet, gitleaks,
lychee, docs-link, symlink and ADR lints) were run directly and pass.

BREAKING CHANGE: converge no longer migrates GitLab repos last
converged before fullsend-ai#7707: it does not strip the obsolete
merge_request_event workflow rule, does not delete a leftover
.gitlab/ci/fullsend-dispatch.yml (reported as an orphan instead), and
status no longer reads that file's version marker. Converge such repos
with an earlier release first, or remove those leftovers manually (or
via uninstall).

Closes fullsend-ai#8031

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active and 1 inactive deployments
site-preview — 8b68e1d7 Deployed Oct 3, 2026 by github-actions[bot]
dev — 8b68e1d7 Deployed Oct 3, 2026 by fullsend-ai-coder[bot] via behaviour #15159
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/ci CI pipelines and checks component/dispatch Workflow dispatch and triggers component/install CLI install and app setup ready-for-merge All reviewers approved — ready to merge ready-for-review Triggers review agent dispatch risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitLab webhook: dispatcher CI scaffold for signed pipeline-input dispatch

1 participant