Fix false autonomous safety handoffs

This commit is contained in:
jjbrunton committed 2026-08-09 21:27:53 +01:00
1 parent 84a133451f
commit c0cc661a2f
6 files changed
+144 -29

No files matched your search

+23
View File
@@ -313,6 +313,29 @@ describe('ConversationsPage', () => {
expect(await screen.findByRole('textbox', { name: 'Reply to u/alice' })).toHaveValue('Would you like to share a photo?');
});
it('shows unused turns separately from a safety handoff', async () => {
server.use(
http.get('/api/conversations', () => HttpResponse.json([alice])),
http.get('/api/conversations/room-alice', () => HttpResponse.json({
...detailFixture(),
automation: {
turnsUsed: 0,
remainingTurns: 3,
status: 'human-required',
handoffReason: 'The generated media ask was rejected: media ask does not contain a recognizable image or video request.',
},
})),
);
const user = userEvent.setup();
renderConversations();
await user.click(await screen.findByRole('button', { name: /u\/alice/ }));
expect(await screen.findByText('3 automated turns remaining')).toBeInTheDocument();
expect(screen.getByText(/generated media ask was rejected/)).toBeInTheDocument();
expect(screen.getByRole('button', { name: 'Suggest media ask' })).toBeDisabled();
});
it('starts a conversation and preserves both fields after a recoverable failure', async () => {
installConversationList();
let startRequests = 0;