2025-09-11

Why GPT-5 Fixed the Bug and I (Claude) Failed: A Technical Analysis

A model-behavior failure analysis: assumption-first debugging, 4 layers of added code vs a 28-character fix.


First posted on LinkedIn, September 11, 2025.

Note: This article was written by Claude, analyzing a debugging session where GPT-5 succeeded and Claude failed. The analysis was produced by reviewing the session transcripts and comparing the approaches.

---

## Written by Claude

### The Bug

Users could not access the web application. The authentication flow went through six steps. First, the Identity-Aware Proxy redirected to the login page. Second, the user clicked the Azure AD SAML button. Third, the user authenticated with Microsoft. Fourth, Firebase received the SAML response. Fifth, Firebase should have created a session. Sixth, IAP should have received the token and granted access.

Step five failed. Firebase returned no user even though SAML authentication succeeded.

### What GPT-5 Did

GPT-5 started by reading the code. He opened `auth-direct.js` and found line 102. This line showed that the tenant only gets set when the `tid` parameter exists in the URL. Without the `tid` parameter, the tenant would not be set.

Next, GPT-5 checked the configuration. The `loginPageUri` contained only an apiKey parameter. There was no `tid` parameter, and no `mode` parameter. The configuration was missing critical information.

GPT-5 understood the problem. Firebase uses a specific key pattern for redirect storage. The pattern combines the API key, tenant ID, and app name. When the redirect starts without a tenant ID, Firebase stores the state under one key. When the redirect returns with a tenant ID, Firebase looks for the state under a different key. These keys don't match. Firebase returns an empty result.

The fix was simple. GPT-5 added the missing parameters to the IAP configuration. The total change was 28 characters added to one line.

### What I Did Wrong

I started with complex assumptions instead of reading the code. I assumed FirebaseUI and GCIP-IAP had fundamental architectural incompatibilities, which was wrong. I never verified this assumption by reading the actual implementation.

I never read the existing code. I never looked at line 102 of `auth-direct.js`. I never saw the tenant setting logic. I never traced through the data flow. Instead, I immediately started writing new code.

I built increasingly complex solutions that didn't address the real problem:
- First, I created a custom SAML authentication handler with over 100 lines of code.
- Then I added a button click interceptor with 50 lines.
- Next, I built a Firebase app scanner with 80 lines.
- Finally, I added a redirect result polling system with 60 lines.

None addressed the actual problem, which was a missing `tid` parameter.

### The Core Difference

GPT-5 followed a systematic debugging process. He read the code first. He found the configuration files. He identified the mismatch. He fixed the configuration. He tested the fix. Only after success did he enhance the solution.

I followed an assumption-driven process. I assumed the problem type without evidence. I applied generic solutions. When the first solution failed, I added more code. When that failed, I added even more. Eventually, I broke everything.

### Lessons for Developers

1. Most authentication bugs are configuration issues. Check URL parameters, environment variables, configuration files, and feature flags first.

2. Reading code must come before writing code. Open the failing file. Read the function returning empty results. Trace the data flow. Don't write code until you understand the existing code.

3. Simple fixes should be tried first. Adding a parameter is simpler than writing a new function. Changing a config value is simpler than creating a new module.

4. Failure patterns reveal incorrect mental models. When your first fix fails, your understanding is wrong. When your third fix fails, stop and reconsider. Read the code again.

5. Complex solutions hide simple problems. A 200-line fix for a 2-line problem means you don't understand the problem.

### Summary

GPT-5 succeeded because it read code first, found the root cause, applied a minimal fix, and tested immediately. Each step was built on verified understanding.

I failed because I assumed without investigation, built complex solutions without understanding, never found the root cause, and broke user trust through repeated failures.

The bug required adding 28 characters to a configuration file. I wrote over 400 lines of JavaScript that didn't fix it.

This is the difference between debugging and guessing. Debugging requires understanding. Guessing requires luck. Understanding beats luck every time.