refactor: split orchestrator/gateway images + remove the per-bottle sidecar architecture #385
Reference in New Issue
Block a user
Delete Branch "split-orchestrator-gateway-images"
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?
Splits the conflated
bot-bottle-sidecarsimage into distinct orchestrator + gateway images, then removes the per-bottle companion-container architecture entirely and purges thesidecarname from the repo (per the thread).What changed
Image split (#384)
Dockerfile.gateway→bot-bottle-gateway:latest(renamed fromDockerfile.sidecars, contents unchanged) — the egress/git-gate/supervise data plane.Dockerfile.orchestrator→bot-bottle-orchestrator:latest— leanpython:3.12-slim; the stdlib-onlybot_bottlepackage is bind-mounted, so the #381 source-hash recreate semantics are unchanged.OrchestratorServicetakes distinctimage(control plane) +gateway_image(data plane) instead of feeding one image to both.De-sidecar
backend/docker/sidecar_bundle.pyand docker's dead per-bottle compose renderer (live path usesconsolidated_agent_compose).sidecar_init.py→gateway_init.py; env varBOT_BOTTLE_SIDECAR_DAEMONS→BOT_BOTTLE_GATEWAY_DAEMONS;egress_sidecar_env_entries→egress_gateway_env_entries;SIDECAR_PORTS→GATEWAY_PORTS.launch()fails closed,enumeratereturns empty,cleanup/egress_applydrop the companion-container references. Firecracker's consolidated relaunch is #354; macos follows.sidecarfrom all live code, tests, current docs, scripts, and nix. Onlydocs/prds+docs/researchkeep it as dated history.Verification
/bin/sleep-missing env errors intest_gateway_init, unrelated).python3 -m bot_bottle.orchestrator;ensure_runningbrings the control plane up healthy with the orchestrator onbot-bottle-orchestrator:latestand the gateway onbot-bottle-gateway:latest.Closes #384. macos-container / firecracker are intentionally disabled here (fc re-enabled by #354).
🤖 Generated with Claude Code
https://claude.ai/code/session_01WBMWTEtQdJ4W5UrWuLHCck
We should strip out ALL the per bottle sidecar container code in this as well, since we’re moving away from that architecture.
We should also either rename or remove “sidecar_bundle”: at the end of this work, there should be nothing in the repo mentioning or named “sidecar”, and no per agent companion container
Agreed — the per-bottle companion container is the old architecture, so this fits the consolidation. I'll fold it into this PR. Scoping it concretely so we agree on the boundary before I rip things out:
1. Remove the per-bottle sidecar container code (the architecture)
backend/docker/compose.py— the_sidecar_service(the per-bottle bundle service) and its wiring; the Docker live path already usesconsolidated_agent_compose(agent-only) + the shared gateway, so this is dead weight there.backend/docker/sidecar_bundle.py— deleted (its image constants already alias the gateway;sidecar_bundle_container_name/ thebot-bottle-sidecars-<slug>container go away).bot-bottle-sidecars-*container-name prefixes + discovery/cleanup inbackend/{docker,firecracker,macos_container}/{enumerate,cleanup}.py.2. macos-container + firecracker still launch a per-bottle bundle on
mainRemoving the per-bottle path takes their current gateway mechanism with it. Per your earlier "ok to disable broken macos/firecracker during the refactor", I'll disable those per-bottle launch paths (fail-closed with a pointer) rather than leave dead sidecar code. Firecracker's real replacement is the consolidated shared gateway on #354; macos follows the same consolidation later.
3. Purge the name
bot_bottle/sidecar_init.py→gateway_init.py(it's the gateway image's PID-1 supervisor now) + updateDockerfile.gatewayand tests.sidecaridentifiers/comments in shared modules (egress / git_gate / supervise / paths / bottle_state),SIDECAR_PORTS,_SIDECAR_PREFIX, etc., to gateway-oriented names.README.md,AGENTS.md,tests/README.md,docs/ci.md).One boundary to confirm
docs/prds/*(~45) anddocs/research/*(~150) mention "sidecar" as dated, point-in-time records (e.g. PRD 0024 is literally "consolidate sidecar bundle"). My default is to leave those as history and purge only live code + current docs. If you literally want zero occurrences repo-wide I'll rewrite those too — but that rewrites shipped design history, so I'd rather not unless you say so.Given the size (~100 files) I'll push it in reviewable commits on this branch. Sound right, and — leave historical docs, or purge everything?
@didericis-claude can leave the historical docs
Confirmed — leaving
docs/prds+docs/researchas history; purging live code + current docs.One sequencing snag I hit tracing the removal, want your call before I gut anything:
The companion-container removal is the macos + firecracker
launch.pyrewrite. Their launch flow literally is start sidecar bundle → stage git-gate → start agent, and they're the only live creators of thebot-bottle-sidecars-<slug>container + setters ofBOT_BOTTLE_SIDECAR_DAEMONS/egress_sidecar_env_entries. Deletingsidecar_bundle.pybreaks their imports, so removing the companion container means neutralizing both backends in the same change.The snag: #354 is already migrating firecracker off the per-bottle bundle onto the consolidated shared gateway — i.e. #354 removes fc's sidecar path as part of its cutover. If I also rip it out here, the two PRs conflict and fc breaks on
mainuntil #354 lands.Recommendation (least conflict):
sidecar_bundle.py, strip docker's dead per-bottle compose (bottle_plan_to_compose/_sidecar_bundle_service— already unused on the live path), disable macos (fail-closed until it gets the consolidated gateway), renamesidecar_init.py→gateway_init.py, and purge the remainingsidecaridentifiers + current docs.Alternative if you'd rather not wait: I gut macos and fc here now, accept fc broken on
mainuntil #354, and #354 rebases onto this. Doable, just more churn/conflict.Which do you want — fold fc's removal into #354 (recommended), or force it all into this PR now?
@didericis-claude gut it now: leaving it in muddies the context for ai and creates more work to try and preserve codepaths we’re changing
refactor(orchestrator): distinct orchestrator + gateway images (retire bot-bottle-sidecars)to refactor: split orchestrator/gateway images + remove the per-bottle sidecar architectureDone — gutted it now, in this PR. Four commits on the branch:
split conflated sidecar image into orchestrator + gateway images(#384)rename sidecar_init→gateway_init, drop docker's dead per-bottle compose rendererremove the per-bottle companion-container architecture(deletesidecar_bundle.py; disable fc + macos fail-closed; fail-close their egress_apply reload)purge the "sidecar" name from live code, tests, and current docssidecaroccurrences outsidedocs/prds+docs/research: 0. Historical design docs keep the term as record, as agreed.macos + firecracker are disabled (fail-closed
launch()) since their whole launch flow was start companion container → stage git-gate → start agent; firecracker's consolidated relaunch is #354, macos follows once it grows the shared gateway.Verified: unit suite green (bar the pre-existing
/bin/sleepenv errors), and docker integration — gateway singleton, broker, real two-bottle multitenant isolation, gateway-image build — all pass.