Draft: [skip ci] POC: Configure the DAP Software Factory from one file
What does this MR do and why?
A proof of concept for configuring a DAP Software Factory from one file, .gitlab-dap-factory.yml, and editing that file in a new Factory Editor.
Today a factory is set up by hand. Its configuration is spread across the status: block of .gitlab-dap-factory.yml, flow triggers created in the UI or by the setup-factory skill of dev-bureau, AI Catalog flows, and project settings. See https://gitlab.com/gitlab-org/ai/swf-base-setup.
The goal is to make what works today easier to configure, not to deliver everything in the design. Everything is behind the wip feature flag dap_software_factory, on for the project or its top-level group.
Note
This MR stays a Draft reference. The shippable work is being split into smaller merge requests.
Update on 2026-10-29: rebased onto master, and changed to match the platform
Rebased onto master. In the week before, the platform added the fix loop for Duo Developer, the software_factory_enabled trigger filter, and one generic dap_software_factory flag. This MR now follows them:
- One flag.
dap_factory_configurationis gone. Everything checksGitlab::Ai::SoftwareFactory.enabled?. review:is read by the fix loop. The validator callsAi::FlowTriggers::FixLoop::Config, so the keys arelabel,reviewerandmax_fix_runs. The CI referee and itsmax_roundsandcap_roundkeys were reverted in swf-base-setup.- Status names live in a
status:block, because the factory's flows read them from there.stages:holds only the settings. The current swf-base-setup file is valid as it is. - Review has a flow. Sync makes it a
merge_requesttrigger onrequested_changes. With Duo Developer, the fix loop limits the fix runs. - Later stages need the Software Factory marker. Their triggers have the
software_factory_enabledrule. Triage and Plan run before a work item has a workplan, so they start for any work item with their status. - Sync adopts the triggers of
setup-factoryby description, instead of making a second trigger for a stage. - The editor warns when flow chaining is off for the group.
- Enabling a stage starts and exits it automatically, picks the foundational flow for the stage when the project has it, and ticks Mark merge requests ready for Build.
The model
- Six fixed, ordered stages: Triage, Plan, Build, Verify, Review, Ship.
- A stage is in the factory when
status:lists it. Leave it out to skip it. - Each stage in
stages:can set:- a start (
automatedormanual, defaultmanual) - an exit (
automatedormanual, defaultmanual): does the flow succeeding move the work item to the next stage, or does a person? - for an automated start, a
flow, which is the ID of a flow enabled in the project - for an automated exit,
mark_merge_requests_ready
- a start (
- Routing only moves forward, to the next stage that is not skipped.
- Review runs its flow when the reviewer requests changes on a merge request that a flow created. Its exit is always manual.
- Validation rules:
- A manual start can't have an automated exit.
- Stages can share a status, unless that status starts a flow.
- Keys under
review:follow the fix loop: an unknown key is an error.
factory: "Project XYZ"
status: # also read by the factory's flows
triage: Start
plan: Planning breakdown
build: In dev
review: In review
ship: Done
stages:
triage:
start: automated
flow: 412
exit: automated
plan:
start: automated
flow: 413 # Generate Workplan
exit: automated
build:
start: automated
flow: 414 # Duo Developer
exit: automated
mark_merge_requests_ready: true
review:
start: automated
flow: 414 # Duo Developer, for the fix loop
review: # read by Ai::FlowTriggers::FixLoop::Config
max_fix_runs: 3What's in the MR
- Validator (
Gitlab::Ai::DapFactory::Validator): one set of rules, used by Sync, the editor and MR validation. Each message has a dottedpath, for examplestages.build.flow, so the editor can show it next to the field. - Sync (
Ai::DapFactory::SyncService): runs when a push to the default branch changes the file, as the person who pushed.- It owns Managed Triggers, marked by a new
ai_flow_triggers.factory_stagecolumn, unique per project. - It goes through the existing flow trigger services, so permissions and audit events are the same as for triggers made in the UI.
- The file wins: a Managed Trigger edited outside the file is put back. Sync touches no other trigger, except one with the description of a stage, which it adopts.
- An invalid or unreadable file changes nothing. A deleted file removes all Managed Triggers.
- It owns Managed Triggers, marked by a new
- MR validation: an MR that changes the file gets one note from the automation bot, updated on every push.
- GraphQL (experiment):
project.dapFactoryConfiguration,project.dapFactoryConfigurationValidation(content:), and thedapFactoryEnableAutoReviewmutation. - The Factory Editor at
/-/automate/software-factory(sidebar: AI → Software factory).- A stage card for each stage, and a drawer to edit each one.
- Comments, key order and unknown keys survive an edit. Invalid YAML is shown read-only, with a link to edit it.
- Create status adds one to the group's lifecycle straight away.
- Commit to
mainis blocked while there are errors. Open merge request stays available. - Turning on Review offers to turn on automatic reviews by GitLab Duo.
References
- Epic: https://gitlab.com/groups/gitlab-org/-/work_items/21067
- Reference project: https://gitlab.com/gitlab-org/ai/swf-base-setup
- Fix loop: https://gitlab.com/gitlab-org/gitlab/-/work_items/634551
- Software Factory marker: https://gitlab.com/gitlab-org/gitlab/-/work_items/631103#note_4029427871
dap_software_factoryrollout: #634801
Screenshots or screen recordings
Demo 1: https://youtu.be/_1Z5Zif5MVs
Demo 2: https://youtu.be/dxs4g8dKz5s
These are from before the 2026-10-29 update.
Caveats and follow-ups
This is a proof of concept. These are known gaps and decisions to revisit.
The Software Factory marker. A work item gets it with its workplan. So Triage and Plan triggers have no marker rule, and start for any work item with their status. A better marker would let a work item enter the factory before it has a workplan.
Configuration and ownership:
- The file is project-specific.
flowis a project enablement ID. - Sync acts as the person who pushed. If a non-Maintainer merges the file, Sync partly fails. It should act as a service account.
- Managed Triggers can still be edited in the UI, and Sync overwrites those edits.
- Adoption matches on the description only. Any unmanaged trigger named
Software Factory: buildis adopted. - Work item type filters (
status.by_work_item_type) are accepted but not synced. - The last Sync result is kept in the Rails cache, not a table.
Prerequisites:
ai_flow_trigger_chainingmust be on for the top-level group, or automated exits do not move the work item, and verdicts of Duo Code Review start no fix run. The editor warns about this.- Duo Code Review settings: automatic reviews, review on push, and approve and request changes.
Effects outside the file (deliberate, and called out in the UI):
- Creating a status changes the top-level group's lifecycle straight away.
- Turning on automatic reviews changes project settings straight away.
Security follow-ups:
- Fork MRs can probe enabled flows. The validation note checks flows against the target project, so a fork author can learn whether a catalog ID is enabled there.
- Pull mirrors apply files from the mirror source, as the mirror user.
Out of scope: the design's Adaptations and Tasks, the Duo Workflow Service reading the file, and re-syncing when the default branch changes.
How to set up and validate locally
- Turn on the flags:
project = Project.find_by_full_path('your-group/your-project') Feature.enable(:dap_software_factory, project) Feature.enable(:ai_flow_trigger_chaining, project.root_ancestor) - In the project, enable Generate Workplan and Developer from the AI Catalog.
- As a Maintainer, open AI → Software factory (
/<project>/-/automate/software-factory). - Enable Plan, Build and Review. Each starts and exits automatically, with its default flow. Select Commit to main. The page shows the Sync result, and the triggers list has
Software Factory: …triggers. - Move a work item to Plan's status. Plan runs, then moves the work item to Build's status, which starts Build.
- Open an MR that makes
.gitlab-dap-factory.ymlinvalid. The automation bot posts the problems.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.