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
fix(web-chat): handle missing run mode toggle test
Steven Enamakel0f2b32020221
diff --git a/app/src/features/conversations/aui/RunModeToggle.test.tsx b/app/src/features/conversations/aui/RunModeToggle.test.tsxnew file mode 100644index 0000000000..52b30037df--- /dev/null+++ b/app/src/features/conversations/aui/RunModeToggle.test.tsx@@ -0,0 +1,41 @@+import { combineReducers, configureStore } from '@reduxjs/toolkit';+import { render, screen } from '@testing-library/react';+import userEvent from '@testing-library/user-event';+import { Provider } from 'react-redux';+import { beforeEach, describe, expect, it, vi } from 'vitest';++import { callCoreRpc } from '../../../services/coreRpcClient';+import runModeReducer from '../../../store/runModeSlice';+import { RunModeToggle } from './RunModeToggle';++vi.mock('../../../services/coreRpcClient', () => ({ callCoreRpc: vi.fn() }));++function renderToggle() {+ const store = configureStore({ reducer: combineReducers({ runMode: runModeReducer }) });+ render(+ <Provider store={store}>+ <RunModeToggle threadId="t1" />+ </Provider>+ );+ return store;+}++describe('RunModeToggle', () => {+ beforeEach(() => vi.mocked(callCoreRpc).mockReset().mockResolvedValue({}));++ it('shows the build label by default', () => {+ renderToggle();+ expect(screen.getByTestId('run-mode-toggle')).toHaveAttribute('data-run-mode', 'build');+ });++ it('flips to plan mode on click and calls agent_set_run_mode', async () => {+ const store = renderToggle();+ await userEvent.click(screen.getByTestId('run-mode-toggle'));++ expect(store.getState().runMode.byThread.t1).toBe('plan');+ expect(callCoreRpc).toHaveBeenCalledWith({+ method: 'openhuman.agent_set_run_mode',+ params: { thread_id: 't1', mode: 'plan' },+ });+ });+});diff --git a/crates/openhuman-core/src/web_chat/ops.rs b/crates/openhuman-core/src/web_chat/ops.rsindex 0da1dc8984..56a8a4acea 100644--- a/crates/openhuman-core/src/web_chat/ops.rs+++ b/crates/openhuman-core/src/web_chat/ops.rs@@ -23,9 +23,13 @@ pub use channel_ops::{channel_web_queue_remove, channel_web_queue_status,};-pub use start_chat::{- is_guardrail_error_message, start_chat, StartChatError, GUARDRAIL_ERROR_PREFIX,-};+pub use start_chat::{start_chat, StartChatError};+// `is_guardrail_error_message` / `GUARDRAIL_ERROR_PREFIX` are exported+// straight from `start_chat` (not re-exported here) for a future RPC-layer+// classifier — nothing in-crate consumes them yet, which would otherwise+// trip `unused_imports` on this re-export.+#[allow(unused_imports)]+pub use start_chat::{is_guardrail_error_message, GUARDRAIL_ERROR_PREFIX};pub use system_turn::{run_system_turn_on_thread, SESSION_CHECKOUT_FAILURE, SYSTEM_CLIENT_ID};#[cfg(test)]