Repository navigation
Description
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
autoand 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). AutoTransportprefers 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 %qwhen it is absent
(go/internal/mpc/optimizer_transport.go:97-123, error at:116). - The official Core image is
alpine:3.22+ca-certificates tzdataonly — no
python3, noftw_optimizermodule (Dockerfile:39-43; the header comment
atDockerfile:1-3states 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-optimizersidecar") is
hidden. docker-compose.yml:50-52reinforces 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
- In
automode, 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 componentunavailable/not_installed
rather thandegraded+ apython3 not founderror. - Optionally, detect at construction that no bundled Python worker/interpreter is
present and skip the process fallback entirely on container builds, so
autogoes straight sidecar → Go DP without attempting an impossibleexec
each cycle. - Correct the
docker-compose.yml:50-52comment 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
fix(mpc): actionable optimizer error when the ftw-optimizer sidecar i…
fix(mpc): actionable optimizer error when the ftw-optimizer sidecar i…