[Bug] Scheduled Codex tasks lose provider binding and fail with Invalid model name
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 401
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
## Summary
A scheduled Codex task can fail even when the same model works in a normal Cindy conversation.
The schedule keeps the selected model (`gpt-5.6-terra`) but does not persist its provider binding. When the scheduler runs, it falls back to the default gateway, which does not expose that model.
## Reproduction
1. Create an AI automation task.
2. Select Codex with model `gpt-5.6-terra`.
3. Save the task and run it manually or wait for the schedule.
## Actual result
The run fails with:
```text
/responses: Invalid model name passed in model=gpt-5.6-terra.
Call `/v1/models` to view available models for your key.
```
## Expected result
The scheduled task should use the same configured provider as the selected model and run successfully.
## Investigation
The normal conversation record contains:
```text
model = gpt-5.6-terra
provider_id = gpt
```
But the generated scheduled task and its background session contain:
```text
model = gpt-5.6-terra
provider_id = NULL
```
As a result, the background runner uses the fallback/default gateway instead of the configured `gpt` provider.
## Environment
- Cindy 0.1.21
- Windows
- Execution mode: AI task / Codex
Contributor guide
Research direction
Start by tracing scheduled-task generation and the background session records, comparing them with the normal conversation record described in the issue. Reproduce the Codex automation with model gpt-5.6-terra and verify that the selected provider_id is persisted and used by the scheduled run without the Invalid model name error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100