Skip to content

RCA: config -p H:C is ignored on the first run — port resolution runs before the CLI pins are merged #52

Closed

Description

@aitrawog

What happens

A port pin supplied on the very command that first configures a deploy is silently lost:

$ charly -C distro-fedora config openwebui -i lab -p 18080:8080
Wrote /home/atrawog/.config/containers/systemd/charly-openwebui-lab.container

$ grep PublishPort ~/.config/containers/systemd/charly-openwebui-lab.container
PublishPort=127.0.0.1:8080:8080          # ← the host port is the auto-allocation, not 18080

The entry DOES record the pin (port: ["18080:8080"]), and re-running the same command honours it:

$ charly -C distro-fedora config openwebui -i lab -p 18080:8080
$ grep PublishPort ~/.config/containers/systemd/charly-openwebui-lab.container
PublishPort=127.0.0.1:18080:8080        # ← correct only on the SECOND run

So the defect is first-run only: a fresh config -p H:C publishes an auto-allocated host port.

Mechanism

plugin-deploy-pod/candy/plugin-deploy-pod/config_setup.go runs port resolution BEFORE the CLI overrides:

  1. resolveDeployPorts(ctx, ex, &dc, key, &meta) — computes ResolvedPort from the IMAGE label's
    container ports plus the entry's port: pins, all through kit.ResolveDeployPorts
    (sdk/kit/ports.go:350 honours a pin for its container port);
  2. deploykit.MergeDeployOntoMetadata(&meta, dc, …) → ports := meta.Port;
  3. if len(c.Port) > 0 { ports, portErr = kit.ApplyPortOverrides(ports, c.Port) } — the CLI pins are
    applied LAST, to ports.

On a first run the entry has no pins yet, so step 1 auto-allocates and persists resolved_port; the
quadlet publishes ResolvedPort, so the override applied in step 3 never reaches the artifact. On a
second run the pin is already in the entry, step 1 honours it, and everything agrees — which is exactly why
the bug hides from a re-run.

Root fix

The resolver's input must include the operator's pins: pass c.Port into resolveDeployPorts and merge
them with the entry's pins (CLI last, matching ApplyPortOverrides precedence) so the FIRST resolution
already lands the operator's host port. resolved_port then equals the pin and the quadlet agrees with the
entry on run one.

Blast radius

Every fresh charly config <image> -p H:C on a pod substrate: the pin is accepted, printed as accepted, and
not applied — and the failure mode is silent, because the deploy starts fine on the auto-allocated port.
Anyone pinning a port for a reverse proxy, a tunnel, or a second instance of one image gets a different port
than they asked for on the first attempt.

Evidence

Measured 2026-11-14 on the Open WebUI lab deploy: first config → 8080:8080; re-run of the identical
command → 18080:8080, with the entry's port: unchanged between the two runs.

Agent: charly (lead)
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

Activity

  1. aitrawog commented on Nov 15, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED by plugin-deploy-pod#53 — the operator's -p pins reach port resolution, so the FIRST config honours the pin (proven on a disposable target)

    Agent: charly (lead)
    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions