iachat/app
Rodribm10 b457e84c2f fix(captain): route embeddings to legacy OpenAI + retry transient errors
Resolve duas camadas de problema identificadas em teste end-to-end:

1. Embeddings falhavam com HTTP 404 (/codex/v1/embeddings não existe).
   Solução: Captain::Llm::EmbeddingService sempre usa OpenAI tradicional
   via Llm::Config.with_api_key(legacy_settings). ProviderConfig expõe
   legacy_openai_settings pra isso.

2. Servidor Codex ocasionalmente responde com response.failed +
   code=server_error (instabilidade transitória). Client agora retenta
   até 2x com backoff exponencial (0.5s, 1.5s) em erros retryable:
   HTTP 5xx, server_error no response.failed, ou stream inacabado.

Outras correções nesta etapa:
- Scenario#agent_model: em modo Codex, ignora CAPTAIN_OPEN_AI_MODEL_SCENARIO
  (que pode ter gpt-4o legado) e usa ProviderConfig.model.
- ExtractionService/ContradictionCheckerService/TranslateQueryService:
  trocam constantes hardcoded gpt-4o-mini/gpt-4.1-nano por
  ProviderConfig.light_model (respeitando o provider ativo).
- ProviderConfig.DEFAULT_CODEX_MODEL agora é gpt-5.2 (reconhecido pelo
  RubyLLM; gpt-5.4 não está no catalog do gem).

Validado ponta-a-ponta: WhatsApp → Chatwoot → Jasmine → handoff Daniela
→ faq_lookup com embedding OK → resposta com preços corretos.

Docs em docs/captain-codex-oauth.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 17:42:31 -03:00
..
actions Merge branch 'main' into chore/merge-upstream-4.5.0 2025-08-20 11:20:31 -03:00
assets feat: Hide installation identifier (#11722) 2025-06-17 15:45:40 -07:00
builders feat: add audio transcoding support for WhatsApp Cloud API (#220) 2026-02-22 16:21:50 -03:00
channels fix: Move contact events to account stream rather than individual user stream (#11082) 2025-03-13 17:46:48 -07:00
controllers feat(captain): Codex OAuth auth module + proxy controller 2026-04-22 15:07:01 -03:00
dashboards feat: Auto confirm user email when super admin make changes (#12418) 2025-09-23 20:14:02 +05:30
dispatchers feat: toggle typing status on channel provider (#39) 2025-05-03 00:39:39 -03:00
drops feat: Implement existing template linking for CSAT surveys (#218) 2026-02-18 18:00:29 -03:00
fields chore: improve plan-based feature handling with plan hierarchy (#11335) 2025-04-28 14:13:56 -07:00
finders feat: add SKIP_INCOMING_BCC_PROCESSING as internal config (#12484) 2025-09-22 17:52:56 +05:30
helpers feat: lead attribution tracking - landing page origin detection 2026-03-02 14:40:35 -03:00
javascript feat(retention): UI layer — badge, filters, cohort matrix, KPI dashboard 2026-04-22 10:30:19 -03:00
jobs Automate landing promotion sync to captain docs/faqs with cascade cleanup 2026-03-04 19:30:05 -03:00
listeners feat: mensagens agendadas (#198) 2026-01-30 22:08:16 -03:00
mailboxes Chore/merge upstream 4.8.0 (#150) 2025-11-19 16:25:58 -03:00
mailers fix: email delivery in Email::SendOnEmailService (#217) 2026-02-18 16:23:13 -03:00
models fix(captain): route embeddings to legacy OpenAI + retry transient errors 2026-04-22 17:42:31 -03:00
policies Merge branch 'main' into chore/merge-upstream-4.11.0 2026-02-17 23:05:26 -03:00
presenters fix(mailbox): handle malformed sender address headers (#13486) 2026-02-11 11:02:38 -08:00
services feat(wuzapi): dispatch interactive messages (buttons/list/url_button) 2026-04-15 01:30:31 -03:00
views fix(ui): dropdown Vincular Unidade Pix mostra unit vinculada em cascata 2026-04-14 20:07:33 -03:00