Skip to content

Fix environment creation from shallow clones - #347

Open
cyq1017 wants to merge 1 commit into
dagger:mainfrom
cyq1017:codex/fix-issue-248-shallow-unshallow
Open

Fix environment creation from shallow clones#347
cyq1017 wants to merge 1 commit into
dagger:mainfrom
cyq1017:codex/fix-issue-248-shallow-unshallow

Conversation

@cyq1017

@cyq1017 cyq1017 commented May 24, 2026

Copy link
Copy Markdown

Summary

  • detect shallow repositories before creating an environment worktree branch
  • fetch full history only when the source repo is shallow
  • add a regression test that reproduces the shallow-clone push failure path

Fixes #248.

Tests

  • go test ./repository -run TestInitializeWorktreeUnshallowOnShallowClone
  • go test -short ./...
  • git diff --check

@awdemos

awdemos commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Endorsed for merge.

  • Detects shallow user repos and runs before pushing the environment branch to the local container-use remote, fixing shallow-clone failures.
  • Includes a regression test that constructs a shallow clone and verifies it becomes unshallow during environment creation.
  • Verified: go test -short ./repository/... passes.

Minor note: if itself fails, the subsequent push retry will retry the push rather than reattempt unshallowing, but that's acceptable since the unshallow error will still surface.

@awdemos

awdemos commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

@cyq1017 friendly ping — this PR currently has merge conflicts with . Could you rebase onto and resolve the conflicts? Once the merge conflicts are gone I'll be happy to re-review.

@cyq1017
cyq1017 force-pushed the codex/fix-issue-248-shallow-unshallow branch from 9356a55 to 42269bc Compare August 12, 2026 18:38
@cyq1017

cyq1017 commented Aug 12, 2026

Copy link
Copy Markdown
Author

Rebased onto the latest main and resolved the conflicts. I reran go test -short ./repository/... -count=1 and go test -short ./... -count=1; both pass. The PR is mergeable again and ready for re-review.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: container-use environment_create fails with shallow Git repositories due to rejected push

2 participants