Skip to content

feat(supervisor): expose sandbox name to middleware request context - #2771

Open
letv1nnn wants to merge 3 commits into
NVIDIA:mainfrom
letv1nnn:expose-sandbox-name-to-supervisor-middleware
Open

feat(supervisor): expose sandbox name to middleware request context#2771
letv1nnn wants to merge 3 commits into
NVIDIA:mainfrom
letv1nnn:expose-sandbox-name-to-supervisor-middleware

Conversation

@letv1nnn

Copy link
Copy Markdown
Contributor

Summary

Adds the originating sandbox name to the supervisor middleware request context. Operator-run middleware already receives the sandbox ID; passing the name alongside it lets audit and approval interfaces show a human-readable identifier instead of an opaque UUID, using data the supervisor already owns.

Related Issue

Closes #2754

Changes

  • Add sandbox_name field to RequestContext in proto/supervisor_middleware.proto; existing field numbers are unchanged for wire compatibility.
  • Add sandbox_name to openshell_supervisor_middleware::HttpRequestInput and carry it into the gRPC RequestContext.
  • Populate sandbox_id and sandbox_name from the process-wide openshell_ocsf::SandboxContext when the network supervisor builds middleware input.
  • Inject the SandboxContext into middleware_request_input instead of reading the global inside it, making the identifier copy unit-testable with a real name.
  • Document the request-context identifiers and their empty-string fallback in docs/extensibility/supervisor-middleware.mdx.
  • Drop the #[cfg(target_os = "linux")] gate on the std::path::Path import in openshell-driver-podman's container.rs. Path is used unconditionally in a public function signature, so the gated import broke the non-Linux (macOS) build after merging main. Unrelated to the feature but required for the branch to compile cross-platform.

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
# Conflicts:
#	crates/openshell-supervisor-network/src/l7/middleware.rs
@copy-pr-bot

copy-pr-bot Bot commented Aug 17, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

// Workload process that originated the request, when available.
Process originating_process = 3;
// Sandbox name that originated the request.
string sandbox_name = 4;

@pimlock pimlock Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please also add workspace to RequestContext as string workspace = 5, preserving the existing field numbers and matching the other workspace-aware APIs. Populate it from the canonical workspace already learned through GetSandboxConfigResponse.workspace, and propagate it through both HTTP and WebSocket requests.

Please add assertions for both paths.


Middleware receives the request before credential injection. Operator-run services cannot inspect OpenShell-managed credentials. Middleware-visible request headers are delivered in wire order and repeated header names are preserved as separate entries. OpenShell filters credential, routing, framing, and hop-by-hop headers before invoking middleware. It rejects malformed request headers and unsupported transfer-coding sequences before middleware or policy dispatch. Headers named by a request's `Connection` field are omitted from middleware input and removed before forwarding, except for the validated WebSocket upgrade pair.

The request context identifies the originating sandbox to operator-run services. It carries the sandbox ID (`sandbox_id`) and the sandbox name (`sandbox_name`), letting audit and approval interfaces show a human-readable name instead of an opaque ID. The name is best-effort: a supervisor that cannot resolve it, or an older supervisor that predates the field, sends an empty string. Services should fall back to the sandbox ID when the name is empty.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please clearly document here and in the protobuf field comment that sandbox_name is for display and logging only. Names are workspace-scoped and may be reused for different sandbox instances. Consumers must use sandbox_id for authorization, persistence, durable correlation, and identity.

Signed-off-by: Artem Lytvyn <alytvyn@redhat.com>
@letv1nnn
letv1nnn force-pushed the expose-sandbox-name-to-supervisor-middleware branch from 9d38ccf to 803dc62 Compare August 20, 2026 13:07
@letv1nnn
letv1nnn requested a review from pimlock August 20, 2026 13:12
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.

feat(supervisor): expose sandbox name to supervisor middleware

2 participants