Skip to content

Managed worktree for a thread flickers between the full checkout and an empty directory #8331

Backlog

Description

@gaodes

Summary

A bb-managed worktree can present two different views to shell commands inside one
thread. Sometimes the commands see the full checkout; at other times the same
directory holds only the file that was written last. In the second view npm ci
falls back to the local prefix /home/elche, git reports not a git repository,
and test -f package.json fails, while a parallel ls "$P/package.json" succeeds.

Versions and environment

  • bb 0.50.1
  • Linux 7.2.5-3-omarchy, host hq
  • install: the bb desktop install under /home/elche/.bb
  • environment: a bb-managed worktree from the environment-git-worktree plugin
  • worktree: /home/elche/.bb/plugins/environment-git-worktree/host-data/worktrees/thr_ys6qvjnnn6-1/services
  • agent: Pi provider, running shell commands through the Pi bash tool

Steps to reproduce

The two views alternate without a pattern, so this is the closest faithful repro.

  1. Open a thread whose environment is the managed worktree above.
  2. In a loop, run a command that reads the checkout, for example
    cd <worktree> && ls -a | wc -l && git rev-parse --show-toplevel && test -f package.json.
  3. Compare the answer with a parallel ls "$P/package.json" in the same turn.

About 30 consecutive retries in a loop never gave a consistent view.

Unverified: I am the filer of this report, not the reporter. I sampled the same
worktree path myself in 6 runs and saw the full view each time, so I could not
reproduce the empty view on demand. The report comes from a live session that hit
both views.

Expected vs actual

Actual, from the reporting session:

npm ci
npm error code ENOENT
npm error enoent Could not read package.json: Error: ENOENT: no such file or
directory, open '/home/elche/package.json'
git status
fatal: not a git repository (or any of the parent directories): .git

At the same moment, in the same turn:

ls "$P/package.json"     # succeeds
/proc/1/root/<worktree path>/package.json   # shows the file

Expected: one stable view of the worktree for every command in the thread. The
checkout on disk is correct, so a command should not see a short or empty
directory, and npm should not fall back to /home/elche.

Evidence

  • Reporting session transcript: npm ci returns ENOENT for
    /home/elche/package.json.
  • The entry count of the same directory oscillates between 3 and 36 while the
    inode stays 61924099.
  • My own samples of the same path (6 runs) show a stable full view: ls -a gives
    8 entries, git rev-parse --show-toplevel returns the worktree path, and the
    directory inode is 61924086.
  • The command runner reaches the same path, so the empty view looks like a view or
    mount problem at command time, not a missing checkout.

What you ruled out

  • Not a missing checkout: /proc/1/root/<path> and a parallel ls show the file
    while another command in the same turn does not.
  • Not the worktree itself: a plain git worktree add under ~/NoxOS/.worktrees/
    (branch services-5-unifi-mcp) is stable across 12 samples. The unifi-mcp work
    was moved there.
  • Not a stale checkout: repeated retries in one turn never settle on one view.
  • Searched open and closed issues for worktree, worktree empty, ENOENT,
    not a git repository and the behavior words. No duplicate found.

Suggested priority and effort

Medium to high: it silently corrupts the view of the workspace, so any build or
test run in a managed worktree can fail or read the wrong tree. The workaround is a
plain git worktree add outside bb. Effort unknown.

Findings Log receipt: flr_2d4ef574-926f-4bda-9f2e-c6c7dfbbf427

AGENT GENERATED

Activity

  1. added theissue type on Nov 29, 2026
  2. added
    workspaces
    provider-pi
    no-repro
    on Nov 29, 2026
  3. bb-slop-cop commented on Nov 29, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Medium · Effort: Medium. Labels: workspaces, provider-pi, no-repro.
    • Reproduction report: NOT REPRODUCED · Root-cause confidence: low.
    • Evidence: Two clean trusted-main checkouts each passed 30 managed-worktree and 30 plain-worktree comparisons using real provisioning and stock Pi bash. The report includes the complete probe and output. Relevant existing suites passed: 592 tests, 6 skipped.
    • Root cause: Not established. Checkout contents and directory/manifest identities stayed stable locally; the affected host, extensions, mount setup, and live provider session were not reproduced.
    • No PR: No failure on trusted main means no safe regression-backed fix was established.

    AGENT GENERATED

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-reproprovider-piworkspaces

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions