Repository navigation
Description
Component / host
Platform — deployment
Edition
Platform
LoopForge version
Observed on a Docker Compose deployment built from dd56585 (2026-11-15) plus local commits that do not touch the engine. The code paths cited below are unchanged on main at 451d38c.
What happened?
After the platform container is recreated (an upgrade, ./start.sh pull, or docker compose up after any change to the service), runs that were waiting at a human gate can no longer be approved. Approve returns the message below. Pass, reject, retry and resume carry the same check in the code, but I only exercised approve:
run <run-id> 的工作区绑定在 <old-container-id>:<data-dir>/workspaces,请在绑定实例上审批(或清理该 run 的 workspace 绑定后重试)
The run in question executes on a CLI runner, so its workspace is on the runner machine and was not affected by the recreate. The run stays blocked until someone edits runs.workspace_host in the database.
Cause, as far as I can trace it:
cmd/agentflow/main.go:143takes the workspace host fromos.Hostname()and nothing overrides it (AGENTFLOW_INSTANCE_IDonly changes the instance ID).compose.yamlsets nohostname:for theplatformservice, so the value is the container ID and changes on every recreate.- The run keeps the old value in
runs.workspace_host, soforeignWorkspaceBind(internal/engine/run_recovery.go:32) is true for the new container even though the workspace root is the same path. workspaceBlocked(internal/engine/run_recovery.go:39-48) normally lets a bind to a dead host be taken over, but its last line returnse.defaultExecutionRunner(r) != "". For a run bound to a runner this is always true, so the dead host is honoured forever and the checks ininternal/engine/run_ops.go(lines 147, 201, 278, 444, 702) reject every control action.
Expected: recreating the platform container should not strand runs whose workspace is on a runner or on the persistent data directory.
Not reproduced, from reading the code only: for a run that executes in the control-plane sandbox, the same hostname change makes the engine treat the workspace as lost and rebindWorkspaceHere (internal/engine/run_environment.go:298) discards the local checkout, although the files are still on the mounted data directory.
Reproduction
- Deploy with
docker compose --profile platform up -dand register a CLI runner. - Start a run that executes on the runner and has a manual approval node. Wait until it reaches the gate.
- Recreate the platform container. In my case it was
docker compose --profile platform up -dafter building a new image.--force-recreateshould have the same effect, but I did not run that variant. - Approve the gate in the UI or with
POST /api/runs/<run-id>/approve.
Result: HTTP 400 with the message above. SELECT workspace_host FROM runs WHERE id='<run-id>' shows the previous container ID, and docker exec <platform> hostname shows a different one.
Workaround that worked for me: set a fixed hostname: on the platform service in a Compose override, then update runs.workspace_host of the waiting runs to that name. Approval went through right after.
Sanitized diagnostics
Possible fixes, in the order I would try them:
- Set a stable
hostname:for theplatformservice incompose.yaml. One line, fixes single-instance Compose deployments. - Let the workspace host be configured (an environment variable next to
AGENTFLOW_INSTANCE_ID). - Revisit the last line of
workspaceBlockedfor runner-bound runs when the bound host has no live worker. I did not send a PR for this one because it changes a guard that protects unpushed workspace changes.
I can send a PR for the first item if that direction is acceptable.
Safety checks
- I removed credentials, private endpoints, internal identifiers, and personal data.
- I searched existing issues for duplicates.
Activity
cocofhu00 commentedon Nov 19, 2026
Thanks for the report.
I understand this as: after the platform container is recreated, a run that was waiting at a human approval gate can no longer be approved, because its workspace binding still refers to the previous container hostname. The report already includes a version, reproduction steps, the observed error, and the expected behavior.
We've seen this issue and will review it along with the existing issue queue.
wcy12378 commentedon Nov 20, 2026
I’m working on the runner-owned workspace case: a dead platform hostname should not permanently block approval/control of a checkout that remains on the same runner. I reproduced the current guard failure and am adding regressions around the recovery path.
This slice will preserve live-owner/lease checks, runner reconnect and runner-switch protections, and the runner's files. It will not change the separate control-plane persistent-volume adoption behavior or Compose hostname configuration. The related workspace-loss/adoption predicates need to be handled together; simply removing the final guard would be unsafe.
linus-liu-web commentedon Nov 20, 2026
Additional manifestation of the same host-binding change, from a Compose install upgraded to v0.4.1-rc.1 (one
platformcontainer,role=all):After the upgrade recreated the platform container, opening the workspace terminal or the Agent browser on conversations created before the upgrade failed with:
There is no API/worker split in this deployment, so
AGENTFLOW_CONTROL_TOKENis not configured and there is nothing to share — the hint is misleading. The old run still carries the previous container ID inruns.workspace_host, soforeignWorkspaceBindis true,WorkspaceRemoteHostsends the browser request down the control-channel path (internal/httpapi/browser.go→ForwardBrowserRequest), and the transport reports a configuration error.Workaround that recovered it: pin the platform hostname and rebind the existing rows, for example
then restart. With the hostname pinned, later recreates keep the workspace reachable — I verified the Agent browser
ensurepath returnsavailable: trueinstead of the control-channel error.I have a PR up for the first item this issue suggests (a stable
hostname:incompose.yamlplus a deployment note), so Compose recreates stop changing the workspace owner: #1158. It does not touch the runner-bound recovery case being worked on above.Separately, for the control-plane path it would help if a foreign bind to a dead local host were recoverable automatically (non-code conversation workspaces hold nothing that would be lost), or at least if the error named the stale
workspace_hostinstead ofAGENTFLOW_CONTROL_TOKEN.