fix(tui): mark disposed when the agent leaves the registry under the TUI
agent/disposed only cleared the status line, so an agent-loop-only reload that disposed the agent while the TUI stayed mounted left the local disposed flag false. Since retained agents accept deliveries after detachment, later input drove a zombie agent/session. Set disposed on agent/disposed so dispatchMessage reports it. Adds a regression that sends after disposal and asserts no delivery.
This commit is contained in:
@@ -3217,6 +3217,11 @@ export function createTuiChat(
|
||||
})
|
||||
const disposeAgent = ctx.on('agent/disposed', (subject) => {
|
||||
if (subject !== agent) return
|
||||
// The agent left the registry (e.g. an agent-loop-only reload) while the
|
||||
// TUI stays mounted. Retained agents accept deliveries after detachment, so
|
||||
// without this a later send would drive a zombie agent/session; mark
|
||||
// disposed so dispatchMessage reports it instead.
|
||||
disposed = true
|
||||
clearStatus()
|
||||
appendNotice(`Agent "${agent.id}" was disposed.`, 'warning')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user