feat(firecracker): consolidated per-host gateway launch (PRD 0070, part of #348) #354
Open
didericis-claude
wants to merge 6 commits from
firecracker-consolidated-launch into main
pull from: firecracker-consolidated-launch
merge into: didericis:main
didericis:main
didericis:lazy-backend-imports
didericis:orchestrator-agent-compose
didericis:orchestrator-gateway-ca
didericis:orchestrator-consolidated-launch
didericis:orchestrator-gateway-provision
didericis:orchestrator-gateway-network
didericis:orchestrator-client
didericis:orchestrator-gateway-net
didericis:orchestrator-gitgate-provision
didericis:orchestrator-registration
didericis:orchestrator-lifecycle
didericis:orchestrator-supervise-writers
didericis:orchestrator-supervise-multitenant
didericis:orchestrator-gitgate-multitenant
didericis:orchestrator-rename-gateway
didericis:orchestrator-slice8
didericis:orchestrator-slice7
didericis:orchestrator-slice6
didericis:prd-orchestrator
didericis:orchestrator-slice5
didericis:orchestrator-slice4
didericis:orchestrator-slice3
didericis:orchestrator-slice2
didericis:ci-kvm-runner
didericis:firecracker-backend
didericis:issue-330-cached-images
didericis:forge-native-integration
didericis:prd-smolmachines-linux
didericis:claude-forward-host-credentials
didericis:fold-orchestrator-subpackage
didericis:prd-egress-control-plane
didericis:manifest-break-import-cycle
didericis:dlp-supervise-quality-fixes
didericis:table-drive-dlp-tests
didericis:fix-integration-test-failures
didericis:fix/macos-container-relative-dockerfile
didericis:prd-0054-install-script
didericis:commit-bottle-state
didericis:pr-211
didericis:move-codex-auth-to-contrib
didericis:feat/pipelock-skip-scan-extensions
didericis:prd-0049-named-labelled-agents
didericis:harden-git-gate-shell-rendering
Dismiss Review
Are you sure you want to dismiss this review?
Labels
Clear labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Low
4
The priority is low
Priority
Medium
3
The priority is medium
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
No Label
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: didericis/bot-bottle#354
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "firecracker-consolidated-launch"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #348 (PRD 0069 — Firecracker-native, Docker-free backend). Closes #353.
Consolidated Firecracker launch (PRD 0070)
Re-enables the Firecracker backend on the shared per-host gateway instead of the per-bottle companion container that the de-sidecar work removed. This is the source-IP-keyed persistent data plane that stage (1) of #348 calls for: one gateway per host, shared by every microVM, rather than one
docker runper bottle.firecracker/consolidated_launch.py(new) mirrorsdocker/consolidated_launch.pybut wired for Firecracker's TAP topology: it ensures a Firecracker-flavoured orchestrator + gateway are up, registers the bottle by its guest IP (the attribution key), provisions the bottle's git-gate state into the running gateway, and returns the shared gateway CA for the provisioner to install in the rootfs.firecracker/launch.pyis rebuilt around that sequence. The per-bottle sidecar bundle is gone; VMs reach the shared gateway at their slot's host-side TAP IP, where Docker's PREROUTING DNAT + the nft table'sct status dnat acceptforward rule route the traffic. Attribution is unspoofable by construction (the /31 point-to-point TAP + thebot_bottle_fcnft table guarantee only the expected VM can source-IP its guest address).orchestrator/lifecycle.pyandorchestrator/gateway.pygrow small, additive knobs so both backends can run on one host without collision:OrchestratorServicetakesorchestrator_name/orchestrator_labeland exposes a_gateway()override hook;DockerGatewaytakeshost_port_bindingsso the Firecracker gateway can publish its ports on the host for VMs to reach over their TAP link. The Firecracker orchestrator usesbot-bottle-fc-*container names and the heavy gateway data-plane image (_gateway_image, kept distinct from the lean control-plane image after the #384 split).The TAP slot allocation, rootfs build, and VM boot are unchanged; only the data-plane wiring moved from per-bottle sidecar to shared gateway.
Post-build agent-image smoke test (Closes #353)
npm treats
optionalDependenciesfailures as non-fatal, so a transient network blip duringnpm install -gcan leave a stub CLI in an image that stilldocker build-exits 0 — then gets baked into the Docker layer cache indefinitely (this is exactly the brokenclaude-codenative-binary image in #353). A provider-declared smoke test, run in a throwaway container of the freshly built image, fails the launch loudly at build time instead of at first agent use.docker/util.pygainsdocker_exec,docker_cp, andverify_agent_imagehelpers plus--no-cachesupport inbuild_image, all built on the sharedrun_dockerprimitive.docker/launch.py,firecracker/launch.py, andmacos_container/util.pyrunverify_agent_imageafter every fresh agent-image build.cli/start.pyadds--no-cacheto force a from-scratch agent-image rebuild (the escape hatch when a broken layer is already cached).bfdbae804btoe862b82322@@ -113,1 +114,4 @@)docker_mod.verify_agent_image(plan.image, runtime_for(plan.agent_provider_template).smoke_test,)This requires spinning up a new container, just for the verification step?
@@ -113,1 +114,4 @@)docker_mod.verify_agent_image(plan.image, runtime_for(plan.agent_provider_template).smoke_test,)Yes — it runs
docker run --rmwith just the smoke-test argv (e.g.claude --version), so the container exits in under a second and is immediately removed. The overhead is intentional: the root bug was thatdocker buildexits 0 even when npm silently fails to install the optional binary, so the only reliable way to catch a broken image is to actually run it.@didericis-claude I think it's pretty rare to have a broken image/that only happened because a build got interrupted (ideally we'd be using cached images the majority of the time). Could we instead only have this run in a new "doctor" or "rebuild" command? I think an explicit "rebuild" command for agent images probably makes more sense. Push back/challenge whatever seems wrong and acknowledge what seems like good direction.
@@ -113,1 +114,4 @@)docker_mod.verify_agent_image(plan.image, runtime_for(plan.agent_provider_template).smoke_test,)Two things worth separating:
Agree: A
rebuildcommand is a good idea regardless — useful escape hatch when you want to force a fresh build without digging into--no-cacheflags. Worth adding.Push back on the framing: The root cause wasn't just an interrupted build. npm treats optional-dependency failures as non-fatal and exits 0, so a transient network hiccup during
npm install -gcan silently produce a broken binary on any build — then BuildKit caches that broken layer indefinitely. You wouldn't know until the agent tries to use its CLI. That's the exact failure mode in #353.Also: the verify already only runs in the fresh-build branch. When a committed image is reused (the common case), it's skipped entirely. Moving verification to a
doctor/rebuildcommand doesn't reduce per-launch overhead (there isn't any on cached launches) — it just shifts discovery from build time to first-real-use time, which is where we started.I'd keep the verify on build and add the
rebuildcommand on top.add4c53f43tof47957d847Smoke-test agent images after build, add start --no-cacheto feat(firecracker): consolidated orchestrator launch (PRD 0070)f47957d847to06a920f08d06a920f08dto79616a646069cbf82e6dto0a1f949937feat(firecracker): consolidated orchestrator launch (PRD 0070)to feat(firecracker): consolidated per-host gateway launch (PRD 0070, part of #348)View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.