mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-06-28 11:11:37 +08:00
fix(hermes): restore profile and isolate group-chat run events
Group chat switched profiles during multi-agent sends but never restored the user's active profile afterward, leaving Chat/Channels on the wrong profile. matchesRun also accepted any hermes-run-done while run_id was still null, so a concurrent run could leak output. - Save initialProfile separately and restore in finally - matchesHermesRun requires a known matching run_id - Add regression tests Co-authored-by: 晴天 <1186258278@users.noreply.github.com>
This commit is contained in:
19
tests/hermes-group-chat-run-match.test.js
Normal file
19
tests/hermes-group-chat-run-match.test.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import test from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
|
||||
import { matchesHermesRun } from '../src/engines/hermes/pages/group-chat.js'
|
||||
|
||||
test('matchesHermesRun rejects events before run_id is known', () => {
|
||||
assert.equal(matchesHermesRun(null, 'run_other'), false)
|
||||
assert.equal(matchesHermesRun(undefined, 'run_other'), false)
|
||||
assert.equal(matchesHermesRun('', 'run_other'), false)
|
||||
})
|
||||
|
||||
test('matchesHermesRun rejects foreign run_id', () => {
|
||||
assert.equal(matchesHermesRun('run_a', 'run_b'), false)
|
||||
assert.equal(matchesHermesRun('run_a', null), false)
|
||||
})
|
||||
|
||||
test('matchesHermesRun accepts only the same run_id', () => {
|
||||
assert.equal(matchesHermesRun('run_a', 'run_a'), true)
|
||||
})
|
||||
Reference in New Issue
Block a user