Skip to content

feat(compute): negotiate gateway callback listeners - #2492

Open
elezar wants to merge 15 commits into
codex/gateway-listener-refactorfrom
codex/gateway-callback-contract-poc-v2
Open

feat(compute): negotiate gateway callback listeners#2492
elezar wants to merge 15 commits into
codex/gateway-listener-refactorfrom
codex/gateway-callback-contract-poc-v2

Conversation

@elezar

@elezar elezar commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

Add a shared, gateway-owned contract for built-in compute drivers to report the
additional listeners required by their sandbox callback topology. Migrate
Docker and Podman to that contract so the primary gateway listener can remain
on its loopback default.

This PR is the production-scoped listener-discovery portion of #2215. It keeps
the initial authorization ceiling limited to the built-in Docker and Podman
topologies. Negotiated listeners expose only the generated sandbox-callable
gRPC surface; the operator-configured primary listener retains the full
multiplexed API.

Per-sandbox callback URI delivery, portable credential delivery, rootless
slirp4netns callback support, and operator-configurable or
interceptor-extensible listener capabilities remain follow-up work.

Related Issue

Related to #2215

Depends on #2542

Changes

  • Add ComputeDriver.GetGatewayListenerRequirements with exact-address and
    semantic default-route/IPv4-loopback selectors.
  • Treat UNIMPLEMENTED from older external drivers as no additional listener
    requirements for protocol compatibility.
  • Validate, authorize, resolve, deduplicate, and bind requested listeners in
    the gateway before persisted sandboxes resume.
  • Preserve the listener authorization scope through connection dispatch and
    request extensions, while keeping driver/reason provenance in listener
    binding diagnostics.
  • Restrict compute-driver callback listeners to sandbox-callable gRPC methods
    before normal authentication and routing.
  • Reject user/admin APIs, health, reflection, non-callback inference APIs, and
    HTTP routes on callback listeners while leaving primary routing unchanged.
  • Migrate the Docker managed-bridge listener to an authorized exact requirement.
  • Add Podman discovery for rootful Linux bridges, rootless pasta
    default-route interfaces, Podman Machine IPv4 loopback, and explicit Linux
    host_gateway_ip.
  • Fail startup for local rootless Podman callbacks when the helper is
    slirp4netns, unknown, or unreported. An explicitly remote grpc_endpoint
    remains supported for those environments.
  • Require Podman 5.x for supported rootless local callbacks and remove the
    Ubuntu 24.04/Podman 4 rootless E2E case until slirp4netns support is added.
  • Request no additional listener for explicitly remote Podman callback URIs,
    and fail startup when a required local callback listener cannot be safely
    discovered.
  • Reject local Podman callback aliases whose effective URI port differs from
    the gateway primary listener, while permitting arbitrary remote ports.
  • Support split IPv4/IPv6 listeners on the same port by making the IPv6
    wildcard socket IPv6-only when necessary.
  • Keep the primary listener on its loopback default in Docker E2E, RPM/Podman
    configurations, and the local rootless-Podman development launcher.
  • Update gateway architecture, operator docs, Podman networking notes, and
    cluster diagnostics.

Testing

  • cargo test -p openshell-driver-podman (142 tests)
  • mise run test
  • mise run pre-commit
  • mise run docs
  • Focused gateway-listener tests (15 tests)
  • Focused callback-listener authorization tests (5 tests)
  • Focused server and Podman Clippy across all targets with warnings denied
  • Rust formatting and Markdown/Mermaid linting
  • Unit and regression coverage for listener authorization, Podman discovery
    failures, remote callbacks, IPv4 loopback selection, split-dual-stack
    binding, callback-only routing, and unchanged primary-listener behavior
  • Updated GitHub and mirrored E2E checks for the latest head

Docker and live Podman E2E were not run locally.

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture and relevant user-facing documentation updated

@copy-pr-bot

copy-pr-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@elezar elezar added the test:e2e Requires end-to-end coverage label Jul 27, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied, but pull-request/2492 does not exist yet. A maintainer needs to comment /ok to test 7e8b6d2fe61ad994ea9687e7fe3fd8ec55ec28e7 to mirror this PR. Once the mirror exists, re-apply the label or re-run Branch E2E Checks from the Actions tab.

@elezar

elezar commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

/ok-to-test 7e8b6d2

@elezar
elezar force-pushed the codex/gateway-callback-contract-poc-v2 branch from 7e8b6d2 to ec3d9eb Compare July 27, 2026 12:39
@elezar

elezar commented Jul 27, 2026

Copy link
Copy Markdown
Member Author

/ok-to-test ec3d9eb

@elezar
elezar force-pushed the codex/gateway-callback-contract-poc-v2 branch 5 times, most recently from c2543d9 to e817863 Compare July 28, 2026 08:55
@github-actions

Copy link
Copy Markdown

@elezar

elezar commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

/ok-to-test e817863

@elezar

elezar commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

/ok to test

@elezar

elezar commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

/ok-to-test c768219

@elezar

elezar commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

/ok-to-test a5cef7d

@elezar
elezar marked this pull request as ready for review July 28, 2026 11:47
@elezar elezar changed the title refactor(compute): prototype gateway listener requirements feat(compute): negotiate gateway callback listeners Jul 28, 2026
@elezar

elezar commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

/ok-to-test ee88761

@elezar elezar left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This maintainer-authored PR is project-valid and directly advances the listener-discovery work related to #2215.
Head SHA: ee8876193e2191b948b470abf592ce9d3b32357e

Review findings:

  • Three warning-level findings were left inline: one docs accuracy issue, one gateway config reference-doc gap, and one operational logging gap.

Docs: Updated in part, but the published Podman and gateway configuration docs still need the inline corrections before gator can move this to pipeline watch.

Next state: gator:in-review

Comment thread docs/reference/sandbox-compute-drivers.mdx Outdated
# you don't use Podman or want loopback-only access (e.g. behind a reverse
# proxy). mTLS is enabled by default and protects all connections.
bind_address = "0.0.0.0:17670"
# Keep the primary listener on the built-in 127.0.0.1:17670 default. The

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

Warning: This changes the RPM config default by removing the bind_address = "0.0.0.0:17670" override, but docs/reference/gateway-config.mdx was not updated. Please add a short note that RPM/Podman leaves bind_address unset, uses the built-in 127.0.0.1:17670 primary listener, and relies on restricted driver-negotiated callback listeners.

Comment thread crates/openshell-server/src/lib.rs Outdated
let local_addr = listener.local_addr().unwrap_or(address);
.map_err(|e| Error::transport(format!("failed to bind to {}: {e}", spec.address)))?;
let local_addr = listener.local_addr().unwrap_or(spec.address);
info!(address = %local_addr, "Server listening");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

Warning: The troubleshooting skill now tells operators to inspect the listener-purpose startup log, but this startup log still emits only address. Please include purpose = ?spec.purpose here so unexpected callback binds show the driver and reason in gateway logs.

@elezar elezar added the gator:in-review Gator is reviewing or awaiting PR review feedback label Jul 28, 2026
@elezar
elezar force-pushed the codex/gateway-callback-contract-poc-v2 branch from ee88761 to 18044d2 Compare July 29, 2026 08:45
@elezar

elezar commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

/ok-to-test 18044d2

@elezar elezar left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This maintainer-authored PR is project-valid and directly advances the listener-discovery work related to #2215.
Head SHA: 18044d2ddaaab25063fa2f2be7adcbd65c03ec4a

Review findings:

  • Two warning-level findings are left inline: the Podman callback discovery docs still describe only pasta, and the startup listener log still omits listener purpose/provenance.
  • General warning: docs/reference/gateway-config.mdx is not in the current diff, but it still needs a note that RPM/Podman leaves bind_address unset, uses the built-in 127.0.0.1:17670 primary listener, and relies on restricted driver-negotiated callback listeners.

Docs: Updated in part, but the published compute-driver and gateway configuration docs still need the corrections above before gator can move this to pipeline watch.

Next state: gator:in-review

Comment thread docs/reference/sandbox-compute-drivers.mdx Outdated
Comment thread crates/openshell-server/src/lib.rs Outdated

@elezar elezar left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This maintainer-authored PR is project-valid and directly advances the listener-discovery work related to #2215.
Head SHA: 1394c1e0d54a0c546e889ccaf9ba9ad55533871f

Review findings:

  • One warning-level finding was left inline: Podman bridge gateway inspection is now mandatory during startup even for callback topologies that do not need the bridge address.

Docs: Fern docs and companion troubleshooting guidance were updated for the primary listener default and callback-only listener behavior.

Tests: I did not run local tests. Current GitHub checks are still pending, including OpenShell / E2E and some package build jobs.

Next state: gator:in-review

.network_gateway_ip(&config.network_name)
.await
.unwrap_or(None);
let network_gateway_ip = client.network_gateway_ip(&config.network_name).await?;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

Warning: network_gateway_ip() is now mandatory during every Podman driver startup, before the driver knows whether the callback endpoint actually needs the Podman bridge address. This regresses explicitly remote grpc_endpoint configurations, and also rootless pasta without host_gateway_ip, where listener discovery uses the host default-route source instead of the Podman bridge gateway. Keep this inspection best-effort at construction time and fail later only when gateway_listener_requirements() needs the exact bridge address. For example, restore a guarded fallback here:

let network_gateway_ip = match client.network_gateway_ip(&config.network_name).await {
    Ok(gateway_ip) => gateway_ip,
    Err(err) => {
        warn!(
            network = %config.network_name,
            error = %err,
            "Podman bridge gateway inspection failed; exact local callback listeners may be unavailable"
        );
        None
    }
};

@elezar
elezar force-pushed the codex/gateway-callback-contract-poc-v2 branch from 1394c1e to 3dedd40 Compare July 29, 2026 14:22
@elezar
elezar changed the base branch from main to codex/gateway-listener-refactor July 29, 2026 14:23

@elezar elezar left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This maintainer-authored PR is project-valid and directly advances the listener-discovery work related to #2215.
Head SHA: 3dedd40ec1ddd7dc4935a8673d7f21df017f68cc

Review findings:

  • No blocking findings remain from the independent code-only review for this head. The previous docs, gateway-config, listener provenance, and Podman bridge-inspection findings appear resolved.

Docs: Fern docs, RPM/operator docs, and troubleshooting guidance were updated for the primary listener default and callback-only listener behavior.

Tests: I did not run local tests. GitHub Branch Checks currently include a macOS Rust toolchain setup failure while installing Clippy, and test:e2e pipeline jobs are still pending.

Next state: gator:watch-pipeline

@elezar elezar added gator:watch-pipeline Gator is monitoring PR CI/CD status gator:in-review Gator is reviewing or awaiting PR review feedback and removed gator:in-review Gator is reviewing or awaiting PR review feedback gator:watch-pipeline Gator is monitoring PR CI/CD status labels Jul 29, 2026
@elezar
elezar force-pushed the codex/gateway-listener-refactor branch from 26dd8a8 to a8b41f9 Compare July 29, 2026 15:23
@elezar
elezar force-pushed the codex/gateway-callback-contract-poc-v2 branch from 3dedd40 to bcef4ca Compare July 29, 2026 15:28

@elezar elezar left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

PR Review Status

Validation: This maintainer-authored PR is project-valid and directly advances the listener-discovery work related to #2215.
Head SHA: bcef4ca7e352589d2db5d2eb0df9c447c1907ef5

Review findings:

  • One warning-level finding is left inline: Podman driver startup still makes bridge gateway inspection mandatory even when the selected callback topology does not need that bridge address.

Docs: Fern docs, RPM/operator docs, and companion troubleshooting guidance were updated for the primary listener default and callback-only listener behavior.

Tests: I did not run local tests. Current GitHub checks are still pending, including OpenShell / Branch Checks and OpenShell / E2E.

Next state: gator:in-review

.network_gateway_ip(&config.network_name)
.await
.unwrap_or(None);
let network_gateway_ip = client.network_gateway_ip(&config.network_name).await?;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gator-agent

Warning: network_gateway_ip() is still mandatory during Podman driver construction even when the selected callback topology does not need the bridge gateway address, such as an explicitly remote grpc_endpoint, macOS loopback forwarding, or rootless pasta without host_gateway_ip. Startup should fail when a required local callback listener cannot be discovered, not when unused bridge inspection fails. Move auto-detected grpc_endpoint setup before gateway-IP inspection and only call network_gateway_ip() for Linux local-alias cases that will use an exact bridge bind, such as rootful Podman with empty host_gateway_ip.

@elezar elezar added gator:blocked Gator is blocked by process or repository gates and removed gator:in-review Gator is reviewing or awaiting PR review feedback labels Jul 29, 2026
elezar added 15 commits July 29, 2026 18:31
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
Signed-off-by: Evan Lezar <elezar@nvidia.com>
@elezar
elezar force-pushed the codex/gateway-callback-contract-poc-v2 branch from bcef4ca to 352683d Compare July 29, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gator:blocked Gator is blocked by process or repository gates test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant