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(chat): wrap cancel RPC response in result object
Steven Enamakel17fe846ce2f7
diff --git a/app/src/services/__tests__/chatService.test.ts b/app/src/services/__tests__/chatService.test.tsindex 3e296c1689..729b9ee1a7 100644--- a/app/src/services/__tests__/chatService.test.ts+++ b/app/src/services/__tests__/chatService.test.ts@@ -466,7 +466,7 @@ describe('chatService.chatCancel', () => {});it('reports a torn-down turn when the core returns its request id', async () => {- mockCallCoreRpc.mockResolvedValue({ cancelled: true, request_id: 'req-1' });+ mockCallCoreRpc.mockResolvedValue({ result: { cancelled: true, request_id: 'req-1' } });expect(await chatCancel('thread-9')).toEqual({ accepted: true, turnCancelled: true });expect(mockCallCoreRpc).toHaveBeenCalledWith({@@ -477,9 +477,7 @@ describe('chatService.chatCancel', () => {it('reports no turn when the core had nothing in flight', async () => {mockCallCoreRpc.mockResolvedValue({- cancelled: true,- request_id: null,- subagents_cancelled: 2,+ result: { cancelled: true, request_id: null, subagents_cancelled: 2 },});expect(await chatCancel('thread-9')).toEqual({ accepted: true, turnCancelled: false });});diff --git a/crates/openhuman-core/src/agent/orchestration/background_completions.rs b/crates/openhuman-core/src/agent/orchestration/background_completions.rsindex e2a75b0e79..c0d5285a5c 100644--- a/crates/openhuman-core/src/agent/orchestration/background_completions.rs+++ b/crates/openhuman-core/src/agent/orchestration/background_completions.rs@@ -331,13 +331,15 @@ pub(crate) fn discard_for_thread(thread_id: &str) -> usize {removed}-/// Drop every queued completion for `thread_id` **without** tombstoning it.+/// Drop every queued completion for `thread_id` and gate late results from the+/// stopped generation.////// The Stop-button counterpart of [`discard_for_thread`]: the user halted the/// thread's work, so results that finished but were not yet delivered must not/// start a fresh delivery turn behind their back. The thread itself stays-/// alive, so sub-agents spawned by later turns on it deliver normally. Returns-/// the number of queued completions removed.+/// alive; [`resume_for_thread`] reopens it when a later user turn begins, so+/// sub-agents spawned by that turn deliver normally. Returns the number of+/// queued completions removed.pub(crate) fn discard_pending_for_thread(thread_id: &str) -> usize {let mut state = queue().lock()