Skip to content

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

fix(security): handle auth timeout in event bridge and credential profiles

Steven Enamakel4488e9fe6835
diff --git a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
index 77d04191af..67922797ac 100644
--- a/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/observability/event_bridge.rs
@@ -73,7 +73,6 @@ pub(crate) struct OpenhumanEventBridge {
/// Shared FIFO carry of the per-call provider `UsageInfo` the model adapter
/// observed; drained in `record_usage` to restore backend-charged USD +
/// context-window + cache-creation/reasoning tokens the crate `Usage` drops.
- #[allow(dead_code)]
pub(super) usage_carry: ProviderUsageCarry,
/// Model-call iterations whose `UsageRecorded` has already been folded into
/// the global cost tracker (W2-budget-dedupe). A single model call can now
diff --git a/crates/openhuman-core/src/desktop/app_state/ops/auth_timeout.rs b/crates/openhuman-core/src/desktop/app_state/ops/auth_timeout.rs
index 860ab5cea5..1daf610a46 100644
--- a/crates/openhuman-core/src/desktop/app_state/ops/auth_timeout.rs
+++ b/crates/openhuman-core/src/desktop/app_state/ops/auth_timeout.rs
@@ -47,7 +47,7 @@ pub fn parse_auth_fetch_timeout_secs(raw: Option<&str>) -> u64 {
/// Split from [`parse_auth_fetch_timeout_secs`] so the resolver can tell
/// "accepted" from "fell back" without re-deriving it by comparing strings —
/// which would report a valid `05` as ignored.
-fn auth_fetch_timeout_override(raw: Option<&str>) -> Option<u64> {
+pub(super) fn auth_fetch_timeout_override(raw: Option<&str>) -> Option<u64> {
raw.map(str::trim)
.and_then(|s| s.parse::<u64>().ok())
.filter(|n| (MIN_AUTH_FETCH_TIMEOUT_SECS..=MAX_AUTH_FETCH_TIMEOUT_SECS).contains(n))
@@ -87,7 +87,7 @@ pub(super) fn auth_fetch_timeout() -> Duration {
/// (#5624 — 51 timeouts in one session, ~5s each). Making the timeout
/// configurable (#5930) without deriving this would let an operator re-open
/// that bug by widening the timeout past a fixed 10s step.
-fn current_user_backoff_base_for(fetch_timeout: Duration) -> Duration {
+pub(super) fn current_user_backoff_base_for(fetch_timeout: Duration) -> Duration {
CURRENT_USER_BACKOFF_BASE_FLOOR.max(fetch_timeout.saturating_mul(2))
}
diff --git a/crates/openhuman-core/src/security/credentials/profiles.rs b/crates/openhuman-core/src/security/credentials/profiles.rs
index 25d27dfc79..a13ac0b8cd 100644
--- a/crates/openhuman-core/src/security/credentials/profiles.rs
+++ b/crates/openhuman-core/src/security/credentials/profiles.rs
@@ -295,10 +295,6 @@ fn write_owner_only(path: &Path, bytes: &[u8]) -> std::io::Result<()> {
fs::write(path, bytes)
}
}
-include!("profiles_impl_01_part_01.rs");
-include!("profiles_impl_01_part_02.rs");
-include!("profiles_impl_01_part_03.rs");
-
/// Cross-platform best-effort check that a given OS process id is currently
/// running. Used by [`AuthProfilesStore::clear_lock_if_stale`] to decide
/// whether a recorded lock owner is still alive; a false negative just