Commit Graph

2 Commits

Author SHA1 Message Date
didericis b315a127b8 fix(backend): skip gateway reconcile when no running bottles (0081)
tracker-policy-pr / check-pr (pull_request) Successful in 12s
lint / lint (push) Successful in 56s
test / unit (pull_request) Failing after 46s
test / integration-docker (pull_request) Successful in 1m1s
test / coverage (pull_request) Has been skipped
reconcile_running_bottles() gathered the gateway attach-resources (a read of
the per-host singleton gateway's CA) *before* enumerating running bottles. On
a cold-boot bring-up of a NON-default gateway instance with no host bottles —
e.g. an isolated integration test's `-itest-` gateway — that read targeted the
default `bot-bottle-orch-gateway`, which doesn't exist for that instance, so
setUpClass died with "No such container: bot-bottle-orch-gateway" (seen on the
0081 PR's integration-docker job).

Enumerate running bottles first and return early when there are none: the
reconcile is a no-op with nothing to reattach, so the CA read is both wasted
and wrong for a non-default instance. Production (default names, real bottles)
is unchanged. Adds unit coverage for the three reconcile paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-26 22:52:47 -04:00
didericis-claude 3c0d2fb66f refactor(backend): base owns the gateway-attach flow, fail hard (0081 review)
lint / lint (push) Successful in 1m1s
test / unit (pull_request) Successful in 1m5s
tracker-policy-pr / check-pr (pull_request) Successful in 10s
test / integration-docker (pull_request) Failing after 1m30s
test / coverage (pull_request) Has been skipped
Addresses review on #519 (@didericis 6143 + the fail-hard direction over the
codex skip).

Base owns the flow (6143 / ADR 0006). `attach_bottled_agents_to_gateway()` is
now a concrete method on `BottleBackend` that delegates to
`gateway_attach.reconcile_running_bottles`; backends override only three
primitives — `_gateway_attach_resources()`, `_running_bottles()`,
`_attach_bottle_to_gateway()`. The shared control flow + error policy live in
one place so a backend can't drift onto a bespoke loop or a silent skip. Keeps
the reconcile flow + `GatewayAttachResources` out of `backend/base.py` (the
size guardrail) in a dedicated `backend/gateway_attach.py`. New ADR 0006 records
the "shared behaviour in the base backend, subclasses override primitives"
theme.

Fail hard, never skip (the maintainer's direction over the codex review's
skip). Any attach failure now aborts bring-up instead of being logged and
skipped: a bottle that silently can't reach the fresh gateway (its egress just
starts failing TLS) is worse than a loud failure. Every bottle is attempted and
the failures are raised together (aggregate `InfraLaunchError`) so one bring-up
surfaces the full blast radius. Resource gathering (the CA fetch) also fails
hard. PRD 0081 goal + design updated to match (reversed from the earlier
"tolerate per-bottle failures" draft).

Bumps the base.py guardrail cap 580->600 for the new contract surface (the
delegator + 3 abstract primitives); the flow itself lives in gateway_attach.py.

Refs #516, #519.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 01:50:06 +00:00