Skip to content

Optimizer auto transport surfaces misleading "python3: not found" on containerized Core when the sidecar is absent (masks "optimizer sidecar not installed"; planner drops to Go DP) #699

Closed

Description

@HuggeK

Summary

On the containerized Core (the official ghcr.io/srcfl/ftw image), when the
ftw-optimizer sidecar is not reachable, the auto optimizer transport falls
back to spawning a bundled python3 -m ftw_optimizer.worker process — which
can never exist in the slim Core image. The result is a misleading error,

optimizer transport: start optimizer "python3": exec: "python3": executable file not found in $PATH

surfaced as the optimizer component's error / health_error / fallback_reason,
and the planner silently drops to the built-in Go DP fallback. The real cause —
the optimizer sidecar is not installed/running — is masked by a "missing
Python" message that wrongly implies Core needs a Python dependency (it does
not; Python lives only in the separate optimizer image).

Observed (live, Core v1.13.4)

GET /api/components on an affected host reports:

"optimizer": {
  "active_solver": {
    "engine": "go-dp", "backend": "bellman", "status": "fallback", "fallback": true,
    "fallback_reason": "optimizer transport: start optimizer \"python3\": exec: \"python3\": executable file not found in $PATH"
  },
  "configured": true, "degraded": true, "healthy": false,
  "error": "start optimizer \"python3\": exec: \"python3\": executable file not found in $PATH",
  "updates": { "current": "", "latest": "v1.3.2", "sidecar_ready": true }
}

optimizer.updates.current: "" confirms no optimizer sidecar is installed,
yet the surfaced error talks about python3, not the missing sidecar.

Root cause

  • Core defaults the optimizer transport to auto and the process command to
    python3: FTW_OPTIMIZER_TRANSPORT: auto (docker-compose.yml:53), command
    ["python3", "-m", "ftw_optimizer.worker"] (go/cmd/ftw/main.go:3029-3032,
    :3065-3074).
  • AutoTransport prefers the unix/sidecar primary and, when it is unavailable,
    retries once through the process transport
    (go/internal/mpc/optimizer_transport.go:238-245).
  • The process transport execs the interpreter and errors with
    start optimizer %q when it is absent
    (go/internal/mpc/optimizer_transport.go:97-123, error at :116).
  • The official Core image is alpine:3.22 + ca-certificates tzdata only — no
    python3, no ftw_optimizer module
    (Dockerfile:39-43; the header comment
    at Dockerfile:1-3 states the optimizer ships as its own image and "Core falls
    back safely when it is absent").

So on a containerized Core the process fallback is structurally guaranteed to
fail, every plan cycle, with a message that describes the wrong thing.

Why the process fallback exists at all (native / all-in-one deployments)

ProcessTransport is documented as preserving "the all-in-one/native fallback"
(optimizer_transport.go:50). It is meaningful for a native deployment where
Core runs as a host binary next to a real Python interpreter (e.g. make dev,
which sets FTW_OPTIMIZER_PYTHON and runs the worker locally). The bug is
specifically that this fallback is attempted, and its raw exec error surfaced,
on the container image where it can never succeed.

Impact

  • Misleading operator-facing error: suggests installing Python into Core, which
    contradicts the module architecture (docs/architecture.md,
    docs/self-update.md).
  • The actionable root cause ("install/start the ftw-optimizer sidecar") is
    hidden.
  • docker-compose.yml:50-52 reinforces the confusion: it claims core "falls back
    to its bundled Python worker, then to the Go DP planner" — but the shipped Core
    image has no bundled Python worker; the real chain is sidecar → Go DP.
  • Not a safety issue — Core correctly validates and runs the Go DP fallback — but
    it is a real observability/diagnosability defect.

Proposed fix

  1. In auto mode, when the process fallback fails with exec ENOENT (no
    interpreter), surface a clear, actionable optimizer status such as
    "optimizer sidecar unavailable — using built-in Go planner; install/start the
    ftw-optimizer sidecar"
    , and mark the component unavailable / not_installed
    rather than degraded + a python3 not found error.
  2. Optionally, detect at construction that no bundled Python worker/interpreter is
    present and skip the process fallback entirely on container builds, so
    auto goes straight sidecar → Go DP without attempting an impossible exec
    each cycle.
  3. Correct the docker-compose.yml:50-52 comment to describe the actual
    sidecar → Go DP chain for the container image.

Operator remediation (meanwhile)

Install/start the intended optimizer sidecar; Core stays safe on the Go planner
until it is healthy:

cd ~/ftw            # or the deploy dir
docker compose up -d ftw-optimizer
# or: Update Center → Optimizer → Update  (POST /api/components/optimizer/update)

If the deploy's docker-compose.yml predates the ftw-optimizer service (e.g. a
dev/host-binary layout), add the service from the current
docker-compose.yml
first.


Filed from an on-site diagnosis: Core was updated to v1.13.4, after which
the planner ran the Go DP fallback because the host had no ftw-optimizer
sidecar and auto transport reported the python3 exec error above.

Activity

  1. added a commit that references this issue on Jul 29, 2026
    7e302d1
  2. added a commit that references this issue on Jul 30, 2026
    cbbabae
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