iachat/spec/enterprise/models
Aakash Bakhle dbe35252bc
fix: Use handoff_key for scenarios (#13755)
# Pull Request Template

## Description

Ensure agent function names stay within OpenAI's 64-char limit
(ai-agents prepends "handoff_to_").

Add HANDOFF_TITLE_SLUG_MAX_LENGTH and
handoff_key generation: persisted records use `scenario_{id}_agent`; new
records use a truncated title slug.
Assistant scenario keys and agent_name now reference the generated
handoff key.

fixes :

`Invalid 'messages[9].tool_calls[0].function.name': string too long.
Expected a string with maximum length 64, but got a string with length
95 instead.`

## 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.

Tested locally
<img width="1806" height="1044" alt="image"
src="https://github.com/user-attachments/assets/40cd7a3d-3d97-43a8-bd56-d3f5d63abbda"
/>

## 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

---------

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
2026-03-11 14:01:25 +05:30
..
captain fix: Use handoff_key for scenarios (#13755) 2026-03-11 14:01:25 +05:30
channel feat(voice): Improved voice call creation flow [EE] (#12268) 2025-08-22 13:38:23 +02:00
concerns feat: add campaign context to Captain v2 prompts (#13644) 2026-02-25 18:33:37 +05:30
enterprise/concerns chore: Automate SSL with Cloudflare (#12021) 2025-07-24 13:09:06 +04:00
account_saml_settings_spec.rb feat: update users on SAML setup and destroy [CW-2958][CW-5612] (#12346) 2025-09-15 21:20:22 +05:30
account_spec.rb chore: Update account deletion email copy (#12317) 2025-08-31 16:01:41 +02:00
account_user_spec.rb feat: Add APIs to manage custom roles in Chatwoot (#9995) 2024-08-23 17:18:28 +05:30
agent_capacity_policy_spec.rb feat: Add agent capacity controllers (#12200) 2025-08-26 19:12:58 -07:00
applied_sla_spec.rb feat: Conversation API to return applied_sla and sla_events (#9174) 2024-04-01 23:30:07 +05:30
assignment_policy_spec.rb feat: Add assignment policies controllers with jbuilder views (#12199) 2025-08-18 19:15:21 -07:00
automation_rule_spec.rb feat: sla-2 add automation backend support for SLA (#8775) 2024-02-01 15:42:12 +05:30
company_spec.rb feat: Add company model and API with tests (#12548) 2025-10-08 07:53:43 -07:00
contact_company_association_spec.rb feat: Add company auto-association for contacts (CW-5726 Part 2) (#12711) 2025-11-03 20:36:13 +05:30
conversation_spec.rb feat: Add automatic favicon fetching for companies (#13013) 2026-03-05 18:51:28 -08:00
copilot_message_spec.rb fix: Update specs, add background response job implementation for copilot threads (#11600) 2025-05-27 14:10:27 -06:00
copilot_thread_spec.rb feat: Add support for more tool, standardize copilot chat service (#11560) 2025-05-23 01:07:07 -07:00
custom_attribute_definition_spec.rb feat: Conversation workflows(EE) (#13040) 2026-01-27 11:36:20 +04:00
custom_role_spec.rb feat: Add APIs to manage custom roles in Chatwoot (#9995) 2024-08-23 17:18:28 +05:30
inbox_capacity_limit_spec.rb feat: Add agent capacity controllers (#12200) 2025-08-26 19:12:58 -07:00
inbox_member_spec.rb feat: auditlog for team and inbox member updates (#7516) 2023-08-15 19:55:19 -07:00
inbox_spec.rb feat: MFA (#12290) 2025-09-18 20:19:24 +05:30
macro_spec.rb feat: add audit trail for macros (#7352) 2023-06-20 13:04:59 +05:30
message_spec.rb fix: captain talking over support agent (#13673) 2026-03-03 16:13:34 +05:30
sla_event_spec.rb feat: Conversation API to return applied_sla and sla_events (#9174) 2024-04-01 23:30:07 +05:30
sla_policy_spec.rb feat: sla 1 - refactor sla_policies model and add applied_sla model (#8602) 2024-01-23 23:48:02 +05:30
team_member_spec.rb feat: auditlog for team and inbox member updates (#7516) 2023-08-15 19:55:19 -07:00
team_spec.rb feat: Add audit trail events for team (#7285) 2023-06-09 17:30:36 -07:00
user_spec.rb chore: Move Enterprise pricing validation to on create (#8856) 2024-02-05 19:18:29 +05:30
webhook_spec.rb feat: Audit log APIs (#6434) 2023-03-01 20:02:58 +05:30