Skip to content

A hub worktree created anywhere can commit, with or without hub-private #386

Open

Description

@ooloth

Current state

A hub worktree outside hub-worktrees/, such as one in a temporary directory, cannot commit, and hub's checks fail there, so agent workflows that check or land work in a worktree made with mktemp -d stop on hub. In a fresh worktree the pre-commit cargo fmt --check fails with failed to resolve mod private: clients/src/private.rs does not exist, and the same for ui/tui and workflows, before hub-private is involved. After just setup-private links hub-private in, clippy fails reading prompts/investigations/media.md, which hub tracks as a relative link to ../../../hub-private/prompts/media-investigate.md, so it resolves only when the checkout's parent also holds hub-private. Worktrees under hub-worktrees/ work only because that folder holds an untracked hub-private -> ../hub-private link that no doc mentions (both seen 2026-10-28).

Ideal state

  • A hub worktree created anywhere commits and pushes without hub-private linked
  • After just setup-private, a hub worktree created anywhere commits and pushes in every configuration just lint checks

Decisions

Constraints

Open

No open decisions.

Starting points

  • scripts/src/setup_private.rs: what setup-private links into a checkout
  • prompts/investigations/media.md: the tracked relative link that resolves only beside hub-private
  • prek.toml: the pre-commit hooks, including cargo fmt --check, that a fresh worktree fails

Activity

  1. ooloth commented on Nov 5, 2026

    @ooloth
    OwnerAuthor

    A fix for this should not make worktrees share the main checkout's target/ through CARGO_TARGET_DIR to skip the cold build. It lets one checkout run the other's code with no warning.

    What I ran (2026-11-04, 57f71d6, --features private,hub-tui/media): a scratch worktree with a #[used] static holding a marker string that only the worktree's source had. I built it with CARGO_TARGET_DIR set to the main checkout's target/, then ran cargo build in the main checkout.

    What I saw: the worktree build put the marker in target/debug/hub-tui. The main checkout's build then reported the package fresh and recompiled nothing. Its hub-tui binary still held the marker, although the main checkout's source has none. Both checkouts resolve the workspace packages to the same artifact hash (for example hub_tui-5ce22af363431038), so each accepts whatever the other built last. A just tui in either checkout can run the other checkout's code.

    What a separate target/ costs instead, on an M2 with 8 cores: git worktree add 0.1s, a cold just build 19.1s and 1.1 GB, then 0.1s with no change and 2.3s after touching one leaf file. In a second worktree at e17d0db, starting cold: just setup-private home-laptop 8.0s, just test 23.5s to compile and 4.4s to run all 1,646 tests, then just lint across all three configurations 20.5s. A second just lint with no change took 0.8s. The worktree's target/ ended at 2.2 GB. So a worktree reaches hub's full checks in about a minute of cold work, which is cheap enough that sharing a target is not worth the risk.

  2. ooloth commented on Nov 5, 2026

    @ooloth
    OwnerAuthor

    Seen again 2026-11-05: a hub worktree made with mktemp -d could not build with hub-private linked until prompts/investigations/media.md was relinked to an absolute path. Since #401, AGENTS.md says a Dependabot PR that changes Cargo.toml or Cargo.lock merges only after just lint and just test pass with every hub-private module linked. Until this is fixed, each such PR (#406 to #410 so far) has to be checked in the main checkout or under hub-worktrees/.

  3. ooloth commented on Nov 9, 2026

    @ooloth
    OwnerAuthor

    Seen again on #410 (2026-11-08): hub's own PR worktrees, such as ~/.hub/repos/hub/pr-410, have no hub-private beside them either, so just lint failed in the "hub-private with media" configuration until a hub-private link was added next to the checkout.

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

    maintenanceKeeps code, docs or tooling healthy

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions