Skip to content

Workspace.git() fails to authenticate private HTTPS submodules on beta.28 #15247

Open

Description

@ShaneMurphy2

AI disclosure (AI100): 100% AI-generated. OpenAI Codex wrote this report, performed the investigation, and executed the reproduction commands at my request.

Reading a local workspace's commit SHA fails when the repository contains a private HTTPS submodule, even though a direct Dagger clone of that same submodule succeeds using the same host credential helper.

This reproduces with an empty dagger.toml and a core GraphQL query; no module or SDK is involved. The submodule URL is absolute HTTPS, so relative URL resolution is not required to trigger it.

Environment

  • CLI: v1.0.0-beta.28, commit 856a3dac, darwin/arm64/v8
  • Engine: v1.0.0-beta.28+856a3dac, running locally in Docker Desktop
  • Host: macOS 26.7.3, ARM64
  • Private GitLab repository over HTTPS; authentication through glab auth git-credential
  • Tested with an isolated Git configuration containing the HTTPS credential helper and no URL rewrites

Reproduction

Use any private HTTPS Git repository for which your host Git credential helper has read access. The URL below is a placeholder; do not put a token in the URL. Both host git ls-remote and the direct Dagger query should succeed before comparing the workspace query.

export PRIVATE_REPO="https://gitlab.com/YOUR_NAMESPACE/YOUR_PRIVATE_REPO.git"
PRIVATE_SHA=$(git ls-remote "$PRIVATE_REPO" HEAD | awk '{print $1}')
test -n "$PRIVATE_SHA"

repro_dir=$(mktemp -d)
cd "$repro_dir"
git init -b main
printf '# Empty workspace\n' > dagger.toml
git config -f .gitmodules submodule.private-lib.path private-lib
git config -f .gitmodules submodule.private-lib.url "$PRIVATE_REPO"
git add dagger.toml .gitmodules
git update-index --add --cacheinfo "160000,$PRIVATE_SHA,private-lib"
git -c commit.gpgsign=false -c user.name=Repro \
  -c [email protected] commit -m "Private submodule repro"

The gitlink intentionally starts uninitialized. No parent repository needs to be published.

Control: a direct clone of the private submodule succeeds and returns its entries:

dagger api query -M --var "url=$PRIVATE_REPO" <<'GRAPHQL'
query($url: String!) {
  git(url: $url) {
    head { tree { entries } }
  }
}
GRAPHQL

Reading only the workspace's HEAD SHA fails:

dagger api query -M <<'GRAPHQL'
{
  currentWorkspace {
    git { head { targetCommit { sha } } }
  }
}
GRAPHQL

Actual behavior

The workspace query reconstructs a checkout and runs git submodule update --init --recursive --depth=1. The clone cannot authenticate. Sanitized excerpt:

git submodule update --init --recursive --depth=1 ERROR
fatal: Authentication failed for 'https://gitlab.com/YOUR_NAMESPACE/YOUR_PRIVATE_REPO.git/'

Error: make request: input: currentWorkspace.git.head workspace git uncommitted:
get canonical checkout snapshot: failed to checkout refs/heads/main:
failed to update submodules: git error: git authentication failed

Expected behavior

Reading the parent repository's Git metadata should work. If this operation requires checking out submodules, their private URLs need an authentication path using the caller's authorized credentials, or an explicit way to supply those credentials. The direct core Git query can already access this exact URL in the same environment.

Workaround and investigation

Committing update = none for the submodule makes the workspace query succeed. This changes normal developer submodule behavior, so it is an undesirable workaround. Supplying submodule.<name>.update=none only through host Git configuration/environment did not suppress the engine checkout.

The beta.28 source suggests the local checkout path is missing the credential plumbing used by remote repositories:

This is a source-level hypothesis; I have not tested an engine patch. The direct-clone success, workspace failure, and committed-skip workaround were all reproduced locally on beta.28.

Related: #10863 (closed), which discusses broader submodule authentication/API limitations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions