Skip to content

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

fix(channels): start channels when no explicit config is present

Steven Enamakel72b9dd5afb93
diff --git a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
index 270b2a5c6c..82e2487f75 100644
--- a/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
+++ b/crates/openhuman-core/src/channels/runtime/startup/start_channels.rs
@@ -103,43 +103,6 @@ async fn start_channels_inner(mut config: Config) -> Result<()> {
// in bootstrap_core_runtime() (crates/openhuman-core/src/core/runtime/bootstrap.rs) to avoid double-registration
// when both startup paths run in the same process.
- let provider_runtime_options = provider::ProviderRuntimeOptions {
- auth_profile_override: None,
- openhuman_dir: config.config_path.parent().map(std::path::PathBuf::from),
- secrets_encrypt: config.secrets.encrypt,
- reasoning_enabled: config.runtime.reasoning_enabled,
- };
- let (model, provider_name) = match resolve_chat_workload(&config) {
- ChatWorkloadResolution::Cloud => {
- let (_chat, model) = provider::create_chat_model_with_model_id(
- "chat",
- &config,
- config.default_temperature,
- )?;
- (model, provider::INFERENCE_BACKEND_ID.to_string())
- }
- ChatWorkloadResolution::Workload {
- provider_string,
- slug,
- } => {
- tracing::info!(
- chat_provider = %provider_string,
- slug = %slug,
- "[channels][startup] chat workload routed to per-workload provider — building dedicated channel provider"
- );
- let (_chat, model_id) = provider::create_chat_model_with_model_id(
- "chat",
- &config,
- config.default_temperature,
- )?;
- (model_id, slug)
- }
- };
-
- let runtime: Arc<dyn host_runtime::RuntimeAdapter> = Arc::from(host_runtime::create_runtime(
- &config.runtime,
- config.shell.hide_window,
- )?);
// Create the agent's action sandbox + default projects home and register the
// projects dir as a ReadWrite trusted root. Shared with the always-run
// `bootstrap_core_runtime` boot so a fresh install gets these dirs even with
@@ -166,35 +129,12 @@ async fn start_channels_inner(mut config: Config) -> Result<()> {
// `OPENHUMAN_DISABLE_CHANNEL_LISTENERS` is set, which would otherwise leave
// channel-less / web-chat-only cores running the default timeout instead of the
// user-configured `[agent].agent_timeout_secs` (#5027).
- // Phase 1 of #1401: audit logger is wired with defaults so emission paths
- // are exercised at runtime. A follow-up promotes `SecurityConfig` (and
- // therefore the `audit` knob) onto the runtime `Config` schema so users
- // can override `enabled`, `log_path`, and `max_size_mb` via TOML. The
- // logger is workspace-scoped and shared, so concurrent sessions append to
- // one `audit.log` without racing on rotation.
- let audit = crate::security::get_or_create_workspace_audit_logger(
- crate::config::AuditConfig::default(),
- config.workspace_dir.clone(),
- )?;
- let temperature = config.default_temperature;
- // Build system prompt from workspace identity files + skills
+ // Model, tools and the identity-refreshing system prompt (`turn_parts`),
+ // shared with the hosted-channel relay.
+ let parts = build_channel_turn_parts(&config, &security, PromptToolDescs::Fixed)?;
+ let model = parts.model.clone();
let workspace = config.workspace_dir.clone();
- let tools_registry = Arc::new(tools::ops::all_tools_with_runtime(
- Arc::new(config.clone()),
- &security,
- runtime,
- audit,
- // `all_tools_with_runtime` no longer takes a memory handle — the two
- // tools that needed one resolve the guarded driver per call.
- &config.browser,
- &config.http_request,
- &config.action_dir,
- &config.agents,
- &config,
- None,
- ));
-
- let skills = crate::skills::load_workflow_metadata(&workspace);
+ let skills = parts.skills.clone();
// Install the triggered-workflow subscriber now that workflows are
// discovered — otherwise any workflow declaring `triggers:` is silently
@@ -203,85 +143,6 @@ async fn start_channels_inner(mut config: Config) -> Result<()> {
// which startup path runs first (web-chat-only cores never reach here).
crate::skills::bus::ensure_triggered_workflow_subscriber(&workspace);
- // Collect tool descriptions for the prompt
- let mut tool_descs: Vec<(&str, &str)> = vec![
- (
- "shell",
- "Execute terminal commands. Use when: running local checks, build/test commands, diagnostics. Don't use when: a safer dedicated tool exists, or command is destructive without approval.",
- ),
- (
- "file_read",
- "Read file contents. Use when: inspecting project files, configs, logs. Don't use when: a targeted search is enough.",
- ),
- (
- "file_write",
- "Write file contents. Use when: applying focused edits, scaffolding files, updating docs/code. Don't use when: side effects are unclear or file ownership is uncertain.",
- ),
- (
- "memory",
- "Long-term memory: recall, fetch, learn, forget. Use when: retrieving prior decisions, preferences or history beyond the <memory-context> each turn already carries, or preserving a durable fact. Don't use when: the answer is already in context or the information is transient.",
- ),
- ];
-
- if config.browser.enabled {
- tool_descs.push((
- "browser_open",
- "Open approved HTTPS URLs in Brave Browser (allowlist-only, no scraping)",
- ));
- }
- // Composio tool descriptions are intentionally excluded from the main
- // agent prompt — integration actions are reached through tool search.
- tool_descs.push((
- "schedule",
- "Manage scheduled tasks (create/list/get/cancel/pause/resume). Supports recurring cron and one-shot delays.",
- ));
- tool_descs.push((
- "pushover",
- "Send a Pushover notification to your device. Requires PUSHOVER_TOKEN and PUSHOVER_USER_KEY in .env file.",
- ));
- if !config.agents.is_empty() {
- tool_descs.push((
- "delegate",
- "Delegate a subtask to a specialized agent. Use when: a task benefits from a different model (e.g. fast summarization, deep reasoning, code generation). The sub-agent runs a single prompt and returns its response.",
- ));
- }
-
- let bootstrap_max_chars = if config.agent.compact_context {
- Some(6000)
- } else {
- None
- };
- // Filter out Workflow-category tools (e.g. Composio, Apify) from the
- // main agent prompt — integration actions are reached through tool search.
- let non_skill_tools: Vec<&Box<dyn tinytools::Tool>> = tools_registry
- .iter()
- .filter(|t| t.category() != tinytools::ToolCategory::Workflow)
- .collect();
- // Everything after the rendered prompt is fixed for the process: the
- // tool-instruction block, then the model's current filesystem access
- // boundaries so it self-limits (advisory only — the SecurityPolicy
- // enforces these regardless).
- let non_skill_specs: Vec<tinytools::ToolSpec> =
- non_skill_tools.iter().map(|tool| tool.spec()).collect();
- let mut prompt_suffix = tinytools_agent::dialect::XmlDialect::instructions(&non_skill_specs);
- prompt_suffix.push_str(&format_access_context(&security));
- // The prompt itself is rendered here for the current identity and
- // re-rendered whenever the active profile or an identity file changes
- // (#6027, #6028). `channel_name = None`: the runtime wires up multiple
- // providers in parallel, so the capability block keeps its
- // platform-agnostic "messaging bot" phrasing.
- let system_prompt = ChannelSystemPrompt::refreshing(ChannelPromptInputs {
- workspace_dir: workspace.clone(),
- model: model.clone(),
- tool_descs: tool_descs
- .iter()
- .map(|(name, desc)| ((*name).to_string(), (*desc).to_string()))
- .collect(),
- skills: skills.clone(),
- bootstrap_max_chars,
- suffix: prompt_suffix,
- });
-
if !skills.is_empty() {
println!(
" 🧩 Skills: {}",
@@ -451,32 +312,7 @@ async fn start_channels_inner(mut config: Config) -> Result<()> {
println!(" 🚦 In-flight message limit: {max_in_flight_messages}");
- let message_timeout_secs =
- effective_channel_message_timeout_secs(config.channels_config.message_timeout_secs);
-
- let runtime_ctx = Arc::new(ChannelRuntimeContext {
- channels_by_name,
- turn_model_source: None,
- default_provider: Arc::new(provider_name),
- tools_registry: Arc::clone(&tools_registry),
- system_prompt,
- model: Arc::new(model.clone()),
- temperature,
- max_tool_iterations: config.agent.max_tool_iterations,
- conversation_histories: Arc::new(Mutex::new(HashMap::new())),
- turn_model_source_cache: Arc::new(Mutex::new(HashMap::new())),
- route_overrides: Arc::new(Mutex::new(HashMap::new())),
- api_url: config.api_url.clone(),
- inference_url: config.inference_url.clone(),
- reliability: Arc::new(config.reliability.clone()),
- provider_runtime_options,
- workspace_dir: Arc::new(config.workspace_dir.clone()),
- message_timeout_secs,
- multimodal: config.multimodal.clone(),
- multimodal_files: config.multimodal_files.clone(),
- // Crate-native turn models for the channel turn (Phase 3 P3-B).
- config: Some(std::sync::Arc::new(config.clone())),
- });
+ let runtime_ctx = Arc::new(runtime_context(&config, parts, channels_by_name));
// Let cron jobs created from a channel chat read that chat's history, send
// into it and append their replies to it.
crate::cron::channel_bridge::register_channel_bridge(