chatwoot/enterprise/lib/captain
Aakash Bakhle 70f799ab35
fix(captain): add v1 handoff classifier [AI-137] (#14337)
# Pull Request Template

## Description

Captain (v1) makes false promises by saying it will handoff but doesn't.
This happens due to an exact string match comparison and the prompt
gives the model a lot of responsibilities:
- identity
- what to respond
- obey custom instructions
- decide on tool calls

This PR decouples responsibility, the core prompt responds, and an
additional llm call evaluates if handoff was needed or not after that
message.

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration.

Locally


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] Any dependent changes have been merged and published in downstream
modules
2026-05-05 14:34:31 +05:30
..
prompts fix: conservative hand_off prompt on auto-resolution (#13953) 2026-03-31 11:10:12 +05:30
tools feat: Add force legacy auto-resolve flag (#13804) 2026-03-13 15:04:58 -07:00
assistant_action_schema.rb fix(captain): add v1 handoff classifier [AI-137] (#14337) 2026-05-05 14:34:31 +05:30
conversation_completion_schema.rb feat: captain decides if conversation should be resolved or kept open (#13336) 2026-03-13 10:03:58 +05:30
conversation_completion_service.rb fix: log only on system api key failures (#13968) 2026-04-09 18:04:52 +05:30
prompt_renderer.rb fix: captain liquid render file system (#13647) 2026-02-25 20:19:34 +05:30
response_schema.rb feat: scenario agents & runner (#11944) 2025-08-14 12:39:21 +05:30