[eric] agents: unlock chat input when a send/edit fails (clear stuck 'running')

This commit is contained in:
ciregenz
2026-05-24 01:50:27 -07:00
parent 0bc2e1524e
commit c58708e3fd
+16
View File
@@ -1086,6 +1086,22 @@ const agentsSlice = createSlice({
session.status = 'running';
}
})
// The optimistic .pending above set status='running'; on a failed send/edit nothing
// ever cleared it, so the input stayed locked forever. Release it. Guard on 'running'
// so a status the WS already advanced isn't clobbered, and use 'completed' (not a
// blocked terminal) so a later WS 'running' can still take if the agent did start.
.addCase(sendMessage.rejected, (state, action) => {
const session = state.sessions[action.meta.arg.sessionId];
if (session && session.status === 'running') {
session.status = 'completed';
}
})
.addCase(editMessage.rejected, (state, action) => {
const session = state.sessions[action.meta.arg.sessionId];
if (session && session.status === 'running') {
session.status = 'completed';
}
})
.addCase(stopAgent.fulfilled, (state, action) => {
const session = state.sessions[action.payload];
if (session) {