Skip to content

thrawn: worktree setup hook — fresh worktrees start without installed dependencies #1

Description

@swmcc

Problem

Every worktree thrawn creates (task worktrees and _integration) is a fresh checkout branched from the base commit. Installed dependencies don't carry over — so on a Ruby repo, if the run touches Gemfile.lock, the first bin/rspec in the integration worktree fails with missing gems.

Observed on a real run (gh-4 on a Rails repo): the merged code was fine, but checks went red purely because the fresh _integration worktree needed bundle install. The integrator agent then burned a whole fix attempt (out of integrator_attempts = 2) rediscovering and running bundle install — several minutes of opus time for a deterministic one-liner.

This will recur on every run in any repo where checks need installed deps (bundler, npm/yarn, mix deps.get, pip, …).

Proposal

Add a per-repo setup hook to .thrawn.toml, run in each freshly created worktree before the task agent starts / before checks run:

[thrawn]
setup = ["bundle install"]   # or ["npm ci"], ["mix deps.get"], …

Behaviour:

  • Run in task worktrees after git worktree add, before the agent spawns (agents also benefit — they can run tests while working)
  • Run in _integration after merging, before the first check command
  • Failure of a setup command should fail fast with its output — not dispatch an integrator
  • Log to .thrawn/runs/<run>/setup-<where>.log

Alternatives considered

  • Making bundle install the first entry in [checks] commands — works today as a per-repo workaround, but it conflates setup with verification, doesn't help task worktrees, and still counts a setup failure as a "checks failing" integrator trigger
  • Auto-detecting (Gemfile → bundle install, package.json → npm ci, …) — could complement the hook as a default, but an explicit hook should exist first

Acceptance

  • setup commands from .thrawn.toml run in every new task worktree and in _integration before checks
  • Setup failure aborts with clear output and does not consume an integrator attempt
  • Documented in README + USAGE
  • Covered in thrawn/tests/test_thrawn.py (fake setup command, both worktree kinds, failure path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestthrawnThe thrawn orchestrator

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions