Codex continues issuing Terra requests for 5 minutes after task_complete
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Summary
Codex 0.153.4 issued repeated gpt-5.6-terra Responses API requests after the visible task had completed. This caused unintended token usage.
Environment
- Windows 11
- Codex CLI 0.153.4, custom Responses provider
disable_response_storage = true- CC Switch proxy,
auto_failover_enabled = 0 - Default Codex/CC Switch model at the time:
gpt-6-astra
Observed timeline (local proxy log, China Standard Time)
- 10:01:53: Codex sent Astra and Luna requests concurrently.
- 10:02:00: Luna circuit breaker opened after repeated upstream 503 responses.
- 10:02:07: first request with
model=gpt-5.6-terra. - 10:03:01: the Codex session JSONL recorded
task_complete. - 10:03:17 through 10:07:08: Terra requests continued, with input growing from about 20K to 63,757 tokens and small outputs.
- 10:07:14: final Terra record had 0 input and 0 output; no further Terra requests occurred.
Evidence
- CC Switch log lines 506-534 and 541-593 show the model names and timestamps.
- Codex session file
~/.codex/sessions/2026/09/05/rollout-2026-09-05T10-01-24-01a06f4c-9469-7750-bf68-c68fbdeeea04.jsonlrecordstask_completeat 10:03:01. - Local Codex agent configs contain only Luna; Codex config and live backup contained Astra. No Terra agent configuration was found.
- CC Switch
auto_failover_enabled=0, so this was not ordinary proxy failover.
Expected behavior
When a task reaches task_complete or the user-visible response is delivered, all continuation/background requests for that task should be cancelled. A model should never be selected outside the configured model policy without an auditable reason.
Questions
- What Codex component can issue requests after
task_complete? - Why was
gpt-5.6-terraselected although it was absent from Codex and agent configuration? - Why was there no cancellation signal when the visible task completed?
- Is there a supported way to disable or cap hidden continuation/loop work?
Request bodies are unavailable because response storage was disabled, but the local timestamps, model names, token counts, and session completion event are preserved.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the cited session JSONL alongside CC Switch log lines 506-534 and 541-593, then compare the timestamps with the local Codex and agent configurations. Trace what continues after task_complete and how Terra was selected; done means identifying the responsible component and explaining or fixing cancellation and model-policy behavior, including a supported way to cap or disable continuation work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100