Skip to content

Commit ffc3a25

Browse files
committed
feat(agents): refuse ended Sandbox sessions on deploy
Move the Sandbox deploy onto the shared lifecycle library. A deploy now splits identity checks (agent, owner, thread, management marker) from liveness checks, and reuses a Sandbox only while it is a live, Running session with a matching launch fingerprint. Each refusal names the lifecycle state (ended, ending, unknown, deleting) so the desktop can offer the right explicit action. New Sandboxes record whether checkpoint-on-stop is configured and use a File termination message policy so the harness receipt reaches the container status. Add an in-memory apiserver that drives the real kube::Client request path, and document the Sandbox lifecycle states and tombstones. Signed-off-by: Tee8z <[email protected]>
1 parent 8a78548 commit ffc3a25

7 files changed

Lines changed: 1107 additions & 294 deletions

File tree

‎crates/buzz-backend-kubernetes/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ rustls = { version = "0.23", default-features = false, features = ["ring", "std"
4040

4141
[dev-dependencies]
4242
tower = { workspace = true }
43+
tokio = { workspace = true, features = ["test-util"] }

‎crates/buzz-backend-kubernetes/src/main.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn respond(input: &str) -> Response {
109109
};
110110
match runtime.block_on(deploy_agent(&deploy)) {
111111
Ok(agent_id) => Response::deployed(agent_id),
112-
Err(e) => Response::error(e),
112+
Err(e) => Response::failed(e),
113113
}
114114
}
115115
}
@@ -134,7 +134,7 @@ fn refuse_relay_mesh(raw: &serde_json::Value) -> Option<String> {
134134
}
135135

136136
/// Run one deploy to a terminal outcome.
137-
async fn deploy_agent(request: &wire::DeployRequest) -> Result<String, String> {
137+
async fn deploy_agent(request: &wire::DeployRequest) -> Result<String, wire::ProviderError> {
138138
let cfg = config::parse(&request.provider_config)?;
139139
let sandbox = sandbox::Options::parse(&request.provider_config)?;
140140
// Identity before any cluster contact: a malformed nsec is a refusal, not
@@ -162,7 +162,7 @@ async fn deploy_agent(request: &wire::DeployRequest) -> Result<String, String> {
162162
return sandbox::deploy(client, &identity, &cfg, &scope, owner, env).await;
163163
}
164164
let substrate = cluster::Cluster::new(client, &cfg.namespace);
165-
reconcile::deploy(&substrate, &identity, &cfg, env).await
165+
Ok(reconcile::deploy(&substrate, &identity, &cfg, env).await?)
166166
}
167167

168168
#[cfg(test)]

0 commit comments

Comments
 (0)