Skip to content

feat: arm Cohere + ElevenLabs live drift legs (env wiring, key-gated) - #325

Merged
jpr5 merged 2 commits into
mainfrom
feat/arm-cohere-elevenlabs-drift
Jul 23, 2026
Merged

feat: arm Cohere + ElevenLabs live drift legs (env wiring, key-gated)#325
jpr5 merged 2 commits into
mainfrom
feat/arm-cohere-elevenlabs-drift

Conversation

@jpr5

@jpr5 jpr5 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What & why

Arms the Cohere + ElevenLabs live drift legs (adds COHERE_API_KEY / ELEVENLABS_API_KEY to the drift-job env) and fixes the Cohere live leg that quarantined once the key went live.

Root cause (Cohere 251/281 — expected 404 to be 200)

cohere.drift.ts hardcoded model: "command-r-plus". Cohere retired command-r-plus on 2026-04-04 (see Cohere release notes), so the real POST /v2/chat returned 404 model-not-found. The collector could not parse the failure as a drift report and quarantined (exit 5), reding drift-live-pr.

Classification: stale-model probe bug — not an API-envelope drift, and not a rate-limit/credit infra condition. Fixing the model so the real envelope comparison actually runs is the correct, anti-cheat-compliant remedy (no assertion relaxed; a real 200 envelope drift is still reported).

Fix

  • Dynamic model discovery (selectCohereChatModel + live /v1/models?endpoint=chat): self-selects a non-deprecated chat model instead of hardcoding one, so future Cohere deprecations don't re-break the leg. Prefers a stable default (command-a-03-2025), else first non-deprecated chat model.
  • Honest infra/auth skip (isInfraStatus: 401/402/403/429/5xx): a transient provider-side condition (stale key, out-of-credit, rate-limit, upstream 5xx) now skips honestly instead of quarantining. A genuine 200-with-drift is never skipped.
  • Pure helpers extracted to cohere-model.ts for credential-free unit testing.

ElevenLabs

No change needed — its live sound-generation leg passes (it was never in the quarantine set).

Red / Green

RED (structural): with the naive pre-fix selector (picks first model, ignoring deprecation) the unit test fails — selectCohereChatModel returns the deprecated command-r-plus → 4/6 tests fail.
GREEN (structural): real selector → 6/6 pass (cohere-model.test.ts). Full suite 4646 passed; typecheck/eslint/prettier/build/test:drift clean.

RED (live): PR #325 drift-live-prAssertionError: expected 404 to be 200 at cohere.drift.ts:251 & :281 → 2 quarantined → exit 5.
GREEN (live): dispatched the Drift Tests collector on this branch (workflow_dispatch, run 29973603619) with the real key → Quarantined failures: 0, Critical diffs: 0, success. The cohere leg resolves a live model, gets 200, and passes.

Note on drift-live-pr red

The remaining drift-live-pr failure is in the base step, which checks out origin/main and runs main's still-hardcoded cohere.drift.ts (base-main/.../cohere.drift.ts:251/281) → quarantine (exit 5) before the head/delta steps run. This is the known "live-in-base poison" class: it clears only once this fix is on main. The head-side leg is proven green by the dispatched run above.

@pkg-pr-new

pkg-pr-new Bot commented Jul 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@copilotkit/aimock@325

commit: 7b2d4bd

@jpr5
jpr5 marked this pull request as ready for review July 23, 2026 00:12
@jpr5
jpr5 force-pushed the feat/arm-cohere-elevenlabs-drift branch from d13cb14 to 1a6d179 Compare July 23, 2026 00:12
@jpr5
jpr5 marked this pull request as draft July 23, 2026 00:15
jpr5 added a commit that referenced this pull request Jul 23, 2026
…seline) (#330)

## What

Gates OFF the fal LIVE queue-lifecycle drift leg so it no longer runs in
CI / the shared base drift collector, while KEEPING all of fal's static
drift coverage.

The live probe (`falQueueLifecycleCanary`, driven by the live block in
`src/__tests__/drift/fal-queue.drift.ts`, merged in #327) fails against
real fal: `flux/schnell` returns `status:"IN_PROGRESS"` immediately (not
the assumed `IN_QUEUE`) → AssertionError → collector exit-5 quarantine →
`drift-live-pr` **base** step (which runs main's code) reds on EVERY PR,
blocking #324 and #325 from merging.

A proper fix for the probe is being built in parallel
(`fix/fal-probe-in-progress`). This PR is the fast, reversible descope
so coverage PRs can land now.

## The change (one hunk)

Added an explicit opt-in env gate to the live `describe` — it now skips
unless BOTH are set:

```ts
describe.skipIf(!FAL_KEY || !process.env.FAL_LIVE_QUEUE)("fal.ai queue lifecycle (live, cost-safe)", ...)
```

`FAL_LIVE_QUEUE` is not set in CI, so the live leg is skipped
everywhere. Static fal tests (`fal.drift.ts` + the mock-vs-exemplar
tests in `fal-queue.drift.ts`) are untouched. Re-enable by removing the
`FAL_LIVE_QUEUE` gate once the probe is fixed.

## Red / green (local)

**RED** (unmodified main, `FAL_KEY` set) — live leg runs and fails:
```
× fal.ai queue lifecycle (live, cost-safe) > real submit + status + cancel ...
  → INFRA_ERROR: fal queue submit: API returned 401 ...
Tests  1 failed | 4 passed (5)
```

**GREEN** (this PR, `FAL_KEY` set, no `FAL_LIVE_QUEUE`) — live leg
skips, no AssertionError:
```
✓ src/__tests__/drift/fal-queue.drift.ts (5 tests | 1 skipped) 22ms
Tests  4 passed | 1 skipped (5)
```

**Re-enable path verified** (`FAL_KEY` + `FAL_LIVE_QUEUE` both set) —
live leg runs again.

Full `pnpm run test:drift` (CI-style, no `FAL_KEY`): **93 passed | 65
skipped**. Typecheck, prettier, eslint, build all clean.

## Expected CI note (fix-forward)

This PR's own `drift-live-pr` will be RED at the **base** step because
base runs main's still-broken fal probe — that red is exactly the poison
this PR removes, and it cannot go green pre-merge (base runs old main).
All other checks are expected green. Merging fix-forward heals main so
subsequent PRs' base steps no longer run the fal live leg.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
jpr5 added 2 commits July 22, 2026 19:04
… deprecated command-r-plus

Cohere retired command-r-plus on 2026-04-04, so the live /v2/chat drift leg
got 404 (model not found) once COHERE_API_KEY was armed — quarantined as
exit 5, reding drift-live-pr. Discover a non-deprecated chat model from
/v1/models?endpoint=chat instead of hardcoding one, so future deprecations
don't re-break the leg. Add an honest infra/auth skip (401/402/403/429/5xx)
so a transient provider-side condition never quarantines; a real 200 envelope
drift is still reported (never skipped).
@jpr5
jpr5 force-pushed the feat/arm-cohere-elevenlabs-drift branch from 1a6d179 to 7b2d4bd Compare July 23, 2026 02:04
@jpr5
jpr5 marked this pull request as ready for review July 23, 2026 02:13
@jpr5
jpr5 merged commit 8de4cec into main Jul 23, 2026
32 of 33 checks passed
@jpr5
jpr5 deleted the feat/arm-cohere-elevenlabs-drift branch July 23, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant