Gateway upgrade: tag local builds with the pin; pull outside the lock
Build App (Preview) / compute-version (pull_request) Successful in 8s
Secret Scan / scan (push) Successful in 12s
Secret Scan / scan (pull_request) Successful in 9s
Build App (Preview) / create-release (pull_request) Successful in 1s
Build App (Preview) / test (pull_request) Successful in 4m18s
Build App (Preview) / build-macos (pull_request) Successful in 3m15s
Build App (Preview) / build-windows (pull_request) Successful in 6m51s
Build App (Preview) / build-linux (pull_request) Successful in 9m31s
Build App (Preview) / prune-previews (pull_request) Successful in 3s

Second-review follow-ups, replacing the label + probe approach:
- Local builds are tagged `triple-c-gateway:<pin>` instead of `latest`, so
  a build for an older pin simply doesn't match. Drops the version label,
  the probe container, its cache and version normalisation — and with them
  the case where a failed probe made a current build look stale.
- The pinned image is pulled before taking the gateway lock, so a long
  pull no longer blocks Stop, shutdown or settings saves; skipped when the
  start would fail on configuration anyway.
- If no pinned image is available, the old container is removed and the
  error keeps the pull failure, reporting a removal failure alongside it.
- Status gains `image_outdated` (container image id != pinned image id).
  Settings uses it for the label, keeps Stop for any running gateway, and
  always offers Start, since Start pulls the image.
- Reuse `migration::image_id` and one container-removal helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-11-02 15:14:33 -08:00
1 parent 00b504063f
commit 03c77c5f55
5 files changed
+215 -339

No files matched your search

@@ -39,6 +39,7 @@ const status = (over: Partial<GatewayStatus> = {}): GatewayStatus => ({
running: true,
port: 4000,
image_exists: true,
image_outdated: false,
model_count: 0,
has_api_key: false,
base_url: "http://host.docker.internal:4000",
@@ -102,15 +103,26 @@ describe("GatewaySettings", () => {
);
await waitFor(() => expect(getGatewayStatus).toHaveBeenCalledTimes(2));
});
it("can still stop a running gateway whose image is out of date", async () => {
it("can stop a gateway running an outdated image, and says so", async () => {
appSettings = settingsWithGateway(true);
getGatewayStatus.mockResolvedValue(status({ image_exists: false }));
getGatewayStatus.mockResolvedValue(status({ image_outdated: true }));
render(<GatewaySettings />);
const stop = await screen.findByRole("button", { name: "Stop" });
expect(screen.getByText(/image out of date/i)).toBeInTheDocument();
expect(screen.getByText(/outdated LiteLLM/i)).toBeInTheDocument();
fireEvent.click(stop);
await waitFor(() => expect(stopGateway).toHaveBeenCalledTimes(1));
});
it("offers Start without an image, since Start pulls it", async () => {
appSettings = settingsWithGateway(true);
getGatewayStatus.mockResolvedValue(
status({ running: false, container_exists: false, image_exists: false }),
);
render(<GatewaySettings />);
expect(await screen.findByRole("button", { name: "Start" })).toBeInTheDocument();
expect(screen.getByText(/Start will pull it/i)).toBeInTheDocument();
});
});
+19 -19
View File
@@ -178,29 +178,29 @@ export default function GatewaySettings() {
setTimeout(() => setCopied(null), 2000);
};
// A running container is reported (and stoppable) even when its image is no
// longer the pinned one — e.g. right after an app update moved the pin.
// A running container is shown (and stoppable) whatever its image. Start
// pulls the pinned image itself when it is missing, so it is always offered.
const tone: StatusTone = status?.running
? healthy === false
? healthy === false || status.image_outdated
? "busy"
: "running"
: !status?.image_exists
? "off"
: status.container_exists
? "stopped"
: "off";
: status?.container_exists
? "stopped"
: "off";
const statusLabel = status?.running
? !status.image_exists
? `Running on port ${status.port} (image out of date)`
: healthy === false
const statusLabel = !status
? "Checking…"
: status.running
? healthy === false
? "Starting…"
: `Running on port ${status.port}`
: !status?.image_exists
? "No image"
: status.container_exists
? "Stopped"
: "Image ready";
: status.image_outdated
? `Running on port ${status.port} — outdated LiteLLM, Stop and Start to update`
: `Running on port ${status.port}`
: !status.image_exists
? "No image — Start will pull it"
: status.container_exists
? "Stopped"
: "Image ready";
// Rendered in whichever branch is live — only one of them ever mounts.
const errorLine = error ? (
@@ -258,7 +258,7 @@ export default function GatewaySettings() {
{/* ── Container ─────────────────────────────────────────────── */}
<div className="flex items-center gap-3 flex-wrap">
<StatusIndicator tone={tone} label={statusLabel} className="text-xs" />
{(status?.image_exists || status?.running) && (
{status && (
<Button
variant={status.running ? "danger" : "primary"}
disabled={loading}