Skip to content

git/checkout: a fresh working copy lives inside the run's own directory - #124

Merged
Evanfeenstra merged 1 commit into
mainfrom
feature/checkout-into-run-dir
Oct 8, 2026
Merged

Evanfeenstra merged 1 commit into
mainfrom
feature/checkout-into-run-dir

Conversation

@Evanfeenstra

Copy link
Copy Markdown
Contributor

Follow-up to #123 (federation step 1); the strut half of step 2, the explorer.

The problem. A run has one directory, the job's or its own (plans/jobs.md §2). With workdir a checkout is kept inside the job's directory; without one it went under <dataDir>/worktrees/<runId>, while job/dir hands a run with no job its artifact dir. So a workflow whose agent has cwd: "{{ dir.path }}" could only see the repositories it checked out when it ran under a job.

The change. git/checkout without workdir puts the fresh copy under the run's artifact dir, <artifacts>/<runId>/<repo>, still removed at run end; the dir itself is the run's and stays. A bare bag with no artifacts capability keeps the old fallback. Invisible to code-change-pr, which reads checkout.path.

Why now. It lets the seeded job and explore workflows in the lab take repos on the launch with one YAML and no conditional cwd: one git/checkout per URL into the run's directory, kept under a job, fresh in a one-shot. That is plans/jobs.md §2 as written; its sketch is corrected here too ({{ $current }}, a body id), and federation.md marks step 2 built. The lab PR is stakwork/stakgraph (branch feature/explore-seed), which bumps its pinned strut once this lands.

Tests. A new case in src/git.test.ts pins the path, the removal at run end, the kept artifact dir, no fallback dir made, and the single cache worktree. The bare-bag case keeps its existing assertions. 1361 tests pass.

A run has one directory — the job's, or its own (plans/jobs.md §2). With
`workdir` a checkout is kept inside the job's; without one it used to go
under <dataDir>/worktrees/<runId>, while job/dir hands a run with no job
its artifact dir — so a workflow whose agent has cwd: "{{ dir.path }}"
could not see the repositories it checked out unless it ran under a job.
Now the fresh copy goes under the run's artifact dir, <artifacts>/<runId>/
<repo>, still removed at run end (the dir itself is the run's and stays);
a bare bag with no artifacts capability keeps the worktrees fallback.
Invisible to code-change-pr, which reads checkout.path.

This is what lets the seeded `job` and `explore` workflows take `repos`
on the launch (plans/jobs.md §2 as written — one git/checkout per URL into
the run's directory, kept under a job, fresh in a one-shot) with one YAML
and no conditional cwd. The jobs.md sketch now reads `{{ $current }}`
and gives the foreach body an id, the two things that would not have run
as written; federation.md marks step 2 (the explorer, in mcp) built.
@Evanfeenstra
Evanfeenstra merged commit 8908a18 into main Oct 8, 2026
1 check passed
Evanfeenstra added a commit to stakwork/stakgraph that referenced this pull request Oct 8, 2026
…, peers + strut/run-workflow)

stakwork/strut#124 merged: a fresh checkout now lands in the run's artifact
dir, so the seeded job and explore workflows see their `repos` in cwd
without a job too. Also carries #123: peers.json + /peers, the
strut/run-workflow step, list_peers and `peer` on the builder's tools.
Evanfeenstra added a commit to stakwork/stakgraph that referenced this pull request Oct 8, 2026
… job launch (#1752)

* Lab: the explore workflow (federation step 2), and repos on the job launch

explore — what another strut asks this one to run (strut
plans/federation.md §2.2): a read-only agent over the graph's read steps
and the read-only file tools that answers a question from this swarm's
knowledge graph and the repositories named on the launch, with its
sources. The SAME launch and skeleton as `job`: { prompt, repos?,
session? } + `job` on the launch; job/dir → one git/checkout per
repository INTO the run's directory → agent → pack. No bash or web: the
caller may be another strut. params (model, maxSteps, tools, builtins,
system) are the evolvable surface; tests fake the agent and the checkout
and run the rest through the real registry.

job gains `repos?` the same way — plans/jobs.md §2 as written: each
repository checked out into the job's directory, kept turn to turn; hive
passes none today. `items: "{{ input.repos || 0 }}"` is how "none"
reads (foreach takes a count).

The one-shot case — a run with no job seeing its checkouts in cwd — needs
strut's git/checkout to put a fresh copy under the run's own directory
(stakwork/strut, feature/checkout-into-run-dir); the pinned strut gets
bumped once that lands. Under a job it works on today's pin.

* mcp: bump strut to 8908a18 (git/checkout into the run's own directory, peers + strut/run-workflow)

stakwork/strut#124 merged: a fresh checkout now lands in the run's artifact
dir, so the seeded job and explore workflows see their `repos` in cwd
without a job too. Also carries #123: peers.json + /peers, the
strut/run-workflow step, list_peers and `peer` on the builder's tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant