> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formation.texturehq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitLab coding

> Check out GitLab.com projects in an agent's sandbox, push branches, and open merge requests.

GitLab.com is the second coding provider after GitHub. Its native checkout uses
the same sandbox checkout engine, agent-owned permissions, run issuance,
revocation, secret redaction, and execution backend selection as GitHub. The
native GitLab package offers one tool, `checkout_gitlab_repo`; issue and merge
request work happens through `glab` in the sandbox. A GitLab MCP server, if you
connect one, is a separate connection with its own credential.

## Setup

On the agent's **Tools** page, choose **Add tool → GitLab**. Supply a personal
access token from **that agent's own GitLab.com account**, with `api` and
`write_repository` scopes. Optionally set `default_repository` to
`namespace/project` (nested groups are supported), then **Save changes**.
Checkout and workspace tools become available automatically when a
[sandbox runtime](https://docs.formation.texturehq.com/runtime/sandboxed-execution.md) is configured. **Manage tools**
and **Coding account access** provide optional opt-outs.

Sandbox delivery is on by default: once saved, the token is usable in this
agent's own sandbox without a separate step. An explicit opt-out under **Coding
account access** is kept. GitHub and GitLab permissions are independent, and an
agent can have either or both. No instance acting identity, shared account, or
another agent's token is inherited. Provider permissions are the real resource
boundary: a default project does not restrict a broad PAT.

## Workflow

`checkout_gitlab_repo` accepts `project`, `ref`, and `branch`, verifies the
GitLab account and project through `glab`, and returns the checkout path. Use it
as `workspace_exec`'s `cwd`, edit and test, commit, and push with Git. Open the
merge request with:

```sh theme={null}
glab mr create --title "TITLE" --description "DESCRIPTION" \
  --source-branch "BRANCH" --target-branch "BASE" --yes
```

Add `--draft` when needed. An existing local branch is preserved, including
unpushed commits. Push before finishing: unpushed work is lost when the
workspace is released, and Formation retains a workspace only for a paused task.

Git credentials are host-scoped and commit identity is repository-local, so
switching providers does not relabel an earlier checkout. GitLab project paths
and snapshot keys include `gitlab.com`, keeping GitHub's existing paths intact.
The glab installer pins a release and verifies upstream SHA-256 checksums for
Linux AMD64/ARM64. The token reaches the sandbox through the protected grant
file, never a literal clone URL or command argument.

## Supported boundary

This release supports **GitLab.com over HTTPS with a personal access token**.
It does not support self-managed/Dedicated hosts, SSH keys, OAuth, CI job tokens,
or multiple GitLab accounts for one agent. Account identity comes from GitLab's
current-user API, including the account's configured commit email. An empty
repository must be initialized before checkout. The agent's token must have
access to the target project and permission to push/create merge requests.

Rotating the token or changing either provider's delivery permission
invalidates the run's sandbox and retires reusable snapshots; continuation
cannot revive an older permission.

See [sandbox credential delivery](https://docs.formation.texturehq.com/runtime/workspace-credentials.md) for teardown,
long-lived PAT exposure, failure behavior, and provider-side token revocation.

## Upgrading

The multi-provider credential migrations (`0076`–`0078`) recorded GitLab
delivery as disabled for every agent that already had a GitHub credential
issuance. Those rows are explicit opt-outs: the later automatic default applies
only where no permission row exists, and existing disabled GitLab and GitHub
permissions remain unchanged. On an upgraded install, turn GitLab delivery on
under **Coding account access** for those agents; until then checkout reports
that sandbox delivery must be enabled.

These migrations are a planned maintenance step, not a zero-downtime change.
Stop old application replicas before applying them: the old binary uses a
single-run conflict key. The index build runs in its own transaction and blocks
issuance writes while allowing reads; a short exclusive DDL transaction follows,
and backfill and CHECK validation run after its locks are released. The
multi-provider issuance schema cannot be downgraded to its old single-row
primary key once a run has both provider records; roll forward to recover.

## References

* [GitLab CLI authentication](https://docs.gitlab.com/cli/authentication/)
* [GitLab CLI configuration](https://docs.gitlab.com/cli/configuration/)
* [Pinned glab release](https://gitlab.com/gitlab-org/cli/-/releases/v1.118.0)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.