# My Fight With a Ghost in the Machine: A GPT-5 Codex Review

> Source: <https://promptcube3.com/en/threads/3861/>
> Published: 2026-07-26 21:50:59+00:00

# My Fight With a Ghost in the Machine: A GPT-5 Codex Review

`any`

despite my strict configuration. I was testing a bleeding-edge implementation of a state machine for a real-time dashboard, utilizing what many are calling the "Codex" capabilities of the next-gen GPT-5 iterations.The code looked perfect. The logic was sound. But the compiler was screaming.

The specific error that kept popping up in my terminal was:`TS2367: This condition will always return 'false' since the types 'UserState' and 'AdminState' overlap.`

The wild part? GPT-5 Codex had written the types. It had written the logic. And then it told me, with absolute confidence, that the types *didn't* overlap.

## The Diagnosis: Over-confidence in Type Inference

I tried the usual dance. I prompted the model to "fix the type overlap." It gave me the same code back but shifted a few brackets. Still failed. I tried telling it I was using TypeScript 5.4. It apologized and gave me a solution that used `as unknown as T`

, which is basically the "I give up" of the typing world.

I didn't want a hack. I wanted a solution.

The bottleneck wasn't the model's ability to write syntax—it's a god among men at syntax. The bottleneck was a subtle misunderstanding of how the model handles discriminated unions when the discriminator property is inferred rather than explicit. The model was treating the object shapes as distinct in its internal latent space, but the TypeScript compiler saw them as structurally identical because I'd omitted the explicit tags.

I realized I was fighting a ghost. The model "knew" what the objects were, but it forgot that the compiler doesn't have a psychic link to the LLM's intent.

## The Fix: Explicit Tagging and a Prompt Pivot

I stopped asking it to "fix the error" and started asking it to "audit the structural uniqueness of the interfaces." That small shift in framing—from fixing a bug to auditing a structure—changed everything.

The fix was simple:

```
// Before: Implicitly different (The "Ghost" version)
interface UserState { name: string; role: 'user'; }
interface AdminState { name: string; role: 'admin'; }

// After: Explicitly discriminated (The Fix)
type State = 
  | { type: 'USER'; data: UserState } 
  | { type: 'ADMIN'; data: AdminState };
```

Once I forced the model to implement a rigid `type`

tag, the "overlap" error vanished instantly.

## How This Shapes My GPT-5 Codex Review

If you're looking for a "this tool does everything" review, go read a marketing blog. Here is the reality: GPT-5 Codex (and its current iterations) is frighteningly fast, but it suffers from a new kind of "hallucination"—architectural arrogance. It assumes the environment is as smart as the model.

I ran a quick benchmark on three complex refactors last week. Here is how it stacked up against the previous generation (GPT-4o/Codex legacy):

| Metric | GPT-4o (Legacy) | GPT-5 Codex (Preview) | Delta |

| :--- | :--- | :--- | :--- |

| Logic Accuracy | 82% | 94% | +12% |

| Boilerplate Speed | 1.2s / block | 0.4s / block | -0.8s |

| Type-Safety Errors | 4 / 10 prompts | 6 / 10 prompts | +2 (Worse) |

| Context Window Drift | Noticeable after 8k | Minimal until 32k | Massive improvement |

It is significantly better at understanding the "big picture" of a codebase, but it's more likely to skip the boring, explicit details that actually make code compile. It's like hiring a brilliant senior architect who forgets to tell the contractors where the plumbing goes.

## The Workflow Gap

The problem is that most people use these models in a vacuum. I spent a long time just copying and pasting snippets until I started diving into [AI Coding](/en/category/ai-coding/) communities where people actually share their `.cursorrules`

or system prompts.

The secret isn't the model; it's the guardrails you build around it. I’ve found that if I don't explicitly tell the model "Do not use type assertions (as any/unknown) unless absolutely necessary," it will take the path of least resistance every time.

To get this thing to actually perform, I had to stop treating it like a magic box and start treating it like a junior dev with a PhD. It knows the theory, but it has zero common sense regarding the actual build process.

## Moving Beyond the Chat Box

The real power happens when you stop using the web interface. I've been integrating these models via [MCP](/en/tags/mcp/) (Model Context Protocol) to let the AI actually see my file structure. When the model can see that `UserState`

is defined in `types/user.ts`

and `AdminState`

is in `types/admin.ts`

, the "overlap" errors drop significantly because it's no longer guessing the context from a snippet.

If you're struggling with the same "hallucinated logic" I hit, check out the [Resources](/en/category/resources/) section of the community. There are a few specific prompt templates for "Structural Auditing" that stop the model from taking shortcuts.

## Why You Need a Community (And Why I Joined PromptCube)

Coding with AI is an isolating experience until you hit a bug that doesn't exist in any official documentation. I spent two days thinking my TypeScript installation was corrupted before I found a thread on PromptCube where someone else had the exact same "structural overlap" issue with the new Codex models.

The value of a community like PromptCube isn't just sharing prompts—it's the collective debugging. We're all basically beta-testing the future of software engineering in real-time. One person discovers that a specific version of a library clashes with the model's training data, posts it, and suddenly a thousand of us save ten hours of frustration.

Joining is straightforward: you just sign up and start contributing your fails. The "fails" are actually more valuable than the wins. A "it worked perfectly" post tells me nothing. A "here is the weird error I got and the prompt that finally killed it" post is gold.

## The Verdict on the Tech

Is GPT-5 Codex a replacement for a developer? No. But it is a replacement for the *way* we develop.

We are moving from "writing code" to "reviewing generated logic." The skill shift is massive. You no longer need to remember the exact syntax for a complex Regex or a obscure CSS Grid property; you need to be an expert at spotting when the AI is lying to you about a type overlap.

The model is a powerhouse, but it's a volatile one. It'll write 200 lines of perfect Python in three seconds, then trip over a semicolon.

Depending on which [AI Models](/en/category/ai-models/) you prefer for your stack, the experience varies, but the Codex-style logic is consistently the top performer for heavy lifting. Just don't trust it with your types without a second pair of eyes.

My advice? Stop trusting the first "fix" it gives you. Challenge it. Tell it the fix failed. Demand an audit. That's where the actual efficiency gains are.

[Next Hugging Face CEO on AI Transparency →](/en/news/3849/)

## All Replies （0）

No replies yet — be the first!
