Skip to content

delegate-mcp: oc_collect always fails for a session opened from a shallow repository #130

Closed

Description

@Alter-Igor

What happens

oc_collect fails with upstream_error: The delegate box failed to bundle the session branch every time, when the session was started from a shallow repository (a git clone --depth or git fetch --depth copy). Seen 2026-10-05 on session s-f661c03bdd (fork #129 work): the opencode main checkout X:/opencode has a .git/shallow file, so every worktree of it is shallow too.

Several Claude Code sessions delegate from this repo at the same time, so this blocks all of them at collect, after the box has done the work.

Cause

open runs host git bundle create <file> HEAD. A bundle carries objects and refs, not git's shallow list. The box clone then holds the boundary commit with a parent it never got. Any history walk past it fails in the box:

error: Could not read 8b68dc0d7fa24d820990461eed13bec2e604c157
fatal: Failed to traverse parents of commit f014686b07f6f14c01cf090c3c97bcb931d57cf9

That includes collect's box git bundle create ... delegate/<key>, and plain git log for the agent.

Fix

At open, when git rev-parse --is-shallow-repository is true, read the host's shallow list (git rev-parse --git-path shallow, shared by every worktree) and write the same commit ids into the box copy's .git/shallow (argument-passed, ids checked against the commit-id shape, at most 1000).

Proven by hand on s-f661c03bdd: with the list written, the box bundle was made and oc_collect fetched 1 commit into the shallow host repo.

Acceptance

  • A session opened from a depth-1 clone: the box copy's git rev-list --count HEAD works, and collect fetches the box commit.
  • A full repository gets no shallow list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions