Skip to content

fix: apple host.docker.internal DNS hint (#118) - #164

Closed
BoldBlackBot wants to merge 1 commit into
boldblackai:mainfrom
BoldBlackBot:fix/apple-host-dns-and-hermes-context-118-119
Closed

fix: apple host.docker.internal DNS hint (#118)#164
BoldBlackBot wants to merge 1 commit into
boldblackai:mainfrom
BoldBlackBot:fix/apple-host-dns-and-hermes-context-118-119

Conversation

@BoldBlackBot

@BoldBlackBot BoldBlackBot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Rebased replacement for #126 (originally by @hggz). Apple DNS hint changes only; the Hermes contextDir change from #126 was reverted and will be addressed separately to avoid shadowing project-level AGENTS.md.

  • host.docker.internal does not resolve inside containers with HARNESS_CONTAINER_RUNTIME=apple #118 — On HARNESS_CONTAINER_RUNTIME=apple, harness checks container system dns list and prints a one-time setup command when host.docker.internal is missing (LM Studio / local gateway reachability). Documents the Apple-recommended container system dns create … --localhost 203.0.113.113 flow in README.
  • E2e: skip PTY tests when macOS script lacks util-linux -qfec; fix "container absent from PATH" test when real container is on PATH; conditional test for the DNS warning.

Test plan

  • pnpm build
  • pnpm lint (biome, markdownlint)
  • CI e2e (Linux — full suite including PTY)
  • Operator one-time on Mac (outside harness): sudo container system dns create host.docker.internal --localhost 203.0.113.113

Closes #118.
Supersedes #126.

cc @capotej @hggz

@BoldBlackBot BoldBlackBot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Verdict: Comment (1 warning, 3 suggestions)

Reviewed the rebased diff. CI is all green (build, lint, e2e). The two core changes are sound — the contextDir fix is correct for Hermes's cwd-only context loading, and the Apple DNS check is well-structured with proper fail-open behavior.

One behavioral concern worth discussing re: AGENTS.md shadowing at /workspace. Details in the inline comment.

✅ Looks Good

  • appleHostDockerInternalDnsConfigured() fail-opens (returns true on error) — never blocks a run
  • hasScript() upgrade correctly probes the actual flag combo (-qfec) instead of just PATH presence — catches the BSD vs util-linux script gap
  • Test for absent container filters PATH entries that contain the real binary — fixes false passes on Macs with apple/container installed
  • DNS warning test is properly conditional (skips silently when preconditions aren't met)

Reviewed by otacon (Hermes Agent)

Comment thread src/harness.ts Outdated
return "/home/harness/.hermes";
// Hermes reads AGENTS.md / CLAUDE.md from the project cwd only, not
// ~/.hermes/. Mount global context files into /workspace so they apply.
return "/workspace";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Warning: AGENTS.md shadowing

Changing contextDir() to /workspace means the global ~/.agents/AGENTS.md is bind-mounted at /workspace/AGENTS.md (line 837: ${cf.host}:${contextDir}/${cf.name}).

Since $PWD is already mounted at /workspace, this mount shadows any project-level AGENTS.md in the repo root. If a user has both ~/.agents/AGENTS.md (global) and ./AGENTS.md (project), only the global one is visible inside the container — the project-level instructions are lost.

This differs from the pi and opencode adapters, whose contextDir (/home/harness/.pi/agent, /home/harness/.config/opencode) is separate from /workspace, so both global and project context files coexist.

Worth documenting in the comment or README, or handling with a merge/concat strategy. If shadowing is intentional (global overrides project), a one-line note would clarify the design choice.

Comment thread src/harness.ts
);
process.exit(1);
}
if (!appleHostDockerInternalDnsConfigured()) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Suggestion: The DNS warning prints on every run when the mapping is missing. Consider suppressing after the first occurrence, or adding a note like (this message prints once per run), to reduce noise in iterative workflows. Not blocking — the message is clear and actionable.

Comment thread src/harness.ts
}
if (!appleHostDockerInternalDnsConfigured()) {
console.error(
`harness: ${HOST_DOCKER_INTERNAL} is not configured for Apple's container runtime.\nLocal services on the Mac (e.g. LM Studio on :1234) will not be reachable from the container.\nOne-time fix (requires administrator):\n sudo container system dns create ${HOST_DOCKER_INTERNAL} --localhost ${APPLE_HOST_LOCALHOST_IP}\nSee https://github.com/apple/container/blob/main/docs/how-to.md#access-a-host-service-from-a-container`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Suggestion (nit): This console.error call is a single ~300-char line. Breaking it into a multi-line template literal (like the ensureReady error above at line 241) would improve readability. Not blocking.

});

test("HARNESS_CONTAINER_RUNTIME=apple warns when host.docker.internal DNS is missing", () => {
const which = spawnSync("sh", ["-c", "command -v container"], {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Suggestion: Consider adding a brief comment like // Skip on Linux CI / when DNS already configured above the skip logic so the reason is obvious to future readers scanning the test file.

@BoldBlackBot
BoldBlackBot force-pushed the fix/apple-host-dns-and-hermes-context-118-119 branch from 9e7e3d5 to 5b6eb73 Compare August 9, 2026 15:20
@BoldBlackBot BoldBlackBot changed the title fix: apple host.docker.internal DNS hint + Hermes context mount (#118, #119) fix: apple host.docker.internal DNS hint (#118) Aug 9, 2026
@BoldBlackBot
BoldBlackBot force-pushed the fix/apple-host-dns-and-hermes-context-118-119 branch 4 times, most recently from 5b24e4e to a26947a Compare August 16, 2026 13:31
@BoldBlackBot
BoldBlackBot force-pushed the fix/apple-host-dns-and-hermes-context-118-119 branch from a26947a to 54b0907 Compare August 17, 2026 13:31
On HARNESS_CONTAINER_RUNTIME=apple, harness checks 'container system dns list'
and prints a one-time setup command when host.docker.internal is missing
(LM Studio / local gateway reachability). Documents the Apple-recommended
'container system dns create --localhost 203.0.113.113' flow in README.

E2e: skip PTY tests when macOS 'script' lacks util-linux -qfec; fix
'container absent from PATH' test when real container is on PATH; conditional
test for the DNS warning.

Co-Authored-By: Julio Capote <6135+capotej@users.noreply.github.com>
Co-Authored-By: Hugo Gonzalez <601542+hggz@users.noreply.github.com>
@BoldBlackBot
BoldBlackBot force-pushed the fix/apple-host-dns-and-hermes-context-118-119 branch from 54b0907 to ae287bb Compare August 18, 2026 21:30
@capotej capotej closed this Aug 24, 2026
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.

host.docker.internal does not resolve inside containers with HARNESS_CONTAINER_RUNTIME=apple

2 participants