fix(build): n8 build always builds the nemesis8 container#98
Merged
Conversation
Two failure modes let `n8 build` build the wrong thing — or nothing:
1. cwd hijack: project_dir_fn() treated ANY Dockerfile in the current
directory as the nemesis8 source, so running `n8 build` from a sibling
repo (e.g. skiff) compiled THAT project and stamped it nemesis8:latest,
silently clobbering the real agent image. Now the cwd Dockerfile is
accepted only if it carries a nemesis8 build marker (nemesis8-base /
nemesis8-entry); a foreign Dockerfile is ignored with a warning and
resolution falls through to the real nemesis8 source.
2. Installed users have only the binary — no repo, no Dockerfile. The
fetch path now downloads the GitHub source tarball for THIS binary's
version (v{CARGO_PKG_VERSION}) over HTTPS (reqwest::blocking, already
used in entry.rs) and unpacks it with flate2 + tar — no git required.
git clone of the tag remains a fallback. The context is cached under
~/.nemesis8/project with a .nemesis8-version stamp and re-fetched only
on version mismatch, so the built container always matches the binary
instead of chasing a floating main.
Cargo.lock will gain flate2 on the next build (no main-binary path uses
--locked). No new commands or behavior.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…_oxide, simd-adler32)
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.
Problem
Two failure modes let
n8 buildbuild the wrong thing — or nothing:cwd hijack.
project_dir_fn()treated anyDockerfilein the current directory as the nemesis8 source. Runningn8 build(or triggering an auto-build) from a sibling repo that ships a Dockerfile (e.g.skiff) compiled that project and stamped itnemesis8:latest(DEFAULT_IMAGE is fixed), silently clobbering the real agent image.Installed users have no repo/Dockerfile. The fetch path (
~/.nemesis8/project) shallow-clonedmainviagit, which (a) requires git on the user's machine and (b) floats tomaininstead of the tag matching the installed binary — so the built container could drift out of sync with the binary.Fix
is_nemesis8_dockerfile): the cwdDockerfileis trusted only if it carries a nemesis8 build marker (nemesis8-base/nemesis8-entry). A foreign Dockerfile is ignored with a warning, and resolution falls through to the real nemesis8 source.download_build_filesnow downloads the GitHub source tarball for this binary's version (v{CARGO_PKG_VERSION}) over HTTPS (reqwest::blocking, already used inentry.rs) and unpacks it withflate2+tar— no git required. A shallowgit cloneof the tag remains a fallback. The context is cached under~/.nemesis8/projectwith a.nemesis8-versionstamp and re-fetched only on version mismatch.Net:
n8 buildalways builds the nemesis8 container matching the binary — never a foreign project, never a floatingmain.Verification
Compiled locally with
cargo build(stable 1.97.1, x86_64-pc-windows-msvc) —Finishedwith no errors.flate2+ transitive deps locked inCargo.lock.🤖 Generated with Claude Code