Skip to content

Send an :authority on the builder gRPC connection - #2428

Merged
jglogan merged 1 commit into
apple:mainfrom
jglogan:builder-grpc-authority
Oct 24, 2026
Merged

jglogan merged 1 commit into
apple:mainfrom
jglogan:builder-grpc-authority

Conversation

@jglogan

@jglogan jglogan commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

The CLI connects to the builder shim by wrapping an already-connected vsock file descriptor with HTTP2ClientTransport.WrappedChannel.wrapping(config: .defaults, ...). There is no target address to derive an :authority from and Config.http2.authority defaults to nil, so the CLI sends requests with no :authority header.

grpc-go now rejects such requests in the HTTP/2 transport, before any handler or interceptor runs, with Internal: "no host or :authority header present" (grpc/grpc-go#9365). The check is in v1.82.2, v1.83.2 and v1.84.0 and later; v1.83.1 is the last release without it. The builder shim is a grpc-go server, so a shim built with one of those versions accepts the connection from this CLI but never delivers the Info probe to its handler, and the builder never becomes ready (the CLI's Info retries just keep opening connections). That also means the shim cannot take a grpc-go update past v1.83.1, including security fixes, until the CLI sends an :authority.

This sets http2.authority explicitly on the transport configuration. The shim does not route on it and there is no TLS, so any valid host name works; this reuses the builder container id. The configuration is factored into Builder.transportConfig() so it can be tested.

There is no impact with the shim version currently pinned by builderShimVersion. This change needs to be in a release no later than the one that moves the pinned shim to a grpc-go newer than v1.83.1. A newer CLI sending an :authority to an older shim is fine, since those versions accept it.

Testing

  • Tested locally

  • Added/updated tests

  • Added/updated docs

  • Added BuilderTransportConfigTests, which asserts the configuration carries a non-empty :authority. This guards against the configuration returning to .defaults.

  • Reproduced the server behavior in isolation with a Go server switched between grpc-go v1.83.1 and v1.84.0 and a Swift client built the same way as Builder (grpc-swift-2 2.4.2, grpc-swift-nio-transport 2.9.0). With no authority, v1.83.1 answered and v1.84.0 returned Internal: no host or :authority header present without reaching a handler. The shim's own server options made no difference.

  • Against a builder image built with grpc-go v1.84.0, a CLI without this change never got a response to the Info probe; a goroutine dump from the shim showed accepted connections idle in HandleStreams and no RPC handler running. With this change, the full CLI integration suite (serial and concurrent) passed against that same image.

The builder connection wraps an already-connected socket, so grpc-swift
has no target address to derive an :authority from and sends none.
gRPC-Go v1.82.2, v1.83.2 and v1.84.0 reject requests without an
:authority (grpc-go #9365), so a builder shim built with one of those
accepts the connection but never delivers the Info probe to a handler,
and the builder never becomes ready.

Set http2.authority explicitly on the transport configuration. The shim
does not route on it, so reuse the builder container id. Factor the
configuration into Builder.transportConfig() and add a test so it cannot
silently return to the defaults.
@github-actions

Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 22.81%
Integration 69.43%
Combined 78%

@jglogan
jglogan merged commit 804209b into apple:main Oct 24, 2026
4 checks passed
@jglogan
jglogan deleted the builder-grpc-authority branch October 24, 2026 00:49
jglogan added a commit to apple/container-builder-shim that referenced this pull request Oct 27, 2026
* Update all Go dependencies; require Go 1.26.8.
  Notable direct updates:
  * moby/buildkit v0.29.0 -> v0.34.1
  * google.golang.org/grpc v1.83.1 -> v1.84.0
  * containerd v2.2.3 -> v2.4.2
  * logrus v1.9.4 -> v1.10.2,
  * tonistiigi/fsutil, golang.org/x/*, and OpenTelemetry v1.47.0.
* moby/buildkit v0.34.1 requires Go 1.26.8, so the go directive moves from
  1.25.5 to 1.26.8. Update the CI setup-go version and the Dockerfile's
  golang base image to match.
* Compatibility: grpc-go v1.82.2, v1.83.2 and v1.84.0 and later reject
  requests that carry no :authority (grpc-go #9365). The container CLI
  sends one since apple/container#2428, so a CLI that includes that
  change is required to use a shim built from this commit. The CLI pins
  the shim version, so this only matters for a manual `[build]` image
  override on an older CLI, which will not get a response to its Info
  probe.
* Update the bundled buildkitd to v0.34.1
* Configure buildkitd debug logging through log.level
static let grpcAuthority = Builder.builderContainerId

/// The transport configuration for the connection to the builder shim.
static func transportConfig() -> HTTP2ClientTransport.WrappedChannel.Config {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

K

henrywang added a commit to henrywang/Berthly that referenced this pull request Nov 12, 2026
….0 (#238)

Closes #231. Closes #232.

Moves Berthly's `container` pin from 1.6.1 to 1.7.1, and
`containerization` from 0.53.0 to 0.54.0. No other package moved. 1.7.1
is the first 1.7 release (1.7.0 was tagged but never published).

## Why

- **Builds with builder shim 0.13.3.** The pin also moves the builder
shim from 0.13.2 to 0.13.3 (apple/container#2434). 0.13.3 is built with
gRPC-Go v1.84.0, which rejects requests without an `:authority`
(grpc/grpc-go#9365). apple/container#2428 adds one in `ContainerBuild`,
which Berthly links, so the shim and the fix arrive together here.
- **Build steps that need the whole context.** apple/container#2414: an
empty `followpaths` now means the whole context instead of nothing.
- **`[container.dns]` defaults** (apple/container#1614) reach Run/Create
through `Utility.containerConfigFromFlags`. The builder side is #233.

## Changes

- `project.pbxproj`: `minimumVersion = 1.7.1` (`upToNextMinorVersion`).
- `Package.resolved`: `container` 1.7.1, `containerization` 0.54.0.
- `ContainerCompatibility`:
- `requiredVersion = "1.7.1"`: every 1.6.x daemon hits the upgrade gate
(#232, option 1).
- `patchFloor` becomes `String? = nil` rather than being removed, so the
mechanism and its tests stay for the next known-bad patch.
  - New `requiredVersionRationale`.
- `shippedFloorBlocksContainer160` becomes
`shippedGateBlocks16xAndAccepts171`.

No compile breaks. `ContainerListFilters.withoutMachines()` was removed
upstream, but Berthly doesn't call it. The new defaulted `Builder.start`
parameters don't affect it either, since Berthly uses its own replica
(#210).

The 1.7.1 pkg and the `container` binary are still signed by `Apple Inc.
- Containerization (UPBK2H6LZM)`, so the installer's signature check
still accepts them.

## Testing

All local, on Xcode 27.2 with a container 1.7.1 daemon and the 1.7.1
recommended kernel (Kata 4.3.1, `vmlinux-6.18.56-208-debug`):

- `swiftlint lint --strict`: clean
- BerthlyTests: 611 passed
- BerthlyUITests (mock): 85 passed, 2 skipped (App Intents tests, which
need a team-signed runner)
- E2E via `scripts/e2e.sh`: 28/28 passed. Covers Dockerfile builds,
SSH-forwarded builds, a machine-image build plus boot, a registry
build/push/pull round trip, and machine first boot. After the run, the
`buildkit` container is on `builder:0.13.3`.

## Follow-ups (milestone v1.7.1)

#233 builder DNS defaults, #234 System page `container.dns.*` rows, #235
CPU % unit decision, #236 PARITY.md re-audit, #237 remaining real-daemon
checks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
benoitf pushed a commit to socktainer/socktainer that referenced this pull request Nov 12, 2026
apple/container 1.7.1 pins containerization 0.54.0. No source changes
are needed here.

The builder fixes are in apple/container's client library, so socktainer
only gets them by rebuilding against it:
- Builder sends an :authority on its gRPC connection to the builder shim
  (apple/container#2428). gRPC-Go v1.82.2, v1.83.2 and v1.84.0+ reject
  requests without one, so a newer BuildKit could not answer even the
  Info probe.
- A build step whose Walk request has empty followpaths now gets the
  whole context instead of none (apple/container#2414).
- The builder image moves to container-builder-shim 0.13.3.

The one library API removed, ContainerListFilters.withoutMachines(), is
not used here: plugin containers are kept out by the presence of the
plugin label, which also covers cluster nodes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wes Morgan <[email protected]>
andrewkomkov added a commit to getgantry/gantry that referenced this pull request Nov 12, 2026
Apple container **1.7.1** is out. The previously tracked version is
`1.6.1`.

Upstream notes: https://github.com/apple/container/releases/tag/1.7.1. A
copy is in `docs/upstream/apple-container-1.7.1.md`.

Most of the 1.7.1 support is already on main from PR #57
(`specs/001-apple-container-1-7-1`) and PR #50 (clusters). This PR adds
no code. It adds the 1.7.1 features to the README and records the live
check in spec 001.

## Review checklist

- [x] New or changed CLI flags Gantry should surface: `cluster run
--shared-image-store` and `--workers count=,cpus=,memory=` came in PR
#50. The `run`, `create`, `machine` and `build` commands have no new
flags in 1.7.1.
- [x] Changed `--format json` shapes the DockerKit apple transport
decodes: only `stats` changed (`cpuUtilization`).
`AppleContainerJSON.statsBody` uses it, with the counter math as
fallback
(`Packages/DockerKit/Sources/DockerKit/AppleContainer/AppleContainerJSON.swift:653`).
The live output matches the test fixture. `container ls --format json`
did not change.
- [x] Fixed upstream bugs Gantry currently works around: none. The
BuildKit fixes (#2428, #2414) need no change in Gantry. The "Builder
image is outdated" card covers the new builder shim 0.13.3
(`AppleBuilderStatus.imageUpdate`).
- [x] `ContainerTooling.recommendedVersion` and feature gates:
`recommendedVersion = "1.7.1"`
(`Packages/AppCore/Sources/AppCore/ContainerTooling.swift:18`). The DNS
defaults are gated on 1.7.0 (`containerDNSDefaultsVersion`, line 46).
- [x] MCP tools and App Intents that expose the affected commands:
`container_stats` uses the same DockerKit decoder. `apple_set_property`
accepts lists for the DNS keys (PR #57). No App Intent shows the changed
commands.
- [x] README and CHANGELOG entries for whatever is adopted: the
CHANGELOG has the #57 and #50 lines. This PR adds the 1.7.1 features to
the README.

## Adopted (on main, checked again on CLI 1.7.1)

- Stats `cpuUtilization` (#2146). The old calculation stays as fallback
for 1.6.1.
- `[container.dns]` defaults in `config.toml` (#1614): a list editor in
System Properties, gated on 1.7.0.
- Recommended kernel (#2447): Gantry has no kernel version of its own.
It runs `system kernel set --recommended`.
- Cluster changes (#2437, #2448, #2451, #2462) came in PR #50. The
notice for missing or stopped cluster services came in PR #57.
- Builder shim 0.13.3: the outdated builder card.

## Not adopted, and why

- #2412 Time Machine exclusion, #2443 containerization 0.54.0, #2458
package size, #2470 copy blobs, #2416 bootstrapper, #2477 test library:
internal changes. Gantry has nothing to show for them.
- #2457, #2459, #2433, #2413: upstream docs and examples only.

## Checks

- `swift test` in DockerKit: 324 tests passed. AppCore
`AppleContainer171` tests: 19 passed.
- `scripts/check-localization.py`: 0 problems in 28 languages. This PR
adds no strings.
- Debug build on CLI 1.7.1: a busy test container shows 98 % CPU. The
CLI reports `cpuUtilization` 1.0 for it.
- The Builder card shows 0.13.2 to 0.13.3 in light and dark mode. System
Properties shows `[container.dns]`. The cluster list shows one row for
each cluster.
- Open (T035 in spec 001): two items had no check in the app. These are
the DNS list editor sheet and the cluster services notice. The editor
needs a click. The notice needs a broken cluster setup.

---

<details><summary>Upstream release notes</summary>

## Highlights

⌨️ denotes breaking CLI changes.

👩‍💻 denotes breaking API changes.

- Core
- [`container stats` now reports `cpuUtilization` in JSON, YAML, and
TOML output](apple/container#2146)
- [Image snapshots and container filesystems are now excluded from Time
Machine backups](apple/container#2412)
- [Default Kata kernel is now 4.3.1
(`vmlinux-6.18.56-208-debug`)](apple/container#2447)
- [Updated Containerization to
0.54.0](apple/container#2443)
- Networking
- [Default DNS nameservers, search domains, and options can now be set
in `config.toml`](apple/container#1614)
- Build
- [Fixed `container build` failures with newer
BuildKit](apple/container#2428) and [missing
build context for steps that need the full
context](apple/container#2414)
- Kubernetes
- ⌨️ [New `--shared-image-store` option on `container cluster run` to
use the `container` image store from cluster nodes; removed the
`load-image` subcommand](apple/container#2437)
- ⌨️ [`container cluster ls` now shows one row per cluster; use
`--nodes` for the per-node
view](apple/container#2451)
- ⌨️ [Container lifecycle commands no longer operate on cluster
nodes](apple/container#2462)
- [Worker node CPU and memory can now be set with `--workers
count=<n>,cpus=<n>,memory=<size>`](apple/container#2448)

## What's Changed
* Send an :authority on the builder gRPC connection by @jglogan in
apple/container#2428
* Adds `container cluster` example. by @jglogan in
apple/container#2433
* Update container-builder-shim to 0.13.3. by @jglogan in
apple/container#2434
* use macos 27 runners by @madrob in
apple/container#2436
* Fix empty followpaths handling in BuildFSSync by @onlyarnav in
apple/container#2414
* Document container clean in the reclaim disk space guide by
@lucasbrito-wdt in apple/container#2413
* Bump to use containerization 0.54.0 by @adityaramani in
apple/container#2443
* feat(stats): report cpuUtilization in the machine-readable formats by
@guanchzhou in apple/container#2146
* [k8s plugin] Create a cluster bootstrapper by @katiewasnothere in
apple/container#2416
* Update recommended kernel to kata 4.3.1 release
vmlinux-6.18.56-208-debug by @katiewasnothere in
apple/container#2447
* Add TOML configuration for default DNS nameservers, search, options by
@0xMH in apple/container#1614
* Add the ability to share container's image store with container
cluster by @crosbymichael in
apple/container#2437
* Reduce install package size and install footprint. by @jglogan in
apple/container#2458
* Add reference to apple/container-examples and remove examples/ out of
this repo by @michaelzhang114 in
apple/container#2457
* Create container-core-clusters XPC service by @adityaramani in
apple/container#2451
* Exclude recreatable container data from Time Machine by @abdullahtas0
in apple/container#2412
* Clean the `cluster-shim` build files with `make clean` by @dkovba in
apple/container#2463
* Quiet the `cluster-shim` build output and show the swift progress in
place by @dkovba in apple/container#2461
* Do not allow high level container lifecycle commands to operate on
cluster nodes by @katiewasnothere in
apple/container#2462
* Switch to copy blobs by @crosbymichael in
apple/container#2470
* Add option to set cpus and memory resources for worker nodes of
cluster by @katiewasnothere in
apple/container#2448
* Removed bug-report-how-to.md as this info is now consolidated in
CONTRIBUTING.md by @michaelzhang114 in
apple/container#2459
* Move HostStoreServer into a library so tests don't link the executable
by @katiewasnothere in apple/container#2477

## New Contributors
* @madrob made their first contribution in
apple/container#2436
* @onlyarnav made their first contribution in
apple/container#2414
* @lucasbrito-wdt made their first contribution in
apple/container#2413
* @abdullahtas0 made their first contribution in
apple/container#2412

**Full Changelog**:
apple/container@1.6.1...1.7.1

</details>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: andrewkomkov <[email protected]>
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.

3 participants