Move the host launcher into the swarmforge package - #36
Merged
Conversation
The launcher, the tongs core, and the git-dir guard each loaded the next by file path: two spec_from_file_location blocks in the launcher, one sys.path prepend in the tongs core, and one loader in each of three test files. Every consumer re-implemented module loading, so nothing could be type-checked, linted for import errors, or mocked through ordinary means. They are now swarmforge.anvil, swarmforge.tongs, and swarmforge.gitguard, importing each other normally, and the only files that resolve a path are three shims under bin/ -- run-anvil, tongs, git-guard -- that put the checkout on sys.path and call the module's main(). The Makefile invokes the shims. Behavior is unchanged. The usage strings now name the entry points a caller can actually run, and the make-recipe tests gained a guard that the recipe reaches the launcher through its shim: naming a module file directly would still import fine here and fail on a machine without the package installed.
The README named `scripts/run_anvil.py` and `scripts/git_guard.py`, and the contributor notes described `swarmforge/` as the package the container-side entrypoint runs. The launcher lives there now too, reached through the shims under `bin/`, which the overview did not mention at all.
…package
Conflicts:
AGENTS.md
- Adjacent lines conflicted: the `anvil/` bullet and the `swarmforge/`
bullet, for different reasons.
- master added the Claude status line and its settings seeder to the
`anvil/` inventory, which this branch left untouched -> took master's
bullet verbatim.
- master described `swarmforge/` as the package the entrypoint runs agent
translation and config merging out of, while this branch rewrote the
same bullet to name the host launcher now living there and added a
`bin/` bullet after it -> kept master's wording for the container side
and folded this branch's host-launcher clause in front of it, then the
`bin/` bullet unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The launcher, the tongs core, and the git-dir guard each loaded the next by file path — two
spec_from_file_locationblocks in the launcher, asys.pathprepend in the tongs core, and a loader in each of three test files. Every consumer re-implemented module loading, so none of it could be type-checked, linted for import errors, or mocked through ordinary means.They are now
swarmforge.anvil,swarmforge.tongs, andswarmforge.gitguard, importing each other normally. The only files left that resolve a path are three shims underbin/—run-anvil,tongs,git-guard— each of which puts the checkout onsys.pathand calls its module'smain(). The Makefile'srun_agent_containerrecipe invokes the shims.This is a move, not a rewrite. Git reports the three files as renames at 98–99% similarity, and the only non-import changes inside them are docstrings and three usage strings that named files a caller can no longer run (
run_anvil.py→run-anvil,tongs.py→tongs,git_guard.py:→git-guard:). Nothing parses those strings; the Makefile consumes only the guard's stdout, which is unchanged.Verification
The docker argv is the thing that must not move. Running the real
run_opencodeandrun_clauderecipes on this branch and on its base, withdockerstubbed to record its argv, produces byte-identical argv on both targets (62 and 84 arguments), with the git guard emitting the same six.gitmounts through the new shim.The unit suite is green, and the make-recipe tests gained a guard that the recipe reaches the launcher through its shim rather than naming a module file: a path-named module still imports fine from a checkout and fails on a machine where the package is not installed, so that drift would otherwise pass CI and break in the field.
The shims resolve
__file__throughrealpath, so one symlinked ontoPATHstill finds the checkout it lives in.