Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(modules): rename desktop module references to TinyComputer and handle reinitialization faults

Steven Enamakel63c2ce6bd434
diff --git a/crates/openhuman-core/src/modules/desktop.rs b/crates/openhuman-core/src/modules/desktop.rs
index f01597378c..b51c541975 100644
--- a/crates/openhuman-core/src/modules/desktop.rs
+++ b/crates/openhuman-core/src/modules/desktop.rs
@@ -44,9 +44,9 @@ pub(crate) async fn proxy(config: &Config) -> Result<Proxy, String> {
.map_err(crate::modules::ops::LoadError::into_message)?;
let runtime = crate::modules::host::runtime()
.await
- .map_err(|error| format!("desktop module bus unavailable: {error}"))?;
+ .map_err(|error| format!("TinyComputer module bus unavailable: {error}"))?;
crate::modules::registry::find(MODULE_ID)
- .ok_or_else(|| "desktop module is not in the compiled registry".to_owned())?;
+ .ok_or_else(|| "TinyComputer module is not in the compiled registry".to_owned())?;
// Reinitialization is private and retains no plaintext secret in this host.
// The lock makes credential rotation atomic across concurrent tool calls.
@@ -58,13 +58,22 @@ pub(crate) async fn proxy(config: &Config) -> Result<Proxy, String> {
.connection()
.reinitialize_module(MODULE_ID, configuration)
.await
- .map_err(|error| format!("desktop module credential refresh failed: {error}"))?;
+ .map_err(|error| {
+ let message = format!("TinyComputer configuration refresh failed: {error}");
+ if error.wire_name().ends_with("ModuleUnavailable") {
+ // The module refused its configuration and faulted; it
+ // stays unusable in this process, so report it that way.
+ tracing::warn!(%message, "[computer] module faulted on reinitialization");
+ super::resolution::table().mark_faulted(MODULE_ID, message.clone());
+ }
+ message
+ })?;
}
*previous = Some(current);
drop(previous);
runtime
.proxy(names::INTERFACE, names::OBJECT_PATH)
- .map_err(|error| format!("desktop module proxy unavailable: {error}"))
+ .map_err(|error| format!("TinyComputer module proxy unavailable: {error}"))
}
/// Call one contract member, preserving the structured error envelope.
@@ -123,7 +132,7 @@ pub fn state(config: &Config) -> (String, Option<String>) {
|| {
(
"failed".to_owned(),
- Some("desktop module is not registered".to_owned()),
+ Some("TinyComputer module is not registered".to_owned()),
)
},
|item| (format!("{:?}", item.state).to_lowercase(), item.detail),
diff --git a/crates/openhuman-core/src/modules/resolution.rs b/crates/openhuman-core/src/modules/resolution.rs
index 637ad8229d..4725d02515 100644
--- a/crates/openhuman-core/src/modules/resolution.rs
+++ b/crates/openhuman-core/src/modules/resolution.rs
@@ -128,6 +128,20 @@ impl ResolutionTable {
let _ = sender.send(Some(resolution));
}
+ /// Record that a module which resolved `Ready` has since faulted, such as
+ /// when a lifecycle reinitialization is refused. tinybus never recovers a
+ /// faulted module in-process, so the slot settles as failed and later
+ /// callers get the reason instead of a retry.
+ pub(crate) fn mark_faulted(&self, id: &str, reason: String) {
+ let mut slots = self
+ .slots
+ .lock()
+ .unwrap_or_else(|poisoned| poisoned.into_inner());
+ if matches!(slots.get(id), Some(Slot::Done(Resolution::Ready))) {
+ slots.insert(id.to_string(), Slot::Done(Resolution::Failed(reason)));
+ }
+ }
+
/// The state of `id` without touching it.
pub(super) fn peek(&self, id: &str) -> ResolutionState {
let slots = self