From 1fb0151c6ecd4f00acae79fd500a5e8adc2fd864 Mon Sep 17 00:00:00 2001 From: Ghost Scripter Date: Fri, 13 Nov 2026 02:12:17 +0530 Subject: [PATCH 1/4] chore(config): remove dead settings and loader paths (#329) Drop config settings that nothing reads outside schema and tests, plus the dead loader paths: - DaemonConfig and its core/embed re-exports (and the now-orphaned SecurityConfig / ResourceLimitsConfig it alone embedded) - WatcherStateStore (config/workspace/state.rs), no callers - DiagramViewerConfig and its TS type - reliability.{provider_retries,model_fallbacks} - agent.session_dual_write, local_ai.selected_tier - browser native_headless / native_webdriver_url / native_chrome_path / computer_use (BrowserComputerUseConfig) - integrations.parallel and its secret slot (37 slots now) - WebSearchConfig and its OPENHUMAN_WEB_SEARCH_* env overlay (now a deprecation warning) - Config::load_from_default_paths and load/migrate.rs redact_url_for_log (migration logging uses util::redact_url_for_log) Kept because they are still read on main: reliability.fallback_providers (doctor runtime-settings check), browser.session_name (doctor config-semantics), local_ai.autosummary_debounce_ms (tinyinference-local bootstrap), integrations.{google_places,stock_prices} (tinyhumans tool registration). Config has no deny_unknown_fields, so old keys are ignored on load. A compat test loads an old config.toml carrying every retired key (including a sealed enc2: value under integrations.parallel), checks the retained settings, saves, reloads, and checks the retired keys are recorded as unknown and gone from the saved file. Co-Authored-By: Claude Opus 5.5 --- .../panels/BrowserConnectionsPanel.test.tsx | 4 - app/src/utils/tauriCommands/config.ts | 14 +- .../src/channels/providers/relay/ops_tests.rs | 1 - .../dispatch/host_agent/dispatch_tests.rs | 1 - crates/openhuman-core/src/config/README.md | 6 +- crates/openhuman-core/src/config/daemon.rs | 57 ------ .../openhuman-core/src/config/daemon_tests.rs | 13 -- crates/openhuman-core/src/config/mod.rs | 34 ++-- .../src/config/ops/loader/snapshot.rs | 1 - .../ops/loader_snapshot_secrets_tests.rs | 2 +- .../src/config/schema/README.md | 15 +- .../openhuman-core/src/config/schema/agent.rs | 13 -- .../src/config/schema/dashboard.rs | 35 ---- .../src/config/schema/dashboard_tests.rs | 26 --- .../config/schema/load/config_file_read.rs | 4 +- .../src/config/schema/load/dirs.rs | 4 +- .../config/schema/load/env_overlay/search.rs | 38 +--- .../src/config/schema/load/impl_load.rs | 58 +----- .../src/config/schema/load/migrate.rs | 28 +-- .../src/config/schema/load/mod.rs | 4 - .../src/config/schema/load/secrets.rs | 1 - .../schema/load_active_user_and_dirs_tests.rs | 62 ------- .../config/schema/load_env_overlay_tests.rs | 33 +--- .../src/config/schema/load_migration_tests.rs | 29 --- .../schema/load_retired_keys_compat_tests.rs | 150 +++++++++++++++ .../src/config/schema/load_tests.rs | 2 + .../src/config/schema/local_ai.rs | 6 +- .../openhuman-core/src/config/schema/mod.rs | 27 ++- .../src/config/schema/runtime.rs | 12 +- .../src/config/schema/security.rs | 14 -- .../src/config/schema/security_mode.rs | 3 - .../src/config/schema/security_tests.rs | 10 +- .../src/config/schema/tools/browser.rs | 56 +----- .../src/config/schema/tools/integrations.rs | 9 +- ...grations_integration_toggle_tests_tests.rs | 8 +- .../src/config/schema/tools/mod.rs | 4 +- .../src/config/schema/tools/search.rs | 26 --- .../src/config/schema/types/config.rs | 3 - .../src/config/schema/types/config_clone.rs | 1 - .../src/config/schema/types/defaults.rs | 1 - .../src/config/workspace/README.md | 6 +- .../src/config/workspace/mod.rs | 1 - .../src/config/workspace/state.rs | 174 ------------------ .../src/config/workspace/state_tests.rs | 98 ---------- .../src/cron/scheduler/agent_run_tests.rs | 1 - crates/openhuman-core/src/lib.rs | 2 - .../src/storage/import/README.md | 4 +- crates/openhuman-core/src/storage/mod.rs | 8 +- crates/openhuman-core/src/tools/ops_tests.rs | 1 - .../ops_tests_execution_and_serde_tests.rs | 1 - .../web_chat/web_tests_ptt_source_tests.rs | 1 - .../openhuman-embed/examples/linux_fleet.rs | 1 - .../openhuman-embed/examples/support/mod.rs | 7 +- crates/openhuman-embed/src/lib.rs | 3 +- crates/openhuman-embed/tests/common/mod.rs | 7 +- crates/openhuman-embed/tests/session_store.rs | 5 +- .../src/integrations/tools/families_tests.rs | 1 - .../src/integrations/tools/mod.rs | 4 +- .../developing/architecture/agent-harness.md | 2 +- .../en/developing/architecture/security.md | 2 +- .../en/developing/embed/api-index.json | 1 - .../gitbooks/en/developing/embed/api-index.md | 1 - llms-full.txt | 1 - scripts/__tests__/storage-bypass.test.mjs | 2 - tests/in_process/config_e2e.rs | 67 +------ tests/support/config_auth_harness.rs | 6 +- 66 files changed, 257 insertions(+), 965 deletions(-) delete mode 100644 crates/openhuman-core/src/config/daemon.rs delete mode 100644 crates/openhuman-core/src/config/daemon_tests.rs create mode 100644 crates/openhuman-core/src/config/schema/load_retired_keys_compat_tests.rs delete mode 100644 crates/openhuman-core/src/config/workspace/state.rs delete mode 100644 crates/openhuman-core/src/config/workspace/state_tests.rs diff --git a/app/src/components/settings/panels/BrowserConnectionsPanel.test.tsx b/app/src/components/settings/panels/BrowserConnectionsPanel.test.tsx index 644e255b601..c12139f2c8c 100644 --- a/app/src/components/settings/panels/BrowserConnectionsPanel.test.tsx +++ b/app/src/components/settings/panels/BrowserConnectionsPanel.test.tsx @@ -147,10 +147,6 @@ describe('BrowserConnectionsPanel', () => { allowed_domains: [], session_name: null, backend: 'auto', - native_headless: true, - native_webdriver_url: 'http://127.0.0.1:9515', - native_chrome_path: null, - computer_use: { endpoint: 'http://127.0.0.1:8787/v1/actions', timeout_ms: 15000 }, }, http_request: { allowed_domains: ['selenium.dev'] }, }, diff --git a/app/src/utils/tauriCommands/config.ts b/app/src/utils/tauriCommands/config.ts index e1ff1606f0e..1ca215fb243 100644 --- a/app/src/utils/tauriCommands/config.ts +++ b/app/src/utils/tauriCommands/config.ts @@ -762,14 +762,14 @@ export interface SearchSettingsUpdate { allow_all?: boolean; } -export interface DiagramViewerSettings { - enabled: boolean; - source_url: string; - refresh_interval_seconds: number; -} - export interface DashboardSettings { - diagram_viewer: DiagramViewerSettings; + event_stream: { enabled: boolean; max_entries: number; new_entries: string }; + model_health: { + enabled: boolean; + hallucination_threshold: number; + min_tasks_for_rating: number; + evaluation_window_tasks: number; + }; } export async function openhumanGetDashboardSettings(): Promise> { diff --git a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs index c26ca2db0f3..639b2bc92ae 100644 --- a/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs +++ b/crates/openhuman-core/src/channels/providers/relay/ops_tests.rs @@ -75,7 +75,6 @@ async fn config(tmp: &tempfile::TempDir) -> Config { }; config.local_ai.runtime_enabled = false; config.memory.conversations.enabled = false; - config.agent.session_dual_write = false; config.agent.session_shadow_reads = false; crate::credentials::api_key::store_api_key(&config, "test-session-fixture-key") .await diff --git a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs index 4b59cd36fe6..84c60fbd07a 100644 --- a/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs +++ b/crates/openhuman-core/src/channels/runtime/dispatch/host_agent/dispatch_tests.rs @@ -80,7 +80,6 @@ async fn config(tmp: &tempfile::TempDir, agent_id: Option<&str>) -> Config { config.modules.allow_download = false; config.local_ai.runtime_enabled = false; config.memory.conversations.enabled = false; - config.agent.session_dual_write = false; config.agent.session_shadow_reads = false; crate::credentials::api_key::store_api_key(&config, "test-session-fixture-key") .await diff --git a/crates/openhuman-core/src/config/README.md b/crates/openhuman-core/src/config/README.md index ce6863916a6..d6fe73069f8 100644 --- a/crates/openhuman-core/src/config/README.md +++ b/crates/openhuman-core/src/config/README.md @@ -92,10 +92,8 @@ On success the resolved workspace is published to the cache in [`schema/load/act way). `active_workspace_snapshot()` resolves the workspace again from disk and returns it with a revision number, for callers that make one decision per workspace switch. -Two other entry points exist for narrower cases. `Config::load_from_config_path` reloads a config whose +One other entry point exists for a narrower case. `Config::load_from_config_path` reloads a config whose paths are already known and ignores `OPENHUMAN_WORKSPACE`, for long-lived objects that hold a snapshot. -`Config::load_from_default_paths` ignores `OPENHUMAN_WORKSPACE` too and is read-only; the debug prompt -dump uses it. Most code does not call these directly. `ops::load_config_with_timeout()` wraps `load_or_init` in a 30-second timeout, returns the embedding host's `Config` instead when one is installed on the current @@ -165,7 +163,6 @@ config.update_model_settings (JSON-RPC / CLI) | `migrations/` | Version-gated startup migrations and `seed_new_workspace`. See [migrations/README.md](migrations/README.md). | | `workspace/` | Workspace bootstrap (`init_workspace`) and the `workspace.*` RPCs over the editable persona files (`SOUL.md`, `IDENTITY.md`). Registers its own controllers. See [workspace/README.md](workspace/README.md). | | `app_env.rs` | Reads the app environment (`production`, `staging`) used to pick the root directory. | -| [`daemon.rs`](./daemon.rs) | `DaemonConfig`, a small bundle of `data_dir`, `workspace_dir` and the autonomy, security, reliability, secrets and audit sections, built from a Tauri app data dir by `from_app_data_dir`. Re-exported by `openhuman-embed`. | | [`tools.rs`](./tools.rs) | Read-only agent tools over config: `config_snapshot`, `config_get_runtime_flags`, `config_get_client_config`, `config_get_autonomy`, `config_get_search`, `config_resolve_api_url`, `config_get_data_paths`. | | [`workspace_handle.rs`](./workspace_handle.rs) | `workspace_handle(path)`, a short stable digest of a workspace path. Process-wide streams (Event Log, `core_notification`) carry it instead of the path so home directories never reach exported logs. | @@ -183,7 +180,6 @@ config.update_model_settings (JSON-RPC / CLI) | `build_runtime_proxy_client`, `apply_runtime_proxy_to_builder` | [`schema/proxy.rs`](./schema/proxy.rs) | `reqwest` clients that honor the configured proxy for a named service key. | | `migrations::run_pending`, `CURRENT_SCHEMA_VERSION` | [`migrations/mod.rs`](./migrations/mod.rs) | The startup migration runner. | | `WORKLOAD_ROLES` | [`schema/types/model_ids.rs`](./schema/types/model_ids.rs) | Provider-neutral workload roles shared by inference and settings. Hosted model ids and aliases are registered by the host. | -| `DaemonConfig` | `daemon.rs` | Supervisor-level config bundle for embedders. | ## RPC surface diff --git a/crates/openhuman-core/src/config/daemon.rs b/crates/openhuman-core/src/config/daemon.rs deleted file mode 100644 index f1c8162b0fb..00000000000 --- a/crates/openhuman-core/src/config/daemon.rs +++ /dev/null @@ -1,57 +0,0 @@ -//! Tauri-focused daemon configuration wrapper for openhuman. - -use crate::config::{ - AuditConfig, AutonomyConfig, ReliabilityConfig, SecretsConfig, SecurityConfig, -}; -use serde::{Deserialize, Serialize}; -use std::path::PathBuf; - -/// Top-level daemon configuration for the Tauri supervisor. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct DaemonConfig { - /// Root data directory (defaults to Tauri's `app_data_dir/openhuman`). - pub data_dir: PathBuf, - /// Workspace directory the agent may operate within. - pub workspace_dir: PathBuf, - /// Autonomy / command-policy settings. - #[serde(default)] - pub autonomy: AutonomyConfig, - /// Security / sandbox settings. - #[serde(default)] - pub security: SecurityConfig, - /// Reliability / backoff settings. - #[serde(default)] - pub reliability: ReliabilityConfig, - /// Encrypted secret store settings. - #[serde(default)] - pub secrets: SecretsConfig, - /// Audit logging settings. - #[serde(default)] - pub audit: AuditConfig, -} - -impl DaemonConfig { - /// Build a config that derives paths from the Tauri `app_data_dir`. - pub fn from_app_data_dir(app_data_dir: &std::path::Path) -> Self { - let data_dir = app_data_dir.join("openhuman"); - let workspace_dir = data_dir.join("workspace"); - log::info!( - "[openhuman:config] Initialized config: data_dir={}, workspace_dir={}", - data_dir.display(), - workspace_dir.display() - ); - Self { - data_dir, - workspace_dir, - autonomy: AutonomyConfig::default(), - security: SecurityConfig::default(), - reliability: ReliabilityConfig::default(), - secrets: SecretsConfig::default(), - audit: AuditConfig::default(), - } - } -} - -#[cfg(test)] -#[path = "daemon_tests.rs"] -mod tests; diff --git a/crates/openhuman-core/src/config/daemon_tests.rs b/crates/openhuman-core/src/config/daemon_tests.rs deleted file mode 100644 index 809bce6ee54..00000000000 --- a/crates/openhuman-core/src/config/daemon_tests.rs +++ /dev/null @@ -1,13 +0,0 @@ -use super::*; - -#[test] -fn daemon_config_from_app_data_dir() { - let app_data = std::path::PathBuf::from("/tmp/test-openhuman"); - let config = DaemonConfig::from_app_data_dir(&app_data); - - assert_eq!(config.data_dir, app_data.join("openhuman")); - assert_eq!( - config.workspace_dir, - app_data.join("openhuman").join("workspace") - ); -} diff --git a/crates/openhuman-core/src/config/mod.rs b/crates/openhuman-core/src/config/mod.rs index 840411b1f8b..c1831712e50 100644 --- a/crates/openhuman-core/src/config/mod.rs +++ b/crates/openhuman-core/src/config/mod.rs @@ -3,12 +3,10 @@ //! This module serves as the primary gateway for all configuration-related functionality. //! It re-exports types and functions from submodules to provide a unified API for: //! - Loading and saving user settings (`Config`). -//! - Managing the core daemon's lifecycle and options (`DaemonConfig`). //! - Defining the RPC surface for configuration management. //! - Handling the schema definitions for all agent and system settings. pub mod app_env; -pub mod daemon; pub mod enrichers; pub mod migrations; pub mod ops; @@ -20,8 +18,6 @@ pub(crate) mod user_scope; pub mod workspace; pub mod workspace_handle; -#[allow(unused_imports)] -pub use daemon::DaemonConfig; pub use enrichers::{ register_enricher, register_enricher_in, run_enrichers, unregister_enricher, ConfigEnricher, }; @@ -46,27 +42,27 @@ pub use schema::{ apply_runtime_proxy_to_builder, build_runtime_proxy_client, build_runtime_proxy_client_with_timeouts, device_time_zone, normalize_time_zone, output_language_directive, runtime_proxy_config, set_runtime_proxy_config, - Agent37RuntimeConfig, AgentConfig, AuditConfig, AutonomyConfig, BrowserComputerUseConfig, - BrowserConfig, BudgetAction, BudgetPeriod, BudgetPolicy, BudgetScope, CapabilityProviderConfig, + Agent37RuntimeConfig, AgentConfig, AuditConfig, AutonomyConfig, BrowserConfig, BudgetAction, + BudgetPeriod, BudgetPolicy, BudgetScope, CapabilityProviderConfig, CapabilityProviderTrustState, ChannelVoiceConfig, ChannelVoiceOverride, ChannelsConfig, CompactionSettings, CompactionStrategy, ComposioConfig, ComposioDirectBaseUrls, ComposioHostCredential, ComputerConfig, Config, ContextConfig, ContextSettings, CostConfig, - CronConfig, CurlConfig, DashboardConfig, DecisionModel, DiagramViewerConfig, DiscordConfig, - DockerRuntimeConfig, EmailConfig, EmbeddingRouteConfig, GitbooksConfig, HttpHeader, - HttpRequestConfig, IMessageConfig, IntegrationToggle, IntegrationsConfig, LarkConfig, - LegacySearchInputs, LinqConfig, LocalAiConfig, LocalJailConfig, McpAuthConfig, McpClientConfig, + CronConfig, CurlConfig, DashboardConfig, DecisionModel, DiscordConfig, DockerRuntimeConfig, + EmailConfig, EmbeddingRouteConfig, GitbooksConfig, HttpHeader, HttpRequestConfig, + IMessageConfig, IntegrationToggle, IntegrationsConfig, LarkConfig, LegacySearchInputs, + LinqConfig, LocalAiConfig, LocalJailConfig, McpAuthConfig, McpClientConfig, McpClientIdentityConfig, McpServerConfig, McpToolExposure, MemoryConfig, MemoryLayoutMode, ModelRouteConfig, MultimodalConfig, MultimodalFileConfig, ObservabilityConfig, OpenShellRuntimeConfig, OrchestratorModelConfig, PresentationMode, PrivacyConfig, PrivacyMode, - ProviderRoute, ProxyConfig, ProxyScope, ReliabilityConfig, ResourceLimitsConfig, RuntimeConfig, - SandboxBackend, SandboxConfig, SchedulerConfig, SchedulerGateConfig, SchedulerGateMode, - SearchConfig, SearchEngineCredentials, SearchHostCredential, SearchProviderSettings, - SearxngConfig, SecretsConfig, SecurityConfig, ShellConfig, SlackConfig, StreamMode, SttEngine, - TeamModelConfig, TelegramConfig, TokenjuiceConfig, UnknownKeyedSearchProvider, UpdateConfig, - UpdateRestartStrategy, VoiceServerConfig, WebSearchConfig, YuanbaoConfig, - MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, - SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, - SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, + ProviderRoute, ProxyConfig, ProxyScope, ReliabilityConfig, RuntimeConfig, SandboxBackend, + SandboxConfig, SchedulerConfig, SchedulerGateConfig, SchedulerGateMode, SearchConfig, + SearchEngineCredentials, SearchHostCredential, SearchProviderSettings, SearxngConfig, + SecretsConfig, ShellConfig, SlackConfig, StreamMode, SttEngine, TeamModelConfig, + TelegramConfig, TokenjuiceConfig, UnknownKeyedSearchProvider, UpdateConfig, + UpdateRestartStrategy, VoiceServerConfig, YuanbaoConfig, MANAGED_SEARCH_PROVIDERS, + SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, + SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, + SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, }; // Kept as a separate re-export (issue #4117) so the large alphabetized group // above stays byte-identical and rustfmt-stable. diff --git a/crates/openhuman-core/src/config/ops/loader/snapshot.rs b/crates/openhuman-core/src/config/ops/loader/snapshot.rs index c8868591d38..054d1eddf64 100644 --- a/crates/openhuman-core/src/config/ops/loader/snapshot.rs +++ b/crates/openhuman-core/src/config/ops/loader/snapshot.rs @@ -104,7 +104,6 @@ const DATA_KEYED_MAPS: &[&str] = &[ "/inbound_debounce/by_channel", "/memory/agents", "/memory/engines", - "/reliability/model_fallbacks", "/runtime/reasoning_effort_by_model", "/search/providers", "/search/roles", diff --git a/crates/openhuman-core/src/config/ops/loader_snapshot_secrets_tests.rs b/crates/openhuman-core/src/config/ops/loader_snapshot_secrets_tests.rs index a72e00d7cd0..91efd688c9a 100644 --- a/crates/openhuman-core/src/config/ops/loader_snapshot_secrets_tests.rs +++ b/crates/openhuman-core/src/config/ops/loader_snapshot_secrets_tests.rs @@ -98,7 +98,7 @@ fn config_with_every_secret() -> Config { } filled += 1; } - assert_eq!(filled, 38, "every sealed credential field must be set"); + assert_eq!(filled, 37, "every sealed credential field must be set"); config } diff --git a/crates/openhuman-core/src/config/schema/README.md b/crates/openhuman-core/src/config/schema/README.md index a9c22af3c34..3734e9a945a 100644 --- a/crates/openhuman-core/src/config/schema/README.md +++ b/crates/openhuman-core/src/config/schema/README.md @@ -20,12 +20,12 @@ is mounted as a submodule of [`load/dirs.rs`](./load/dirs.rs) via `#[path]`. | `[agent]`, `[orchestrator]`, `[teams.*]` | [`agent.rs`](./agent.rs) | `AgentConfig`, `OrchestratorModelConfig`, `TeamModelConfig` | | `[autonomy]` | [`autonomy.rs`](./autonomy.rs) | `AutonomyConfig`: feeds `security::SecurityPolicy` | | `[[capability_providers]]` | [`capability_providers.rs`](./capability_providers.rs) | `CapabilityProviderConfig` | -| `[channels_config]`, `[sandbox]` | [`channels.rs`](./channels.rs) | `ChannelsConfig` and per-provider configs re-exported from `tinychannels_bus`; `SandboxConfig`, `ResourceLimitsConfig`, `AuditConfig`, and `SecurityConfig` (only `DaemonConfig` embeds the last one) | +| `[channels_config]`, `[sandbox]` | [`channels.rs`](./channels.rs) | `ChannelsConfig` and per-provider configs re-exported from `tinychannels_bus`; `SandboxConfig` and `AuditConfig` | | `[claude_agent_sdk]` | [`claude_agent_sdk.rs`](./claude_agent_sdk.rs) | `ClaudeAgentSdkConfig` | | `[[cloud_providers]]`, `primary_cloud`, `*_provider` slugs | [`cloud_providers.rs`](./cloud_providers.rs) | `CloudProviderCreds`, `AuthStyle` | | `[context]` | TinyAgents `ContextConfig` re-exported by [`context.rs`](./context.rs); OpenHuman environment overlays remain in `load/env_overlay/context.rs` | `ContextConfig` | | `[cost]` | [`identity_cost.rs`](./identity_cost.rs) | `CostConfig`, `ModelPricing` | -| `[dashboard]` | [`dashboard.rs`](./dashboard.rs) | `DashboardConfig`, `DiagramViewerConfig`, `EventStreamConfig`, `ModelHealthConfig` | +| `[dashboard]` | [`dashboard.rs`](./dashboard.rs) | `DashboardConfig`, `EventStreamConfig`, `ModelHealthConfig` | | `[channel_voice]` | [`channel_voice.rs`](./channel_voice.rs) | `ChannelVoiceConfig`, `ChannelVoiceOverride`, `VoiceReplyMode` | | `[ephemeral_route]` | [`ephemeral_route.rs`](./ephemeral_route.rs) | `EphemeralRoute` | | `[cron]` | [`cron.rs`](./cron.rs) | `CronConfig` (`shell_timeout_secs`: shell-job timeout, default 120) | @@ -39,7 +39,7 @@ is mounted as a submodule of [`load/dirs.rs`](./load/dirs.rs) via `#[path]`. | `[observability]` | [`observability.rs`](./observability.rs) | `ObservabilityConfig`, `AgentTracingConfig` | | `[privacy]` | [`privacy.rs`](./privacy.rs) | `PrivacyConfig`, `PrivacyMode` | | `[prompt_screen]` | [`prompt_screen.rs`](./prompt_screen.rs) | `PromptScreenConfig`, `PromptScreenMode` (TinySecurity prompt screen; `off` is an explicit opt-out, default enforces and fails closed; `[security] mode = "off"` also turns it off) | -| `[security]` | [`security_mode.rs`](./security_mode.rs) | `SecurityModeConfig`, `SecurityMode` (whether TinySecurity-delegated checks run; `off` allows them and passes redaction through, default enforces and fails closed). Not the daemon's `SecurityConfig` in `security.rs` | +| `[security]` | [`security_mode.rs`](./security_mode.rs) | `SecurityModeConfig`, `SecurityMode` (whether TinySecurity-delegated checks run; `off` allows them and passes redaction through, default enforces and fails closed) | | `[proxy]` | [`proxy.rs`](./proxy.rs) | `ProxyConfig`, `ProxyScope`, plus `runtime_proxy_config()` / `set_runtime_proxy_config()` process-wide accessors | | `[[model_routes]]`, `[[embedding_routes]]` | [`routes.rs`](./routes.rs) | `ModelRouteConfig`, `EmbeddingRouteConfig` | | `[runtime]` (+ `[runtime.docker]`), `[shell]`, `[reliability]`, `[scheduler]` | [`runtime.rs`](./runtime.rs) | `RuntimeConfig`, `DockerRuntimeConfig`, `ShellConfig`, `ReliabilityConfig`, `SchedulerConfig` | @@ -56,13 +56,12 @@ is mounted as a submodule of [`load/dirs.rs`](./load/dirs.rs) via `#[path]`. | top-level `Config` and its scalar keys | `types.rs` (+ `types/config.rs`, `types/model_ids.rs`) | `Config`, `ModelRegistryEntry`, provider-neutral workload roles | | built-in defaults | [`defaults.rs`](./defaults.rs) | `impl Default for Config` and per-field `default_*` fns | -[`tools/mod.rs`](./tools/mod.rs) groups the tool-facing sections: `browser.rs` (`BrowserConfig`, -`BrowserComputerUseConfig`, and the `unattended_actions` allow-list with its -known names in `UNATTENDED_BROWSER_ACTIONS`), `http.rs` (`HttpRequestConfig`, `CurlConfig`), +[`tools/mod.rs`](./tools/mod.rs) groups the tool-facing sections: `browser.rs` (`BrowserConfig` and the +`unattended_actions` allow-list with its known names in `UNATTENDED_BROWSER_ACTIONS`), `http.rs` (`HttpRequestConfig`, `CurlConfig`), `integrations.rs` (`IntegrationsConfig`, `ComposioConfig`, `SecretsConfig`), `mcp.rs` (`McpServerConfig`, `McpClientConfig`, `GitbooksConfig`), `multimodal.rs` (`MultimodalConfig`, `MultimodalFileConfig`), `search.rs` -(`SearchConfig`, `WebSearchConfig`, `SearxngConfig`, `SeltzConfig`). +(`SearchConfig`, `SearxngConfig`, `SeltzConfig`). `SearchConfig` (schema version 2) holds `providers` (enabled + `managed` / `direct` route per provider), `roles` (ordered providers per capability role), `presentation`, limits, and direct keys; fresh installs default to managed Exa @@ -111,7 +110,7 @@ sandbox policy contract described under Workspace/identity helpers below. `resolve_runtime_config_dirs_with`). With no config file and the default config dir, it returns a pre-login in-memory `Config` without writing anything. -2. Read and parse `config.toml` (`parse_config_with_recovery`), recovering +2. Read and parse `config.toml` (`parse_config_boxed`), recovering from non-UTF-8 or unparsable content by renaming the file to `.corrupted[.]`, trying the `.bak` copy, and finally falling back to defaults with `recovered_from_corruption = true`. diff --git a/crates/openhuman-core/src/config/schema/agent.rs b/crates/openhuman-core/src/config/schema/agent.rs index 32de0cd49c5..aeda494ace1 100644 --- a/crates/openhuman-core/src/config/schema/agent.rs +++ b/crates/openhuman-core/src/config/schema/agent.rs @@ -244,14 +244,6 @@ pub struct AgentConfig { #[serde(default = "default_agent_timeout_secs")] pub agent_timeout_secs: u64, - /// **Retired, no effect.** Once mirrored each completed turn from the - /// `session_raw/*.jsonl` transcript into a second, file-shaped layout - /// (`{workspace}/tinyagents_store/{kv,journal}`). Sessions now live in the - /// storage backend and nothing is mirrored; the field is kept so existing - /// `config.toml` files still load. - #[serde(default = "default_session_dual_write")] - pub session_dual_write: bool, - /// **Retired, no effect.** Once compared a resumed session's transcript /// with its mirror in the file-shaped store and logged any divergence /// (`[session_shadow_read]`). The mirror is gone with the dual-write; the @@ -383,10 +375,6 @@ fn default_agents_md_enabled() -> bool { true } -fn default_session_dual_write() -> bool { - true -} - fn default_session_shadow_reads() -> bool { // ON for the Phase 2 parity soak. Observation-only: the legacy read stays // authoritative and the probe runs on a background task, so the worst case @@ -495,7 +483,6 @@ impl Default for AgentConfig { channel_agents: std::collections::HashMap::new(), tool_result_budget_bytes: default_tool_result_budget_bytes(), agent_timeout_secs: default_agent_timeout_secs(), - session_dual_write: default_session_dual_write(), session_shadow_reads: default_session_shadow_reads(), required_output: None, agents_md_enabled: default_agents_md_enabled(), diff --git a/crates/openhuman-core/src/config/schema/dashboard.rs b/crates/openhuman-core/src/config/schema/dashboard.rs index 3297d07f80e..46c99d2949b 100644 --- a/crates/openhuman-core/src/config/schema/dashboard.rs +++ b/crates/openhuman-core/src/config/schema/dashboard.rs @@ -3,18 +3,6 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -fn default_diagram_viewer_enabled() -> bool { - true -} - -fn default_diagram_viewer_source_url() -> String { - "http://localhost:8787/workspace/diagrams/latest.png".to_string() -} - -fn default_diagram_viewer_refresh_interval_seconds() -> u64 { - 10 -} - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[serde(default)] #[derive(Default)] @@ -23,8 +11,6 @@ pub struct DashboardConfig { pub event_stream: EventStreamConfig, #[serde(default)] pub model_health: ModelHealthConfig, - #[serde(default)] - pub diagram_viewer: DiagramViewerConfig, } #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] @@ -100,27 +86,6 @@ impl Default for ModelHealthConfig { } } -#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] -#[serde(default)] -pub struct DiagramViewerConfig { - #[serde(default = "default_diagram_viewer_enabled")] - pub enabled: bool, - #[serde(default = "default_diagram_viewer_source_url")] - pub source_url: String, - #[serde(default = "default_diagram_viewer_refresh_interval_seconds")] - pub refresh_interval_seconds: u64, -} - -impl Default for DiagramViewerConfig { - fn default() -> Self { - Self { - enabled: default_diagram_viewer_enabled(), - source_url: default_diagram_viewer_source_url(), - refresh_interval_seconds: default_diagram_viewer_refresh_interval_seconds(), - } - } -} - #[cfg(test)] #[path = "dashboard_tests.rs"] mod tests; diff --git a/crates/openhuman-core/src/config/schema/dashboard_tests.rs b/crates/openhuman-core/src/config/schema/dashboard_tests.rs index 276d35d20ac..dd6f84d148f 100644 --- a/crates/openhuman-core/src/config/schema/dashboard_tests.rs +++ b/crates/openhuman-core/src/config/schema/dashboard_tests.rs @@ -27,32 +27,6 @@ fn deserialize_custom_values() { assert_eq!(cfg.event_stream.new_entries, "bottom"); } -#[test] -fn dashboard_config_defaults_enable_local_diagram_viewer() { - let config = DashboardConfig::default(); - - assert!(config.diagram_viewer.enabled); - assert_eq!( - config.diagram_viewer.source_url, - "http://localhost:8787/workspace/diagrams/latest.png" - ); - assert_eq!(config.diagram_viewer.refresh_interval_seconds, 10); -} - -#[test] -fn diagram_viewer_partial_toml_uses_missing_defaults() { - let config: DashboardConfig = - toml::from_str("[diagram_viewer]\nsource_url = \"http://localhost:9000/latest.svg\"") - .expect("dashboard config should deserialize"); - - assert!(config.diagram_viewer.enabled); - assert_eq!( - config.diagram_viewer.source_url, - "http://localhost:9000/latest.svg" - ); - assert_eq!(config.diagram_viewer.refresh_interval_seconds, 10); -} - #[test] fn model_health_defaults_match_spec() { let mh = ModelHealthConfig::default(); diff --git a/crates/openhuman-core/src/config/schema/load/config_file_read.rs b/crates/openhuman-core/src/config/schema/load/config_file_read.rs index 7999691299e..ff19df1bdb8 100644 --- a/crates/openhuman-core/src/config/schema/load/config_file_read.rs +++ b/crates/openhuman-core/src/config/schema/load/config_file_read.rs @@ -6,6 +6,8 @@ use super::super::Config; use super::branches::default_config_boxed; use super::{ConfigLoadFallback, ConfigParseError}; +/// Unboxed [`parse_config_boxed`], for the recovery tests. +#[cfg(test)] pub(crate) async fn parse_config_with_recovery( config_path: &Path, contents: &str, @@ -14,7 +16,7 @@ pub(crate) async fn parse_config_with_recovery( (*config, recovered) } -/// [`parse_config_with_recovery`] with the config kept behind a `Box`, so the +/// Parses `config.toml` with recovery, keeping the config behind a `Box` so the /// async chain that threads it through (load, recover, migrate, save) moves a /// pointer instead of an ~8 KB value per hop. pub(super) async fn parse_config_boxed(config_path: &Path, contents: &str) -> (Box, bool) { diff --git a/crates/openhuman-core/src/config/schema/load/dirs.rs b/crates/openhuman-core/src/config/schema/load/dirs.rs index c95b98ffd83..49385b13ade 100644 --- a/crates/openhuman-core/src/config/schema/load/dirs.rs +++ b/crates/openhuman-core/src/config/schema/load/dirs.rs @@ -417,9 +417,7 @@ pub(crate) async fn resolve_runtime_config_dirs_with( } /// Same as [`resolve_runtime_config_dirs`] but skips the -/// `OPENHUMAN_WORKSPACE` env var override. Used by -/// [`Config::load_from_default_paths`] so callers can reliably load -/// the real user config without mutating the process environment. +/// `OPENHUMAN_WORKSPACE` env var override. pub(super) async fn resolve_config_dirs_ignoring_env( default_openhuman_dir: &Path, default_workspace_dir: &Path, diff --git a/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs b/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs index 5311c58cef5..7f7571c4651 100644 --- a/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs +++ b/crates/openhuman-core/src/config/schema/load/env_overlay/search.rs @@ -470,37 +470,17 @@ impl Config { ); } - if let Some(max_results) = - env.get_any(&["OPENHUMAN_WEB_SEARCH_MAX_RESULTS", "WEB_SEARCH_MAX_RESULTS"]) - { - if let Ok(max_results) = max_results.parse::() { - if (1..=10).contains(&max_results) { - self.web_search.max_results = max_results; - self.record_env_override( - env, - "web_search.max_results", - &["OPENHUMAN_WEB_SEARCH_MAX_RESULTS", "WEB_SEARCH_MAX_RESULTS"], - ); - } - } - } - - if let Some(timeout_secs) = env.get_any(&[ + for retired in [ + "OPENHUMAN_WEB_SEARCH_MAX_RESULTS", + "WEB_SEARCH_MAX_RESULTS", "OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", "WEB_SEARCH_TIMEOUT_SECS", - ]) { - if let Ok(timeout_secs) = timeout_secs.parse::() { - if timeout_secs > 0 { - self.web_search.timeout_secs = timeout_secs; - self.record_env_override( - env, - "web_search.timeout_secs", - &[ - "OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", - "WEB_SEARCH_TIMEOUT_SECS", - ], - ); - } + ] { + if env.contains(retired) { + log::warn!( + "[config] {retired} is deprecated and ignored; use \ + OPENHUMAN_SEARCH_MAX_RESULTS / OPENHUMAN_SEARCH_TIMEOUT_SECS." + ); } } } diff --git a/crates/openhuman-core/src/config/schema/load/impl_load.rs b/crates/openhuman-core/src/config/schema/load/impl_load.rs index 88bbf576afa..4afeac241b2 100644 --- a/crates/openhuman-core/src/config/schema/load/impl_load.rs +++ b/crates/openhuman-core/src/config/schema/load/impl_load.rs @@ -3,12 +3,10 @@ use super::branches::pre_login_config_boxed; use super::context_refresh::is_document_conflict; use super::dirs::{ default_action_dir, default_config_and_workspace_dirs, resolve_action_dir, - resolve_config_dirs_ignoring_env, resolve_runtime_config_dirs_with, ConfigResolutionSource, + resolve_runtime_config_dirs_with, ConfigResolutionSource, }; use super::env::{EnvLookup, NoEnv, ProcessEnv, ProcessEnvWithoutWorkspace}; -use super::migrate::{ - apply_loaded_config_migrations, migrate_components, migrate_legacy_memory_backend, -}; +use super::migrate::apply_loaded_config_migrations; use super::secrets::{ decrypt_config_secrets, decrypt_config_secrets_strict, encrypt_config_secrets, }; @@ -17,6 +15,7 @@ use std::path::Path; use std::sync::{Mutex, OnceLock}; use tokio::fs; +#[cfg(test)] pub(crate) use super::config_file_read::parse_config_with_recovery; pub(crate) use super::config_file_read::CONFIG_OWNER_MISMATCH_MARKER; pub(super) use super::config_file_read::{ @@ -275,57 +274,6 @@ impl Config { } } - /// Load config from the default user paths, bypassing the - /// `OPENHUMAN_WORKSPACE` environment variable. - /// - /// This is used by the debug dump to load the real user config - /// for auth token resolution when the dump script overrides - /// `OPENHUMAN_WORKSPACE` to a throwaway temp directory. - pub async fn load_from_default_paths() -> Result { - Self::load_from_default_paths_unenriched() - .await - .map(crate::config::enrichers::enriched) - } - - async fn load_from_default_paths_unenriched() -> Result { - let (default_openhuman_dir, default_workspace_dir) = default_config_and_workspace_dirs()?; - let (openhuman_dir, workspace_dir, _source) = - resolve_config_dirs_ignoring_env(&default_openhuman_dir, &default_workspace_dir) - .await?; - let config_path = openhuman_dir.join("config.toml"); - - if !config_path.exists() { - let mut config = Config { - config_path, - workspace_dir, - action_dir: default_action_dir(), - ..Default::default() - }; - config.apply_env_overrides(); - return Ok(config); - } - - // NOTE: no backup recovery here by design -- this is the debug-dump path only; - // `load_or_init()` is the authoritative startup path that handles corruption. - // However, we still use `read_config_with_recovery_or_default` to handle the - // non-UTF-8 case: a corrupted file is renamed to `.corrupted.` so the next - // authoritative load can create a fresh config. - let (raw, _read_was_recovered) = - Box::pin(read_config_with_recovery_or_default(&config_path)).await?; - let (mut config, _was_corrupted) = parse_config_with_recovery(&config_path, &raw).await; - config.config_path = config_path.clone(); - config.workspace_dir = workspace_dir; - config.action_dir = resolve_action_dir(&config.action_dir_override); - let migration_raw = migration_source(&config_path, &raw).await; - migrate_legacy_memory_backend(&mut config, &migration_raw); - migrate_components(&mut config, &migration_raw); - config.apply_env_overrides(); - // Debug-dump path is read-only; ignore the migration signal (the - // authoritative `load_or_init` path persists upgraded secrets). - let _ = decrypt_config_secrets(&mut config, &openhuman_dir).await?; - Ok(config) - } - /// Reload a config from an already-resolved `config.toml` path. /// /// This is for long-lived runtime objects that hold a `Config` diff --git a/crates/openhuman-core/src/config/schema/load/migrate.rs b/crates/openhuman-core/src/config/schema/load/migrate.rs index 88bde268951..5a24cf8727d 100644 --- a/crates/openhuman-core/src/config/schema/load/migrate.rs +++ b/crates/openhuman-core/src/config/schema/load/migrate.rs @@ -34,7 +34,7 @@ pub(crate) fn migrate_legacy_inference_url(config: &mut Config) { }; let logged = match moved.as_deref() { None => "".to_string(), - Some(u) => super::redact_url_for_log(u), + Some(u) => crate::util::redact_url_for_log(u), }; tracing::info!( "[config][migrate] splitting legacy api_url -> inference_url (api_url cleared, inference_url={})", @@ -45,32 +45,6 @@ pub(crate) fn migrate_legacy_inference_url(config: &mut Config) { config.load_diagnostics_mut().record_migrated_key("api_url"); } -/// Strip userinfo (basic-auth) and query string from a URL string for log -/// emission. Falls back to a coarse `/...` form when parsing fails so -/// we never leak the raw input. Public only so the migration's unit test -/// can assert the behaviour. -pub fn redact_url_for_log(raw: &str) -> String { - if let Ok(mut url) = url::Url::parse(raw) { - let _ = url.set_username(""); - let _ = url.set_password(None); - url.set_query(None); - url.set_fragment(None); - return url.to_string(); - } - let truncated = raw - .split(['?', '#']) - .next() - .unwrap_or(raw) - .trim_end_matches('/'); - if let Some((scheme, rest)) = truncated.split_once("://") { - if let Some((_, host_path)) = rest.split_once('@') { - return format!("{scheme}://***@{host_path}"); - } - return format!("{scheme}://{rest}"); - } - "".to_string() -} - /// Migrate `cloud_providers` entries to the new slug-keyed shape and rewrite /// any per-workload routing strings that still use the old bare-prefix grammar. /// diff --git a/crates/openhuman-core/src/config/schema/load/mod.rs b/crates/openhuman-core/src/config/schema/load/mod.rs index e737664c7bf..747a83f1e32 100644 --- a/crates/openhuman-core/src/config/schema/load/mod.rs +++ b/crates/openhuman-core/src/config/schema/load/mod.rs @@ -35,10 +35,6 @@ pub use dirs::{ PRE_LOGIN_USER_ID, }; -// redact_url_for_log is pub(super) for the schema module; tests inside load -// can access it because they are a submodule and use `use super::*`. -pub(super) use migrate::redact_url_for_log; - // The wire contract between the config loader (which appends the marker to a // read failure) and `core::observability::expected_error_kind` (which keys on // it to keep an ownership mismatch paging instead of demoting it as diff --git a/crates/openhuman-core/src/config/schema/load/secrets.rs b/crates/openhuman-core/src/config/schema/load/secrets.rs index 5bc221685ad..ff701bb0345 100644 --- a/crates/openhuman-core/src/config/schema/load/secrets.rs +++ b/crates/openhuman-core/src/config/schema/load/secrets.rs @@ -193,7 +193,6 @@ pub(crate) fn secret_slots(config: &mut Config) -> Vec<(String, SecretSlot<'_>)> let integrations = &mut config.integrations; for (name, toggle) in [ ("google_places", &mut integrations.google_places), - ("parallel", &mut integrations.parallel), ("tinyfish", &mut integrations.tinyfish), ("stock_prices", &mut integrations.stock_prices), ] { diff --git a/crates/openhuman-core/src/config/schema/load_active_user_and_dirs_tests.rs b/crates/openhuman-core/src/config/schema/load_active_user_and_dirs_tests.rs index 6585f551960..84acfd3e948 100644 --- a/crates/openhuman-core/src/config/schema/load_active_user_and_dirs_tests.rs +++ b/crates/openhuman-core/src/config/schema/load_active_user_and_dirs_tests.rs @@ -336,68 +336,6 @@ fn classify_shell_hide_window_distinguishes_unset_from_unrecognized() { assert_eq!(classify_shell_hide_window("2"), P::Unrecognized); } -#[test] -fn apply_env_overrides_web_search_limits_only() { - let _g = env_lock(); - clear_env(&[ - "OPENHUMAN_WEB_SEARCH_MAX_RESULTS", - "WEB_SEARCH_MAX_RESULTS", - "OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", - "WEB_SEARCH_TIMEOUT_SECS", - ]); - let mut cfg = Config::default(); - unsafe { - std::env::set_var("OPENHUMAN_WEB_SEARCH_MAX_RESULTS", "5"); - std::env::set_var("OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", "20"); - } - cfg.apply_env_overrides(); - assert_eq!(cfg.web_search.max_results, 5); - assert_eq!(cfg.web_search.timeout_secs, 20); - clear_env(&[ - "OPENHUMAN_WEB_SEARCH_MAX_RESULTS", - "OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", - ]); -} - -#[test] -fn apply_env_overrides_web_search_max_results_and_timeout_clamped() { - let _g = env_lock(); - clear_env(&[ - "OPENHUMAN_WEB_SEARCH_MAX_RESULTS", - "WEB_SEARCH_MAX_RESULTS", - "OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", - "WEB_SEARCH_TIMEOUT_SECS", - ]); - let mut cfg = Config::default(); - cfg.web_search.max_results = 3; - cfg.web_search.timeout_secs = 10; - - // Valid values apply. - unsafe { - std::env::set_var("OPENHUMAN_WEB_SEARCH_MAX_RESULTS", "5"); - std::env::set_var("OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", "20"); - } - cfg.apply_env_overrides(); - assert_eq!(cfg.web_search.max_results, 5); - assert_eq!(cfg.web_search.timeout_secs, 20); - - // Out-of-range (>10 for max_results, 0 for timeout) — ignored. - unsafe { - std::env::set_var("OPENHUMAN_WEB_SEARCH_MAX_RESULTS", "999"); - std::env::set_var("OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", "0"); - } - cfg.apply_env_overrides(); - assert_eq!( - cfg.web_search.max_results, 5, - "out-of-range must be ignored" - ); - assert_eq!(cfg.web_search.timeout_secs, 20); - clear_env(&[ - "OPENHUMAN_WEB_SEARCH_MAX_RESULTS", - "OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", - ]); -} - #[test] fn apply_env_overrides_searxng_config() { let _g = env_lock(); diff --git a/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs b/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs index dd25f96f82e..24b3426dff0 100644 --- a/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs +++ b/crates/openhuman-core/src/config/schema/load_env_overlay_tests.rs @@ -196,38 +196,6 @@ fn env_overlay_reasoning_enabled_recognises_truthy_falsy_and_ignores_garbage() { assert_eq!(cfg.runtime.reasoning_enabled, Some(true)); } -#[test] -fn env_overlay_web_search_limits_validated() { - let mut cfg = Config::default(); - cfg.web_search.max_results = 3; - cfg.web_search.timeout_secs = 10; - - // Valid values apply. - cfg.apply_env_overlay_with( - &HashMapEnv::new() - .with("OPENHUMAN_WEB_SEARCH_MAX_RESULTS", "7") - .with("OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", "25"), - ); - assert_eq!(cfg.web_search.max_results, 7); - assert_eq!(cfg.web_search.timeout_secs, 25); - - // Out-of-range — ignored. - cfg.apply_env_overlay_with( - &HashMapEnv::new() - .with("OPENHUMAN_WEB_SEARCH_MAX_RESULTS", "0") - .with("OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", "0"), - ); - assert_eq!(cfg.web_search.max_results, 7); - assert_eq!(cfg.web_search.timeout_secs, 25); - - cfg.apply_env_overlay_with(&HashMapEnv::new().with("OPENHUMAN_WEB_SEARCH_MAX_RESULTS", "11")); - assert_eq!(cfg.web_search.max_results, 7); - - // Bare aliases also accepted when the OPENHUMAN-prefixed variant is absent. - cfg.apply_env_overlay_with(&HashMapEnv::new().with("WEB_SEARCH_MAX_RESULTS", "4")); - assert_eq!(cfg.web_search.max_results, 4); -} - #[test] fn env_overlay_tavily_api_key_supports_alias_precedence_and_ignores_blank_values() { let mut cfg = Config::default(); @@ -568,6 +536,7 @@ tts_config_download_url = "https://example.invalid/voice.onnx.json" assert_eq!(cfg.local_ai.embedding_model_id, "bge-m3"); let saved = toml::to_string(&cfg).expect("updated config serializes"); for retired in [ + "selected_tier", "quantization", "preload_vision_model", "preload_embedding_model", diff --git a/crates/openhuman-core/src/config/schema/load_migration_tests.rs b/crates/openhuman-core/src/config/schema/load_migration_tests.rs index 175fe70089d..83a982d94b8 100644 --- a/crates/openhuman-core/src/config/schema/load_migration_tests.rs +++ b/crates/openhuman-core/src/config/schema/load_migration_tests.rs @@ -305,35 +305,6 @@ backend = "sqlite" assert!(reason.contains("legacy memory backend")); } -#[test] -fn redact_url_strips_basic_auth_and_query() { - let out = redact_url_for_log( - "https://user:token@api.example.com/v1/chat/completions?api_key=sk-x&debug=1", - ); - assert!(!out.contains("token"), "got: {out}"); - assert!(!out.contains("sk-x"), "got: {out}"); - assert!(out.starts_with("https://api.example.com"), "got: {out}"); -} - -#[test] -fn redact_url_handles_plain_url() { - let out = redact_url_for_log("https://api.openai.com/v1/chat/completions"); - assert_eq!(out, "https://api.openai.com/v1/chat/completions"); -} - -#[test] -fn redact_url_strips_query_and_fragment() { - let out = redact_url_for_log("https://api.example/v1?token=secret#fragment"); - assert_eq!(out, "https://api.example/v1"); -} - -#[test] -fn redact_url_fallback_masks_userinfo_when_unparseable() { - let out = redact_url_for_log("not-a-scheme://user:secret@host/path?token=1"); - assert!(!out.contains("secret"), "got: {out}"); - assert!(!out.contains("token=1"), "got: {out}"); -} - #[test] fn migrate_legacy_inference_url_moves_external_chat_completions() { let mut cfg = Config::default(); diff --git a/crates/openhuman-core/src/config/schema/load_retired_keys_compat_tests.rs b/crates/openhuman-core/src/config/schema/load_retired_keys_compat_tests.rs new file mode 100644 index 00000000000..361b1fdd7b5 --- /dev/null +++ b/crates/openhuman-core/src/config/schema/load_retired_keys_compat_tests.rs @@ -0,0 +1,150 @@ +//! A `config.toml` written by an older build still carries settings that no +//! longer exist (issue #329). Unknown keys are ignored, not rejected: such a +//! file must load, keep every setting that still exists, and save cleanly. + +use super::*; + +/// Every retired key, each next to a setting that still exists so the test +/// can tell "ignored" apart from "the whole section was dropped". +const OLD_CONFIG: &str = r#" +[reliability] +provider_backoff_ms = 777 +fallback_providers = ["legacy-provider"] +provider_retries = 9 +model_fallbacks = { "acme/model" = ["acme/backup"] } + +[agent] +agent_timeout_secs = 321 +session_dual_write = false + +[local_ai] +autosummary_debounce_ms = 4321 +selected_tier = "ram_2_4gb" + +[browser] +enabled = true +session_name = "legacy-session" +native_headless = false +native_webdriver_url = "http://127.0.0.1:9999" +native_chrome_path = "/opt/chrome" + +[browser.computer_use] +endpoint = "http://127.0.0.1:8787/v1/actions" +timeout_ms = 1000 +allow_remote_endpoint = true +window_allowlist = ["Terminal"] + +[dashboard.event_stream] +max_entries = 42 + +[dashboard.diagram_viewer] +enabled = false +source_url = "http://localhost:1/x.png" +refresh_interval_seconds = 99 + +[security.resources] + +[web_search] +max_results = 7 +timeout_secs = 20 + +[integrations.google_places] +enabled = false + +[integrations.tinyfish] +enabled = false + +[integrations.parallel] +enabled = false +mode = "byo" +api_key = "enc2:00000000000000000000000000000000000000000000000000000000000000000000" +"#; + +/// Dotted paths of the retired keys in [`OLD_CONFIG`]. +const RETIRED_KEYS: &[&str] = &[ + "reliability.provider_retries", + "reliability.model_fallbacks", + "agent.session_dual_write", + "local_ai.selected_tier", + "browser.native_headless", + "browser.native_webdriver_url", + "browser.native_chrome_path", + "browser.computer_use", + "dashboard.diagram_viewer", + "security.resources", + "web_search", + "integrations.parallel", +]; + +/// Loads, keeps every setting that still exists, saves, and loads again. +#[tokio::test] +async fn old_config_with_retired_keys_loads_and_saves_cleanly() { + let tmp = tempfile::tempdir().unwrap(); + std::fs::write(tmp.path().join("config.toml"), OLD_CONFIG).unwrap(); + + let config = load_or_init_for_workspace(tmp.path()).await; + assert_retained(&config); + config.save().await.unwrap(); + + let reloaded = load_or_init_for_workspace(tmp.path()).await; + assert_retained(&reloaded); +} + +/// The retired keys are ignored on load (recorded as unknown, never +/// decrypted, so a sealed value under one cannot fail the load) and are gone +/// from the saved file. +#[tokio::test] +async fn retired_keys_are_ignored_on_load_and_dropped_on_save() { + let tmp = tempfile::tempdir().unwrap(); + let config_path = tmp.path().join("config.toml"); + std::fs::write(&config_path, OLD_CONFIG).unwrap(); + + let config = load_or_init_for_workspace(tmp.path()).await; + let unknown = &config.load_diagnostics().unknown_keys; + for retired in RETIRED_KEYS { + assert!( + unknown.iter().any(|key| key.starts_with(retired)), + "{retired} should be recorded as an ignored key, got {unknown:?}" + ); + } + + config.save().await.unwrap(); + let saved = std::fs::read_to_string(&config_path).unwrap(); + let document: toml::Value = toml::from_str(&saved).unwrap(); + for retired in RETIRED_KEYS { + let mut node = Some(&document); + for part in retired.split('.') { + node = node.and_then(|value| value.get(part)); + } + assert!( + node.is_none(), + "retired {retired} survived config save:\n{saved}" + ); + } + assert!( + !saved.contains("enc2:0000"), + "the sealed value under a retired key must be dropped, not kept:\n{saved}" + ); + + let reloaded = load_or_init_for_workspace(tmp.path()).await; + assert!( + reloaded.load_diagnostics().unknown_keys.is_empty(), + "a saved config must not carry unknown keys: {:?}", + reloaded.load_diagnostics().unknown_keys + ); +} + +fn assert_retained(config: &Config) { + assert_eq!(config.reliability.provider_backoff_ms, 777); + assert_eq!(config.reliability.fallback_providers, ["legacy-provider"]); + assert_eq!(config.agent.agent_timeout_secs, 321); + assert_eq!(config.local_ai.autosummary_debounce_ms, 4321); + assert!(config.browser.enabled); + assert_eq!( + config.browser.session_name.as_deref(), + Some("legacy-session") + ); + assert_eq!(config.dashboard.event_stream.max_entries, 42); + assert!(!config.integrations.google_places.enabled); + assert!(!config.integrations.tinyfish.enabled); +} diff --git a/crates/openhuman-core/src/config/schema/load_tests.rs b/crates/openhuman-core/src/config/schema/load_tests.rs index 2ea07f507ed..eb2ac7b39db 100644 --- a/crates/openhuman-core/src/config/schema/load_tests.rs +++ b/crates/openhuman-core/src/config/schema/load_tests.rs @@ -156,3 +156,5 @@ mod profile_layout_parity_tests; #[path = "load_managed_provider_tests.rs"] mod managed_provider_tests; +#[path = "load_retired_keys_compat_tests.rs"] +mod retired_keys_compat_tests; diff --git a/crates/openhuman-core/src/config/schema/local_ai.rs b/crates/openhuman-core/src/config/schema/local_ai.rs index 411b1296226..26e0b7ae6d7 100644 --- a/crates/openhuman-core/src/config/schema/local_ai.rs +++ b/crates/openhuman-core/src/config/schema/local_ai.rs @@ -69,10 +69,8 @@ pub struct LocalAiConfig { pub tts_provider: String, #[serde(default = "default_autosummary_debounce_ms")] pub autosummary_debounce_ms: u64, - #[serde(default)] - pub selected_tier: Option, /// Explicit MVP opt-in marker. Bootstrap disables local AI unless this is - /// `true`, regardless of any prior `selected_tier` value. Existing installs + /// `true`, regardless of any prior tier selection. Existing installs /// (upgrading from pre-MVP) default to `false` and must re-opt-in from /// Settings. Set by `apply_preset` on any non-disabled tier. #[serde(default)] @@ -123,7 +121,6 @@ impl std::fmt::Debug for LocalAiConfig { .field("tts_voice_id", &self.tts_voice_id) .field("tts_provider", &self.tts_provider) .field("autosummary_debounce_ms", &self.autosummary_debounce_ms) - .field("selected_tier", &self.selected_tier) .field("opt_in_confirmed", &self.opt_in_confirmed) .field("ollama_binary_path", &self.ollama_binary_path) .field("voice_llm_cleanup_enabled", &self.voice_llm_cleanup_enabled) @@ -208,7 +205,6 @@ impl Default for LocalAiConfig { tts_voice_id: default_tts_voice_id(), tts_provider: default_tts_provider(), autosummary_debounce_ms: default_autosummary_debounce_ms(), - selected_tier: None, opt_in_confirmed: false, ollama_binary_path: None, voice_llm_cleanup_enabled: default_voice_llm_cleanup_enabled(), diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rs index ccaba1c03d4..e9f2a6c9ee0 100644 --- a/crates/openhuman-core/src/config/schema/mod.rs +++ b/crates/openhuman-core/src/config/schema/mod.rs @@ -129,7 +129,7 @@ pub use context::{ ReasoningReplay, SummarizerSettings, }; pub use cron::CronConfig; -pub use dashboard::{DashboardConfig, DiagramViewerConfig, EventStreamConfig, ModelHealthConfig}; +pub use dashboard::{DashboardConfig, EventStreamConfig, ModelHealthConfig}; pub use identity_cost::{ BudgetAction, BudgetPeriod, BudgetPolicy, BudgetScope, CostConfig, ModelPricing, }; @@ -160,9 +160,7 @@ pub use runtime_agent37::{Agent37RuntimeConfig, DEFAULT_AGENT37_TEMPLATE}; pub use runtime_local_jail::LocalJailConfig; pub use runtime_openshell::{OpenShellRuntimeConfig, DEFAULT_OPENSHELL_IMAGE}; pub use scheduler_gate::{PauseReason, Policy, SchedulerGateConfig, SchedulerGateMode}; -pub use security::{ - AuditConfig, ResourceLimitsConfig, SandboxBackend, SandboxConfig, SecurityConfig, -}; +pub use security::{AuditConfig, SandboxBackend, SandboxConfig}; pub use security_mode::{ JudgeMode, SecurityJudgeDialect, SecurityJudgeRoute, SecurityMode, SecurityModeConfig, }; @@ -174,17 +172,16 @@ pub use tinychannels_bus::config::{ }; pub use tokenjuice::TokenjuiceConfig; pub use tools::{ - BrowserComputerUseConfig, BrowserConfig, ComposioConfig, ComposioDirectBaseUrls, - ComposioHostCredential, CurlConfig, GitbooksConfig, HttpHeader, HttpRequestConfig, - IntegrationToggle, IntegrationsConfig, LegacySearchInputs, McpAuthConfig, McpClientConfig, - McpClientIdentityConfig, McpServerConfig, McpToolExposure, MultimodalConfig, - MultimodalFileConfig, PresentationMode, ProviderRoute, SearchConfig, SearchEngineCredentials, - SearchHostCredential, SearchProviderSettings, SearxngConfig, SecretsConfig, SeltzConfig, - UnknownKeyedSearchProvider, WebSearchConfig, COMPOSIO_MODE_BACKEND, COMPOSIO_MODE_DIRECT, - COMPOSIO_MODE_DISABLED, MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, - SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, - SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, - SEARCH_ROLE_SEARCH, + BrowserConfig, ComposioConfig, ComposioDirectBaseUrls, ComposioHostCredential, CurlConfig, + GitbooksConfig, HttpHeader, HttpRequestConfig, IntegrationToggle, IntegrationsConfig, + LegacySearchInputs, McpAuthConfig, McpClientConfig, McpClientIdentityConfig, McpServerConfig, + McpToolExposure, MultimodalConfig, MultimodalFileConfig, PresentationMode, ProviderRoute, + SearchConfig, SearchEngineCredentials, SearchHostCredential, SearchProviderSettings, + SearxngConfig, SecretsConfig, SeltzConfig, UnknownKeyedSearchProvider, COMPOSIO_MODE_BACKEND, + COMPOSIO_MODE_DIRECT, COMPOSIO_MODE_DISABLED, MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE, + SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, + SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, + SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, }; pub use update::{UpdateConfig, UpdateRestartStrategy}; pub use web_chat_config::WebChatConfig; diff --git a/crates/openhuman-core/src/config/schema/runtime.rs b/crates/openhuman-core/src/config/schema/runtime.rs index 79046f8e5ca..f0076eeb0ab 100644 --- a/crates/openhuman-core/src/config/schema/runtime.rs +++ b/crates/openhuman-core/src/config/schema/runtime.rs @@ -3,7 +3,7 @@ use super::defaults; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use std::collections::{BTreeMap, HashMap}; +use std::collections::BTreeMap; #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[serde(default)] @@ -125,14 +125,10 @@ impl Default for RuntimeConfig { #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[serde(default)] pub struct ReliabilityConfig { - #[serde(default = "default_provider_retries")] - pub provider_retries: u32, #[serde(default = "default_provider_backoff_ms")] pub provider_backoff_ms: u64, #[serde(default)] pub fallback_providers: Vec, - #[serde(default)] - pub model_fallbacks: HashMap>, #[serde(default = "default_channel_backoff_secs")] pub channel_initial_backoff_secs: u64, #[serde(default = "default_channel_backoff_max_secs")] @@ -143,10 +139,6 @@ pub struct ReliabilityConfig { pub scheduler_retries: u32, } -fn default_provider_retries() -> u32 { - 2 -} - fn default_provider_backoff_ms() -> u64 { 500 } @@ -170,10 +162,8 @@ fn default_scheduler_retries() -> u32 { impl Default for ReliabilityConfig { fn default() -> Self { Self { - provider_retries: default_provider_retries(), provider_backoff_ms: default_provider_backoff_ms(), fallback_providers: Vec::new(), - model_fallbacks: HashMap::new(), channel_initial_backoff_secs: default_channel_backoff_secs(), channel_max_backoff_secs: default_channel_backoff_max_secs(), scheduler_poll_secs: default_scheduler_poll_secs(), diff --git a/crates/openhuman-core/src/config/schema/security.rs b/crates/openhuman-core/src/config/schema/security.rs index b4f894b3bb3..ff9dd611841 100644 --- a/crates/openhuman-core/src/config/schema/security.rs +++ b/crates/openhuman-core/src/config/schema/security.rs @@ -3,16 +3,6 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)] -pub struct SecurityConfig { - #[serde(default)] - pub sandbox: SandboxConfig, - #[serde(default)] - pub resources: ResourceLimitsConfig, - #[serde(default)] - pub audit: AuditConfig, -} - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[serde(default)] pub struct SandboxConfig { @@ -55,10 +45,6 @@ pub enum SandboxBackend { None, } -#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)] -#[serde(default)] -pub struct ResourceLimitsConfig {} - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[serde(default)] pub struct AuditConfig { diff --git a/crates/openhuman-core/src/config/schema/security_mode.rs b/crates/openhuman-core/src/config/schema/security_mode.rs index 07039b4b318..311cb0f9b66 100644 --- a/crates/openhuman-core/src/config/schema/security_mode.rs +++ b/crates/openhuman-core/src/config/schema/security_mode.rs @@ -10,9 +10,6 @@ //! redaction passes content through unchanged. A build without the //! `security-module` feature behaves as `off` whatever this says, because there //! is no module to ask (`crate::security::switch`). -//! -//! This is not the daemon's [`SecurityConfig`](super::SecurityConfig), which -//! configures sandboxing, resource limits and the audit sink. use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/crates/openhuman-core/src/config/schema/security_tests.rs b/crates/openhuman-core/src/config/schema/security_tests.rs index 1b059b204a9..47e47bfab8b 100644 --- a/crates/openhuman-core/src/config/schema/security_tests.rs +++ b/crates/openhuman-core/src/config/schema/security_tests.rs @@ -1,11 +1,11 @@ use super::*; #[test] -fn security_config_defaults() { - let sec = SecurityConfig::default(); - assert!(sec.audit.enabled); - assert_eq!(sec.audit.log_path, "audit.log"); - assert_eq!(sec.audit.max_size_mb, 100); +fn audit_config_defaults() { + let audit = AuditConfig::default(); + assert!(audit.enabled); + assert_eq!(audit.log_path, "audit.log"); + assert_eq!(audit.max_size_mb, 100); } #[test] diff --git a/crates/openhuman-core/src/config/schema/tools/browser.rs b/crates/openhuman-core/src/config/schema/tools/browser.rs index d583ad928bd..915fcdf85d3 100644 --- a/crates/openhuman-core/src/config/schema/tools/browser.rs +++ b/crates/openhuman-core/src/config/schema/tools/browser.rs @@ -1,47 +1,9 @@ -//! Browser and computer-use config types. +//! Browser config types. use super::super::defaults; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] -#[serde(default)] -pub struct BrowserComputerUseConfig { - #[serde(default = "default_browser_computer_use_endpoint")] - pub endpoint: String, - #[serde(default = "default_browser_computer_use_timeout_ms")] - pub timeout_ms: u64, - #[serde(default)] - pub allow_remote_endpoint: bool, - #[serde(default)] - pub window_allowlist: Vec, - #[serde(default)] - pub max_coordinate_x: Option, - #[serde(default)] - pub max_coordinate_y: Option, -} - -fn default_browser_computer_use_endpoint() -> String { - "http://127.0.0.1:8787/v1/actions".into() -} - -fn default_browser_computer_use_timeout_ms() -> u64 { - 15_000 -} - -impl Default for BrowserComputerUseConfig { - fn default() -> Self { - Self { - endpoint: default_browser_computer_use_endpoint(), - timeout_ms: default_browser_computer_use_timeout_ms(), - allow_remote_endpoint: false, - window_allowlist: Vec::new(), - max_coordinate_x: None, - max_coordinate_y: None, - } - } -} - #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] #[serde(default)] pub struct BrowserConfig { @@ -58,14 +20,6 @@ pub struct BrowserConfig { pub session_name: Option, #[serde(default = "default_browser_backend")] pub backend: String, - #[serde(default = "default_true")] - pub native_headless: bool, - #[serde(default = "default_browser_webdriver_url")] - pub native_webdriver_url: String, - #[serde(default)] - pub native_chrome_path: Option, - #[serde(default)] - pub computer_use: BrowserComputerUseConfig, /// Run Chrome without a visible window. #[serde(default = "default_true")] pub headless: bool, @@ -179,10 +133,6 @@ fn default_browser_backend() -> String { "tinycomputer".into() } -fn default_browser_webdriver_url() -> String { - "http://127.0.0.1:9515".into() -} - impl Default for BrowserConfig { fn default() -> Self { Self { @@ -190,10 +140,6 @@ impl Default for BrowserConfig { allowed_domains: Vec::new(), session_name: None, backend: default_browser_backend(), - native_headless: default_true(), - native_webdriver_url: default_browser_webdriver_url(), - native_chrome_path: None, - computer_use: BrowserComputerUseConfig::default(), headless: true, viewport_width: default_viewport_width(), viewport_height: default_viewport_height(), diff --git a/crates/openhuman-core/src/config/schema/tools/integrations.rs b/crates/openhuman-core/src/config/schema/tools/integrations.rs index e43f44608c7..a0750742670 100644 --- a/crates/openhuman-core/src/config/schema/tools/integrations.rs +++ b/crates/openhuman-core/src/config/schema/tools/integrations.rs @@ -348,14 +348,15 @@ impl Default for IntegrationToggle { /// Composio in particular is unconditionally enabled and has no toggle: /// as long as the user is signed in, composio tools are available. /// -/// The per-tool `google_places`, `parallel`, `tinyfish`, and `stock_prices` +/// The per-tool `google_places`, `tinyfish`, and `stock_prices` /// flags below are preserved because those integrations incur per-call /// costs that the user may legitimately want to turn off; composio /// costs are metered server-side, so there is no client-side toggle /// for it. /// /// Unknown keys are ignored on load, so configs written by older builds that -/// still carry the retired `twilio` / `apify` toggles keep deserializing. +/// still carry the retired `twilio` / `apify` / `parallel` toggles keep +/// deserializing. #[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Default)] #[serde(default)] pub struct IntegrationsConfig { @@ -363,10 +364,6 @@ pub struct IntegrationsConfig { #[serde(default)] pub google_places: IntegrationToggle, - /// Parallel web search & content extraction integration. - #[serde(default)] - pub parallel: IntegrationToggle, - /// TinyFish web search, fetch, and browser automation integration. #[serde(default)] pub tinyfish: IntegrationToggle, diff --git a/crates/openhuman-core/src/config/schema/tools/integrations_integration_toggle_tests_tests.rs b/crates/openhuman-core/src/config/schema/tools/integrations_integration_toggle_tests_tests.rs index 4437eefedfe..4e58cfb9a35 100644 --- a/crates/openhuman-core/src/config/schema/tools/integrations_integration_toggle_tests_tests.rs +++ b/crates/openhuman-core/src/config/schema/tools/integrations_integration_toggle_tests_tests.rs @@ -55,7 +55,7 @@ fn default_is_managed_and_active() { } #[test] -fn integrations_config_ignores_retired_twilio_and_apify_keys() { +fn integrations_config_ignores_retired_twilio_apify_and_parallel_keys() { let raw = r#" [twilio] enabled = true @@ -64,11 +64,15 @@ fn integrations_config_ignores_retired_twilio_and_apify_keys() { [apify] enabled = false + [parallel] + enabled = false + api_key = "enc2:00" + [google_places] enabled = false "#; let cfg: IntegrationsConfig = toml::from_str(raw).expect("old config with retired keys must still load"); assert!(!cfg.google_places.enabled); - assert!(cfg.parallel.enabled); + assert!(cfg.tinyfish.enabled); } diff --git a/crates/openhuman-core/src/config/schema/tools/mod.rs b/crates/openhuman-core/src/config/schema/tools/mod.rs index fcda1d5afe4..3ee5094ae66 100644 --- a/crates/openhuman-core/src/config/schema/tools/mod.rs +++ b/crates/openhuman-core/src/config/schema/tools/mod.rs @@ -7,7 +7,7 @@ pub mod mcp; pub mod multimodal; pub mod search; -pub use browser::{BrowserComputerUseConfig, BrowserConfig}; +pub use browser::BrowserConfig; pub use http::{CurlConfig, HttpRequestConfig}; pub use integrations::{ ComposioConfig, ComposioDirectBaseUrls, ComposioHostCredential, IntegrationToggle, @@ -22,7 +22,7 @@ pub use multimodal::{MultimodalConfig, MultimodalFileConfig}; pub use search::{ LegacySearchInputs, PresentationMode, ProviderRoute, SearchConfig, SearchEngineCredentials, SearchHostCredential, SearchProviderSettings, SearxngConfig, SeltzConfig, - UnknownKeyedSearchProvider, WebSearchConfig, MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE, + UnknownKeyedSearchProvider, MANAGED_SEARCH_PROVIDERS, SEARCH_ENGINE_BRAVE, SEARCH_ENGINE_DISABLED, SEARCH_ENGINE_EXA, SEARCH_ENGINE_MANAGED, SEARCH_ENGINE_PARALLEL, SEARCH_ENGINE_QUERIT, SEARCH_ENGINE_TAVILY, SEARCH_PROVIDERS, SEARCH_ROLES, SEARCH_ROLE_ANSWER, SEARCH_ROLE_CONTENTS, SEARCH_ROLE_SEARCH, diff --git a/crates/openhuman-core/src/config/schema/tools/search.rs b/crates/openhuman-core/src/config/schema/tools/search.rs index e1f381e39a8..583e404fed5 100644 --- a/crates/openhuman-core/src/config/schema/tools/search.rs +++ b/crates/openhuman-core/src/config/schema/tools/search.rs @@ -93,32 +93,6 @@ impl Default for SearxngConfig { } } -#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)] -#[serde(default)] -pub struct WebSearchConfig { - #[serde(default = "default_web_search_max_results")] - pub max_results: usize, - #[serde(default = "default_web_search_timeout_secs")] - pub timeout_secs: u64, -} - -fn default_web_search_max_results() -> usize { - 5 -} - -fn default_web_search_timeout_secs() -> u64 { - 15 -} - -impl Default for WebSearchConfig { - fn default() -> Self { - Self { - max_results: default_web_search_max_results(), - timeout_secs: default_web_search_timeout_secs(), - } - } -} - // ── Search providers ──────────────────────────────────────────────── // // Several providers can be active at once. Each provider has a route — diff --git a/crates/openhuman-core/src/config/schema/types/config.rs b/crates/openhuman-core/src/config/schema/types/config.rs index 4573aa3f9c6..f1df89bbbc6 100644 --- a/crates/openhuman-core/src/config/schema/types/config.rs +++ b/crates/openhuman-core/src/config/schema/types/config.rs @@ -380,9 +380,6 @@ pub struct Config { #[serde(default)] pub searxng: SearxngConfig, - #[serde(default)] - pub web_search: WebSearchConfig, - /// Unified search-engine selector. Picks exactly one engine /// (managed / parallel / brave) and layers the corresponding tools. #[serde(default)] diff --git a/crates/openhuman-core/src/config/schema/types/config_clone.rs b/crates/openhuman-core/src/config/schema/types/config_clone.rs index f5faf50dbd2..58c85d7da5f 100644 --- a/crates/openhuman-core/src/config/schema/types/config_clone.rs +++ b/crates/openhuman-core/src/config/schema/types/config_clone.rs @@ -74,7 +74,6 @@ impl Clone for Config { multimodal_files: self.multimodal_files.clone(), seltz: self.seltz.clone(), searxng: self.searxng.clone(), - web_search: self.web_search.clone(), search: self.search.clone(), proxy: self.proxy.clone(), cost: self.cost.clone(), diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rs index d976291afa2..4df86a98250 100644 --- a/crates/openhuman-core/src/config/schema/types/defaults.rs +++ b/crates/openhuman-core/src/config/schema/types/defaults.rs @@ -90,7 +90,6 @@ impl Default for Config { multimodal_files: MultimodalFileConfig::default(), seltz: SeltzConfig::default(), searxng: SearxngConfig::default(), - web_search: WebSearchConfig::default(), search: SearchConfig::default(), proxy: ProxyConfig::default(), cost: CostConfig::default(), diff --git a/crates/openhuman-core/src/config/workspace/README.md b/crates/openhuman-core/src/config/workspace/README.md index 564d075cf36..f2f19a8aadd 100644 --- a/crates/openhuman-core/src/config/workspace/README.md +++ b/crates/openhuman-core/src/config/workspace/README.md @@ -1,6 +1,6 @@ # workspace -Owns workspace layout bootstrap and the editable "Persona Pack" prompt files (`SOUL.md`, `IDENTITY.md`) that drive the agent's personality. Two concerns live here: (1) `init_workspace`, the one-shot setup that creates the default directory tree and copies the bundled prompt/skills files into a fresh workspace (backs CLI `init`-style entrypoints); and (2) read/edit/reset RPCs over a tightly allowlisted set of persona files, so the settings UI can round-trip those prompts without ever exposing an arbitrary path under the workspace. It also carries an unrelated file-watcher state store (see [`state.rs`](./state.rs) below). +Owns workspace layout bootstrap and the editable "Persona Pack" prompt files (`SOUL.md`, `IDENTITY.md`) that drive the agent's personality. Two concerns live here: (1) `init_workspace`, the one-shot setup that creates the default directory tree and copies the bundled prompt/skills files into a fresh workspace (backs CLI `init`-style entrypoints); and (2) read/edit/reset RPCs over a tightly allowlisted set of persona files, so the settings UI can round-trip those prompts without ever exposing an arbitrary path under the workspace. ## Responsibilities @@ -20,7 +20,6 @@ Owns workspace layout bootstrap and the editable "Persona Pack" prompt files (`S | [`crates/openhuman-core/src/config/workspace/rpc.rs`](./rpc.rs) | Pure-domain persona file API: `WorkspaceFile` type, `read_workspace_file` / `write_workspace_file` / `reset_workspace_file`, `MAX_WORKSPACE_FILE_BYTES`, allowlist enforcement (`ensure_editable`). Returns `Outcome`. | | [`crates/openhuman-core/src/config/workspace/schemas.rs`](./schemas.rs) | Controller schemas + `handle_*` fns delegating to `rpc.rs`; loads config to resolve `workspace_dir`. | | [`crates/openhuman-core/src/config/workspace/tools.rs`](./tools.rs) | LLM-callable wrappers over the persona-file RPCs: `WorkspaceReadPersonaTool` (default-on), `WorkspaceUpdatePersonaTool`, `WorkspaceResetPersonaTool`, and `WorkspaceInitTool` (all three mutators default-off, gated by the `workspace_manage` toggle in [`tools/user_filter.rs`](../../tools/user_filter.rs)). | -| `crates/openhuman-core/src/config/workspace/state.rs` | `WatcherStateStore`, a machine-local TSD KV store for `path -> last_mtime_secs`, so a vault file watcher can skip re-ingesting unchanged files after a restart. It opens its own local backend and does not use a shared remote storage URL. Not otherwise wired to the persona/bootstrap concerns above; currently has no other caller in the tree. | ## Public surface @@ -61,7 +60,6 @@ The editable surface is restricted to the `BOOTSTRAP_FILES` allowlist (`SOUL.md` - `crate::core::Outcome`: uniform RPC return type. - Bundled prompt assets via `include_str!("../../agent/prompts/SOUL.md" | "IDENTITY.md")`. - `tinytools` (`PermissionLevel`, `Tool`, `ToolResult`) for the agent tools in `tools.rs`. -- The watcher state store uses the configured TSD SQLite driver for its dedicated local database; legacy SQLite table import remains part of host migration. ## Used by @@ -73,7 +71,7 @@ The editable surface is restricted to the `BOOTSTRAP_FILES` allowlist (`SOUL.md` - `bundled_default_contents` is the single allowlist gate: membership there is both "what may be edited from the Persona surface" and "what to restore on reset", so a caller can never read or clobber an arbitrary workspace path (path-traversal names like `../escape.md` and case variants like `soul.md` are rejected). - `read_workspace_file` deliberately avoids a `metadata().len()` pre-check (TOCTOU-prone) and instead reads through `take(MAX_WORKSPACE_FILE_BYTES + 1)`, capping bytes held regardless of races; an over-cap file is refused, non-UTF-8 is rejected. - `WorkspaceFile` intentionally omits the absolute on-disk path to avoid leaking host filesystem layout over RPC. -- The persona/bootstrap surface has no `store.rs`, `bus.rs`, or `types.rs`: no event-bus subscribers, no persisted in-memory state beyond plain files. `tools.rs` and `state.rs` are the exceptions to an otherwise stateless-handler domain. +- The persona/bootstrap surface has no `store.rs`, `bus.rs`, or `types.rs`: no event-bus subscribers, no persisted in-memory state beyond plain files. `tools.rs` is the exception to an otherwise stateless-handler domain. - The module's own `init_workspace` is unrelated to `keyring::init_workspace` (same name, different domain). ## Further reading diff --git a/crates/openhuman-core/src/config/workspace/mod.rs b/crates/openhuman-core/src/config/workspace/mod.rs index 683194ea6c7..1e75e7c3a9d 100644 --- a/crates/openhuman-core/src/config/workspace/mod.rs +++ b/crates/openhuman-core/src/config/workspace/mod.rs @@ -3,7 +3,6 @@ pub mod ops; pub mod rpc; mod schemas; -pub mod state; pub mod tools; pub use ops::*; diff --git a/crates/openhuman-core/src/config/workspace/state.rs b/crates/openhuman-core/src/config/workspace/state.rs deleted file mode 100644 index 32755bf4ec6..00000000000 --- a/crates/openhuman-core/src/config/workspace/state.rs +++ /dev/null @@ -1,174 +0,0 @@ -//! Machine-local mtime state for the vault file watcher. -//! -//! The rows contain absolute paths and mtimes observed by this machine, so -//! they use a dedicated local SQLite backend opened through the storage -//! facade rather than the process-wide backend (which may be shared across -//! hosts). The legacy SQLite table is read only by the host migration path. - -use std::path::{Path, PathBuf}; -use std::sync::Arc; - -use anyhow::{anyhow, Context, Result}; -use serde::{Deserialize, Serialize}; -use serde_json::Value; -use sha2::{Digest, Sha256}; -use tinystoragedrivers::{StorageBackend, StorageConfig}; -use tinystoragedrivers_api::KvStore; -use tinystoragedrivers_types::{Cursor, Precondition}; - -const KEY_PREFIX: &str = "openhuman.vault-watcher."; -const PAGE_SIZE: usize = 256; - -#[derive(Clone)] -pub struct WatcherStateStore { - kv: Arc, -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct FileState { - pub path: PathBuf, - pub mtime_secs: u64, - pub deleted: bool, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -struct StoredFileState { - path: String, - mtime_secs: u64, - deleted: bool, -} - -impl WatcherStateStore { - /// Open the machine-local store at `db_path` through the TSD facade. - pub fn open(db_path: &Path) -> Result { - let url = format!("sqlite:{}", db_path.display()); - let config = StorageConfig::parse(&url).context("parse watcher storage URL")?; - let backend = - crate::storage::block_on(async move { tinystoragedrivers::open(&config).await }) - .context("open watcher storage backend")?; - Self::from_backend(backend) - } - - fn from_backend(backend: Arc) -> Result { - let storage = backend - .for_scope(&crate::storage::Scope::local()) - .map_err(anyhow::Error::from) - .context("open watcher scope")?; - Ok(Self { - kv: Arc::clone(storage.kv()), - }) - } - - /// Upsert the observed mtime for `path`, marking it as present. - pub fn record_seen(&mut self, path: &Path, mtime_secs: u64) -> Result<()> { - let path = path.to_string_lossy().into_owned(); - let key = key_for(&path); - let value = serde_json::to_value(StoredFileState { - path, - mtime_secs, - deleted: false, - })?; - let kv = Arc::clone(&self.kv); - crate::storage::block_on(async move { kv.put(&key, value).await.map(|_| ()) }) - .context("write watcher state")?; - Ok(()) - } - - /// Mark `path` deleted, retaining its prior mtime if one exists. - pub fn record_deleted(&mut self, path: &Path) -> Result<()> { - let path = path.to_string_lossy().into_owned(); - let key = key_for(&path); - let kv = Arc::clone(&self.kv); - crate::storage::block_on_anyhow(async move { - loop { - let current = kv.get(&key).await?; - let (mtime_secs, expected) = match current { - Some(current) => { - let state = decode_state(¤t.doc)?; - ensure_path(&state, &path)?; - (state.mtime_secs, current.unchanged()) - } - None => (0, Precondition::Absent), - }; - let value = serde_json::to_value(StoredFileState { - path: path.clone(), - mtime_secs, - deleted: true, - })?; - match kv.cas(&key, value, expected).await { - Ok(_) => return Ok(()), - Err(error) if error.kind() == tinystoragedrivers_types::ErrorKind::Conflict => { - continue; - } - Err(error) => return Err(error.into()), - } - } - }) - .context("write deleted watcher state")?; - Ok(()) - } - - /// Return the stored mtime for `path`, or `None` if absent or deleted. - pub fn last_mtime(&self, path: &Path) -> Result> { - let path = path.to_string_lossy().into_owned(); - let key = key_for(&path); - let kv = Arc::clone(&self.kv); - let value = crate::storage::block_on(async move { kv.get(&key).await }) - .context("read watcher state")?; - let Some(value) = value else { - return Ok(None); - }; - let state = decode_state(&value.doc)?; - ensure_path(&state, &path)?; - Ok((!state.deleted).then_some(state.mtime_secs)) - } - - /// Load every non-deleted state in stable key order. - pub fn load_all(&self) -> Result> { - let kv = Arc::clone(&self.kv); - crate::storage::block_on_anyhow(async move { - let mut cursor: Option = None; - let mut states = Vec::new(); - loop { - let page = kv.list(KEY_PREFIX, cursor, PAGE_SIZE).await?; - for item in page.items { - let state = decode_state(&item.doc)?; - if item.id != key_for(&state.path) { - return Err(anyhow!("watcher state key identity mismatch")); - } - if !state.deleted { - states.push(FileState { - path: PathBuf::from(state.path), - mtime_secs: state.mtime_secs, - deleted: false, - }); - } - } - let Some(next) = page.next else { break }; - cursor = Some(next); - } - Ok(states) - }) - .context("list watcher state") - } -} - -fn key_for(path: &str) -> String { - let digest = Sha256::digest(path.as_bytes()); - format!("{KEY_PREFIX}{}", hex::encode(digest)) -} - -fn decode_state(value: &Value) -> Result { - serde_json::from_value(value.clone()).context("decode watcher state") -} - -fn ensure_path(state: &StoredFileState, path: &str) -> Result<()> { - if state.path != path { - return Err(anyhow!("watcher state key identity mismatch")); - } - Ok(()) -} - -#[cfg(test)] -#[path = "state_tests.rs"] -mod tests; diff --git a/crates/openhuman-core/src/config/workspace/state_tests.rs b/crates/openhuman-core/src/config/workspace/state_tests.rs deleted file mode 100644 index 36dc7e4ff13..00000000000 --- a/crates/openhuman-core/src/config/workspace/state_tests.rs +++ /dev/null @@ -1,98 +0,0 @@ -use super::*; - -fn backend() -> Arc { - Arc::new(tinystoragedrivers_testkit::MemoryBackend::new()) -} - -fn open_store(backend: Arc) -> WatcherStateStore { - WatcherStateStore::from_backend(backend).unwrap() -} - -#[test] -fn record_and_retrieve_mtime() { - let mut store = open_store(backend()); - let path = Path::new("/vault/note.md"); - store.record_seen(path, 1_700_000_000).unwrap(); - assert_eq!(store.last_mtime(path).unwrap(), Some(1_700_000_000)); -} - -#[test] -fn unknown_path_returns_none() { - let store = open_store(backend()); - assert_eq!( - store.last_mtime(Path::new("/vault/missing.md")).unwrap(), - None - ); -} - -#[test] -fn deleted_path_returns_none_and_preserves_its_record() { - let mut store = open_store(backend()); - let path = Path::new("/vault/gone.md"); - store.record_seen(path, 1_700_000_000).unwrap(); - store.record_deleted(path).unwrap(); - assert_eq!(store.last_mtime(path).unwrap(), None); - let listed = store.load_all().unwrap(); - assert!(listed.is_empty()); -} - -#[test] -fn upsert_updates_mtime() { - let mut store = open_store(backend()); - let path = Path::new("/vault/updated.md"); - store.record_seen(path, 1_000).unwrap(); - store.record_seen(path, 2_000).unwrap(); - assert_eq!(store.last_mtime(path).unwrap(), Some(2_000)); -} - -#[test] -fn load_all_excludes_deleted() { - let mut store = open_store(backend()); - store.record_seen(Path::new("/vault/a.md"), 1_000).unwrap(); - store.record_seen(Path::new("/vault/b.md"), 2_000).unwrap(); - store.record_deleted(Path::new("/vault/c.md")).unwrap(); - let rows = store.load_all().unwrap(); - assert_eq!(rows.len(), 2); - assert!(rows.iter().all(|row| !row.deleted)); -} - -#[test] -fn reopen_on_same_local_backend_preserves_state() { - let backend = backend(); - { - let mut store = open_store(Arc::clone(&backend)); - store - .record_seen(Path::new("/vault/persist.md"), 42_000) - .unwrap(); - store.record_deleted(Path::new("/vault/gone.md")).unwrap(); - } - let store = open_store(backend); - assert_eq!( - store.last_mtime(Path::new("/vault/persist.md")).unwrap(), - Some(42_000) - ); - assert_eq!(store.last_mtime(Path::new("/vault/gone.md")).unwrap(), None); - let all = store.load_all().unwrap(); - assert_eq!(all.len(), 1); - assert_eq!(all[0].path, Path::new("/vault/persist.md")); -} - -#[test] -fn path_hashes_keep_distinct_paths_and_verify_body_identity() { - assert_ne!(key_for("/vault/a.md"), key_for("/vault/b.md")); - let mut store = open_store(backend()); - let path = Path::new("/vault/a.md"); - store.record_seen(path, 1).unwrap(); - assert_eq!(store.last_mtime(Path::new("/vault/b.md")).unwrap(), None); -} - -#[cfg(feature = "storage-sqlite")] -#[tokio::test] -async fn local_backend_open_and_sync_operations_work_inside_current_thread_runtime() { - let directory = tempfile::tempdir().unwrap(); - let db = directory.path().join("watcher.db"); - let mut store = WatcherStateStore::open(&db).unwrap(); - let path = Path::new("/machine/vault/current.md"); - store.record_seen(path, 123).unwrap(); - assert_eq!(store.last_mtime(path).unwrap(), Some(123)); -} diff --git a/crates/openhuman-core/src/cron/scheduler/agent_run_tests.rs b/crates/openhuman-core/src/cron/scheduler/agent_run_tests.rs index c22e020b1a3..0e11f6da599 100644 --- a/crates/openhuman-core/src/cron/scheduler/agent_run_tests.rs +++ b/crates/openhuman-core/src/cron/scheduler/agent_run_tests.rs @@ -93,7 +93,6 @@ mod corrective_turn { }; config.local_ai.runtime_enabled = false; config.memory.conversations.enabled = false; - config.agent.session_dual_write = false; config.agent.session_shadow_reads = false; config.default_model = Some("fixture".into()); config.secrets.encrypt = false; diff --git a/crates/openhuman-core/src/lib.rs b/crates/openhuman-core/src/lib.rs index cdaaf8987d6..2a3d24e6892 100644 --- a/crates/openhuman-core/src/lib.rs +++ b/crates/openhuman-core/src/lib.rs @@ -113,8 +113,6 @@ pub mod voice; pub mod web3; pub mod web_chat; -pub use config::DaemonConfig; - /// Embeddable core composition API. Host the OpenHuman core in any process — /// the Tauri shell, a CLI, a stdio MCP server, or a cloud/team server — via /// [`CoreBuilder`] → [`CoreRuntime`]. See `crates/openhuman-embed/README.md` diff --git a/crates/openhuman-core/src/storage/import/README.md b/crates/openhuman-core/src/storage/import/README.md index 55f75a5b2ed..8a33a3b3e7e 100644 --- a/crates/openhuman-core/src/storage/import/README.md +++ b/crates/openhuman-core/src/storage/import/README.md @@ -23,8 +23,8 @@ What stays in OpenHuman: The file-era dual-write of transcripts into a second layout, its shadow read and the `OPENHUMAN_SESSION_DUAL_WRITE` / `OPENHUMAN_SESSION_SHADOW_READS` kill switches are gone: the backend is the only record. The -`AgentConfig::session_dual_write` and `session_shadow_reads` fields remain so -existing `config.toml` files still load; they have no effect. +`AgentConfig::session_shadow_reads` field remains and has no effect; an old +`session_dual_write` key is ignored on load. ## Further reading diff --git a/crates/openhuman-core/src/storage/mod.rs b/crates/openhuman-core/src/storage/mod.rs index 250d5588fa4..0fa0805bb66 100644 --- a/crates/openhuman-core/src/storage/mod.rs +++ b/crates/openhuman-core/src/storage/mod.rs @@ -64,17 +64,15 @@ pub use scope::{ use std::future::Future; use std::sync::{mpsc, Arc, LazyLock, Mutex, OnceLock, RwLock}; -/// SQLite bindings re-exported by the storage driver crate, for the two +/// SQLite bindings re-exported by the storage driver crate, for the /// consumers that open a SQLite file that is not a storage backend: the /// read-only legacy importers ([`import`], which open the old per-domain files -/// on a scratch copy) and the vault watcher's per-machine mtime table -/// (`config/workspace/state.rs`). `SqliteNative` cannot stand in for either: it +/// on a scratch copy). `SqliteNative` cannot stand in for them: it /// opens the driver's own database with the driver's schema, not an arbitrary /// foreign file, and its `run_blocking` hands the closure a `rusqlite` /// connection anyway. The core has no `rusqlite` dependency of its own, /// tinystoragedrivers owns the one copy; the re-export goes when the importers -/// do (the one-time legacy import window closes). Re-checked for #7768: both -/// consumers are still present, so it stays. +/// do (the one-time legacy import window closes). pub use tinystoragedrivers::{ CollectionSpec, Precondition, StorageBackend, StorageConfig as StorageUrl, StorageError, }; diff --git a/crates/openhuman-core/src/tools/ops_tests.rs b/crates/openhuman-core/src/tools/ops_tests.rs index ced5abf5a67..c5a21b79872 100644 --- a/crates/openhuman-core/src/tools/ops_tests.rs +++ b/crates/openhuman-core/src/tools/ops_tests.rs @@ -56,7 +56,6 @@ fn integration_test_config(tmp: &TempDir, backend_url: &str) -> Config { let mut cfg = test_config(tmp); cfg.api_url = Some(backend_url.to_string()); cfg.integrations.google_places.enabled = true; - cfg.integrations.parallel.enabled = true; cfg.integrations.tinyfish.enabled = true; cfg.integrations.stock_prices.enabled = true; cfg diff --git a/crates/openhuman-core/src/tools/ops_tests_execution_and_serde_tests.rs b/crates/openhuman-core/src/tools/ops_tests_execution_and_serde_tests.rs index 4c4fe256438..932161900da 100644 --- a/crates/openhuman-core/src/tools/ops_tests_execution_and_serde_tests.rs +++ b/crates/openhuman-core/src/tools/ops_tests_execution_and_serde_tests.rs @@ -112,7 +112,6 @@ async fn all_tools_registers_no_hosted_integration_families_without_a_tool_sourc let mut cfg = test_config(&tmp); cfg.api_url = Some("https://backend.example.test".to_string()); cfg.integrations.google_places.enabled = true; - cfg.integrations.parallel.enabled = true; cfg.integrations.tinyfish.enabled = true; cfg.integrations.stock_prices.enabled = true; store_test_session_token(&cfg).await; diff --git a/crates/openhuman-core/src/web_chat/web_tests_ptt_source_tests.rs b/crates/openhuman-core/src/web_chat/web_tests_ptt_source_tests.rs index 200e055200b..ccfc6d83202 100644 --- a/crates/openhuman-core/src/web_chat/web_tests_ptt_source_tests.rs +++ b/crates/openhuman-core/src/web_chat/web_tests_ptt_source_tests.rs @@ -63,7 +63,6 @@ async fn ptt_source_turn_completes_without_publishing_a_voice_event() { config.files_dir_override = Some(files_dir); config.local_ai.runtime_enabled = false; config.memory.conversations.enabled = false; - config.agent.session_dual_write = false; config.agent.session_shadow_reads = false; config.components.mcp = false; config.components.memory = false; diff --git a/crates/openhuman-embed/examples/linux_fleet.rs b/crates/openhuman-embed/examples/linux_fleet.rs index 2723287e276..72074e8d686 100644 --- a/crates/openhuman-embed/examples/linux_fleet.rs +++ b/crates/openhuman-embed/examples/linux_fleet.rs @@ -63,7 +63,6 @@ async fn measure(count: usize) -> anyhow::Result<()> { let mut config = openhuman_embed::RuntimeConfig::default(); config.local_ai.runtime_enabled = false; config.memory.conversations.enabled = false; - config.agent.session_dual_write = false; config.agent.session_shadow_reads = false; config.default_temperature = 0.0; let before_boot = rss_kib()?; diff --git a/crates/openhuman-embed/examples/support/mod.rs b/crates/openhuman-embed/examples/support/mod.rs index d98f5be1da6..94806737881 100644 --- a/crates/openhuman-embed/examples/support/mod.rs +++ b/crates/openhuman-embed/examples/support/mod.rs @@ -48,10 +48,9 @@ pub fn offline_config() -> Config { // but unrelated to these tests' contracts and would race the final // ephemeral-workspace cleanup assertion. config.memory.conversations.enabled = false; - // Session-store dual writes and shadow reads are also deliberately - // fire-and-forget; leaving them on makes their detached filesystem work - // race the synchronous ephemeral cleanup. - config.agent.session_dual_write = false; + // Session-store shadow reads are also deliberately fire-and-forget; + // leaving them on makes their detached filesystem work race the + // synchronous ephemeral cleanup. config.agent.session_shadow_reads = false; config.default_temperature = 0.0; config diff --git a/crates/openhuman-embed/src/lib.rs b/crates/openhuman-embed/src/lib.rs index 8fd89d3acf9..f3783296508 100644 --- a/crates/openhuman-embed/src/lib.rs +++ b/crates/openhuman-embed/src/lib.rs @@ -93,8 +93,7 @@ pub use tinyinference_llm::model::ReasoningEffort; pub use openhuman_core::agent::tinyagents::host::LastTurnUsage; pub use openhuman_core::agent::{HostAttachment, HostTools, HostTurnTools, TurnContext}; pub use openhuman_core::{ - CoreBootMode, CoreBuilder, CoreRuntime, DaemonConfig, DomainSet, HostKind, ServiceSet, - TokenSource, + CoreBootMode, CoreBuilder, CoreRuntime, DomainSet, HostKind, ServiceSet, TokenSource, }; /// Declarative execution requirements for host-owned tools, from the core's vendored contract. pub use tinytools::ToolPolicy; diff --git a/crates/openhuman-embed/tests/common/mod.rs b/crates/openhuman-embed/tests/common/mod.rs index 956292719ef..62e5e55cfeb 100644 --- a/crates/openhuman-embed/tests/common/mod.rs +++ b/crates/openhuman-embed/tests/common/mod.rs @@ -54,10 +54,9 @@ pub fn offline_config() -> Config { // execution. Avoid recursively inspecting host toolchain trees for local // jail grants on every test turn. config.runtime.local_jail.toolchain_homes = false; - // Session-store dual writes and shadow reads are also deliberately - // fire-and-forget; leaving them on makes their detached filesystem work - // race the synchronous ephemeral cleanup. - config.agent.session_dual_write = false; + // Session-store shadow reads are also deliberately fire-and-forget; + // leaving them on makes their detached filesystem work race the + // synchronous ephemeral cleanup. config.agent.session_shadow_reads = false; config.default_temperature = 0.0; config diff --git a/crates/openhuman-embed/tests/session_store.rs b/crates/openhuman-embed/tests/session_store.rs index ce3b256abea..c58a4f7f57b 100644 --- a/crates/openhuman-embed/tests/session_store.rs +++ b/crates/openhuman-embed/tests/session_store.rs @@ -66,10 +66,7 @@ fn a_stateless_runtime_keeps_every_conversation_in_its_session_store() { let backend = stub_backend().await; let model = provider("noted").await; let store = Arc::new(InMemorySessionStores::new()); - let mut config = offline_config(); - // On by default in the product: it must stand down by itself once - // a host store owns the transcripts. - config.agent.session_dual_write = true; + let config = offline_config(); let runtime = Runtime::builder() .config(config) .workspace(Workspace::stateless()) diff --git a/crates/openhuman-tinyhumans/src/integrations/tools/families_tests.rs b/crates/openhuman-tinyhumans/src/integrations/tools/families_tests.rs index ea024123a78..7bcc6c77eed 100644 --- a/crates/openhuman-tinyhumans/src/integrations/tools/families_tests.rs +++ b/crates/openhuman-tinyhumans/src/integrations/tools/families_tests.rs @@ -20,7 +20,6 @@ fn integration_test_config(tmp: &TempDir, backend_url: &str) -> Config { }; cfg.api_url = Some(backend_url.to_string()); cfg.integrations.google_places.enabled = true; - cfg.integrations.parallel.enabled = true; cfg.integrations.tinyfish.enabled = true; cfg.integrations.stock_prices.enabled = true; cfg diff --git a/crates/openhuman-tinyhumans/src/integrations/tools/mod.rs b/crates/openhuman-tinyhumans/src/integrations/tools/mod.rs index d98e72dea81..a042a5017e9 100644 --- a/crates/openhuman-tinyhumans/src/integrations/tools/mod.rs +++ b/crates/openhuman-tinyhumans/src/integrations/tools/mod.rs @@ -14,9 +14,7 @@ pub use stock_prices::{ /// gated by its own `[integrations.*]` switch. /// /// Web search providers (Exa, Gemini, TinyFish, ...) register through the -/// TinySearch module, so `[search] enabled = false` suppresses them too; -/// `integrations.parallel` is parsed for old config files and no longer does -/// anything. +/// TinySearch module, so `[search] enabled = false` suppresses them too. pub async fn build_integration_tools( root_config: &openhuman_embed::__host::config::Config, ) -> Vec> { diff --git a/docs/gitbooks/en/developing/architecture/agent-harness.md b/docs/gitbooks/en/developing/architecture/agent-harness.md index 06132066a01..0dca191c38d 100644 --- a/docs/gitbooks/en/developing/architecture/agent-harness.md +++ b/docs/gitbooks/en/developing/architecture/agent-harness.md @@ -714,7 +714,7 @@ Every run appends to a durable event journal (`tinyagents/journal.rs`): a `Store The remaining store cutover runs on shadow scaffolding. Product behavior is unchanged and divergences are logged: -- Sessions live in the storage backend (`DriverSessionStores`); the file-era dual-write and shadow read are gone, and `config.session_dual_write` / `session_shadow_reads` no longer have any effect. +- Sessions live in the storage backend (`DriverSessionStores`); the file-era dual-write and shadow read are gone; `config.session_shadow_reads` no longer has any effect, and an old `session_dual_write` key is ignored on load. Goals and todos are crate-backed outright, with no shadow: thread goals live in the crate `graph.goals` KV store (`agent/goals/store.rs`), and the session todo list lives in the in-process crate `graph.todos` store (`agent/todos/ops.rs`); see [Goals and todos](../../features/goals-and-todos.md). diff --git a/docs/gitbooks/en/developing/architecture/security.md b/docs/gitbooks/en/developing/architecture/security.md index 6358afdcde1..99734c518ec 100644 --- a/docs/gitbooks/en/developing/architecture/security.md +++ b/docs/gitbooks/en/developing/architecture/security.md @@ -89,7 +89,7 @@ Local PII detection belongs to [`tinymemory_api::safety`](https://github.com/tin ## Calls into -- `crates/openhuman-core/src/config/`: `SecurityConfig`, `AutonomyConfig` for policy + sandbox selection. +- `crates/openhuman-core/src/config/`: `AutonomyConfig`, `SandboxConfig` for policy + sandbox selection. - Workspace filesystem, for the audit log and secret store. ## Called by diff --git a/docs/gitbooks/en/developing/embed/api-index.json b/docs/gitbooks/en/developing/embed/api-index.json index 6fe6e62ec47..59333d91588 100644 --- a/docs/gitbooks/en/developing/embed/api-index.json +++ b/docs/gitbooks/en/developing/embed/api-index.json @@ -50,7 +50,6 @@ "CronReply", "CronSweepReport", "DEFAULT_MAX_AGENTS", - "DaemonConfig", "DefaultsInfo", "DefinitionBase", "DirectProfileProvider", diff --git a/docs/gitbooks/en/developing/embed/api-index.md b/docs/gitbooks/en/developing/embed/api-index.md index 1b339609518..cea5cf16a2e 100644 --- a/docs/gitbooks/en/developing/embed/api-index.md +++ b/docs/gitbooks/en/developing/embed/api-index.md @@ -53,7 +53,6 @@ Generate the complete local Rust API reference with `cargo doc -p openhuman-embe - [`CronReply`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) - [`CronSweepReport`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) - [`DEFAULT_MAX_AGENTS`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) -- [`DaemonConfig`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) - [`DefaultsInfo`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) - [`DefinitionBase`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) - [`DirectProfileProvider`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) diff --git a/llms-full.txt b/llms-full.txt index 47437181b1c..dc672c1f18a 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -2952,7 +2952,6 @@ Generate the complete local Rust API reference with `cargo doc -p openhuman-embe - [`CronReply`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) - [`CronSweepReport`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) - [`DEFAULT_MAX_AGENTS`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) -- [`DaemonConfig`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) - [`DefaultsInfo`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) - [`DefinitionBase`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) - [`DirectProfileProvider`](https://github.com/tinyhumansai/openhuman/blob/main/crates/openhuman-embed/src/lib.rs) diff --git a/scripts/__tests__/storage-bypass.test.mjs b/scripts/__tests__/storage-bypass.test.mjs index 9289d63698c..00c8ed85809 100644 --- a/scripts/__tests__/storage-bypass.test.mjs +++ b/scripts/__tests__/storage-bypass.test.mjs @@ -134,8 +134,6 @@ test("every allowlisted path carries a reason and known rules", () => { assert.ok(entry.site.length > 5, file); } } - const state = `${SRC}/config/workspace/state.rs`; - assert.equal(ALLOW.has(state), false, "the TSD facade removed the old SQLite opener"); }); test("a new database open fails the check", () => { diff --git a/tests/in_process/config_e2e.rs b/tests/in_process/config_e2e.rs index 23422c67c94..f3011557078 100644 --- a/tests/in_process/config_e2e.rs +++ b/tests/in_process/config_e2e.rs @@ -31,24 +31,13 @@ fn config_schema_defaults_cover_dashboard_capability_memory_and_security_shapes( assert!(dashboard.model_health.enabled); assert_eq!(dashboard.model_health.min_tasks_for_rating, 10); assert_eq!(dashboard.model_health.evaluation_window_tasks, 50); - assert!(dashboard.diagram_viewer.enabled); - assert_eq!( - dashboard.diagram_viewer.source_url, - "http://localhost:8787/workspace/diagrams/latest.png" - ); - assert_eq!(dashboard.diagram_viewer.refresh_interval_seconds, 10); let partial_dashboard: DashboardConfig = serde_json::from_value(json!({ "event_stream": {}, - "model_health": {}, - "diagram_viewer": {} + "model_health": {} })) .expect("partial dashboard config should fill serde defaults"); assert!(partial_dashboard.event_stream.enabled); assert_eq!(partial_dashboard.model_health.hallucination_threshold, 0.10); - assert_eq!( - partial_dashboard.diagram_viewer.refresh_interval_seconds, - 10 - ); let event_stream: EventStreamConfig = serde_json::from_value(json!({})).expect("event stream defaults"); assert_eq!(event_stream.new_entries, "top"); @@ -73,8 +62,6 @@ fn config_schema_defaults_cover_dashboard_capability_memory_and_security_shapes( let sandbox = SandboxConfig::default(); assert!(sandbox.enabled.is_none()); assert!(sandbox.firejail_args.is_empty()); - let security = SecurityConfig::default(); - assert!(security.audit.enabled); let audit = AuditConfig::default(); assert_eq!(audit.log_path, "audit.log"); assert_eq!(audit.max_size_mb, 100); @@ -194,7 +181,7 @@ fn config_schema_defaults_cover_dashboard_capability_memory_and_security_shapes( } #[test] -fn config_active_user_and_daemon_public_helpers_cover_path_branches() { +fn config_active_user_public_helpers_cover_path_branches() { let tmp = tempdir().expect("tempdir"); let root = tmp.path().join(".openhuman"); @@ -218,14 +205,6 @@ fn config_active_user_and_daemon_public_helpers_cover_path_branches() { clear_active_user(&root).expect("clear active user"); clear_active_user(&root).expect("clearing missing active user is idempotent"); assert_eq!(read_active_user_id(&root), None); - - let daemon = DaemonConfig::from_app_data_dir(tmp.path()); - assert_eq!(daemon.data_dir, tmp.path().join("openhuman")); - assert_eq!( - daemon.workspace_dir, - tmp.path().join("openhuman").join("workspace") - ); - assert!(daemon.security.audit.enabled); } #[test] @@ -479,46 +458,11 @@ async fn config_loaders_resolve_user_workspace_markers_and_ignore_workspace_when } #[tokio::test] -async fn config_default_path_loader_ignores_workspace_override_and_projects_dir_trims() { +async fn config_projects_dir_env_override_trims() { let _lock = env_lock_async().await; let tmp = tempdir().expect("tempdir"); let home = tmp.path().join("home"); - let root = home.join(".openhuman"); - let user_dir = root.join("users").join("default-loader-user"); - let workspace_override = tmp.path().join("workspace-override"); - let _guards = [ - EnvVarGuard::set_to_path("HOME", &home), - EnvVarGuard::unset(APP_ENV_VAR), - EnvVarGuard::unset(VITE_APP_ENV_VAR), - EnvVarGuard::set_to_path("OPENHUMAN_WORKSPACE", &workspace_override), - EnvVarGuard::set("OPENHUMAN_MODEL", " default-loader-model "), - ]; - - let missing = Config::load_from_default_paths() - .await - .expect("load default paths without an existing config"); - assert_eq!( - missing.config_path, - root.join("users").join("local").join("config.toml") - ); - assert_eq!(missing.workspace_dir, workspace_override.join("workspace")); - assert_eq!( - missing.default_model.as_deref(), - Some("default-loader-model") - ); - - write_active_user_id(&root, "default-loader-user").expect("write active user"); - write_min_config(&user_dir); - write_min_config(&workspace_override); - let loaded = Config::load_from_default_paths() - .await - .expect("load default active-user config while workspace override is set"); - assert_eq!(loaded.config_path, user_dir.join("config.toml")); - assert_eq!(loaded.workspace_dir, workspace_override.join("workspace")); - assert_eq!( - loaded.default_model.as_deref(), - Some("default-loader-model") - ); + let _home = EnvVarGuard::set_to_path("HOME", &home); let custom_projects = tmp.path().join("OpenHuman Projects"); { @@ -564,8 +508,6 @@ async fn config_env_overlay_public_loader_applies_runtime_and_tool_overrides() { EnvVarGuard::set("OPENHUMAN_SEARCH_MAX_RESULTS", "11"), EnvVarGuard::set("OPENHUMAN_SEARCH_TIMEOUT_SECS", "8"), EnvVarGuard::set("OPENHUMAN_WEB_SEARCH_ENABLED", "0"), - EnvVarGuard::set("OPENHUMAN_WEB_SEARCH_MAX_RESULTS", "7"), - EnvVarGuard::set("OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS", "6"), EnvVarGuard::set("OPENHUMAN_PROXY_ENABLED", "true"), EnvVarGuard::set("OPENHUMAN_HTTP_PROXY", " http://proxy.example:8080 "), EnvVarGuard::set("OPENHUMAN_NO_PROXY", " localhost,example.test "), @@ -625,7 +567,6 @@ async fn config_env_overlay_public_loader_applies_runtime_and_tool_overrides() { assert!(config.search.querit.has_key()); assert!(config.search.exa.has_key()); assert_eq!(config.search.max_results, 11); - assert_eq!(config.web_search.max_results, 7); assert!(config.proxy.enabled); assert_eq!(config.proxy.scope, ProxyScope::Services); assert!(config.proxy.should_apply_to_service("tool.browser")); diff --git a/tests/support/config_auth_harness.rs b/tests/support/config_auth_harness.rs index 7726a471756..d04d10a21b8 100644 --- a/tests/support/config_auth_harness.rs +++ b/tests/support/config_auth_harness.rs @@ -23,12 +23,12 @@ pub use tempfile::{tempdir, TempDir}; pub use openhuman_core::config::schema::{ AuditConfig, CapabilityProviderConfig, CapabilityProviderTrustState, DashboardConfig, DingTalkConfig, DiscordConfig, EventStreamConfig, IrcConfig, LarkConfig, MemoryConfig, - ModelHealthConfig, ProxyConfig, ProxyScope, QQConfig, ResourceLimitsConfig, SandboxConfig, - SecurityConfig, SlackConfig, TelegramConfig, WhatsAppConfig, + ModelHealthConfig, ProxyConfig, ProxyScope, QQConfig, SandboxConfig, SlackConfig, + TelegramConfig, WhatsAppConfig, }; pub use openhuman_core::config::{ clear_active_user, default_projects_dir, pre_login_user_dir, read_active_user_id, - user_openhuman_dir, write_active_user_id, Config, DaemonConfig, UpdateRestartStrategy, + user_openhuman_dir, write_active_user_id, Config, UpdateRestartStrategy, }; pub use openhuman_core::core::events::DomainEvent; pub use openhuman_core::credentials::bus::SessionExpiredSubscriber; From 38afbc6eab32300e0b0a5be889cee5d782859135 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Nov 2026 03:38:41 +0000 Subject: [PATCH 2/4] fix(config): redact migration URLs via tinyinference sanitizer Route the legacy api_url migration log through tinyinference_core's redact_url instead of the local helper, and register the migrate test module so the migration logic is covered. Auto-committed-on: cuttlefish Co-authored-by: Medulla --- .../openhuman-core/src/config/schema/load/migrate.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/openhuman-core/src/config/schema/load/migrate.rs b/crates/openhuman-core/src/config/schema/load/migrate.rs index 5a24cf8727d..e19e2704c7a 100644 --- a/crates/openhuman-core/src/config/schema/load/migrate.rs +++ b/crates/openhuman-core/src/config/schema/load/migrate.rs @@ -34,7 +34,7 @@ pub(crate) fn migrate_legacy_inference_url(config: &mut Config) { }; let logged = match moved.as_deref() { None => "".to_string(), - Some(u) => crate::util::redact_url_for_log(u), + Some(u) => migration_url_for_log(u), }; tracing::info!( "[config][migrate] splitting legacy api_url -> inference_url (api_url cleared, inference_url={})", @@ -45,6 +45,10 @@ pub(crate) fn migrate_legacy_inference_url(config: &mut Config) { config.load_diagnostics_mut().record_migrated_key("api_url"); } +fn migration_url_for_log(url: &str) -> String { + tinyinference_core::sanitize::redact_url(url) +} + /// Migrate `cloud_providers` entries to the new slug-keyed shape and rewrite /// any per-workload routing strings that still use the old bare-prefix grammar. /// @@ -192,6 +196,10 @@ pub(crate) fn migrate_cloud_provider_slugs(config: &mut Config) { rewrite(&mut config.embeddings_provider); } +#[cfg(test)] +#[path = "migrate_tests.rs"] +mod tests; + if legacy_provider_labels { config .load_diagnostics_mut() From e14d52e314337126a64e58d4209ae5d5713be7db Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Nov 2026 03:38:58 +0000 Subject: [PATCH 3/4] test(config): add migration tests for config schema loading Auto-committed-on: cuttlefish Co-authored-by: Medulla --- .../src/config/schema/load/migrate_tests.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 crates/openhuman-core/src/config/schema/load/migrate_tests.rs diff --git a/crates/openhuman-core/src/config/schema/load/migrate_tests.rs b/crates/openhuman-core/src/config/schema/load/migrate_tests.rs new file mode 100644 index 00000000000..ba46b3f7be8 --- /dev/null +++ b/crates/openhuman-core/src/config/schema/load/migrate_tests.rs @@ -0,0 +1,14 @@ +use super::*; + +#[test] +fn migration_log_url_always_removes_url_secrets() { + let raw = "https://user:password@example.test/v1/chat/completions?api_key=secret#fragment"; + + let logged = migration_url_for_log(raw); + + assert!(!logged.contains("user")); + assert!(!logged.contains("password")); + assert!(!logged.contains("secret")); + assert!(!logged.contains("fragment")); + assert!(logged.contains("api_key")); +} From dc7c0ddf35e5fa51ca8471a8ddfcba25511235c5 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Nov 2026 03:39:45 +0000 Subject: [PATCH 4/4] refactor(config): move test module declaration to end of migrate file Relocated the cfg(test) module declaration for migrate_tests below the migration functions so the test module is declared after the code it exercises. Auto-committed-on: cuttlefish Co-authored-by: Medulla --- crates/openhuman-core/src/config/schema/load/migrate.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/openhuman-core/src/config/schema/load/migrate.rs b/crates/openhuman-core/src/config/schema/load/migrate.rs index e19e2704c7a..f9ac16f68d6 100644 --- a/crates/openhuman-core/src/config/schema/load/migrate.rs +++ b/crates/openhuman-core/src/config/schema/load/migrate.rs @@ -196,10 +196,6 @@ pub(crate) fn migrate_cloud_provider_slugs(config: &mut Config) { rewrite(&mut config.embeddings_provider); } -#[cfg(test)] -#[path = "migrate_tests.rs"] -mod tests; - if legacy_provider_labels { config .load_diagnostics_mut() @@ -249,6 +245,10 @@ mod tests; } } +#[cfg(test)] +#[path = "migrate_tests.rs"] +mod tests; + /// Convert the single-engine `[search]` format into providers, routes and /// roles. In-memory and idempotent like the other load migrations: the legacy /// fields are never serialized, so the next save writes the new format.