Repository navigation
feat(supervisor): expose sandbox name to supervisor middleware #2754
Description
Problem Statement
Operator-run supervisor middleware receives the originating sandbox ID in RequestContext, but not the sandbox name. This makes middleware audit and approval interfaces harder for operators to interpret because they must display an opaque UUID or maintain a separate ID-to-name mapping.
The sandbox supervisor already knows both values. Its process-wide SandboxContext contains sandbox_id and sandbox_name, but the middleware request path currently copies only the ID into HttpRequestInput and the protobuf RequestContext.
Related umbrella issue: #1733.
Proposed Design
Extend supervisor middleware request context with the originating sandbox name:
- Add
string sandbox_name = 4toRequestContextinproto/supervisor_middleware.proto. Keep the existing field numbers unchanged for wire compatibility. - Add
sandbox_nametoopenshell_supervisor_middleware::HttpRequestInput. - Populate both
sandbox_idandsandbox_namefrom the existing process-wideopenshell_ocsf::SandboxContextwhen the supervisor constructs middleware input. - Copy the name into the operator-run gRPC request context. Built-in middleware may ignore it unless needed.
- Update middleware protocol documentation and tests to cover propagation of both identifiers.
The field should contain the canonical sandbox name known to the running supervisor. An unavailable name should remain an empty string, matching protobuf string defaults and preserving compatibility with older supervisors. Older middleware services will ignore the unknown field, while newer services remain compatible with older supervisors that omit it.
The existing middleware request-context size limit remains applicable.
Alternatives Considered
- Resolve the UUID through the gateway from each middleware service. This adds control-plane authentication, availability, and latency dependencies to a data-plane request hook.
- Configure a static sandbox label in each middleware policy. This duplicates identity data, can become stale after renames or policy reuse, and does not work cleanly for one service handling multiple sandboxes.
- Display only the sandbox ID. IDs are stable but are difficult for humans to recognize in approval and audit interfaces.
Passing the name beside the existing ID uses data the supervisor already owns and keeps middleware services self-contained.
Agent Investigation
- Searched existing issues for
RequestContext, sandbox name, and supervisor middleware; no focused duplicate was found. proto/supervisor_middleware.protocurrently definesrequest_id = 1,sandbox_id = 2, andoriginating_process = 3inRequestContext.crates/openshell-supervisor-middleware/src/lib.rscarries onlyrequest_idandsandbox_idinHttpRequestInput.crates/openshell-supervisor-network/src/l7/middleware.rscurrently reads onlyopenshell_ocsf::ctx::ctx().sandbox_idwhen constructing middleware input.crates/openshell-sandbox/src/lib.rsalready initializesSandboxContextwith both the sandbox ID and sandbox name, so no new lookup is required.
Checklist
- I've reviewed existing issues and the architecture docs
- This is a design proposal, not a "please build this" request
Activity
letv1nnn commentedon Aug 16, 2026
Hey @pimlock, I'd like to take this one.
pimlock commentedon Aug 18, 2026
Thanks! This sounds good, I will take a look at the PR today.