Skip to content

fix(compose): pin the platform hostname so workspace binds survive recreation - #1158

Open
linus-liu-web wants to merge 1 commit into
Tencent:mainfrom
linus-liu-web:fix/compose-platform-hostname
Open

linus-liu-web wants to merge 1 commit into
Tencent:mainfrom
linus-liu-web:fix/compose-platform-hostname

Conversation

@linus-liu-web

Copy link
Copy Markdown

What changed

compose.yaml does not set a hostname: on the platform service, so the container hostname is the container ID. The engine takes the workspace host from os.Hostname() (cmd/agentflow/main.go, internal/engine/engine.go), and every run and conversation workspace stores that value in runs.workspace_host. Recreating the platform container — an upgrade, ./start.sh pull, or any docker compose up after an image or service change — therefore leaves earlier workspaces bound to a host that no longer exists, and foreignWorkspaceBind (internal/engine/run_recovery.go) treats them as owned by another execution host.

Two user-visible failures follow:

This PR pins hostname: loopforge-platform on the platform service and documents why it must stay stable. Separately deployed workers and execution hosts already report the machine hostname they run on, so they are not affected.

Scope

  • Public adapter / deployment
  • Documentation only
  • Platform core / API / runner
  • Classic
  • Portable
  • Shared behavior contract
  • Installer / CLI

Refs #1079. The runner-bound workspace recovery discussed there is a separate change; this PR only fixes the Compose host identity.

Compatibility

Single-instance Compose deployments only. The pinned hostname is stable across recreates and upgrades. Service DNS is unaffected: platform stays a Compose network alias, so the default AGENTFLOW_PLATFORM_MCP_URL=http://platform:8080 keeps working. Operators that override the platform service (for example with a compose.override.yaml) should keep the hostname or pin their own stable value.

Validation

  • docker compose --profile platform config renders hostname: loopforge-platform on the platform service with the release .env.
  • python3 scripts/check-public.py passes on the patched worktree.
  • Manually verified on a local Compose deployment: with the same hostname pinned through a Compose override, recreating the platform for an upgrade left existing conversation workspaces reachable — after rebinding the rows of the earlier recreate, a further recreate kept the workspace local and the Agent browser ensure call returned available: true in about two seconds instead of the control-channel error.
  • Not run: the full Go suite (go test -p=2 ./...); no Go code changed.

Safety

  • I did not include credentials, internal endpoints, production data, or organization-specific infrastructure.
  • I preserved user files and unrelated changes.
  • I updated generated Classic host bundles when applicable. (n/a — no Classic change)
  • I documented third-party content and licensing changes when applicable. (n/a)

…creation

The engine takes the workspace host from os.Hostname() and every run and
conversation workspace stores it in runs.workspace_host. A Compose container's
default hostname is its container ID, so recreating the platform (an upgrade,
./start.sh pull, or any image or service change) leaves earlier workspaces
bound to a host that no longer exists.

The engine then treats those workspaces as foreign: approval and control
actions reject runner-bound runs, and control-plane workspaces send terminal
and Agent browser requests down the API/worker control channel, which fails
with a workspace-control configuration error that asks for
AGENTFLOW_CONTROL_TOKEN even in the single-container role=all deployment.

Pin the hostname on the Compose platform service and document that it must stay
stable.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant