The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(agent): remove remaining profile contracts
Steven Enamakel2fd73f76553f
diff --git a/app/test/playwright/specs/settings-profiles-crud.spec.ts b/app/test/playwright/specs/settings-profiles-crud.spec.tsdeleted file mode 100644index 2ddae4b777..0000000000--- a/app/test/playwright/specs/settings-profiles-crud.spec.ts+++ /dev/null@@ -1,338 +0,0 @@-import { expect, type Page, test } from '@playwright/test';--import {- bootAuthenticatedPage,- callCoreRpc,- dismissWalkthroughIfPresent,- waitForAppReady,-} from '../helpers/core-rpc';--/**- * Agent profiles — the full create / activate / delete journey, verified- * against the core.- *- * My jsdom specs (`ProfileEditorPage.payload.test.tsx`,- * `ProfilesPanel.actions.test.tsx`) assert the payload the panel BUILDS and the- * errors it renders, with the API mocked. What neither can show is that the- * profile actually reaches `openhuman.profiles_upsert`, comes back in- * `profiles_list`, survives a reload, and disappears on delete. No spec in any- * lane does that today.- *- * Each test therefore reads the core's own profile list over RPC and compares.- */--interface Profile {- id?: string;- name?: string;- description?: string;- builtIn?: boolean;-}--/**- * NOTE the shape: `profiles_list` returns `{ activeProfileId, profiles }`- * DIRECTLY — unlike `wallet_status`, whose payload is nested under a second- * `result`. Reading `res.result?.profiles` here silently yields `[]`, so every- * core comparison passes vacuously or fails for the wrong reason. Verified- * against the live RPC.- */-async function coreProfiles(): Promise<{ profiles: Profile[]; activeId?: string }> {- const res = await callCoreRpc<{ profiles?: Profile[]; activeProfileId?: string }>(- 'openhuman.profiles_list',- {}- );- return { profiles: res.profiles ?? [], activeId: res.activeProfileId };-}--const coreIds = async () =>- (await coreProfiles()).profiles- .map(p => p.id)- .filter(Boolean)- .sort();--async function openProfiles(page: Page) {- await page.goto('/#/settings/profiles');- await waitForAppReady(page);- await dismissWalkthroughIfPresent(page);- await expect(page.getByRole('heading', { level: 1 })).toHaveText('Agent Profiles', {- timeout: 30_000,- });-}--/** The list row for a profile, addressed by its visible name. */-const row = (page: Page, name: string) => page.locator('li').filter({ hasText: name }).first();--/** Remove a profile directly, so a test's own leftovers cannot leak forward. */-async function deleteFromCore(id: string) {- // The param is snake_case `profile_id` (agentProfilesApi.ts:43) — `profileId`- // is accepted by the transport and ignored, so the delete silently no-ops.- await callCoreRpc('openhuman.profiles_delete', { profile_id: id }).catch(() => {});-}--test.describe('Agent profiles — create', () => {- // These tests share one hard-coded profile id against a single core, so they- // must not interleave: a parallel worker's afterEach delete can land between- // another test's create and its assertion. Serialising the describe is the- // fix that keeps the id stable and readable (tinysweeper, test-isolation).- test.describe.configure({ mode: 'serial' });- const NAME = 'W1 Browser Profile';- const ID = 'w1-browser-profile';-- test.beforeEach(async ({ page }) => {- await deleteFromCore(ID);- await bootAuthenticatedPage(page, 'pw-w1-profiles', '/settings/profiles');- await openProfiles(page);- });-- test.afterEach(async () => {- await deleteFromCore(ID);- });-- test('creating a profile persists it to the core and lists it', async ({ page }) => {- expect(await coreIds()).not.toContain(ID);-- await page.getByRole('button', { name: 'New profile' }).click();- await expect(page.getByLabel('Name', { exact: true })).toBeVisible({ timeout: 30_000 });-- await page.getByLabel('Name', { exact: true }).click();- await page.keyboard.type(NAME);- await expect(page.getByLabel('ID', { exact: true })).toHaveValue(ID);-- await page.getByRole('button', { name: 'Create' }).click();-- // Back on the list, and the core holds it.- await expect(page.getByRole('heading', { level: 1 })).toHaveText('Agent Profiles', {- timeout: 30_000,- });- await expect.poll(coreIds, { timeout: 20_000 }).toContain(ID);- await expect(row(page, NAME)).toBeVisible({ timeout: 30_000 });- });-- test('a created profile is custom, not built-in, and offers Delete', async ({ page }) => {- await page.getByRole('button', { name: 'New profile' }).click();- await page.getByLabel('Name', { exact: true }).click();- await page.keyboard.type(NAME);- await page.getByRole('button', { name: 'Create' }).click();- await expect.poll(coreIds, { timeout: 20_000 }).toContain(ID);-- const created = (await coreProfiles()).profiles.find(p => p.id === ID);- expect(created?.builtIn ?? false).toBe(false);-- // Built-ins hide Delete; a custom profile must offer it.- await expect(row(page, NAME).getByText('Delete')).toBeVisible({ timeout: 30_000 });- });-- test('the created profile survives a reload', async ({ page }) => {- await page.getByRole('button', { name: 'New profile' }).click();- await page.getByLabel('Name', { exact: true }).click();- await page.keyboard.type(NAME);- await page.getByRole('button', { name: 'Create' }).click();- await expect.poll(coreIds, { timeout: 20_000 }).toContain(ID);-- await page.reload();- await waitForAppReady(page);- await dismissWalkthroughIfPresent(page);-- await expect(row(page, NAME)).toBeVisible({ timeout: 30_000 });- });-});--test.describe('Agent profiles — activate and delete', () => {- // These tests share one hard-coded profile id against a single core, so they- // must not interleave: a parallel worker's afterEach delete can land between- // another test's create and its assertion. Serialising the describe is the- // fix that keeps the id stable and readable (tinysweeper, test-isolation).- test.describe.configure({ mode: 'serial' });- const NAME = 'W1 Lifecycle Profile';- const ID = 'w1-lifecycle-profile';-- test.beforeEach(async ({ page }) => {- await deleteFromCore(ID);- await callCoreRpc('openhuman.profiles_upsert', {- profile: {- id: ID,- name: NAME,- description: 'Created over RPC so the test starts from a known list.',- agentId: 'orchestrator',- builtIn: false,- includeAgentConversations: true,- },- }).catch(() => {});- await bootAuthenticatedPage(page, 'pw-w1-profiles-life', '/settings/profiles');- await openProfiles(page);- });-- test.afterEach(async () => {- await deleteFromCore(ID);- });-- test('Set as active moves the active profile in the core', async ({ page }) => {- const before = (await coreProfiles()).activeId;- expect(before).not.toBe(ID);-- await row(page, NAME).getByText('Set as active').click();-- await expect.poll(async () => (await coreProfiles()).activeId, { timeout: 20_000 }).toBe(ID);- // The row stops offering "Set as active" once it IS active.- await expect(row(page, NAME).getByText('Set as active')).toHaveCount(0, { timeout: 30_000 });- });-- test('deleting removes it from the core and from the list', async ({ page }) => {- page.once('dialog', d => void d.accept());-- await expect(row(page, NAME)).toBeVisible({ timeout: 30_000 });- await row(page, NAME).getByText('Delete').click();-- await expect.poll(coreIds, { timeout: 20_000 }).not.toContain(ID);- await expect(page.getByText(NAME)).toHaveCount(0, { timeout: 30_000 });- });-- test('dismissing the delete confirm keeps the profile', async ({ page }) => {- page.once('dialog', d => void d.dismiss());-- await row(page, NAME).getByText('Delete').click();-- // Nothing should have been asked of the core, and the row stays.- await expect(row(page, NAME)).toBeVisible();- expect(await coreIds()).toContain(ID);- });-- test('Edit opens the editor with the profile hydrated from the core', async ({ page }) => {- await row(page, NAME).getByText('Edit').click();-- await expect(page.getByLabel('Name', { exact: true })).toHaveValue(NAME, { timeout: 30_000 });- // Edit mode renders the id as a non-editable `<code>`, not a read-only input:- // `ProfileEditorPage.tsx:224-229` branches on `isCreate` and only the create- // branch renders a `SettingsTextField` with an `aria-label`. So there is no- // labelled control to find and the count is 0, not 1 (tinysweeper flagged this- // as possibly a hidden-but-present field; it is genuinely absent).- await expect(page.getByLabel('ID', { exact: true })).toHaveCount(0);- });-});--/**- * Failure paths (#5944 / #5900).- *- * Every test above is a happy path, which is how `[object Object]` shipped:- * `dispatch(thunk).unwrap()` rejects with Redux Toolkit's `SerializedError` — a- * plain object, never an `Error` — so the old `err instanceof Error` guard took- * its `String(err)` branch and stringified an object. The defect was even pinned- * as *expected* in a jsdom test before #5944 inverted it.- *- * These drive the real panels against a real core with only the one failing- * method stubbed, so the whole chain the fix lives on runs:- * `core RPC error → CoreRpcError → thunk rejection → SerializedError →- * errorMessage() → rendered text`. `coreRpcClient.ts:855-859` puts the JSON-RPC- * `error.message` on `CoreRpcError` verbatim, so the string asserted here is the- * one the backend sent.- *- * Each asserts the message IS shown *and* that `[object Object]` is NOT — the- * first fails on a regression, the second names the specific defect.- */-test.describe('Agent profiles — a failing action shows the reason', () => {- test.describe.configure({ mode: 'serial' });- const NAME = 'W6 Failure Profile';- const ID = 'w6-failure-profile';-- /**- * Fail exactly one RPC method with a JSON-RPC error, passing everything else- * through to the real core.- *- * The message is deliberately bland: `classifyRpcError` re-routes anything- * that looks like an auth, timeout or not-found failure, and a reclassified- * error would take a different path through the UI than the one under test.- */- const failMethod = async (page: Page, method: string, message: string) => {- await page.route('**/rpc', async (route, request) => {- const body = JSON.parse(request.postData() || '{}');- if (body.method === method) {- await route.fulfill({- status: 200,- contentType: 'application/json',- body: JSON.stringify({ jsonrpc: '2.0', id: body.id, error: { code: -32000, message } }),- });- return;- }- await route.continue();- });- };-- test.afterEach(async () => {- await deleteFromCore(ID);- });-- test('a failing save shows the backend reason, not [object Object]', async ({ page }) => {- const REASON = 'the core declined to store this profile';- await deleteFromCore(ID);- await bootAuthenticatedPage(page, 'pw-w6-profile-fail', '/settings/profiles');- await openProfiles(page);- await failMethod(page, 'openhuman.profiles_upsert', REASON);-- await page.getByRole('button', { name: 'New profile' }).click();- await expect(page.getByLabel('Name', { exact: true })).toBeVisible({ timeout: 30_000 });- await page.getByLabel('Name', { exact: true }).click();- await page.keyboard.type(NAME);- await page.getByRole('button', { name: 'Create' }).click();-- const alert = page.getByRole('alert');- await expect(alert).toContainText(REASON, { timeout: 30_000 });- await expect(alert).not.toContainText('[object Object]');-- // The editor must stay open on failure — navigating back to the list would- // discard what the user typed on an error they can act on.- await expect(page.getByLabel('Name', { exact: true })).toHaveValue(NAME);- });-- test('a failing Set as active shows the backend reason, not [object Object]', async ({- page,- }) => {- const REASON = 'the core declined to switch profile';- await deleteFromCore(ID);- await callCoreRpc('openhuman.profiles_upsert', {- profile: {- id: ID,- name: NAME,- description: 'Seeded over RPC so the list starts from a known state.',- agentId: 'orchestrator',- builtIn: false,- includeAgentConversations: true,- },- }).catch(() => {});- await bootAuthenticatedPage(page, 'pw-w6-profile-fail-select', '/settings/profiles');- await openProfiles(page);- await failMethod(page, 'openhuman.profiles_select', REASON);-- await row(page, NAME).getByText('Set as active').click();-- // ProfilesPanel renders `actionError` as a plain styled <p>, not an Alert,- // so this is located by its text rather than by role.- await expect(page.getByText(REASON)).toBeVisible({ timeout: 30_000 });- await expect(page.getByText('[object Object]')).toHaveCount(0);- });-- test('a failing delete shows the backend reason, not [object Object]', async ({ page }) => {- const REASON = 'the core declined to remove this profile';- await deleteFromCore(ID);- await callCoreRpc('openhuman.profiles_upsert', {- profile: {- id: ID,- name: NAME,- description: 'Seeded over RPC so the list starts from a known state.',- agentId: 'orchestrator',- builtIn: false,- includeAgentConversations: true,- },- }).catch(() => {});- await bootAuthenticatedPage(page, 'pw-w6-profile-fail-delete', '/settings/profiles');- await openProfiles(page);- await failMethod(page, 'openhuman.profiles_delete', REASON);-- page.once('dialog', d => void d.accept());- await row(page, NAME).getByText('Delete').click();-- await expect(page.getByText(REASON)).toBeVisible({ timeout: 30_000 });- await expect(page.getByText('[object Object]')).toHaveCount(0);-- // The delete failed, so the profile must still be there.- await expect(row(page, NAME)).toBeVisible();- });-});diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.tomlindex f6838b29e8..bcb47010c8 100644--- a/crates/openhuman-core/Cargo.toml+++ b/crates/openhuman-core/Cargo.toml@@ -278,10 +278,6 @@ path = "../../tests/orchestrator_parallel_fanout_routing.rs"name = "orchestrator_presentation_wiring"path = "../../tests/orchestrator_presentation_wiring.rs"-[[test]]-name = "personality_e2e"-path = "../../tests/personality_e2e.rs"-[[test]]name = "skill_registry_e2e"path = "../../tests/skill_registry_e2e.rs"diff --git a/crates/openhuman-core/src/agent/README.md b/crates/openhuman-core/src/agent/README.mdindex bab73f357e..8eddc0ddd0 100644--- a/crates/openhuman-core/src/agent/README.md+++ b/crates/openhuman-core/src/agent/README.md@@ -4,7 +4,7 @@ Multi-agent orchestration domain. Owns the LLM tool-calling loop, sub-agent disp## Public surface-- `pub struct Agent` / `pub struct AgentBuilder` / `pub struct TurnOverrides` — `harness/session/types.rs`, re-exported from `harness::session` and `agent` — top-level conversation runtime; entry point for any chat turn. Constructors `Agent::from_config`, `from_config_for_agent`, `from_config_for_agent_with_profile` live in `harness/session/builder/factory.rs`; `run_single` / `run_interactive` in `harness/session/runtime/run_loop.rs`. The `builder/`, `runtime/`, and `turn/` submodules are private.+- `pub struct Agent` / `pub struct AgentBuilder` / `pub struct TurnOverrides` — `harness/session/types.rs`, re-exported from `harness::session` and `agent` — top-level conversation runtime; entry point for any chat turn. Constructors `Agent::from_config` and `from_config_for_agent` live in `harness/session/builder/factory.rs`; `run_single` / `run_interactive` in `harness/session/runtime/run_loop.rs`. The `builder/`, `runtime/`, and `turn/` submodules are private.- `pub fn run_subagent` / `pub struct SubagentRunOptions` / `pub enum SubagentRunError` — `harness/subagent_runner/` — execute a hierarchical sub-agent from a parent tool loop.- `pub struct AgentDefinition` / `pub struct AgentDefinitionRegistry` / `pub enum SandboxMode` / `pub enum ToolScope` — `harness/definition/` (`agent_definition.rs`, `registry.rs`, `source.rs`, `tier.rs`, `execution_spec.rs`, `prompt_source.rs`, `subagents.rs`) — sub-agent archetypes loaded from built-ins + workspace TOML.- `pub mod harness::fork_context` — task-local parent context for KV-cache reuse.@@ -32,7 +32,6 @@ Multi-agent orchestration domain. Owns the LLM tool-calling loop, sub-agent disp| `library/` | Safe, user-facing projection of agent definitions (`AgentDefinitionDisplay`) || `orchestration/` | Command center, workflow runs, agent teams, worktrees, subagent control, `spawn_subagent` and its sibling tools ([README](orchestration/README.md)) || `plan_review/` | Interactive plan-review gate that parks a live turn on a thread-scoped plan |-| `profiles/` | Persistent agent profiles (name, soul, memory sources, skills, MCP, connectors) ([README](profiles/README.md)) || `progress_tracing.rs` + `progress_tracing/` (`pub(crate)`) | Structured OpenTelemetry/Langfuse-style spans off the `progress::AgentProgress` stream ([README](progress_tracing/README.md)) || `prompts/` | Prompt types, section builders, `SystemPromptBuilder` ([README](prompts/README.md)) || `registry/` | User-facing agent registry: defaults, enablement, custom agents, tool policy; `registry/agents/` holds built-in archetypes ([README](registry/README.md)) |@@ -40,7 +39,7 @@ Multi-agent orchestration domain. Owns the LLM tool-calling loop, sub-agent disp| `session_import/` | One-time import of legacy OpenHuman session JSONL/Markdown into TinyAgents stores ([README](session_import/README.md)) || `task_dispatcher/` | Claims a `TaskBoardCard` via compare-and-set and runs one autonomous agent turn against it; `start_board_poller` drives it in the background ([README](task_dispatcher/README.md)) || `tinyagents/` | Integration with the vendored `tinyagents` loop/replay crate: `TurnModelSource`, middleware, journal, `replay/schemas.rs` ([README](tinyagents/README.md)) |-| `tools/` | Agent-loop control tools (`ask_clarification`, `delegate`, `delegate_to_personality`, `plan_exit`, `remember_preference`, `save_preference`, `run_workflow`, `todo`, `update_task`), re-exported through `crate::tools` |+| `tools/` | Agent-loop control tools (`ask_clarification`, `delegate`, `plan_exit`, `remember_preference`, `save_preference`, `run_workflow`, `todo`, `update_task`), re-exported through `crate::tools` || `triage/` | Classifies external `TriggerEnvelope`s and escalates to sub-agents ([README](triage/README.md)) |Flat files: `bus.rs` (`agent.run_turn` native request handler), `cost.rs` (`pub(crate)`, per-turn token/cost accounting), `error.rs` (typed retryable/permanent loop errors), `hooks.rs` (post-turn self-learning hooks), `host_runtime.rs` (native shell execution backend), `message_convert.rs` (`pub(crate)`, transcript/provider conversion), `messages.rs` (transcript types), `multimodal.rs` (attachment handling), `platform_shell.rs` (cross-platform shell selection shared with `host_runtime` and `sandbox::ops`), `progress.rs` (`AgentProgress` channel), `progress_sink.rs` (task-local progress sink for in-process embedders), `stop_hooks.rs` (mid-turn policy halts), `task_board.rs` (per-thread task board over `tinyagents_graph::todos`), `task_session.rs` (`pub(crate)`, task-board runs as conversation threads), `tool_policy.rs` (pre-execution tool-call policy hook), `turn_origin.rs` (task-local trust/routing label read by the approval gate), `turn_workspace.rs` (task-local per-turn filesystem root).diff --git a/crates/openhuman-core/src/agent/registry/agents/loader_tests_specialist_agents_tests.rs b/crates/openhuman-core/src/agent/registry/agents/loader_tests_specialist_agents_tests.rsindex b89aa0b333..b8b57c8bd9 100644--- a/crates/openhuman-core/src/agent/registry/agents/loader_tests_specialist_agents_tests.rs+++ b/crates/openhuman-core/src/agent/registry/agents/loader_tests_specialist_agents_tests.rs@@ -70,7 +70,7 @@ fn workflow_builder_is_registered_worker_with_bounded_authoring_scope() {"search_tool_catalog","get_tool_contract","get_tool_output_sample",- "list_agent_profiles",+ "list_agent_definitions","list_connectable_toolkits","list_node_kinds","get_node_kind_contract",diff --git a/crates/openhuman-core/src/cron/scheduler/agent_run.rs b/crates/openhuman-core/src/cron/scheduler/agent_run.rsindex 1fa2fde90a..0d6258ddb1 100644--- a/crates/openhuman-core/src/cron/scheduler/agent_run.rs+++ b/crates/openhuman-core/src/cron/scheduler/agent_run.rs@@ -1,5 +1,5 @@//! Execution of `JobType::Agent` and `JobType::Flow` jobs: agent construction-//! (definition / profile attribution) and the single scheduled turn.+//! (definition selection) and the single scheduled turn.use super::delivery::is_morning_briefing_job;use super::failure_classification::classify_agent_anyhow_for_user;@@ -128,7 +128,7 @@ pub(super) async fn run_agent_job("[cron] building isolated agent for scheduled job");match build_agent_for_cron_job(&effective, job) {- Ok(BuiltCronAgent { mut agent, profile }) => {+ Ok(BuiltCronAgent { mut agent }) => {// Tag events so downstream subscribers can correlate// cron-triggered turns. `cron` is the channel so the// event bus can filter from other flows (`cli`, `web`…).@@ -142,12 +142,9 @@ pub(super) async fn run_agent_job(job_id: job.id.clone(),source: crate::agent::turn_origin::TrustedAutomationSource::Cron,};- let turn = crate::memory::source_scope::with_source_scope(- profile.and_then(|profile| profile.memory_sources),- crate::agent::turn_origin::with_origin(- origin,- agent.run_single(&prefixed_prompt),- ),+ let turn = crate::agent::turn_origin::with_origin(+ origin,+ agent.run_single(&prefixed_prompt),);// Morning briefing only: install a 24h task-recency window// so Composio task-fetch tools (Linear/ClickUp/Notion/Asana)diff --git a/crates/openhuman-core/src/cron/scheduler_profile_and_shell_tests.rs b/crates/openhuman-core/src/cron/scheduler_profile_and_shell_tests.rsdeleted file mode 100644index 523dbaca91..0000000000--- a/crates/openhuman-core/src/cron/scheduler_profile_and_shell_tests.rs+++ /dev/null@@ -1,630 +0,0 @@-use super::*;--use crate::cron::JobType;-use crate::cron::SessionTarget;-#[tokio::test]-async fn resolve_cron_profile_present_and_deleted_fallback() {- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;-- // A job attributed to profile "alice".- let mut job = test_job("");- job.job_type = JobType::Agent;- job.profile_id = Some("alice".into());-- // Profile does not exist yet → None (the deleted-profile fallback path;- // the scheduler runs the job without a profile rather than failing it).- assert!(- resolve_cron_profile(&config, &job).unwrap().is_none(),- "missing profile must resolve to None"- );-- // Seed the profile → it now resolves.- let mut profile = crate::agent::profiles::store::built_in_default_profile();- profile.id = "alice".into();- profile.name = "Alice".into();- profile.built_in = false;- profile.is_master = false;- crate::agent::profiles::store::AgentProfileStore::new(config.workspace_dir.clone())- .upsert(profile)- .expect("seed profile");- let resolved = resolve_cron_profile(&config, &job)- .expect("profile store loads")- .expect("profile resolves");- assert_eq!(resolved.id, "alice");-- // A job with no attribution is always None.- let plain = test_job("");- assert!(resolve_cron_profile(&config, &plain).unwrap().is_none());-}--#[tokio::test]-async fn existing_profile_agent_build_failure_does_not_fall_back_profile_less() {- crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins()- .expect("init built-in agent definitions");- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;-- let mut profile = crate::agent::profiles::store::built_in_default_profile();- profile.id = "alice".into();- profile.agent_id = "removed-agent-definition".into();- profile.built_in = false;- profile.is_master = false;- crate::agent::profiles::store::AgentProfileStore::new(config.workspace_dir.clone())- .upsert(profile)- .expect("seed profile");-- let mut job = test_job("");- job.job_type = JobType::Agent;- job.profile_id = Some("alice".into());-- let error = match build_agent_for_cron_job(&config, &job) {- Ok(_) => panic!("existing profile build failure must not fall back profile-less"),- Err(error) => error,- };- assert!(error.to_string().contains("under attributed profile"));- assert!(error.to_string().contains("removed-agent-definition"));-}--#[tokio::test]-async fn attributed_cron_build_retains_profile_gates() {- // The embedding seam fails loudly when unwired. Installed here rather- // than relied upon from another test: `install_for_tests` is- // `Once`-guarded, so a test that omits it passes only while some- // earlier test in the same binary happened to run first.- crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins()- .expect("init built-in agent definitions");- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;-- let mut profile = crate::agent::profiles::store::built_in_default_profile();- profile.id = "alice".into();- profile.built_in = false;- // `shell` rather than `file_read`: the subject here is that a profile's- // `allowed_tools` gate survives the cron build, and `file_read` moved into- // the `files` tool pack, so the visible set would come back as the- // `use_skill` proxy and the assertion would be about packing instead.- profile.allowed_tools = Some(vec!["shell".into()]);- profile.memory_sources = Some(vec!["slack:#eng".into()]);- crate::agent::profiles::store::AgentProfileStore::new(config.workspace_dir.clone())- .upsert(profile)- .expect("seed profile");-- let mut job = test_job("");- job.job_type = JobType::Agent;- job.profile_id = Some("alice".into());- let built = build_agent_for_cron_job(&config, &job).expect("build attributed cron agent");-- assert_eq!(- built.agent.visible_tool_names_for_test(),- &["shell".to_string()].into_iter().collect()- );- assert_eq!(- built.profile.and_then(|profile| profile.memory_sources),- Some(vec!["slack:#eng".to_string()]),- "the run wrapper must retain the resolved profile for memory scoping"- );-}--#[tokio::test]-async fn attributed_cron_build_applies_profile_temperature_and_prompt_defaults() {- // The embedding seam fails loudly when unwired. Installed here rather- // than relied upon from another test: `install_for_tests` is- // `Once`-guarded, so a test that omits it passes only while some- // earlier test in the same binary happened to run first.- crate::agent::harness::definition::AgentDefinitionRegistry::init_global_builtins()- .expect("init built-in agent definitions");- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;-- let mut profile = crate::agent::profiles::store::built_in_default_profile();- profile.id = "alice-runtime".into();- profile.built_in = false;- profile.model_override = Some("profile-runtime-model".into());- profile.temperature = Some(0.17);- profile.system_prompt_suffix = Some("CRON_PROFILE_SUFFIX_SENTINEL".into());- crate::agent::profiles::store::AgentProfileStore::new(config.workspace_dir.clone())- .upsert(profile)- .expect("seed profile");-- let mut job = test_job("");- job.job_type = JobType::Agent;- job.profile_id = Some("alice-runtime".into());- let built = build_agent_for_cron_job(&config, &job).expect("build attributed cron agent");-- // Explicit profile model selection must win over the built-in agent hint.- assert_eq!(built.agent.model_name(), "profile-runtime-model");- assert_eq!(built.agent.temperature(), 0.17);- let prompt = built- .agent- .build_system_prompt(crate::agent::prompts::LearnedContextData::default())- .expect("build cron system prompt");- assert!(prompt.contains("CRON_PROFILE_SUFFIX_SENTINEL"));-}--#[test]-fn cron_job_model_override_wins_over_profile_model() {- let config = Config {- default_model: Some("config-model".into()),- ..Config::default()- };- let mut profile = crate::agent::profiles::store::built_in_default_profile();- profile.model_override = Some("profile-model".into());- profile.temperature = Some(0.23);- let mut job = test_job("");- job.model = Some("job-model".into());-- let effective = apply_cron_profile_runtime_defaults(&config, &job, &profile);- assert_eq!(effective.default_model.as_deref(), Some("job-model"));- assert_eq!(effective.default_temperature, 0.23);-}--#[test]-fn agent_failure_copy_mentions_retry_reporting_and_discord() {- assert!(AGENT_JOB_USER_FAILURE_MESSAGE.contains("Something went wrong. Please try again."));- assert!(AGENT_JOB_USER_FAILURE_MESSAGE.contains("This error has been reported."));- assert!(AGENT_JOB_USER_FAILURE_MESSAGE.contains("Report on Discord"));-}--#[test]-fn cron_alert_body_rewrites_morning_briefing_failure() {- let mut job = test_job("");- job.job_type = JobType::Agent;- job.name = Some("morning_briefing".into());- job.agent_id = Some("morning_briefing".into());-- let body = cron_alert_body(&job, AGENT_JOB_USER_FAILURE_MESSAGE);-- assert_eq!(body, MORNING_BRIEFING_FAILURE_NOTIFICATION);- assert!(!body.contains("Something went wrong"));- assert!(!body.contains("<openhuman-link"));-}--#[test]-fn cron_alert_body_strips_openhuman_link_markup() {- let job = test_job("");- let body = cron_alert_body(- &job,- "Read <openhuman-link path=\"settings/notifications\">notification settings</openhuman-link> before tomorrow.",- );-- assert_eq!(body, "Read notification settings before tomorrow.");- assert!(!body.contains("<openhuman-link"));-}--#[tokio::test]-async fn push_cron_alert_deduplicates_repeated_morning_briefing_failures() {- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;- let mut job = test_job("");- job.job_type = JobType::Agent;- job.name = Some("morning_briefing".into());- job.agent_id = Some("morning_briefing".into());-- push_cron_alert(&config, &job, AGENT_JOB_USER_FAILURE_MESSAGE);- push_cron_alert(&config, &job, AGENT_JOB_USER_FAILURE_MESSAGE);-- let items =- crate::desktop::notifications::store::list(&config, 10, 0, Some("cron"), None).unwrap();- assert_eq!(items.len(), 1);- assert_eq!(items[0].body, MORNING_BRIEFING_FAILURE_NOTIFICATION);-}--// TAURI-RUST-HCK — a failed cron job with NO delivery configured (the default-// `mode = "none"`) must still surface in /notifications. Before the hoist,-// `push_cron_alert` fired only inside the proactive / announce arms, so a-// keyless agent job ("API key not set") failed silently in the alerts tab —-// the user had no active signal that their cron was broken.-#[tokio::test]-async fn deliver_if_configured_alerts_no_delivery_failure() {- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;- let mut job = test_job("");- job.job_type = JobType::Agent;- job.name = Some("hermes".into());- assert_eq!(job.delivery.mode, "none", "exercise the no-delivery arm");-- let failure =- "openrouter API key not set. Configure via the web UI or set the appropriate env var.";- deliver_if_configured(&config, &job, failure, false)- .await- .unwrap();-- let items =- crate::desktop::notifications::store::list(&config, 10, 0, Some("cron"), None).unwrap();- assert_eq!(- items.len(),- 1,- "a no-delivery cron FAILURE must still alert /notifications"- );- assert!(- items[0].body.contains("API key not set"),- "alert body must carry the actionable missing-key wording"- );-}--// Negative guard: a successful no-delivery run with no output must NOT alert —-// the hoist only surfaces failures + non-empty results, never quiet successes.-#[tokio::test]-async fn deliver_if_configured_does_not_alert_successful_empty_no_delivery() {- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;- let mut job = test_job("");- job.job_type = JobType::Agent;- job.name = Some("hermes".into());-- deliver_if_configured(&config, &job, "", true)- .await- .unwrap();-- let items =- crate::desktop::notifications::store::list(&config, 10, 0, Some("cron"), None).unwrap();- assert!(- items.is_empty(),- "a successful empty run must not spam the alerts tab"- );-}--// Codex #4166 — a SUCCESSFUL no-delivery (`none`) run with output must stay-// silent: its result lives in last_output only (the cron contract), so the-// hoisted alert must NOT fire an unread /notifications entry every interval.-// Failures still alert (above); delivering modes still alert success (below).-#[tokio::test]-async fn deliver_if_configured_does_not_alert_successful_none_delivery_with_output() {- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;- let mut job = test_job("");- job.job_type = JobType::Agent;- assert_eq!(job.delivery.mode, "none", "exercise the no-delivery arm");-- deliver_if_configured(&config, &job, "daily digest: 3 new items", true)- .await- .unwrap();-- assert_eq!(- cron_alerts(&config).await,- 0,- "a successful none-delivery run must not alert (silent by contract)"- );-}--// Counterpart to the gate: a delivering mode (proactive) DOES alert a-// successful non-empty run — the mode gate only silences `none`.-#[tokio::test]-async fn deliver_if_configured_alerts_successful_proactive_with_output() {- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;- let job = proactive_job();-- deliver_if_configured(&config, &job, "morning briefing ready", true)- .await- .unwrap();-- assert_eq!(- cron_alerts(&config).await,- 1,- "a delivering-mode successful run still surfaces in /notifications"- );-}--// CodeRabbit #4169 — a permanent config/billing halt must surface its specific,-// actionable copy (not the generic "Something went wrong"), and that copy must-// be a static `&'static str` (no raw-error leak). Precedence mirrors the halt-// classifiers: credits → budget → missing key.-#[test]-fn permanent_halt_message_maps_each_state_to_actionable_static_copy() {- assert_eq!(- permanent_halt_message(true, false),- CRON_HALT_INSUFFICIENT_CREDITS_MESSAGE- );- assert_eq!(- permanent_halt_message(false, true),- CRON_HALT_BUDGET_EXHAUSTED_MESSAGE- );- // Neither credits nor budget set → the missing-key state.- assert_eq!(- permanent_halt_message(false, false),- CRON_HALT_API_KEY_UNSET_MESSAGE- );- // Credits wins when both flags are set (evaluation order).- assert_eq!(- permanent_halt_message(true, true),- CRON_HALT_INSUFFICIENT_CREDITS_MESSAGE- );- // None of the canned bodies are the generic fallback; all are non-empty and- // config-actionable rather than the "report on Discord" generic copy.- for body in [- CRON_HALT_API_KEY_UNSET_MESSAGE,- CRON_HALT_INSUFFICIENT_CREDITS_MESSAGE,- CRON_HALT_BUDGET_EXHAUSTED_MESSAGE,- ] {- assert!(!body.is_empty());- assert_ne!(body, AGENT_JOB_USER_FAILURE_MESSAGE);- assert!(- !body.contains("Discord"),- "permanent-halt copy must be config-actionable, not the generic report message"- );- }-}--#[test]-fn agent_session_target_tag_matches_expected_values() {- assert_eq!(agent_session_target_tag(&SessionTarget::Main), "main");- assert_eq!(- agent_session_target_tag(&SessionTarget::Isolated),- "isolated"- );-}--#[cfg(not(windows))]-#[tokio::test]-async fn run_job_command_success() {- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;- let job = test_job("echo scheduler-ok");- let security = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.workspace_dir,- );-- let (success, output) = run_job_command(&config, &security, &job).await;- assert!(success);- assert!(output.contains("scheduler-ok"));- assert!(output.contains("status=exit status: 0"));-}--#[cfg(not(windows))]-#[tokio::test]-async fn run_job_command_failure() {- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp).await;- // Pin the absolute path so `sh -lc` doesn't pick up a- // homebrew / PATH-shadowed `ls` that macOS SIP refuses to- // execute under an unsigned cargo-test binary. `/bin/ls` is- // an Apple-signed system binary on macOS and present on- // Linux, so this keeps CI behaviour identical while making- // local dev runs deterministic.- let job = test_job("/bin/ls definitely_missing_file_for_scheduler_test");- let security = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.workspace_dir,- );-- let (success, output) = run_job_command(&config, &security, &job).await;- assert!(!success);- assert!(output.contains("definitely_missing_file_for_scheduler_test"));- assert!(output.contains("status=exit status:"));-}--#[cfg(not(windows))]-#[tokio::test]-async fn run_job_command_times_out() {- let tmp = TempDir::new().unwrap();- let mut config = test_config(&tmp).await;- config.autonomy.allowed_commands = vec!["sleep".into()];- // Pin `/bin/sleep` — see note on `run_job_command_failure` for why.- let job = test_job("/bin/sleep 1");- let security = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.workspace_dir,- );-- let (success, output) =- run_job_command_with_timeout(&config, &security, &job, Duration::from_millis(50)).await;- assert!(!success);- assert!(output.contains("job timed out after"));-}--#[tokio::test]-async fn run_job_command_blocks_disallowed_command() {- let tmp = TempDir::new().unwrap();- let mut config = test_config(&tmp).await;- config.autonomy.allowed_commands = vec!["echo".into()];- let job = test_job("curl https://evil.example");- let security = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.workspace_dir,- );-- let (success, output) = run_job_command(&config, &security, &job).await;- assert!(!success);- assert!(output.contains("blocked by security policy"));- assert!(output.contains("command not allowed"));-}--#[tokio::test]-async fn run_job_command_blocks_forbidden_path_argument() {- let tmp = TempDir::new().unwrap();- let mut config = test_config(&tmp).await;- config.autonomy.allowed_commands = vec!["cat".into()];- let job = test_job("cat /etc/passwd");- let security = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.workspace_dir,- );-- let (success, output) = run_job_command(&config, &security, &job).await;- assert!(!success);- assert!(output.contains("blocked by security policy"));- assert!(output.contains("forbidden path argument"));- assert!(output.contains("/etc/passwd"));-}--#[tokio::test]-async fn run_job_command_blocks_readonly_mode() {- let tmp = TempDir::new().unwrap();- let mut config = test_config(&tmp).await;- config.autonomy.level = crate::security::AutonomyLevel::ReadOnly;- let job = test_job("echo should-not-run");- let security = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.workspace_dir,- );-- let (success, output) = run_job_command(&config, &security, &job).await;- assert!(!success);- assert!(output.contains("blocked by security policy"));- assert!(output.contains("read-only"));-}--#[tokio::test]-async fn run_job_command_blocks_rate_limited() {- let tmp = TempDir::new().unwrap();- let mut config = test_config(&tmp).await;- config.autonomy.max_actions_per_hour = 0;- let job = test_job("echo should-not-run");- let security = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.workspace_dir,- );-- let (success, output) = run_job_command(&config, &security, &job).await;- assert!(!success);- assert!(output.contains("blocked by security policy"));- assert!(output.contains("rate limit exceeded"));-}--#[cfg(not(windows))]-#[tokio::test]-async fn execute_job_with_retry_recovers_after_first_failure() {- let tmp = TempDir::new().unwrap();- let mut config = test_config(&tmp).await;- config.reliability.scheduler_retries = 1;- config.reliability.provider_backoff_ms = 1;- config.autonomy.allowed_commands = vec!["retry-once.sh".into()];- let security = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.workspace_dir,- );-- // Pin absolute paths inside the script too — some dev- // environments have a homebrew `touch` on PATH that macOS- // SIP refuses to execute under an unsigned cargo-test binary.- let script = config.workspace_dir.join("retry-once.sh");- tokio::fs::write(- &script,- "#!/bin/sh\nif [ -f retry-ok.flag ]; then\n echo recovered\n exit 0\nfi\n/usr/bin/touch retry-ok.flag\nexit 1\n",- )- .await- .unwrap();- let mut permissions = tokio::fs::metadata(&script).await.unwrap().permissions();- permissions.set_mode(0o755);- tokio::fs::set_permissions(&script, permissions)- .await- .unwrap();- let job = test_job("./retry-once.sh");-- let (success, output) = execute_job_with_retry(&config, &security, &job).await;- assert!(success);- assert!(output.contains("recovered"));-}--#[cfg(not(windows))]-#[tokio::test]-async fn execute_job_with_retry_exhausts_attempts() {- let tmp = TempDir::new().unwrap();- let mut config = test_config(&tmp).await;- config.reliability.scheduler_retries = 1;- config.reliability.provider_backoff_ms = 1;- let security = SecurityPolicy::from_config(- &config.autonomy,- &config.workspace_dir,- &config.workspace_dir,- );-- // Pin `/bin/ls` — see note on `run_job_command_failure`.- let job = test_job("/bin/ls always_missing_for_retry_test");-- let (success, output) = execute_job_with_retry(&config, &security, &job).await;- assert!(!success);- assert!(output.contains("always_missing_for_retry_test"));-}--// TAURI-RUST-N — backend 401 ("Invalid token") leaks from a cron-fired agent-// job through `last_agent_error` and the existing classifier in-// `core::observability::is_session_expired_message` matches it (the-// `OpenHuman API error (401` + `"error":"Invalid token"` conjunction was added-// for OPENHUMAN-TAURI-4P0). `is_session_expired_failure` MUST consult that-// classifier so the cron retry loop halts on the first occurrence instead of-// retrying N times and reporting `failure=retries_exhausted` to Sentry.-#[test]-fn is_session_expired_failure_matches_openhuman_backend_401_in_agent_error() {- let wire =- r#"OpenHuman API error (401 Unauthorized): {"success":false,"error":"Invalid token"}"#;- assert!(- is_session_expired_failure(&JobType::Agent, Some(wire), AGENT_JOB_USER_FAILURE_MESSAGE),- "raw agent error carrying the 401 wire shape must trip the halt"- );-}--// Defense-in-depth: if a future code path ever surfaces the raw error in-// `last_output` instead of `last_agent_error` (currently `run_agent_job`-// keeps the canned user message in `last_output`), the predicate should-// still classify. Falling back to `last_output` when `last_agent_error` is-// `None` is what guards against that silent-miss case.-#[test]-fn is_session_expired_failure_matches_when_only_output_carries_signal() {- let wire =- r#"OpenHuman API error (401 Unauthorized): {"success":false,"error":"Invalid token"}"#;- assert!(is_session_expired_failure(&JobType::Agent, None, wire));-}--// Negative guard: the canned user-facing message that `run_agent_job`-// routes into `last_output` today carries no session signal. The predicate-// must NOT trip on it — otherwise every generic agent failure (provider-// keys missing, tool error, network blip) would halt after one attempt and-// stop reporting to Sentry, defeating the retry semantics for non-401-// failures.-#[test]-fn is_session_expired_failure_does_not_match_canned_user_message() {- assert!(!is_session_expired_failure(- &JobType::Agent,- Some(AGENT_JOB_USER_FAILURE_MESSAGE),- AGENT_JOB_USER_FAILURE_MESSAGE,- ));-}--// Negative guard: ordinary provider-error wire text (e.g. a third-party-// model rejecting a request as 400 / 500 / 429) must not be misclassified-// as session expiry. Those failures are exactly what the retry loop +-// `failure=retries_exhausted` capture exist for.-#[test]-fn is_session_expired_failure_does_not_match_ordinary_provider_error() {- let wire =- r#"OpenHuman API error (500 Internal Server Error): {"error":"Internal server error"}"#;- assert!(!is_session_expired_failure(&JobType::Agent, Some(wire), ""));-- let byo_key = r#"OpenAI API error (401 Unauthorized): {"error":{"message":"Invalid API key","type":"invalid_request_error"}}"#;- assert!(- !is_session_expired_failure(&JobType::Agent, Some(byo_key), ""),- "third-party BYO-key 401 is actionable (user misconfigured their key) — must NOT classify as backend session expiry"- );-}--// Scope guard: the halt is restricted to `JobType::Agent` because the-// `SessionExpired` publish + scheduler-gate handshake only fires from the-// inference layer. A shell job that happens to echo the 401-shaped string-// (e.g. an operator's curl wrapper printing the backend response verbatim)-// MUST keep its existing retry semantics — the operator may want those-// retries, and the gate has no reason to be flipped from a shell exit.-#[test]-fn is_session_expired_failure_does_not_halt_shell_jobs() {- let wire =- r#"OpenHuman API error (401 Unauthorized): {"success":false,"error":"Invalid token"}"#;- assert!(- !is_session_expired_failure(&JobType::Shell, None, wire),- "shell jobs must retain retry semantics regardless of stdout content"- );- assert!(- !is_session_expired_failure(&JobType::Shell, Some(wire), wire),- "shell jobs never populate last_agent_error — but even if a future path did, scope stays Agent-only"- );-}diff --git a/crates/openhuman-core/src/cron/scheduler_tests.rs b/crates/openhuman-core/src/cron/scheduler_tests.rsindex c16f3d2a8f..62e80519d6 100644--- a/crates/openhuman-core/src/cron/scheduler_tests.rs+++ b/crates/openhuman-core/src/cron/scheduler_tests.rs@@ -106,5 +106,3 @@ mod classifier_and_delivery_tests;mod frequency_tests;#[path = "scheduler_halt_and_persist_tests.rs"]mod halt_and_persist_tests;-#[path = "scheduler_profile_and_shell_tests.rs"]-mod profile_and_shell_tests;diff --git a/crates/openhuman-core/src/cron/seed.rs b/crates/openhuman-core/src/cron/seed.rsindex 993063bf19..b8f5b9b23b 100644--- a/crates/openhuman-core/src/cron/seed.rs+++ b/crates/openhuman-core/src/cron/seed.rs@@ -188,7 +188,7 @@ fn seed_morning_briefing(config: &Config) -> Result<()> {false, // recurring — do not delete after runSome(MORNING_BRIEFING_JOB_NAME.to_string()),false, // enabled=false — opt-in, created disabled atomically- None, // no profile attribution for the seeded briefing+ None,)?;tracing::debug!(diff --git a/crates/openhuman-core/src/cron/seed_tests.rs b/crates/openhuman-core/src/cron/seed_tests.rsindex 4332a36737..6856772126 100644--- a/crates/openhuman-core/src/cron/seed_tests.rs+++ b/crates/openhuman-core/src/cron/seed_tests.rs@@ -101,7 +101,7 @@ fn seed_prunes_legacy_welcome_job() {true,Some(LEGACY_WELCOME_JOB_NAME.to_string()),true, // enabled- None, // no profile attribution+ None,).expect("seed legacy welcome");assert_eq!(list_jobs(&config).unwrap().len(), 1);diff --git a/crates/openhuman-core/src/cron/store_tests.rs b/crates/openhuman-core/src/cron/store_tests.rsindex f6a36e3d00..a48e158b52 100644--- a/crates/openhuman-core/src/cron/store_tests.rs+++ b/crates/openhuman-core/src/cron/store_tests.rs@@ -108,84 +108,6 @@ fn due_jobs_filters_by_timestamp_and_enabled() {assert!(due_after_disable.is_empty());}-#[test]-fn agent_job_round_trips_profile_id_and_patch_clears_it() {- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp);-- // Create an agent job attributed to a profile.- let job = add_agent_job_with_definition(- &config,- Some("attributed".into()),- Schedule::Cron {- expr: "0 9 * * *".into(),- tz: None,- active_hours: None,- },- "do the thing",- SessionTarget::Isolated,- None,- None,- false,- None,- true,- Some("alice".into()),- )- .unwrap();- assert_eq!(job.profile_id.as_deref(), Some("alice"));-- // Reload from disk — the column round-trips.- let stored = get_job(&config, &job.id).unwrap();- assert_eq!(stored.profile_id.as_deref(), Some("alice"));-- // Patch to a different profile.- let repointed = update_job(- &config,- &job.id,- CronJobPatch {- profile_id: Some(Some("bob".into())),- ..CronJobPatch::default()- },- )- .unwrap();- assert_eq!(repointed.profile_id.as_deref(), Some("bob"));-- // Patch with `Some(None)` clears the attribution; `None` leaves it untouched.- let cleared = update_job(- &config,- &job.id,- CronJobPatch {- profile_id: Some(None),- ..CronJobPatch::default()- },- )- .unwrap();- assert_eq!(cleared.profile_id, None);-- let untouched = update_job(- &config,- &job.id,- CronJobPatch {- name: Some("renamed".into()),- ..CronJobPatch::default()- },- )- .unwrap();- assert_eq!(untouched.profile_id, None);- assert_eq!(untouched.name.as_deref(), Some("renamed"));-}--#[test]-fn shell_job_has_no_profile_attribution() {- // Back-compat: shell jobs (and any job created without profile_id) load with- // profile_id = None.- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp);- let job = add_job(&config, "*/5 * * * *", "echo ok").unwrap();- assert_eq!(job.profile_id, None);- assert_eq!(get_job(&config, &job.id).unwrap().profile_id, None);-}-#[test]fn enabling_stale_disabled_job_refreshes_next_run() {let tmp = TempDir::new().unwrap();diff --git a/crates/openhuman-core/src/cron/types.rs b/crates/openhuman-core/src/cron/types.rsindex d730e2cdd6..2f1c0ae0ff 100644--- a/crates/openhuman-core/src/cron/types.rs+++ b/crates/openhuman-core/src/cron/types.rs@@ -263,7 +263,7 @@ pub struct CronRun {////// A plain `#[derive(Deserialize)]` on `Option<Option<T>>` collapses the absent/// and the `null` cases *both* to the outer `None`, so "clear over the wire"-/// (`{"profile_id": null}`) silently deserializes as "no change" — a no-op. Used+/// (for example, `{"agent_id": null}`) silently deserializes as "no change" — a no-op. Used/// with `#[serde(default, deserialize_with = "deserialize_double_option")]`,/// this helper restores the distinction: serde only invokes it when the key is/// *present*, so a present `null` becomes `Some(None)` and a present valuediff --git a/crates/openhuman-core/src/cron/types_tests.rs b/crates/openhuman-core/src/cron/types_tests.rsindex 9808ba13cd..a8bda0f2a9 100644--- a/crates/openhuman-core/src/cron/types_tests.rs+++ b/crates/openhuman-core/src/cron/types_tests.rs@@ -236,75 +236,6 @@ fn cron_job_patch_default_is_all_none() {assert!(p.agent_id.is_none());}-#[test]-fn cron_job_deserializes_without_profile_id() {- // A pre-2b serialized CronJob (no `profile_id` key) must still- // deserialize, with the field defaulting to None.- let raw = json!({- "id": "j1",- "expression": "0 9 * * *",- "schedule": { "kind": "cron", "expr": "0 9 * * *" },- "command": "",- "prompt": "hi",- "name": "briefing",- "job_type": "agent",- "session_target": "isolated",- "model": null,- "agent_id": null,- "enabled": true,- "delivery": {},- "delete_after_run": false,- "created_at": "2027-01-15T12:00:00Z",- "next_run": "2027-01-16T09:00:00Z",- "last_run": null,- "last_status": null,- "last_output": null- });- let job: CronJob = serde_json::from_value(raw).unwrap();- assert_eq!(job.profile_id, None);-}--#[test]-fn cron_job_patch_default_leaves_profile_id_none() {- assert!(CronJobPatch::default().profile_id.is_none());-}--#[test]-fn cron_job_patch_profile_id_supports_explicit_none_clearing() {- // Option<Option<String>>: None = no change, Some(None) = clear.- let clear = CronJobPatch {- profile_id: Some(None),- ..Default::default()- };- assert!(clear.profile_id.is_some());- assert!(clear.profile_id.as_ref().unwrap().is_none());-- let set = CronJobPatch {- profile_id: Some(Some("alice".into())),- ..Default::default()- };- assert_eq!(set.profile_id, Some(Some("alice".to_string())));-}--#[test]-fn patch_profile_id_wire_double_option_semantics() {- // The RPC path deserializes CronJobPatch from JSON params — pin the three- // wire cases so a `null` clears rather than silently no-ops.- // absent key → no change.- let absent: CronJobPatch = serde_json::from_value(json!({})).unwrap();- assert_eq!(absent.profile_id, None, "absent key means no change");- // present null → clear.- let cleared: CronJobPatch = serde_json::from_value(json!({ "profile_id": null })).unwrap();- assert_eq!(- cleared.profile_id,- Some(None),- "wire null must clear the attribution"- );- // present value → set.- let set: CronJobPatch = serde_json::from_value(json!({ "profile_id": "writer" })).unwrap();- assert_eq!(set.profile_id, Some(Some("writer".to_string())));-}-#[test]fn patch_agent_id_wire_double_option_semantics() {// Same fix applied consistently to `agent_id` (its doc + the struct-leveldiff --git a/crates/openhuman-core/src/flows/README.md b/crates/openhuman-core/src/flows/README.mdindex 74dba61532..bd700f05ca 100644--- a/crates/openhuman-core/src/flows/README.md+++ b/crates/openhuman-core/src/flows/README.md@@ -43,7 +43,7 @@ from always-compiled code.- `mod store` / `mod draft_store` (private) — bind `tinyflows_sqlite::flows` / `tinyflows_sqlite::drafts` to `<workspace_dir>/flows`; `kv_get`, `kv_set`, and `upsert_flow_run_step` are re-exported from `store` for the `tinyflows::caps::FlowStateStore` seam and the run observer.- `mod schemas` (private; `all_flows_controller_schemas` / `all_flows_registered_controllers` re-exported) — RPC/CLI controller surface under the `flows` namespace, 36 functions. The `ControllerSchema` lookups are split into `schemas/definition_schemas.rs` (`create`, `duplicate`, `validate`, `import`, `get`, `list`, `list_connections`, `update`, `delete`, `set_enabled`, `get_history`, `rollback`, `required_connections`, `approval_manifest`), `schemas/run_schemas.rs` (`run`, `run_detached`, `resume`, `cancel_run`, `list_runs`, `list_all_runs`, `get_run`, `prune_runs`), `schemas/builder_schemas.rs` (`build`, `build_cancel`, `search_tool_catalog`, `get_tool_contract`, `discover`, `list_suggestions`, `dismiss_suggestion`, `mark_suggestion_built`), and `schemas/draft_schemas.rs` (`draft_create/get/update/list/delete/promote`); all 36 `handle_*` thin handlers live in `schemas_handlers.rs`.- `pub mod tools` — `ProposeWorkflowTool`, `RunFlowTool`. All 27 tool structs below are re-exported by glob from `crates/openhuman-core/src/tools/mod.rs` and pushed onto the agent tool list in `tools/ops.rs` under `#[cfg(feature = "flows")]`.-- `pub mod builder_tools` (split into submodules under `builder_tools/`: `draft_revise.rs`, `draft_edit.rs`, `draft_validate.rs`, `flow_reads.rs`, `run_control.rs`, `persistence.rs`, `connection_reads.rs`, `catalog_search.rs`, `tool_contract.rs`, `kind_reads.rs`, `dry_run.rs`, `dry_run_diagnostics.rs`) — the authoring toolset: `ReviseWorkflowTool`, `EditWorkflowTool`, `ValidateWorkflowTool`, `GetFlowHistoryTool`, `ListFlowRunsTool`, `ResumeFlowRunTool`, `CancelFlowRunTool`, `CreateWorkflowTool`, `DuplicateFlowTool`, `ListConnectableToolkitsTool`, `ListFlowsTool`, `GetFlowTool`, `GetFlowRunTool`, `ListFlowConnectionsTool`, `SearchToolCatalogTool`, `GetToolContractTool`, `GetToolOutputSampleTool`, `ListAgentProfilesTool`, `ListNodeKindsTool`, `GetNodeKindContractTool`, `DryRunWorkflowTool`, `SaveWorkflowTool`.+- `pub mod builder_tools` (split into submodules under `builder_tools/`: `draft_revise.rs`, `draft_edit.rs`, `draft_validate.rs`, `flow_reads.rs`, `run_control.rs`, `persistence.rs`, `connection_reads.rs`, `catalog_search.rs`, `tool_contract.rs`, `kind_reads.rs`, `dry_run.rs`, `dry_run_diagnostics.rs`) — the authoring toolset: `ReviseWorkflowTool`, `EditWorkflowTool`, `ValidateWorkflowTool`, `GetFlowHistoryTool`, `ListFlowRunsTool`, `ResumeFlowRunTool`, `CancelFlowRunTool`, `CreateWorkflowTool`, `DuplicateFlowTool`, `ListConnectableToolkitsTool`, `ListFlowsTool`, `GetFlowTool`, `GetFlowRunTool`, `ListFlowConnectionsTool`, `SearchToolCatalogTool`, `GetToolContractTool`, `GetToolOutputSampleTool`, `ListAgentDefinitionsTool`, `ListNodeKindsTool`, `GetNodeKindContractTool`, `DryRunWorkflowTool`, `SaveWorkflowTool`.- `pub mod discovery_tools` — `SuggestWorkflowsTool`.- `pub mod memory_tools` — `FlowMemoryRecallTool`, `FlowMemoryRememberTool`, plus `flow_namespace` / `FLOW_MEMORY_NAMESPACE_PREFIX` / `cross_flow_recall` (re-exported from `mod.rs` because the tinyflows `memory` node's `OpenHumanMemory` adapter needs byte-identical `scope: "flows"` results).- `pub mod agents` — first-class built-in sub-agents: `workflow_builder` (authoring copilot) and `flow_discovery` (read-only suggestion scout); their `agent.toml` and `prompt::build` are referenced by path from the `BUILTINS` slice in `agent/registry/agents/loader.rs`.diff --git a/crates/openhuman-core/src/flows/agents/workflow_builder/agent.toml b/crates/openhuman-core/src/flows/agents/workflow_builder/agent.tomlindex eaf315989a..66fff44a31 100644--- a/crates/openhuman-core/src/flows/agents/workflow_builder/agent.toml+++ b/crates/openhuman-core/src/flows/agents/workflow_builder/agent.toml@@ -95,7 +95,7 @@ named = ["search_tool_catalog","get_tool_contract","get_tool_output_sample",- "list_agent_profiles",+ "list_agent_definitions","list_connectable_toolkits","list_node_kinds","get_node_kind_contract",diff --git a/crates/openhuman-core/src/flows/agents/workflow_builder/tool_wording_tests.rs b/crates/openhuman-core/src/flows/agents/workflow_builder/tool_wording_tests.rsindex 623dab20ee..e782542bc9 100644--- a/crates/openhuman-core/src/flows/agents/workflow_builder/tool_wording_tests.rs+++ b/crates/openhuman-core/src/flows/agents/workflow_builder/tool_wording_tests.rs@@ -3,7 +3,7 @@//! `tinyflows-copilot` pins what the standing archetype says. It cannot pin//! what *this host's* tool descriptions say, and the two have to agree: the//! archetype tells the model that an `agent_ref` step runs the selected-//! specialist's full tool loop, and `list_agent_profiles`' own description used+//! specialist's full tool loop, and `list_agent_definitions`' own description used//! to contradict that with stale "follow-up" / "for now" wording.#[cfg(test)]diff --git a/crates/openhuman-core/src/flows/agents/workflow_builder/tool_wording_tests_tests.rs b/crates/openhuman-core/src/flows/agents/workflow_builder/tool_wording_tests_tests.rsindex 9a51611d06..c8bf5365ca 100644--- a/crates/openhuman-core/src/flows/agents/workflow_builder/tool_wording_tests_tests.rs+++ b/crates/openhuman-core/src/flows/agents/workflow_builder/tool_wording_tests_tests.rs@@ -1,25 +1,25 @@-/// `list_agent_profiles`'s own tool description used to discourage+/// `list_agent_definitions`'s own tool description used to discourage/// `agent_ref` with stale "follow-up"/"for now" wording (issue B37, Gap/// 1) — pin that it now correctly describes the harness's full tool/// loop instead.#[test]-fn list_agent_profiles_tool_description_has_no_stale_followup_language() {- use crate::flows::builder_tools::ListAgentProfilesTool;+fn list_agent_definitions_tool_description_has_no_stale_followup_language() {+ use crate::flows::builder_tools::ListAgentDefinitionsTool;use tinytools::Tool;- let description = ListAgentProfilesTool::new().description().to_string();+ let description = ListAgentDefinitionsTool::new().description().to_string();for banned in ["is a follow-up", "for now"] {assert!(!description.contains(banned),- "list_agent_profiles description must not carry the stale \+ "list_agent_definitions description must not carry the stale \phrasing `{banned}` — an agent_ref step already gets the \selected specialist's full tool loop");}assert!(description.contains("tool loop"),- "list_agent_profiles description must describe agent_ref as running \+ "list_agent_definitions description must describe agent_ref as running \the specialist's full tool loop");}diff --git a/crates/openhuman-core/src/flows/builder_tools.rs b/crates/openhuman-core/src/flows/builder_tools.rsindex 2f98c2d7ce..384e77a3d6 100644--- a/crates/openhuman-core/src/flows/builder_tools.rs+++ b/crates/openhuman-core/src/flows/builder_tools.rs@@ -25,7 +25,7 @@//! | [`SearchToolCatalogTool`] | `None` | read: real Composio tool slugs (live catalog) |//! | [`GetToolContractTool`] | `None` | read: one action's FULL live contract |//! | [`GetToolOutputSampleTool`] | `ReadOnly` | ONE bounded real Composio call (Read-scope only, connected toolkit only) |-//! | [`ListAgentProfilesTool`] | `None` | read: selectable agent kinds (`agent_ref`) |+//! | [`ListAgentDefinitionsTool`] | `None` | read: selectable agent definitions (`agent_ref`) |//! | [`ListNodeKindsTool`] | `None` | read: the DSL's node kinds |//! | [`GetNodeKindContractTool`] | `None` | read: one node kind's config/port/example/gotcha contract |//! | [`DryRunWorkflowTool`] | `None` | run a *draft* against MOCK capabilities — not tier-gated (F7) |@@ -87,7 +87,7 @@ pub use dry_run::DryRunWorkflowTool;pub use flow_reads::{GetFlowHistoryTool, GetFlowRunTool, GetFlowTool, ListFlowRunsTool, ListFlowsTool,};-pub use kind_reads::{GetNodeKindContractTool, ListAgentProfilesTool, ListNodeKindsTool};+pub use kind_reads::{GetNodeKindContractTool, ListAgentDefinitionsTool, ListNodeKindsTool};pub use persistence::{CreateWorkflowTool, DuplicateFlowTool, SaveWorkflowTool};pub use run_control::{CancelFlowRunTool, ResumeFlowRunTool};pub use tool_contract::{GetToolContractTool, GetToolOutputSampleTool};diff --git a/crates/openhuman-core/src/flows/builder_tools/kind_reads.rs b/crates/openhuman-core/src/flows/builder_tools/kind_reads.rsindex b2339e01cd..b8868c8bcf 100644--- a/crates/openhuman-core/src/flows/builder_tools/kind_reads.rs+++ b/crates/openhuman-core/src/flows/builder_tools/kind_reads.rs@@ -1,4 +1,4 @@-//! Read-only DSL/registry tools: agent profiles, node kinds, and node-kind contracts (F2).+//! Read-only DSL/registry tools: agent definitions, node kinds, and node-kind contracts (F2).use async_trait::async_trait;use serde_json::{json, Value};@@ -6,19 +6,19 @@ use serde_json::{json, Value};use tinytools::{PermissionLevel, Tool, ToolResult};// ─────────────────────────────────────────────────────────────────────────────-// list_agent_profiles — read-only: selectable agent kinds for an `agent` node+// list_agent_definitions — read-only: selectable definitions for an `agent` node// ─────────────────────────────────────────────────────────────────────────────-/// `list_agent_profiles`: read-only listing of the agent **kinds** an `agent`+/// `list_agent_definitions`: read-only listing of the agent **definitions** an `agent`/// node can select via `agent_ref` (researcher, code_executor, crypto_agent, …).////// Grounds the builder's `agent_ref` choice in real registry ids — the agent/// analogue of `search_tool_catalog` for `tool_call` slugs — so it never/// hallucinates an agent kind. Returns `{ id, name, description, model, tools,/// tags }` for every enabled registered agent.-pub struct ListAgentProfilesTool;+pub struct ListAgentDefinitionsTool;-impl ListAgentProfilesTool {+impl ListAgentDefinitionsTool {/// Builds the tool (no configuration — reads the process-global registry).#[must_use]pub fn new() -> Self {@@ -26,16 +26,16 @@ impl ListAgentProfilesTool {}}-impl Default for ListAgentProfilesTool {+impl Default for ListAgentDefinitionsTool {fn default() -> Self {Self::new()}}#[async_trait]-impl Tool for ListAgentProfilesTool {+impl Tool for ListAgentDefinitionsTool {fn name(&self) -> &str {- "list_agent_profiles"+ "list_agent_definitions"}fn description(&self) -> &str {@@ -64,10 +64,10 @@ impl Tool for ListAgentProfilesTool {}async fn execute(&self, _args: Value) -> anyhow::Result<ToolResult> {- tracing::debug!(target: "flows", "[flows] list_agent_profiles: listing registered agent kinds (read-only)");+ tracing::debug!(target: "flows", "[flows] list_agent_definitions: listing registered definitions (read-only)");match crate::agent::registry::list_agents(false).await {Ok(agents) => {- let profiles: Vec<Value> = agents+ let definitions: Vec<Value> = agents.iter().map(|a| {json!({@@ -81,11 +81,11 @@ impl Tool for ListAgentProfilesTool {}).collect();Ok(ToolResult::success(serde_json::to_string_pretty(- &json!({ "agent_profiles": profiles }),+ &json!({ "agent_definitions": definitions }),)?))}Err(e) => Ok(ToolResult::error(format!(- "Failed to list agent profiles: {e}"+ "Failed to list agent definitions: {e}"))),}}diff --git a/crates/openhuman-core/src/flows/ops/builder_gates.rs b/crates/openhuman-core/src/flows/ops/builder_gates.rsindex 9f6c6770ec..f39dc75a40 100644--- a/crates/openhuman-core/src/flows/ops/builder_gates.rs+++ b/crates/openhuman-core/src/flows/ops/builder_gates.rs@@ -455,7 +455,7 @@ pub(crate) async fn validate_agent_refs(config: &Config, graph: &WorkflowGraph)errors.push(format!("Node '{}': `agent_ref` `{agent_ref}` is registered but currently \disabled — enable it (or pick another agent_ref via \- list_agent_profiles) before this node can run.",+ list_agent_definitions) before this node can run.",node.id));}@@ -471,7 +471,7 @@ pub(crate) async fn validate_agent_refs(config: &Config, graph: &WorkflowGraph)"Node '{}': `agent_ref` `{agent_ref}` is not a real agent — it \names neither a built-in agent definition nor a custom agent \registry entry, and would fail at run time with an \"unknown \- agent_ref\" error. Call list_agent_profiles to see the real, \+ agent_ref\" error. Call list_agent_definitions to see the real, \selectable agent_ref values.",node.id));diff --git a/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs b/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rsindex ad8eefd595..404f5b6436 100644--- a/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs+++ b/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs@@ -145,16 +145,6 @@ Capability {destinations: &["The machine you configure, when the core runs off this device"],}),},-Capability {- id: "settings.persona_pack",- name: "Persona Pack",- domain: "settings",- category: CapabilityCategory::Settings,- description: "Personalize the assistant across one or more agent profiles: set a display name and description, edit or reset each profile's SOUL.md identity (kept in its own home under personalities/<id>/ and re-read every message), give a profile its own dedicated memory subtree or its own working directory, drop private skills under personalities/<id>/skills/ that only that profile can discover, attribute a scheduled cron job to a profile so it runs with that profile's identity, memory, and permissions, and reach mascot avatar and voice settings. Multiple profiles can run with isolated identity, memory, skills, and workspace state.",- how_to: "Settings > Persona",- status: CapabilityStatus::Beta,- privacy: GITHUB_MASCOT_MANIFEST,- },Capability {id: "settings.manage_privacy_analytics",name: "Manage Privacy and Analytics",diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rsindex b59c0270ef..8b597e58c6 100644--- a/crates/openhuman-core/src/tools/ops.rs+++ b/crates/openhuman-core/src/tools/ops.rs@@ -332,7 +332,7 @@ pub fn all_tools_with_runtime(// (researcher / code_executor / …) — the agent analogue of// search_tool_catalog. Read-only.#[cfg(feature = "flows")]- Box::new(ListAgentProfilesTool::new()),+ Box::new(ListAgentDefinitionsTool::new()),// Steer toolkit choice toward what's already connected + surface which// toolkits a flow still needs (Phase 5, item 19). Read-only.#[cfg(feature = "flows")]@@ -1177,7 +1177,7 @@ fn tool_group(name: &str) -> crate::core::all::DomainGroup {"search_tool_catalog","get_tool_contract","get_tool_output_sample",- "list_agent_profiles",+ "list_agent_definitions","list_connectable_toolkits","list_node_kinds","get_node_kind_contract",diff --git a/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs b/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rsindex 7ddec8af15..38cdd17962 100644--- a/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs+++ b/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs@@ -42,7 +42,7 @@ fn tool_group_classifies_gate_and_harness_families() {"search_tool_catalog","get_tool_contract","get_tool_output_sample",- "list_agent_profiles",+ "list_agent_definitions","list_connectable_toolkits","list_node_kinds","get_node_kind_contract",@@ -187,7 +187,7 @@ fn default_tools_omits_flows_tools_when_feature_off() {"search_tool_catalog","get_tool_contract","get_tool_output_sample",- "list_agent_profiles",+ "list_agent_definitions","list_connectable_toolkits","list_node_kinds","get_node_kind_contract",diff --git a/crates/openhuman-core/src/tools/toolpacks/registry.rs b/crates/openhuman-core/src/tools/toolpacks/registry.rsindex 5c71972354..501bf1e529 100644--- a/crates/openhuman-core/src/tools/toolpacks/registry.rs+++ b/crates/openhuman-core/src/tools/toolpacks/registry.rs@@ -54,7 +54,7 @@ pub const PACKS: &[ToolPack] = &["get_tool_output_sample","list_node_kinds","get_node_kind_contract",- "list_agent_profiles",+ "list_agent_definitions","list_connectable_toolkits",],owners: &["workflow_builder", "flow_discovery"],diff --git a/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rs b/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rsindex 30df3d4027..db7315a72f 100644--- a/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rs+++ b/crates/openhuman-core/src/tools/toolpacks/toolpacks_tests.rs@@ -450,7 +450,7 @@ fn every_pack_declares_the_tools_it_is_named_for() {"get_tool_output_sample","list_node_kinds","get_node_kind_contract",- "list_agent_profiles",+ "list_agent_definitions","list_connectable_toolkits",],),diff --git a/gitbooks/developing/architecture/frontend.md b/gitbooks/developing/architecture/frontend.mdindex 820105720a..9a91b09743 100644--- a/gitbooks/developing/architecture/frontend.md+++ b/gitbooks/developing/architecture/frontend.md@@ -160,7 +160,6 @@ Authoritative list = the `reducer` map in `store/index.ts`. One-line purposes:| Slice | Purpose | Persisted? || -------------------- | ----------------------------------------------------------------------- | -------------------------------------------------------------- || `accounts` | Connected web-app accounts + rail ordering | `accounts`, `order`, `lastActiveAccountId` (not the active id) |-| `agentProfiles` | Agent profile data | no || `announcement` | Harness-init announcement banner, seen ids | `shownIds` || `backendMeet` | Backend-driven Google Meet call state (join/leave, transcript, replies) | no || `channelConnections` | Messaging channel connections (WhatsApp, Slack, …) | connections + migration/default-channel fields |diff --git a/scripts/ci/check-agent-runtime-boundary.mjs b/scripts/ci/check-agent-runtime-boundary.mjsindex c6a0af79e6..4e492ad16a 100644--- a/scripts/ci/check-agent-runtime-boundary.mjs+++ b/scripts/ci/check-agent-runtime-boundary.mjs@@ -14,7 +14,7 @@ const noBaseline = process.argv.includes("--no-baseline");// Product types need not start with `OpenHuman`, so this is an explicit,// reviewed inventory rather than a naming convention.const openhumanDomainTypes = new Set([- "AgentDefinitionDisplay", "AgentDefinitionModel", "AgentProfile", "AgentProfileStore",+ "AgentDefinitionDisplay", "AgentDefinitionModel","AgentProgress", "ApprovalDecision", "ChatMessage", "ConversationMessage","ConversationMessagePatch", "ConversationMessageRecord", "DomainEvent","IntegrationAccount", "OpenHumanConfig", "OpenHumanRunContext", "ToolExecutionResult",diff --git a/tests/domain_modules_e2e.rs b/tests/domain_modules_e2e.rsindex 65ed3fd712..7306b74f13 100644--- a/tests/domain_modules_e2e.rs+++ b/tests/domain_modules_e2e.rs@@ -442,86 +442,6 @@ async fn config_agent_tools_and_threads_mutation_paths_round_trip() {"data paths should return an object: {data_paths}");- let profiles_initial = rpc(- &harness.rpc_base,- 31_001,- "openhuman.profiles_list",- json!({}),- )- .await;- let initial = ok(&profiles_initial, "profiles_list initial");- assert_eq!(- initial.get("activeProfileId").and_then(Value::as_str),- Some("default")- );-- let upsert_profile = rpc(- &harness.rpc_base,- 31_002,- "openhuman.profiles_upsert",- json!({- "profile": {- "id": "E2E Planner",- "name": " E2E Planner ",- "description": " deterministic profile ",- "agentId": "orchestrator",- "modelOverride": "e2e-profile-model",- "temperature": 0.3,- "systemPromptSuffix": "Keep answers brief.",- "allowedTools": ["memory.search", "tools.web_search", ""],- "builtIn": false- }- }),- )- .await;- let upserted = ok(&upsert_profile, "profiles_upsert");- assert!(- upserted- .get("profiles")- .and_then(Value::as_array)- .expect("profiles array")- .iter()- .any(|profile| profile.get("id").and_then(Value::as_str) == Some("e2e-planner")),- "upsert should normalize and persist the custom profile: {upserted}"- );-- let select_profile = rpc(- &harness.rpc_base,- 31_003,- "openhuman.profiles_select",- json!({ "profile_id": "e2e-planner" }),- )- .await;- assert_eq!(- ok(&select_profile, "profiles_select")- .get("activeProfileId")- .and_then(Value::as_str),- Some("e2e-planner")- );-- let delete_profile = rpc(- &harness.rpc_base,- 31_004,- "openhuman.profiles_delete",- json!({ "profile_id": "e2e-planner" }),- )- .await;- let deleted = ok(&delete_profile, "profiles_delete");- assert!(- deleted- .get("profiles")- .and_then(Value::as_array)- .expect("profiles array after delete")- .iter()- .all(|profile| profile.get("id").and_then(Value::as_str) != Some("e2e-planner")),- "delete should remove the custom profile: {deleted}"- );- assert_eq!(- deleted.get("activeProfileId").and_then(Value::as_str),- Some("default"),- "deleting the active custom profile should fall back to default"- );-let diagnostics = rpc(&harness.rpc_base,32_001,diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rsindex 5a3a5ba0ff..0981b2f6c5 100644--- a/tests/json_rpc_e2e.rs+++ b/tests/json_rpc_e2e.rs@@ -6385,228 +6385,6 @@ async fn json_rpc_local_ai_device_profile_and_presets() {rpc_join.abort();}-// ----------------------------------------------------------------------------// Agent profiles — home materialization + dedicated-memory field lifecycle-// -----------------------------------------------------------------------------#[tokio::test]-async fn json_rpc_profiles_dedicated_memory_lifecycle() {- let _env_lock = json_rpc_e2e_env_lock();- let tmp = tempdir().expect("tempdir");- let home = tmp.path();- let openhuman_home = home.join(".openhuman");-- let _home_guard = EnvVarGuard::set_to_path("HOME", home);- let _workspace_guard = EnvVarGuard::unset("OPENHUMAN_WORKSPACE");- let _action_guard = EnvVarGuard::unset("OPENHUMAN_ACTION_DIR");- let _backend_url_guard = EnvVarGuard::unset("BACKEND_URL");- let _vite_backend_guard = EnvVarGuard::unset("VITE_BACKEND_URL");-- let (mock_addr, mock_join) = serve_on_ephemeral(mock_upstream_router()).await;- let mock_origin = format!("http://{}", mock_addr);- write_min_config(&openhuman_home, &mock_origin);-- let (rpc_addr, rpc_join) = serve_on_ephemeral(build_core_http_router(false)).await;- let rpc_base = format!("http://{}", rpc_addr);- tokio::time::sleep(Duration::from_millis(100)).await;-- // --- upsert a custom profile opting into dedicated memory ---- // agentId "orchestrator" is always admitted without a registry (the implicit- // default), so this upsert persists even in the bare e2e core.- let upsert = post_json_rpc(- &rpc_base,- 60,- "openhuman.profiles_upsert",- json!({- "profile": {- "id": "writer",- "name": "Writer",- "description": "Drafts crisp copy.",- "agentId": "orchestrator",- "builtIn": false,- "dedicatedMemory": true- }- }),- )- .await;- let upsert_result = assert_no_jsonrpc_error(&upsert, "profiles_upsert");- let upsert_payload = upsert_result.get("result").unwrap_or(upsert_result);- let writer = upsert_payload- .get("profiles")- .and_then(Value::as_array)- .expect("profiles array")- .iter()- .find(|p| p.get("id").and_then(Value::as_str) == Some("writer"))- .expect("writer profile present after upsert");- assert_eq!(- writer.get("dedicatedMemory").and_then(Value::as_bool),- Some(true),- "dedicatedMemory should round-trip: {upsert_payload}"- );-- // --- list must surface the field + the resolved soulMdFile path ---- let list = post_json_rpc(&rpc_base, 61, "openhuman.profiles_list", json!({})).await;- let list_result = assert_no_jsonrpc_error(&list, "profiles_list");- let list_payload = list_result.get("result").unwrap_or(list_result);- let listed_writer = list_payload- .get("profiles")- .and_then(Value::as_array)- .expect("profiles array")- .iter()- .find(|p| p.get("id").and_then(Value::as_str) == Some("writer"))- .expect("writer present in list");- assert_eq!(- listed_writer- .get("dedicatedMemory")- .and_then(Value::as_bool),- Some(true)- );- // The home was materialized on upsert, so SOUL.md exists and its path is- // surfaced read-only. A shared-memory profile carries no workspaceDir.- assert!(- listed_writer- .get("soulMdFile")- .and_then(Value::as_str)- .is_some_and(|s| s.ends_with("personalities/writer/SOUL.md")),- "soulMdFile should resolve: {listed_writer}"- );- assert!(- listed_writer.get("workspaceDir").is_none(),- "dedicated_memory (not workspace) must not surface workspaceDir"- );-- // --- 2b: a cron agent job can be attributed to this profile, and the- // attribution round-trips through cron_add and cron_list (snake_case- // `profile_id`, matching the cron domain's wire convention). ---- let cron_add = post_json_rpc(- &rpc_base,- 64,- "openhuman.cron_add",- json!({- "schedule": "0 9 * * *",- "prompt": "draft the daily note",- "profile_id": "writer"- }),- )- .await;- let cron_add_result = assert_no_jsonrpc_error(&cron_add, "cron_add");- // `RpcOutcome::single_log` wraps the job as `{ "result": <job>, "logs": [..] }`.- let added_job = cron_add_result.get("result").unwrap_or(cron_add_result);- let job_id = added_job- .get("id")- .and_then(Value::as_str)- .expect("cron job id present")- .to_string();- assert_eq!(- added_job.get("profile_id").and_then(Value::as_str),- Some("writer"),- "cron_add must round-trip profile_id: {cron_add_result}"- );-- let cron_list = post_json_rpc(&rpc_base, 65, "openhuman.cron_list", json!({})).await;- let cron_list_result = assert_no_jsonrpc_error(&cron_list, "cron_list");- let jobs = cron_list_result- .get("result")- .and_then(Value::as_array)- .expect("cron_list jobs array");- let listed_job = jobs- .iter()- .find(|j| j.get("id").and_then(Value::as_str) == Some(job_id.as_str()))- .expect("added cron job present in cron_list");- assert_eq!(- listed_job.get("profile_id").and_then(Value::as_str),- Some("writer"),- "cron_list must surface profile_id: {listed_job}"- );-- // cron_update can repoint the attribution (Some(Some) over the wire).- let cron_update = post_json_rpc(- &rpc_base,- 66,- "openhuman.cron_update",- json!({ "job_id": job_id, "patch": { "profile_id": "editor" } }),- )- .await;- let cron_update_result = assert_no_jsonrpc_error(&cron_update, "cron_update");- let updated_job = cron_update_result- .get("result")- .unwrap_or(cron_update_result);- assert_eq!(- updated_job.get("profile_id").and_then(Value::as_str),- Some("editor"),- "cron_update must repoint profile_id: {cron_update_result}"- );-- // cron_update with a wire `null` clears the attribution (double-option- // semantics — a plain `Option<Option<String>>` would silently no-op here).- let cron_clear = post_json_rpc(- &rpc_base,- 67,- "openhuman.cron_update",- json!({ "job_id": job_id, "patch": { "profile_id": null } }),- )- .await;- let cron_clear_result = assert_no_jsonrpc_error(&cron_clear, "cron_update clear");- let cleared_job = cron_clear_result.get("result").unwrap_or(cron_clear_result);- assert!(- cleared_job.get("profile_id").is_none_or(Value::is_null),- "cron_update patch profile_id=null must clear the attribution: {cron_clear_result}"- );-- // ...and cron_list confirms the attribution is gone.- let cron_list_after = post_json_rpc(&rpc_base, 68, "openhuman.cron_list", json!({})).await;- let cron_list_after_result = assert_no_jsonrpc_error(&cron_list_after, "cron_list after clear");- let jobs_after = cron_list_after_result- .get("result")- .and_then(Value::as_array)- .expect("cron_list jobs array");- let listed_after = jobs_after- .iter()- .find(|j| j.get("id").and_then(Value::as_str) == Some(job_id.as_str()))- .expect("job present in cron_list after clear");- assert!(- listed_after.get("profile_id").is_none_or(Value::is_null),- "cleared profile_id must not reappear in cron_list: {listed_after}"- );-- // --- select then delete round-trips the active id ---- let select = post_json_rpc(- &rpc_base,- 62,- "openhuman.profiles_select",- json!({"profile_id": "writer"}),- )- .await;- let select_result = assert_no_jsonrpc_error(&select, "profiles_select");- let select_payload = select_result.get("result").unwrap_or(select_result);- assert_eq!(- select_payload- .get("activeProfileId")- .and_then(Value::as_str),- Some("writer")- );-- let delete = post_json_rpc(- &rpc_base,- 63,- "openhuman.profiles_delete",- json!({"profile_id": "writer"}),- )- .await;- let delete_result = assert_no_jsonrpc_error(&delete, "profiles_delete");- let delete_payload = delete_result.get("result").unwrap_or(delete_result);- assert_eq!(- delete_payload- .get("activeProfileId")- .and_then(Value::as_str),- Some("default"),- "deleting the active custom profile falls back to default"- );-- mock_join.abort();- rpc_join.abort();-}-#[tokio::test]async fn json_rpc_local_ai_lm_studio_config_diagnostics_and_prompt() {let _env_lock = json_rpc_e2e_env_lock();diff --git a/tests/personality_e2e.rs b/tests/personality_e2e.rsdeleted file mode 100644index ec1a1b6b04..0000000000--- a/tests/personality_e2e.rs+++ /dev/null@@ -1,608 +0,0 @@-//! E2E integration tests for multi-agent personalities.-//!-//! Covers the full personality feature surface end-to-end without requiring-//! the JSON-RPC HTTP stack:-//!-//! 1. Profile lifecycle — backwards compat, suffix auto-assignment, field roundtrip.-//! 2. Memory isolation — two personalities have separate SQLite stores.-//! 3. Personality file resolution — soul/memory.md fallback chain.-//! 4. Prompt section behaviour — IdentitySection / UserFilesSection / PersonalityRosterSection.-//! 5. Integration filtering — allowlist / passthrough / empty.-//! 6. Thread-personality binding — persists through ConversationStore.-//!-//! Run with: `cargo test --test personality_e2e`--use std::collections::HashSet;--use tempfile::tempdir;--use openhuman_core::agent::profiles::{- built_in_profiles, AgentProfile, AgentProfileStore, DEFAULT_PROFILE_ID,-};-use openhuman_core::agent::profiles::{- filter_integrations, memory_subdir_for_suffix, memory_tree_subdir_for_suffix,- resolve_personality_memory_md, resolve_personality_soul, session_raw_subdir_for_suffix,- HasToolkit, PersonalityContext,-};-use openhuman_core::agent::prompts::types::LearnedContextData;-use openhuman_core::agent::prompts::{- IdentitySection, PersonalityRosterEntry, PersonalityRosterSection, PromptContext,- PromptSection, ToolCallFormat, UserFilesSection,-};-use openhuman_core::memory::conversations::{- ensure_thread, list_threads, update_thread_title, ConversationStore, CreateConversationThread,-};-// The engine handle is named on the crate rather than reached through the-// memory module's public surface: it is an in-process engine type, not-// contract vocabulary, and the alias that used to re-export it existed for-// callers that no longer exist (#5560). This note is about `UnifiedMemory`-// alone — the conversation store above is host code again as of #5560 and is-// reached through the memory module's surface like any other host type.--// ─────────────────────────────────────────────────────────────────────────────-// Test helpers-// ─────────────────────────────────────────────────────────────────────────────--fn make_profile(id: &str, name: &str) -> AgentProfile {- AgentProfile {- id: id.to_string(),- name: name.to_string(),- description: format!("{name} personality"),- agent_id: "orchestrator".to_string(),- model_override: None,- temperature: None,- system_prompt_suffix: None,- allowed_tools: None,- built_in: false,- avatar_url: None,- voice_id: None,- soul_md: None,- soul_md_path: None,- composio_integrations: None,- memory_sources: None,- include_agent_conversations: true,- allowed_skills: None,- allowed_mcp_servers: None,- memory_dir_suffix: None,- is_master: false,- sort_order: None,- dedicated_memory: false,- dedicated_workspace: false,- }-}--fn empty_prompt_context<'a>(workspace_dir: &'a std::path::Path) -> PromptContext<'a> {- let visible_tool_names: &'a HashSet<String> = Box::leak(Box::new(HashSet::new()));- PromptContext {- workspace_dir,- model_name: "test-model",- agent_id: "orchestrator",- tools: &[],- workflows: &[],- dispatcher_instructions: "",- learned: LearnedContextData::default(),- visible_tool_names,- tool_call_format: ToolCallFormat::PFormat,- connected_integrations: &[],- connected_identities_md: String::new(),- include_profile: false,- include_memory_md: false,- curated_snapshot: None,- user_identity: None,- personality_soul_md: None,- personality_memory_md: None,- personality_roster: vec![],- agents_md_global: None,- agents_md_local: None,- }-}--// ─────────────────────────────────────────────────────────────────────────────-// 1. Profile lifecycle-// ─────────────────────────────────────────────────────────────────────────────--#[test]-fn backwards_compat_old_profiles_json_deserializes_cleanly() {- let tmp = tempdir().expect("tempdir");- let json = r#"{- "activeProfileId": "default",- "profiles": [{- "id": "default",- "name": "Default",- "description": "Old profile pre-personalities.",- "agentId": "orchestrator",- "builtIn": true- }, {- "id": "research",- "name": "Research",- "description": "",- "agentId": "researcher",- "builtIn": true- }]- }"#;- std::fs::write(tmp.path().join("agent_profiles.json"), json).expect("write");-- let store = AgentProfileStore::new(tmp.path().to_path_buf());- let state = store.load().expect("load");-- let default = state- .profiles- .iter()- .find(|p| p.id == DEFAULT_PROFILE_ID)- .expect("default");- assert!(default.is_master, "default should be master on first read");- assert_eq!(default.memory_dir_suffix.as_deref(), Some(""));- assert_eq!(default.avatar_url, None);-}--#[test]-fn three_personalities_get_sequential_memory_suffixes() {- let tmp = tempdir().expect("tempdir");- let store = AgentProfileStore::new(tmp.path().to_path_buf());-- let state = store.upsert(make_profile("alice", "Alice")).expect("alice");- let alice = state.profiles.iter().find(|p| p.id == "alice").unwrap();- assert_eq!(alice.memory_dir_suffix.as_deref(), Some("-1"));-- let state = store.upsert(make_profile("bob", "Bob")).expect("bob");- let bob = state.profiles.iter().find(|p| p.id == "bob").unwrap();- assert_eq!(bob.memory_dir_suffix.as_deref(), Some("-2"));-- let state = store.upsert(make_profile("carol", "Carol")).expect("carol");- let carol = state.profiles.iter().find(|p| p.id == "carol").unwrap();- assert_eq!(carol.memory_dir_suffix.as_deref(), Some("-3"));-}--#[test]-fn deleted_suffix_is_reused_by_next_personality() {- let tmp = tempdir().expect("tempdir");- let store = AgentProfileStore::new(tmp.path().to_path_buf());-- store.upsert(make_profile("alice", "Alice")).expect("alice");- store.upsert(make_profile("bob", "Bob")).expect("bob");- store.upsert(make_profile("carol", "Carol")).expect("carol");-- store.delete("bob").expect("delete bob");-- let state = store.upsert(make_profile("dave", "Dave")).expect("dave");- let dave = state.profiles.iter().find(|p| p.id == "dave").unwrap();- assert_eq!(- dave.memory_dir_suffix.as_deref(),- Some("-2"),- "freed suffix -2 should be reused"- );-}--#[test]-fn personality_fields_roundtrip_through_upsert() {- let tmp = tempdir().expect("tempdir");- let store = AgentProfileStore::new(tmp.path().to_path_buf());-- let mut alice = make_profile("alice", "Alice");- alice.avatar_url = Some("https://example.com/alice.png".to_string());- alice.voice_id = Some("voice-alice-123".to_string());- alice.soul_md = Some("I am Alice.".to_string());- alice.composio_integrations = Some(vec!["slack".to_string(), "gmail".to_string()]);- alice.sort_order = Some(5);-- store.upsert(alice).expect("upsert");-- let state = store.load().expect("reload");- let alice = state.profiles.iter().find(|p| p.id == "alice").unwrap();- assert_eq!(- alice.avatar_url.as_deref(),- Some("https://example.com/alice.png")- );- assert_eq!(alice.voice_id.as_deref(), Some("voice-alice-123"));- assert_eq!(alice.soul_md.as_deref(), Some("I am Alice."));- assert_eq!(- alice.composio_integrations.as_ref().unwrap(),- &["slack", "gmail"]- );- assert_eq!(alice.sort_order, Some(5));-}--#[test]-fn default_profile_memory_suffix_cannot_be_overridden() {- let tmp = tempdir().expect("tempdir");- let store = AgentProfileStore::new(tmp.path().to_path_buf());-- let mut default_override = built_in_profiles()- .into_iter()- .find(|p| p.id == DEFAULT_PROFILE_ID)- .expect("default profile in built-ins");- default_override.memory_dir_suffix = Some("-99".to_string());- default_override.avatar_url = Some("https://example.com/default.png".to_string());-- let state = store.upsert(default_override).expect("upsert");- let default = state- .profiles- .iter()- .find(|p| p.id == DEFAULT_PROFILE_ID)- .unwrap();- assert_eq!(- default.memory_dir_suffix.as_deref(),- Some(""),- "default suffix must stay empty regardless of user input"- );- assert_eq!(- default.avatar_url.as_deref(),- Some("https://example.com/default.png")- );- assert!(default.is_master);-}--// ─────────────────────────────────────────────────────────────────────────────-// 2. Memory isolation-// ─────────────────────────────────────────────────────────────────────────────--// ─────────────────────────────────────────────────────────────────────────────-// 3. Personality file resolution-// ─────────────────────────────────────────────────────────────────────────────--#[test]-fn resolve_soul_falls_back_through_path_inline_none() {- let tmp = tempdir().expect("tempdir");- let mut profile = make_profile("alice", "Alice");-- // No overrides → None.- assert!(resolve_personality_soul(tmp.path(), &profile).is_none());-- // Inline only.- profile.soul_md = Some("Inline soul.".to_string());- assert_eq!(- resolve_personality_soul(tmp.path(), &profile).as_deref(),- Some("Inline soul.")- );-- // File path takes precedence over inline.- let soul_path = tmp.path().join("souls").join("alice.md");- std::fs::create_dir_all(soul_path.parent().unwrap()).unwrap();- std::fs::write(&soul_path, "File-based soul.").unwrap();- profile.soul_md_path = Some("souls/alice.md".to_string());- assert_eq!(- resolve_personality_soul(tmp.path(), &profile).as_deref(),- Some("File-based soul.")- );-- // Missing file falls back to inline.- profile.soul_md_path = Some("souls/missing.md".to_string());- assert_eq!(- resolve_personality_soul(tmp.path(), &profile).as_deref(),- Some("Inline soul.")- );-}--#[test]-fn resolve_memory_md_reads_personality_dir() {- let tmp = tempdir().expect("tempdir");- let profile = make_profile("alice", "Alice");-- assert!(resolve_personality_memory_md(tmp.path(), &profile).is_none());-- let mem_path = tmp- .path()- .join("personalities")- .join("alice")- .join("MEMORY.md");- std::fs::create_dir_all(mem_path.parent().unwrap()).unwrap();- std::fs::write(&mem_path, "Alice's curated memory.").unwrap();-- assert_eq!(- resolve_personality_memory_md(tmp.path(), &profile).as_deref(),- Some("Alice's curated memory.")- );-}--#[test]-fn personality_context_aggregates_all_overrides() {- let tmp = tempdir().expect("tempdir");- let mut alice = make_profile("alice", "Alice");- alice.memory_dir_suffix = Some("-1".to_string());- alice.voice_id = Some("voice-alice".to_string());- alice.soul_md = Some("I am Alice.".to_string());- alice.composio_integrations = Some(vec!["slack".to_string()]);-- let mem_path = tmp- .path()- .join("personalities")- .join("alice")- .join("MEMORY.md");- std::fs::create_dir_all(mem_path.parent().unwrap()).unwrap();- std::fs::write(&mem_path, "Curated.").unwrap();-- let ctx = PersonalityContext::from_profile(tmp.path(), alice);-- assert_eq!(ctx.memory_suffix, "-1");- assert_eq!(ctx.voice_id.as_deref(), Some("voice-alice"));- assert_eq!(ctx.soul_md_override.as_deref(), Some("I am Alice."));- assert_eq!(ctx.memory_md_override.as_deref(), Some("Curated."));- assert_eq!(ctx.composio_allowlist.as_ref().unwrap(), &["slack"]);-}--#[test]-fn subdir_helpers_handle_empty_and_numeric_suffixes() {- assert_eq!(memory_subdir_for_suffix(""), "memory");- assert_eq!(memory_subdir_for_suffix("-1"), "memory-1");- assert_eq!(memory_tree_subdir_for_suffix(""), "memory_tree");- assert_eq!(memory_tree_subdir_for_suffix("-2"), "memory_tree-2");- assert_eq!(session_raw_subdir_for_suffix(""), "session_raw");- assert_eq!(session_raw_subdir_for_suffix("-3"), "session_raw-3");-}--// ─────────────────────────────────────────────────────────────────────────────-// 4. Prompt section behaviour-// ─────────────────────────────────────────────────────────────────────────────--#[test]-fn identity_section_uses_personality_soul_when_set() {- let tmp = tempdir().expect("tempdir");- let mut ctx = empty_prompt_context(tmp.path());- ctx.personality_soul_md = Some("# I am Alice\n\nI specialise in research.".to_string());-- let rendered = IdentitySection.build(&ctx).expect("render");- assert!(- rendered.contains("I am Alice"),- "personality soul must be in rendered prompt: {rendered}"- );- assert!(rendered.contains("specialise in research"));-}--#[test]-fn user_files_section_prefers_personality_memory_md() {- let tmp = tempdir().expect("tempdir");-- // Write a workspace-level MEMORY.md so we can prove personality override wins.- std::fs::write(- tmp.path().join("MEMORY.md"),- "WORKSPACE memory contents — should not appear.",- )- .expect("write workspace memory");-- let mut ctx = empty_prompt_context(tmp.path());- ctx.include_memory_md = true;- ctx.personality_memory_md = Some("PERSONALITY memory contents.".to_string());-- let rendered = UserFilesSection.build(&ctx).expect("render");- assert!(- rendered.contains("PERSONALITY memory"),- "personality memory should be rendered: {rendered}"- );- assert!(- !rendered.contains("WORKSPACE memory"),- "workspace memory must not be rendered when personality memory is set"- );-}--#[test]-fn user_files_section_falls_back_to_workspace_memory_md() {- let tmp = tempdir().expect("tempdir");- std::fs::write(tmp.path().join("MEMORY.md"), "Workspace fallback memory.").expect("write");-- let mut ctx = empty_prompt_context(tmp.path());- ctx.include_memory_md = true;- // No personality override.-- let rendered = UserFilesSection.build(&ctx).expect("render");- assert!(- rendered.contains("Workspace fallback memory"),- "should fall back to workspace MEMORY.md: {rendered}"- );-}--#[test]-fn personality_roster_renders_entries_with_truncated_summaries() {- let tmp = tempdir().expect("tempdir");- let mut ctx = empty_prompt_context(tmp.path());-- let long_summary = "A".repeat(300);- ctx.personality_roster = vec![- PersonalityRosterEntry {- id: "alice".to_string(),- name: "Alice".to_string(),- description: "Research specialist.".to_string(),- memory_summary: Some(long_summary.clone()),- },- PersonalityRosterEntry {- id: "bob".to_string(),- name: "Bob".to_string(),- description: "Code reviewer.".to_string(),- memory_summary: None,- },- ];-- let rendered = PersonalityRosterSection.build(&ctx).expect("render");- assert!(rendered.contains("Available Personalities"));- assert!(rendered.contains("Alice"));- assert!(rendered.contains("alice"));- assert!(rendered.contains("Research specialist."));- assert!(rendered.contains("Bob"));- assert!(rendered.contains("Code reviewer."));- // Summary capped at 200 chars + ellipsis.- assert!(- !rendered.contains(&"A".repeat(250)),- "summary should be truncated below 250 chars"- );- assert!(rendered.contains("…"));-}--#[test]-fn personality_roster_renders_empty_when_no_entries() {- let tmp = tempdir().expect("tempdir");- let ctx = empty_prompt_context(tmp.path());- let rendered = PersonalityRosterSection.build(&ctx).expect("render");- assert!(rendered.is_empty(), "empty roster should render nothing");-}--// ─────────────────────────────────────────────────────────────────────────────-// 5. Integration filtering-// ─────────────────────────────────────────────────────────────────────────────--#[derive(Clone, Debug)]-struct FakeIntegration {- toolkit: String,-}--impl HasToolkit for FakeIntegration {- fn toolkit_name(&self) -> &str {- &self.toolkit- }-}--#[test]-fn filter_integrations_none_is_passthrough() {- let all = vec![- FakeIntegration {- toolkit: "slack".into(),- },- FakeIntegration {- toolkit: "gmail".into(),- },- FakeIntegration {- toolkit: "notion".into(),- },- ];- let filtered = filter_integrations(&all, None);- assert_eq!(filtered.len(), 3);-}--#[test]-fn filter_integrations_allowlist_is_case_insensitive() {- let all = vec![- FakeIntegration {- toolkit: "slack".into(),- },- FakeIntegration {- toolkit: "gmail".into(),- },- FakeIntegration {- toolkit: "notion".into(),- },- ];- let allowed = vec!["SLACK".to_string(), "Gmail".to_string()];- let filtered = filter_integrations(&all, Some(&allowed));- let names: Vec<_> = filtered.iter().map(|i| i.toolkit.as_str()).collect();- assert_eq!(names, vec!["slack", "gmail"]);-}--#[test]-fn filter_integrations_empty_allowlist_returns_nothing() {- let all = vec![FakeIntegration {- toolkit: "slack".into(),- }];- let empty: Vec<String> = vec![];- let filtered = filter_integrations(&all, Some(&empty));- assert!(filtered.is_empty());-}--// ─────────────────────────────────────────────────────────────────────────────-// 6. Thread-personality binding-// ─────────────────────────────────────────────────────────────────────────────--#[test]-fn thread_personality_id_persists_through_store() {- let tmp = tempdir().expect("tempdir");- let store = ConversationStore::new(tmp.path().to_path_buf());-- let thread = store- .ensure_thread(CreateConversationThread {- id: "thread-alice".to_string(),- title: "Alice chat".to_string(),- created_at: "2026-05-27T10:00:00Z".to_string(),- parent_thread_id: None,- labels: Some(vec!["work".to_string()]),- personality_id: Some("alice".to_string()),- })- .expect("ensure");-- assert_eq!(thread.personality_id.as_deref(), Some("alice"));-- let listed = store.list_threads().expect("list");- let alice_thread = listed.iter().find(|t| t.id == "thread-alice").unwrap();- assert_eq!(alice_thread.personality_id.as_deref(), Some("alice"));-}--#[test]-fn threads_without_personality_id_remain_none() {- let tmp = tempdir().expect("tempdir");- let store = ConversationStore::new(tmp.path().to_path_buf());-- store- .ensure_thread(CreateConversationThread {- id: "legacy-thread".to_string(),- title: "Legacy".to_string(),- created_at: "2026-05-27T10:00:00Z".to_string(),- parent_thread_id: None,- labels: None,- personality_id: None,- })- .expect("ensure");-- let listed = store.list_threads().expect("list");- let legacy = listed.iter().find(|t| t.id == "legacy-thread").unwrap();- assert!(legacy.personality_id.is_none());-}--#[test]-fn updating_thread_title_preserves_personality_id() {- let tmp = tempdir().expect("tempdir");- let store = ConversationStore::new(tmp.path().to_path_buf());-- store- .ensure_thread(CreateConversationThread {- id: "thread-bob".to_string(),- title: "Original".to_string(),- created_at: "2026-05-27T10:00:00Z".to_string(),- parent_thread_id: None,- labels: None,- personality_id: Some("bob".to_string()),- })- .expect("ensure");-- store- .update_thread_title("thread-bob", "Updated title", "2026-05-27T11:00:00Z")- .expect("update title");-- let listed = store.list_threads().expect("list");- let bob = listed.iter().find(|t| t.id == "thread-bob").unwrap();- assert_eq!(bob.title, "Updated title");- assert_eq!(- bob.personality_id.as_deref(),- Some("bob"),- "personality_id must survive title updates"- );-}--#[test]-fn module_level_helpers_round_trip_personality_id() {- // Verify the free-function API (used by some callers) also propagates personality_id.- let tmp = tempdir().expect("tempdir");- let workspace = tmp.path().to_path_buf();-- let thread = ensure_thread(- workspace.clone(),- CreateConversationThread {- id: "module-thread".to_string(),- title: "via module".to_string(),- created_at: "2026-05-27T12:00:00Z".to_string(),- parent_thread_id: None,- labels: None,- personality_id: Some("carol".to_string()),- },- )- .expect("ensure");- assert_eq!(thread.personality_id.as_deref(), Some("carol"));-- update_thread_title(- workspace.clone(),- "module-thread",- "Updated",- "2026-05-27T13:00:00Z",- )- .expect("update title");-- let threads = list_threads(workspace).expect("list");- let found = threads.iter().find(|t| t.id == "module-thread").unwrap();- assert_eq!(found.personality_id.as_deref(), Some("carol"));- assert_eq!(found.title, "Updated");-}diff --git a/tests/worker_b_domain_e2e.rs b/tests/worker_b_domain_e2e.rsindex 5b03a61147..153450fbac 100644--- a/tests/worker_b_domain_e2e.rs+++ b/tests/worker_b_domain_e2e.rs@@ -256,10 +256,6 @@ async fn worker_b_schema_catalog_exposes_all_controller_methods() {"openhuman.agent_get_definition","openhuman.agent_reload_definitions","openhuman.agent_triage_evaluate",- "openhuman.profiles_list",- "openhuman.profiles_select",- "openhuman.profiles_upsert",- "openhuman.profiles_delete","openhuman.tools_composio_execute","openhuman.tools_web_search","openhuman.tools_seltz_search",@@ -484,25 +480,6 @@ async fn agent_definitions_profiles_and_validation_paths_are_reachable() {json!({ "id": "missing-worker-b-agent" }),"not found",),- (- "openhuman.profiles_upsert",- json!({- "profile": {- "id": "bad-worker-b-profile",- "name": "Bad Worker B",- "description": "Exercise unknown agent validation",- "agentId": "missing-worker-b-agent",- "allowedTools": [],- "builtIn": false- }- }),- "not found",- ),- (- "openhuman.profiles_select",- json!({ "profile_id": "missing-worker-b-profile" }),- "not found",- ),("openhuman.agent_chat",json!({}),