From 04f3e2fc0e85ccdaa0255c948531a63344b0763b Mon Sep 17 00:00:00 2001 From: jason Date: Sat, 21 Nov 2026 16:14:11 +0800 Subject: [PATCH] fix(runtime): give every docker sandbox the host-gateway mapping AGENTFLOW_SESSION_GATEWAY hands a native install's sandboxes a host.docker.internal URL, but --add-host host.docker.internal:host-gateway was only added for conversation and runner-login containers, so git credential fill in an SOP run sandbox failed with "lookup host.docker.internal ... no such host" and the MR node had to rediscover the docker bridge gateway on every run. Add the mapping to all sandboxes. --- CHANGELOG.md | 4 ++++ internal/runtime/docker_cases_test.go | 4 ++-- internal/runtime/sandbox_docker.go | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e6e79c51b..02552f338 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Platform releases use `vX.Y.Z` tags and publish `ghcr.io/tencent/loopforge`. LoopForge Local packages use `local-vX.Y.Z` tags and are published by manually running the `release-local` workflow. +## Unreleased + +- Docker sandboxes always get `--add-host host.docker.internal:host-gateway`. A native install hands every sandbox an `AGENTFLOW_SESSION_GATEWAY` URL on `host.docker.internal`, but the mapping was only added for conversation and runner-login containers, so `git credential fill` in an SOP run sandbox failed with `lookup host.docker.internal ... no such host` and the 发起 MR agent had to rediscover the docker bridge gateway on every run. The mapping now applies to all sandboxes. + ## 0.4.1 — Git and MCP credentials, SOP orchestration and conversation workspaces - Configure HTTPS Git credentials per host, authorize the IP addresses of self-hosted HTTPS Git servers, and distribute trusted SSH host keys to execution machines. MCP servers, market items and SOP nodes can use configured credentials. diff --git a/internal/runtime/docker_cases_test.go b/internal/runtime/docker_cases_test.go index f390d1a24..9aa0c3113 100644 --- a/internal/runtime/docker_cases_test.go +++ b/internal/runtime/docker_cases_test.go @@ -131,8 +131,8 @@ func TestDockerSandboxUsesRelayNetworkOnlyWhenRequested(t *testing.T) { t.Fatalf("docker create used the wrong network: %s", args) } usesGateway := strings.Contains(args, "\n--add-host\nhost.docker.internal:host-gateway\n") - if usesGateway != (tc.conversation || tc.runnerLoginRelay) { - t.Fatalf("docker create host gateway = %v for %s", usesGateway, tc.name) + if !usesGateway { + t.Fatalf("docker create missing host gateway mapping for %s: %s", tc.name, args) } }) } diff --git a/internal/runtime/sandbox_docker.go b/internal/runtime/sandbox_docker.go index af9f3289d..9251c98f2 100644 --- a/internal/runtime/sandbox_docker.go +++ b/internal/runtime/sandbox_docker.go @@ -767,6 +767,11 @@ func (s *dockerSandbox) start(ctx context.Context, recreate bool) error { } } network := strings.TrimSpace(os.Getenv("AGENTFLOW_DOCKER_NETWORK")) + // Sandboxes reach a native platform through the host-gateway alias: + // AGENTFLOW_SESSION_GATEWAY hands them a host.docker.internal URL, and + // Linux daemons only resolve that name when the container carries the + // mapping. Add it for every sandbox, not only conversation relays. + args = append(args, "--add-host", "host.docker.internal:host-gateway") if s.requirements.ConversationRoot != "" || s.requirements.RunnerLoginRelay { _, relayNetwork, err := conversationDockerAccess(ctx) if err != nil { @@ -775,7 +780,6 @@ func (s *dockerSandbox) start(ctx context.Context, recreate bool) error { if relayNetwork != "" { network = relayNetwork } - args = append(args, "--add-host", "host.docker.internal:host-gateway") } if network != "" { args = append(args, "--network", network)