1212//! Podman / VM drivers write this to a bundle file at sandbox-create
1313//! time).
1414//! 3. `OPENSHELL_K8S_SA_TOKEN_FILE` — projected `ServiceAccount` JWT; the
15- //! supervisor exchanges it for a gateway JWT via `IssueSandboxToken`
16- //! once at startup.
15+ //! supervisor registers its pod and receives a gateway JWT via
16+ //! `RegisterSupervisorPod` once at startup.
1717//!
1818//! The resolved bearer credential is held in process memory thereafter and
1919//! injected on every outbound call by [`AuthInterceptor`].
@@ -24,11 +24,11 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH};
2424
2525use crate :: proto:: {
2626 DenialSummary , GetDraftPolicyRequest , GetInferenceBundleRequest , GetInferenceBundleResponse ,
27- GetSandboxConfigRequest , GetSandboxProviderEnvironmentRequest , IssueSandboxTokenRequest ,
28- NetworkActivitySummary , PolicyChunk , PolicySource , PolicyStatus , RefreshSandboxTokenRequest ,
29- ReportPolicyStatusRequest , SandboxPolicy as ProtoSandboxPolicy , SubmitPolicyAnalysisRequest ,
30- SubmitPolicyAnalysisResponse , UpdateConfigRequest , inference_client :: InferenceClient ,
31- open_shell_client:: OpenShellClient ,
27+ GetSandboxConfigRequest , GetSandboxProviderEnvironmentRequest , NetworkActivitySummary ,
28+ PolicyChunk , PolicySource , PolicyStatus , RefreshSandboxTokenRequest ,
29+ RegisterSupervisorPodRequest , ReportPolicyStatusRequest , SandboxPolicy as ProtoSandboxPolicy ,
30+ SubmitPolicyAnalysisRequest , SubmitPolicyAnalysisResponse , UpdateConfigRequest ,
31+ inference_client :: InferenceClient , open_shell_client:: OpenShellClient ,
3232} ;
3333use crate :: sandbox_env;
3434use miette:: { IntoDiagnostic , Result , WrapErr } ;
@@ -258,7 +258,7 @@ async fn token_slot(endpoint: &str, plain_channel: &Channel) -> Result<(TokenSlo
258258///
259259/// `endpoint` is logged on errors but never used for transport here; the
260260/// actual network call lives inside this function only on the K8s
261- /// bootstrap path, which uses `plain_channel` to call `IssueSandboxToken `
261+ /// bootstrap path, which uses `plain_channel` to call `RegisterSupervisorPod `
262262/// once before the steady-state Bearer-authenticated channel is built.
263263async fn acquire_sandbox_token ( endpoint : & str , plain_channel : & Channel ) -> Result < AcquiredToken > {
264264 if let Ok ( t) = std:: env:: var ( sandbox_env:: SANDBOX_TOKEN )
@@ -311,7 +311,7 @@ async fn acquire_k8s_sandbox_token(
311311 . wrap_err_with ( || format ! ( "failed to read K8s SA token from {sa_path}" ) ) ?
312312 . trim ( )
313313 . to_string ( ) ;
314- info ! ( endpoint = %endpoint, "exchanging K8s ServiceAccount token for sandbox JWT " ) ;
314+ info ! ( endpoint = %endpoint, "registering K8s supervisor pod for sandbox activation " ) ;
315315 // The bootstrap exchange uses a one-off interceptor pinned to the
316316 // SA token; the resulting gateway JWT becomes the value in the
317317 // shared `TOKEN_SLOT` once `connect_channel` returns.
@@ -324,11 +324,23 @@ async fn acquire_k8s_sandbox_token(
324324 let bootstrap = InterceptedService :: new ( plain_channel. clone ( ) , interceptor) ;
325325 let mut client = OpenShellClient :: new ( bootstrap) ;
326326 let resp = client
327- . issue_sandbox_token ( IssueSandboxTokenRequest { } )
327+ . register_supervisor_pod ( RegisterSupervisorPodRequest { } )
328328 . await
329329 . into_diagnostic ( )
330- . wrap_err ( "IssueSandboxToken bootstrap exchange failed" ) ?;
331- Ok ( resp. into_inner ( ) . token )
330+ . wrap_err ( "RegisterSupervisorPod bootstrap stream failed" ) ?;
331+ let mut stream = resp. into_inner ( ) ;
332+ let activation = stream
333+ . message ( )
334+ . await
335+ . into_diagnostic ( )
336+ . wrap_err ( "RegisterSupervisorPod activation stream failed" ) ?
337+ . ok_or_else ( || miette:: miette!( "RegisterSupervisorPod stream closed before activation" ) ) ?;
338+ info ! (
339+ sandbox_id = %activation. sandbox_id,
340+ sandbox_name = %activation. sandbox_name,
341+ "received supervisor pod activation"
342+ ) ;
343+ Ok ( activation. token )
332344}
333345
334346/// Build an authenticated channel for direct external use (e.g. the
0 commit comments