DeepSeek and Codex: 9/9 green tests and the wrong file

A 3 min 59 s execution ended with 10/10 on delivery verification; the other passed 9 tests and left the requested file untouched.

When Codex finished the task, I didn’t look at the test counter first. I opened a terminal and compared the hash of inventory_service.py. That decision turned an apparently perfect demonstration into a useful test: the agent had passed the suite, yes, but it had also modified exactly the file that needed to be repaired.

The detail matters because a baseline execution, which I’ll call DSH, got the same 9/9 with deepseek-v4.1-flash and didn’t touch that file. It created a copy of the package in another path and the suite imported that copy. The tested code was correct; the delivery didn’t match the request.

I’m not presenting this as a competition between models. It’s a story about Codex’s workflow loop and about the difference between “the suite is green” and “the change landed in the right place.” It’s also why I’ve found it useful to connect DeepSeek to Codex: the low cost lets me investigate a second hypothesis without turning every retry into a budget decision. Cheap doesn’t fix delivery, but it makes it easier to demand one more check before accepting it.

The repair that seemed finished

The repository contained a small inventory service and several failure paths around the same purchase operation. Multiple items had to be deducted atomically, repeated SKUs merged before calculating stock, and invalid quantities rejected uniformly. Also, snapshot() had to avoid returning a reference capable of altering internal state and protect the sale of the last unit against two simultaneous threads.

The hidden suite didn’t stick to the happy path. It threw fifty threads at seven units and forty buyers requesting two products with limited stock. It checked that a failed purchase didn’t leave a part deducted, that duplicate SKUs were consolidated before deduction, and that a snapshot copy didn’t modify the real inventory.

That material gives Codex a concrete signal. It reads the test output, goes back to the project, proposes an edit, runs again, and uses the new error to adjust the next edit. There’s no need to copy the failure in a separate window: the tool’s result comes back to the same context that holds the code.

Codex completed that loop in 3 min 59 s. The nine behavior tests passed and the target file changed. The check added a point for that modification, up to 10/10. Up to here, the result was what anyone would want to publish as a screenshot.

The agent’s value shows up when a tool’s output can change the next edit; the suite’s green is only part of that cycle.

The import that resolved the doubt

The DSH execution served as a control. It passed the nine behavior tests, but its delivery score was 9/10. The requested file kept its original hash. Python had found another module with the same name in the working directory, and the tests were exercising that implementation.

This doesn’t mean the tests were badly written in the abstract. It means an import can resolve a name to a different path than expected. For anyone reviewing the patch, the order of questions changes:

  1. Did the process end without errors?

  2. Did the diff stay within the allowed files?

  3. Did the indicated file change?

  4. Did the test import that same file?

Those are four different answers. A correct exit code doesn’t guarantee a clean diff. A clean diff doesn’t guarantee the target was edited. A green suite doesn’t guarantee the imported path is the delivered path.

The hashes for this execution were these:

before:
5F8FA06F3A9B9ED7022CE2EEC9158D0139DEC6716872FAC8F9D0E86DDC7C88F8
​
after:
008AF21A36C45CDBB9513961DBF52E2E663791EF5CA5A31FB018871F1F4EF66D

The second hash doesn’t prove by itself that the patch is good. It demonstrates something more limited and very practical: the file I asked to modify is no longer the file I started with. That check would have stopped the DSH delivery before the 9/9 got confused with finished work.

How I connected DeepSeek to Codex

The setup I used keeps Codex’s loop and changes the model provider. This is the config.toml block:

model = "deepseek-v4.1-flash"
model_provider = "crazyrouter"
​
[model_providers.crazyrouter]
name = "Crazyrouter"
base_url = "https://api.crazyrouter.com/v1"
env_key = "CRAZYROUTER_API_KEY"
wire_api = "responses"
requires_openai_auth = false

wire_api = "responses" defines the request format Codex expects. requires_openai_auth = false avoids also asking for OpenAI login when the provider’s key already authenticates the call. The CRAZYROUTER_API_KEY variable must exist in the environment from which Codex is launched; if it’s defined in another terminal, it doesn’t work for that process.

Before running the repair I checked three layers separately. A short request confirmed the gateway responded with the requested model identifier. A side-effect-free command confirmed Codex could run tools in the working directory. And a test that failed on purpose confirmed the error came back to the loop and the agent could try another edit.

Separating the layers saves time. An authorization failure shows up before reaching the model. A wrong identifier might fail when selecting the route. If the model responds but no command runs, the problem is in the session, directory, or permissions. Changing the configuration without knowing which of those layers failed just adds noise.

The delivery receipt I use now

I don’t wait for the agent to describe its own success. After execution, I gather four signals in the same terminal. This is the minimal version for Python in PowerShell:

python -m pytest -q
$LASTEXITCODE
​
git diff --stat
git diff -- inventory_service.py
​
$target = (Resolve-Path .\inventory_service.py).Path
$target
(Get-FileHash $target -Algorithm SHA256).Hash
​
python -c "import inventory_service; print(inventory_service.__file__)"
Get-ChildItem -Name inventory_service*

The first command confirms which tests ran and what the exit code was. The git diff block delimits the change and shows if unexpected files appeared. The hash answers whether the target changed. The import answers a different question: what file Python sees when it resolves the module. The last listing makes visible the existence of packages or homonymous files that might have diverted the test.

Codex reached 10/10 in this execution; DSH stayed at 9/10 because the target file didn’t change. The difference wasn’t in the number of tests, but in the artifact.

For a real review I’d add the diff content to the review history. The hash detects that something changed, not that the change is correct. And the suite only covers cases someone wrote. In concurrent code, a test can be very useful and still leave out a dangerous interleaving.

Why 773,893 tokens cost $0.064 USD

Codex’s execution logged 773,893 input tokens. Of those, 738,432 came from cache and 35,461 weren’t cached. The output was 24,869 tokens, with 8,033 dedicated to reasoning.

The volume makes more sense if you look at the tool loop. Each file read, each test output, and each new edit expand the context of the next call. The visible conversation can look brief even though the API is processing a lot of repeated material.

With DeepSeek V4 Flash public prices from October 27, 2026, the estimate looks like this:

Component Tokens List Price Estimate
Uncached Input 35,461 $0.45 / million $0.01596
Cached Input 738,432 $0.02 / million $0.01477
Output 24,869 $1.34 / million $0.03332
Total $0.064

It’s arithmetic on public prices, not an invoice. The final amount can change depending on the plan, cache rules, retries, and the provider routing used.

The useful comparison isn’t “DeepSeek thinks better than another model,” because this test doesn’t support it. The useful comparison is of cost with the same token profile. Applying GPT-6.1 Sol’s list prices to the same amounts—$2 per million input and $10 per million output—the result would be approximately $1.797.

The practical difference isn’t just a smaller number. It changes loop policy: at an estimated cost of six cents, trying another strategy after an ambiguous signal is a reasonable decision. At a cost close to $1.80, the same retry demands better justification for why it will bring new information.

That’s the advantage I’ve noticed with DeepSeek inside Codex. It doesn’t magically reduce context or turn an incomplete test into a complete one. It makes the agent’s repetitive work cheap enough to run and then audit carefully. The savings buy attempts; delivery engineering is still necessary.

When to stop the loop

“Cheap” doesn’t mean “retry without limit.” A retry is worth it when a new error appears, a different assertion, a more precise trace, or a reading that changes the hypothesis. If Codex runs the same command, gets the same output, and proposes the same change again, continuing only inflates context.

I’d also stop if I see a modification out of scope, a new file the task didn’t ask for, or an explanation that contradicts terminal output. In those cases the problem isn’t “give the model another turn.” There’s work to do back in the repository, fix the import test, or rephrase the assignment.

The repair I describe fits a specific category: a reproducible suite, an identifiable target file, and a diff that can be reviewed. I’d use this setup for test failures, type errors, lint, small refactorings, or test case generation. Before accepting the patch I’d review the behavior and not just the green.

I wouldn’t use it as a substitute for review in data migrations, payments, authentication, permissions, or production configuration. A six-cent patch is still expensive if the test imported another module or if the change made it to production without human review. The economics of the model don’t change the economics of the incident.

What I take from this test

DeepSeek was capable enough to walk through this repair inside Codex and cheap enough to retry when the agent needed another pass. That combination is the part I recommend. The comfort doesn’t come from trusting the model more, but from being able to put the loop to work and demand verifiable evidence at the end.

The next task I’d try would be small and fail today in a reproducible way. Before starting I’d write down the target file. When done I’d review the exit code, the diff, the hash, and the imported path. If those four signals agree, the result moves from “looks good” to a delivery I can defend.

The connection setup used here is documented by Crazyrouter. The scope of this observation is one project, one machine, and one specific suite; it’s not a general model ranking or a promise that the same patch works in another repository.


Transparency: AI tools were used to draft and edit this text. Hashes, tokens, commands, and figures were checked against the execution log. The amounts are estimates of public pricing, not invoices.