Hi Anna team,
I found a reproducible BYOK issue while testing an Anna App using `anna.llm.complete`.
## Environment
- App: YourTurn
- App slug: `yourturn`
- App version: `0.1.7`
- Anna CLI: `0.1.47`
- Node: `22.19.0`
- Provider: Gemini BYOK
- Test date: September 23, 2026
- Endpoint: `/api/v1/copilot/app/complete`
- Dev session kind: `complete`
BYOK is enabled and Anna is successfully reaching the Gemini provider.
## Request configuration
The app requested:
```json
{
“modelPreferences”: {
"hints": \[
{
"name": "google/gemini-3.1-flash-lite-preview"
}
\]
},
“maxTokens”: 4096
}
```
## Actual routing
Anna returned:
- Requested model: `google/gemini-3.1-flash-lite-preview`
- Actual model: `byok:gemini/models/gemini-3-flash-preview`
- Provider: `byok:gemini`
Could you confirm whether this model substitution is expected for Gemini BYOK?
## Results
### Test 1
CREATE succeeded:
- Structured response valid: yes
- Client/server latency: approximately 18.94 seconds
- No repair needed
The following TURN request failed three times with HTTP 502 Bad Gateway. Cloudflare reported Browser and Cloudflare working, with the Anna host failing.
Relevant timestamps and Ray IDs:
- 13:15:23 UTC — `a3f9d1125a63868c`
- 13:15:29 UTC — `a3f9d1672b09b64b`
- 13:15:33 UTC — `a3f9d18a78c4a6df`
### Test 2
A repeated CREATE returned truncated JSON:
- Actual model: `byok:gemini/models/gemini-3-flash-preview`
- Latency: approximately 39.59 seconds
- Response length: 6,407 characters
- Validation category: `truncated_json`
- Reported usage: 1,776 input tokens and 1,842 output tokens
The automatic repair request then failed with HTTP 502:
- 13:16:41 UTC
- Ray ID: `a3f9d321684b0883`
### Test 3 — fixed persisted TURN
The same fixed story state and action were tested independently without creating a new story.
Result:
- JSON valid: yes
- Schema valid: yes
- Application semantic validation: yes
- Repair needed: no
- Response length: 3,090 characters
- Client latency: 55.99 seconds
- Server latency: 55.36 seconds
- Actual model: `byok:gemini/models/gemini-3-flash-preview`
## Expected behavior
1. `app/complete` should reliably return a completion through BYOK.
2. If the requested model is substituted, the documented mapping or supported BYOK model hint should be clear.
3. Structured CREATE and TURN requests should not intermittently return host-level 502 errors.
4. Repair requests should remain available after truncated model output.
## Impact
Successful BYOK responses are structurally compatible with the app, but the intermittent 502 errors and 39–56 second latency currently make BYOK unreliable for full-story testing.
The application correctly preserves canonical story state when these requests fail, so no persisted story corruption occurred.
Could you please confirm:
1. Is the requested-to-actual model mapping expected?
2. Are these 502 responses a known BYOK routing issue?
3. Which model hint should be used to target the configured Gemini BYOK model?
4. Are there additional request or provider IDs you would like us to capture?
This may be related to the previously fixed BYOK `app/complete` routing issue:
Thanks!