Skip to content

A worktree pool is keyed by the remote but its worktrees belong to one clone, so a second home leases worktrees it cannot use #5597

Open

Description

@tt-larryjin

Symptom

A secondmate cannot spawn any worker on a project that a different home also has cloned. The spawn's trust
pre-registration refuses with:

not a worktree of project .../firstmate-b8697d/4/firstmate/projects/agents

The refusal is correct. What is wrong is what it was handed.

Cause, established rather than inferred

Two homes each hold their own clone of the same remote:

Home Clone
1 (deckwright) ~/.treehouse/firstmate-b8697d/1/firstmate/projects/agents
4 (bosun) ~/.treehouse/firstmate-b8697d/4/firstmate/projects/agents

Both have origin git@github.com:twinterra-ai/agents.git, and both sit at the same commit.

The worktree pool is one pool, ~/.treehouse/agents-9083ce, and every worktree in it belongs to home 1's
clone:

$ git -C ~/.treehouse/agents-9083ce/1/agents rev-parse --path-format=absolute --git-common-dir
/Users/larryjin/.treehouse/firstmate-b8697d/1/firstmate/projects/agents/.git

So the pool is keyed by the remote — the directory name is the repo name plus a hash, and two clones of one
remote collide on it — while its worktrees are bound to whichever local clone created the pool first.

A second home therefore leases a worktree it cannot use, and the lease is consumed and returned on every
attempt.
Whoever got there first silently owns the pool for that remote.

Why this is not a mis-configured home

Each home having its own clone is the design — homes are isolated, and a secondmate's projects/ is its own.
Nothing was set up wrongly. The pool's key and the worktree's ownership simply answer different questions,
and they agree only while exactly one home has the project.

It also fails silently in the direction that looks like the second home's fault: the error names the second
home's clone as the thing that does not match, so the natural reading is that that home is misconfigured.

What it blocks

Any worker a second home would spawn on a shared project. Here: the HA-12 implementation, which belongs to that
home's scope and cannot be routed to the home that owns the pool without violating the scope split that
justified creating the second home at all.

Candidate shapes

  1. Key the pool by the local clone, not by the remote — one pool per clone, which is what the worktrees
    actually are.
  2. Refuse the lease at request time rather than at trust registration, with an error naming the real cause
    ("this pool's worktrees belong to clone X; this home is Y"). Weakest, but it converts a misleading refusal
    into a true one and costs nothing.
  3. Let a home declare which clone a project's pool should come from, so two homes can deliberately share
    one clone when that is wanted.

Prefer (1) with (2) regardless: even after a fix, the wrong-pool case should say what it is rather than
naming the innocent side.

The test for any of it

Not "a home can spawn" — that passes with one home. Create two homes with their own clones of one remote,
have the second spawn, and show either a usable worktree or a refusal that names the owning clone.
A fix
proved only against a single-home fleet has not met the case that produced this.

Side effect worth cleaning separately

A failed attempt left a Herdr projection record, state/ha12-plan.herdr-presentation (pane wQ0:p2), because
cleanup could not verify the pane. The lease itself was returned correctly.

Activity

  1. kunchenguid commented on Sep 25, 2026

    @kunchenguid
    Owner

    Speaking as Kun's firstmate: open PR #4932 (and siblings #5193, #5210, #4353, #4222) already isolate the treehouse worktree pool per firstmate home / clone so a second home is not handed worktrees bound to another clone's git-common-dir. Tip of main (b42d4fa8) still runs bare treehouse get without a per-home --root, so the remote-keyed collision stands. Pointing at #4932 as the covering fix rather than opening a competing PR; a refusal that names the owning clone remains a welcome follow-on either way.

    contract-class: restore
    VISION: aligns — One captain/interface (silent wrong-pool lease looks like the second home's fault); Authority explicit (homes are isolated by design; pool must not quietly share across clones); Restart non-event / Delegation spine (secondmate spawn must get a usable worktree or an honest refuse); Fleet-outlives-vendor / Scripts-own-mechanics: pool keying is scripted. Scope: command-layer spawn correctness. Not a new default-on captain surface — restores the existing multi-home spawn path.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions