mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
fix: check the Assistant config inside its lock and pass bare stream events through (OM-179)
ensureAssistantMode now checks whether opencode.json exists after taking the file lock, so a conversion that ran in between cannot leave it acting on a stale result. The browser event stream again delivers a message frame that carries a typed event without the directory envelope, as it did before the client migration, instead of dropping it silently.
This commit is contained in:
1 parent
052b501963
commit
8b6ed7a861
3 files changed
+20
-4
No files matched your search
@@ -67,6 +67,21 @@ describe('OpenCodeEventStream', () => {
|
||||
expect(onEvent).toHaveBeenNthCalledWith(2, { type: 'credential.updated', data: {} })
|
||||
})
|
||||
|
||||
it('passes through a bare event without an envelope and drops frames without a type', () => {
|
||||
const transport = new TestEventStreamTransport()
|
||||
const stream = new OpenCodeEventStream({ transport })
|
||||
const onEvent = vi.fn()
|
||||
|
||||
stream.subscribeGlobalMonitor({ directories: ['/repo'], onEvent })
|
||||
transport.openConnection()
|
||||
transport.connected()
|
||||
transport.message({ type: 'ssh.host-key-request', properties: { requestId: 'r1' } })
|
||||
transport.message({ payload: { data: {} } })
|
||||
|
||||
expect(onEvent).toHaveBeenCalledTimes(1)
|
||||
expect(onEvent).toHaveBeenCalledWith({ type: 'ssh.host-key-request', properties: { requestId: 'r1' } })
|
||||
})
|
||||
|
||||
it('copies the envelope server id onto remote events only', () => {
|
||||
const transport = new TestEventStreamTransport()
|
||||
const stream = new OpenCodeEventStream({ transport })
|
||||
|
||||
Reference in new issue
Block a user