Skip to content

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

chore: remove dead code across multiple modules

Steven Enamakel63b4d7761c33
diff --git a/crates/openhuman-core/src/agent/orchestration/running_subagents/steering.rs b/crates/openhuman-core/src/agent/orchestration/running_subagents/steering.rs
index c1b5fc2131..d3f0216e42 100644
--- a/crates/openhuman-core/src/agent/orchestration/running_subagents/steering.rs
+++ b/crates/openhuman-core/src/agent/orchestration/running_subagents/steering.rs
@@ -131,17 +131,6 @@ pub(crate) enum SteerDirectiveError {
PolicyRejected,
}
-pub(crate) fn steer_directive_error_from_registry(
- error: DetachedTaskRegistryError,
-) -> SteerDirectiveError {
- match error {
- DetachedTaskRegistryError::NotOwned => SteerDirectiveError::NotOwned,
- DetachedTaskRegistryError::AlreadyDone => SteerDirectiveError::AlreadyDone,
- DetachedTaskRegistryError::NoSteeringHandle => SteerDirectiveError::NoRegisteredHandle,
- _ => SteerDirectiveError::Unknown,
- }
-}
-
/// Inject a message into a running sub-agent. Prefer the crate-native
/// TinyAgents steering registry when the child run has registered its live
/// handle, and fall back to the OpenHuman `RunQueue` compatibility path.
diff --git a/crates/openhuman-core/src/agent/prompts/types.rs b/crates/openhuman-core/src/agent/prompts/types.rs
index 83f9223548..af1ef0b864 100644
--- a/crates/openhuman-core/src/agent/prompts/types.rs
+++ b/crates/openhuman-core/src/agent/prompts/types.rs
@@ -26,20 +26,6 @@ pub(crate) const BOOTSTRAP_MAX_CHARS: usize = 20_000;
/// grown.
pub(crate) const USER_FILE_MAX_CHARS: usize = 2_000;
-/// Per-namespace cap when injecting tree summarizer root summaries into
-/// the prompt. ~8 000 chars ≈ 2 000 tokens — that's the floor the user
-/// asked for ("at least 2000 tokens of user memory") for a single
-/// namespace, and matches what the tree summarizer's `Day` level
-/// already enforces upstream.
-///
-/// **Note**: this constant matches the `Balanced` preset of
-/// [`crate::config::schema::agent::MemoryContextWindow`] —
-/// the live agent harness now resolves the per-namespace cap from that
-/// preset (see `AgentConfig::resolved_memory_limits`). The constant is
-/// kept as the documented baseline for prompt-section authors.
-#[allow(dead_code)]
-pub(crate) const USER_MEMORY_PER_NAMESPACE_MAX_CHARS: usize = 8_000;
-
// ─────────────────────────────────────────────────────────────────────────────
// Learned context (pre-fetched, not blocking)
// ─────────────────────────────────────────────────────────────────────────────
diff --git a/crates/openhuman-core/src/agent/session_host/turn/tools.rs b/crates/openhuman-core/src/agent/session_host/turn/tools.rs
index a042d2ae11..d62109c34b 100644
--- a/crates/openhuman-core/src/agent/session_host/turn/tools.rs
+++ b/crates/openhuman-core/src/agent/session_host/turn/tools.rs
@@ -353,17 +353,6 @@ impl OpenHumanSessionHost {
true
}
- /// Test-only: inject a specific skill-events receiver (e.g. one whose
- /// sender has been dropped) so `drain_skill_events`' `Closed` arm is
- /// reachable without the global bus singleton.
- #[cfg(test)]
- pub(in super::super) fn set_skill_events_rx_for_test(
- &mut self,
- rx: tinybus::events::EventReceiver<crate::core::events::DomainEvent>,
- ) {
- self.skill_events_rx = Some(rx);
- }
-
/// Re-synthesise `delegate_*` tools for the orchestrator's `subagents`
/// declaration using the live `connected_integrations` slice, and
/// reconcile the resulting set into `self.synthesized_tools` /
diff --git a/crates/openhuman-core/src/core/cli_capability.rs b/crates/openhuman-core/src/core/cli_capability.rs
index e23211661e..36f201f012 100644
--- a/crates/openhuman-core/src/core/cli_capability.rs
+++ b/crates/openhuman-core/src/core/cli_capability.rs
@@ -68,40 +68,6 @@ pub fn capability_unavailable_message(
)
}
-/// The operator-facing sentence for a legacy CLI command that cannot run under
-/// the bound driver.
-///
-/// `invocation` follows the same static-strings-only rule as
-/// [`capability_unavailable_message`]. This is a distinct diagnostic from the
-/// capability one: a null or external binding does not necessarily lack the
-/// family — the legacy command is unavailable because it operates on the
-/// embedded engine directly, and the bound driver is not that engine.
-///
-/// The `class` parameter tailors the explanation: a `Null` driver is
-/// unconfigured (no external source), while an `External` one answers from
-/// a remote store — both refuse legacy subcommands for the same structural
-/// reason but deserve different descriptions.
-pub fn legacy_client_unavailable_message(
- driver_id: &str,
- class: DriverClass,
- invocation: &str,
-) -> String {
- let detail = if class == DriverClass::Null {
- "no memory driver is configured".to_string()
- } else {
- format!(
- "this configuration bound a driver (`{driver_id}`) that answers from \
- a remote store, not this machine's embedded engine"
- )
- };
- format!(
- "{LEGACY_CLIENT_UNAVAILABLE_PREFIX}`{driver_id}` does not keep memory in the \
- local store, so `{invocation}` is unavailable: it reads that store \
- directly, and {detail}. Run `openhuman subsystems` to see the bound driver, \
- or change `[subsystems.memory] driver` in your config.",
- )
-}
-
/// The pure verdict: given what a driver advertises, is `required` available?
///
/// `required == None` (ungated surface) is always `Ok`. Mirrors
diff --git a/crates/openhuman-core/src/core/memory_cli_tests.rs b/crates/openhuman-core/src/core/memory_cli_tests.rs
index c0ae07dd9d..97e2c9ad7a 100644
--- a/crates/openhuman-core/src/core/memory_cli_tests.rs
+++ b/crates/openhuman-core/src/core/memory_cli_tests.rs
@@ -105,20 +105,3 @@ fn default_embedded_driver_gates_nothing() {
/// through the contract, where "not the embedded engine" is not a refusal
/// reason — see [`create_memory_binding`].
const LEGACY_ENGINE_SUBCOMMANDS: &[&str] = &["ingest", "query"];
-
-/// The legacy-client diagnostic must not leak credentials or endpoints.
-#[test]
-fn legacy_message_never_contains_a_credential_or_endpoint() {
- use crate::core::subsystem::DriverClass;
- let msg = crate::core::cli_capability::legacy_client_unavailable_message(
- "supermemory",
- DriverClass::External,
- "openhuman memory clear",
- );
- assert!(!msg.contains("keychain:"), "{msg}");
- assert!(!msg.contains("api.supermemory.ai"), "{msg}");
- assert!(
- msg.starts_with(crate::core::cli_capability::LEGACY_CLIENT_UNAVAILABLE_PREFIX),
- "{msg}"
- );
-}
diff --git a/crates/openhuman-core/src/inference/tokenjuice/mod.rs b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
index 9e5aef21e8..6818348438 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/mod.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/mod.rs
@@ -153,33 +153,6 @@ pub(super) async fn proxy(_config: &crate::config::Config) -> Result<tinybus::Pr
Err("native modules are not compiled into this build".to_string())
}
-/// Compact tool output using an already-resolved runtime config when available.
-///
-/// Agent turns must not reload configuration from the middle of a deep tool
-/// call stack: startup owns migrations, while a turn only needs the snapshot it
-/// was constructed with.
-pub async fn compact_output_with_config(
- content: String,
- tool_name: &str,
- enabled: bool,
- profile: AgentTokenjuiceCompression,
- runtime_config: Option<&std::sync::Arc<crate::config::Config>>,
-) -> String {
- compact_tool_output(ToolOutputCompaction {
- content,
- tool_name,
- enabled,
- profile,
- runtime_config,
- arguments: None,
- focus: None,
- context_token: None,
- scope: None,
- })
- .await
- .text
-}
-
/// Everything the module considers about one tool result.
pub struct ToolOutputCompaction<'a> {
pub content: String,
diff --git a/crates/openhuman-core/src/runtime/pool/types.rs b/crates/openhuman-core/src/runtime/pool/types.rs
index 625920dcb6..a81179bac0 100644
--- a/crates/openhuman-core/src/runtime/pool/types.rs
+++ b/crates/openhuman-core/src/runtime/pool/types.rs
@@ -34,19 +34,6 @@ impl PoolLang {
}
}
- /// The pool a bus language belongs to, if this build has one for it.
- ///
- /// A language this core ships no pool concept for is `None` rather than an
- /// error: the module routes whatever its configuration routes, and a status
- /// surface should skip an unfamiliar entry rather than fail rendering.
- #[must_use]
- pub fn from_language(language: &Language) -> Option<Self> {
- match language.as_str() {
- tinyruntime_bus::NODEJS => Some(Self::Node),
- tinyruntime_bus::PYTHON => Some(Self::Python),
- _ => None,
- }
- }
}
/// The result of running one job on a pooled worker.
diff --git a/crates/openhuman-core/src/runtime/pool/types_tests.rs b/crates/openhuman-core/src/runtime/pool/types_tests.rs
index be67898488..e229526fcd 100644
--- a/crates/openhuman-core/src/runtime/pool/types_tests.rs
+++ b/crates/openhuman-core/src/runtime/pool/types_tests.rs
@@ -56,20 +56,6 @@ fn a_timed_out_reply_stays_timed_out_through_the_adaptation() {
assert!(!adapted.success());
}
-#[test]
-fn each_pool_language_round_trips_through_its_bus_language() {
- for lang in [PoolLang::Node, PoolLang::Python] {
- assert_eq!(PoolLang::from_language(&lang.language()), Some(lang));
- }
-}
-
-#[test]
-fn an_unfamiliar_language_is_skipped_rather_than_guessed() {
- // The module routes whatever its own configuration routes; a status surface
- // should skip an entry this build has no pool concept for.
- assert_eq!(PoolLang::from_language(&Language::new("ruby")), None);
-}
-
#[test]
fn settings_disable_idle_reaping_on_zero() {
let cfg = RuntimePoolLangConfig {
diff --git a/crates/openhuman-core/src/security/audit.rs b/crates/openhuman-core/src/security/audit.rs
index 301323c37f..5251e6479e 100644
--- a/crates/openhuman-core/src/security/audit.rs
+++ b/crates/openhuman-core/src/security/audit.rs
@@ -133,21 +133,6 @@ impl AuditEvent {
self
}
- /// Set action metadata for a generated tool execution.
- pub fn with_generated_tool_action(mut self, entry: GeneratedToolExecutionLog<'_>) -> Self {
- self.action = Some(Action {
- command: Some(entry.tool_name.to_string()),
- risk_level: Some(entry.risk_level.to_string()),
- approved: entry.approved,
- allowed: entry.allowed,
- provider_id: Some(entry.provider_id.to_string()),
- capability_id: Some(entry.capability_id.to_string()),
- policy_decision: Some(entry.policy_decision.to_string()),
- approval_id: entry.approval_id.map(str::to_string),
- });
- self
- }
-
/// Set the result
pub fn with_result(
mut self,
diff --git a/crates/openhuman-core/src/security/devices/crypto.rs b/crates/openhuman-core/src/security/devices/crypto.rs
index 29da348b2b..92298ee02c 100644
--- a/crates/openhuman-core/src/security/devices/crypto.rs
+++ b/crates/openhuman-core/src/security/devices/crypto.rs
@@ -100,16 +100,6 @@ impl DeviceKeypair {
self.private.to_bytes()
}
- /// Reconstruct from stored (decrypted) private key bytes.
- pub fn from_private_bytes(bytes: [u8; 32]) -> Self {
- let private = StaticSecret::from(bytes);
- let public = PublicKey::from(&private);
- let pubkey_b64 = base64url_encode(public.as_bytes());
- Self {
- private,
- pubkey_b64,
- }
- }
}
// ---------------------------------------------------------------------------
diff --git a/crates/openhuman-core/src/security/devices/crypto_tests.rs b/crates/openhuman-core/src/security/devices/crypto_tests.rs
index 8a3a01fb50..216b71a554 100644
--- a/crates/openhuman-core/src/security/devices/crypto_tests.rs
+++ b/crates/openhuman-core/src/security/devices/crypto_tests.rs
@@ -9,14 +9,6 @@ fn keypair_round_trip_pubkey_is_base64url() {
assert_eq!(decoded.len(), 32);
}
-#[test]
-fn keypair_private_bytes_round_trip() {
- let kp = DeviceKeypair::generate();
- let bytes = kp.private_bytes();
- let kp2 = DeviceKeypair::from_private_bytes(bytes);
- assert_eq!(kp.pubkey_b64, kp2.pubkey_b64);
-}
-
#[test]
fn dh_both_sides_derive_same_secret() {
let core_kp = DeviceKeypair::generate();
diff --git a/crates/openhuman-core/src/security/encryption/core.rs b/crates/openhuman-core/src/security/encryption/core.rs
index ed9985385f..b0ea6d50cc 100644
--- a/crates/openhuman-core/src/security/encryption/core.rs
+++ b/crates/openhuman-core/src/security/encryption/core.rs
@@ -85,19 +85,6 @@ impl EncryptionKey {
.map_err(|e| format!("Decryption failed: {e}"))
}
- /// Encrypt a string and return base64-encoded JSON payload.
- pub fn encrypt_string(&self, plaintext: &str) -> Result<String, String> {
- let payload = self.encrypt(plaintext.as_bytes())?;
- serde_json::to_string(&payload).map_err(|e| format!("Serialization failed: {e}"))
- }
-
- /// Decrypt a base64-encoded JSON payload back to a string.
- pub fn decrypt_string(&self, encrypted_json: &str) -> Result<String, String> {
- let payload: EncryptedPayload =
- serde_json::from_str(encrypted_json).map_err(|e| format!("Deserialization: {e}"))?;
- let plaintext = self.decrypt(&payload)?;
- String::from_utf8(plaintext).map_err(|e| format!("UTF-8 decode: {e}"))
- }
}
/// Get the path to the OpenHuman data directory.
diff --git a/crates/openhuman-core/src/security/encryption/core_tests.rs b/crates/openhuman-core/src/security/encryption/core_tests.rs
index 2f881dbde8..645c7fdccf 100644
--- a/crates/openhuman-core/src/security/encryption/core_tests.rs
+++ b/crates/openhuman-core/src/security/encryption/core_tests.rs
@@ -24,14 +24,6 @@ fn encrypt_decrypt_bytes_round_trip() {
assert_eq!(k.decrypt(&payload).expect("decrypt"), plaintext);
}
-#[test]
-fn encrypt_decrypt_string_round_trip() {
- let k = key("pw", &EncryptionKey::generate_salt());
- let secret = "sk-live-🔐-multibyte";
- let json = k.encrypt_string(secret).expect("encrypt_string");
- assert_eq!(k.decrypt_string(&json).expect("decrypt_string"), secret);
-}
-
#[test]
fn kdf_is_deterministic_for_same_password_and_salt() {
// Two independent derivations from the same (password, salt) must yield
@@ -114,15 +106,6 @@ fn generate_salt_is_correct_length_and_random() {
assert_ne!(s1, s2, "two generated salts must differ (CSPRNG)");
}
-#[test]
-fn decrypt_string_rejects_malformed_json() {
- let k = key("pw", &EncryptionKey::generate_salt());
- assert!(
- k.decrypt_string("not-json").is_err(),
- "non-JSON payload must be a clean Err, not a panic"
- );
-}
-
#[test]
fn empty_plaintext_round_trips() {
let k = key("pw", &EncryptionKey::generate_salt());