Skip to content

Fix debate transcript pages returning 404 on Vercel#4

Draft
emregucerr wants to merge 1 commit into
mainfrom
cursor/fix-debate-page-vercel-23f9
Draft

Fix debate transcript pages returning 404 on Vercel#4
emregucerr wants to merge 1 commit into
mainfrom
cursor/fix-debate-page-vercel-23f9

Conversation

@emregucerr

Copy link
Copy Markdown
Owner

Problem

Debate detail pages like /debate/debate-041-grok-4.20-reasoning-vs-grok-4.20-multi-agent return 404 after deploying to Vercel.

Root cause

The debate page (/debate/[id]/page.tsx) loads transcript data using fs.readFileSync from ../benchmark/results/debates/, a path that only exists in the monorepo during local development or benchmark runs. On Vercel, only the web/ directory is deployed, so the filesystem read always fails and getDebateData() returns null, triggering notFound().

Additionally, generateStaticParams() tried to enumerate debate files from the same missing directory, returning [] — meaning zero debate pages were pre-rendered at build time.

Fix

web/src/lib/benchmark-data.ts

  • Added getDebateById(debateId) that reconstructs a full DebateResult from the bundled benchmark-results.json summary data
  • Derives initial_votes and final_votes arrays from the vote_details already present in each debate's score object

web/src/app/debate/[id]/page.tsx

  • getDebateData() now falls back to getDebateById() when the filesystem path doesn't exist
  • generateStaticParams() now falls back to the bundled debate list, so all 45 debate pages are pre-rendered at build time

web/src/components/debate/DebateReplay.tsx

  • Shows a helpful message when the transcript array is empty (simulated/summary debates don't include transcript text) instead of rendering a blank section

Verification

Build output confirms all 45 debate pages are now statically generated:

● /debate/[id]
│ ├ /debate/debate-001-claude-opus-4.6-thinking-vs-claude-opus-4.6
│ ├ /debate/debate-002-claude-opus-4.6-thinking-vs-gemini-3.1-pro-preview
│ ├ /debate/debate-003-claude-opus-4.6-thinking-vs-grok-4.20
│ └ [+42 more paths]
Open in Web Open in Cursor 

The debate detail page (/debate/[id]) was loading transcript data from
../benchmark/results/debates/ using fs.readFileSync. This directory only
exists in the monorepo during local development and benchmark runs — it
is not included in Vercel deployments where only the web/ directory is
deployed.

Changes:
- Add getDebateById() to benchmark-data.ts that reconstructs a
  DebateResult from the bundled benchmark-results.json summary data,
  deriving initial/final votes from vote_details
- Update debate page's getDebateData() to fall back to bundled data
  when filesystem files aren't available
- Update generateStaticParams() to fall back to bundled debate list,
  so all 45 debate pages are pre-rendered at build time
- Show a helpful message in DebateReplay when transcript is empty
  instead of rendering a blank section

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>
@vercel

vercel Bot commented Apr 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-squared Ready Ready Preview, Comment Apr 9, 2026 6:23am

Request Review

cursor Bot pushed a commit that referenced this pull request Apr 9, 2026
* Phase 0+1: Benchmark engine scaffolding - models, prompts, API client, audience, debate engine, scoring, tests

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Fix: min max_tokens for OpenAI models (>=16), handle null content in question gen

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Add benchmark runner.py for full 45-matchup benchmark

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Phase 2+3: Web app with leaderboard, arena, SSE debate API, generated visual assets

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Fix: remove nested git repo in web/, add all web files properly

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Add results sync script, fix data loading, update synced data

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Add RecentDebates sidebar, sync 2 debate results

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Add debate replay pages with full transcript, vote analysis, and vote shift table

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Generate full 45-debate sample results (2 real + 43 simulated), populate leaderboard and judge analysis

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Add comprehensive README with architecture docs, model table, getting started guide

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Add model detail pages: ELO, win rate, h2h records, judge profile, debate history

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Add fallback for empty cross-exam questions before full benchmark run

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Batch judge calls (3 at a time) to avoid credit pre-auth spikes

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Fix: always load existing debates to skip them, dotenv override=True for new API key

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 3 real benchmark debates (debates 1-3 complete, debate 4 in progress)

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 5 real debates, benchmark running steadily (~$1/debate)

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 7 real debates

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 9 real debates (10th in progress)

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 11 real debates

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 15 real debates ($12.58 credits remaining)

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 17 real debates

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 20 real debates - past halfway mark

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 22 real debates (~50%)

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Parallelize benchmark: run 3 debates concurrently in batches

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 29 real debates (parallel execution working, ~3x speedup)

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* Sync 32 real debates (auto top-up replenished credits)

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

* 🏆 Complete benchmark: all 45 real debates finished, final ELO leaderboard

FINAL RESULTS (45 real head-to-head debates):
  #1 Claude Opus 4.6 (Thinking)   ELO: 1590
  #2 Grok 4.20 (Reasoning)        ELO: 1577
  #3 Grok 4.20 Multi-Agent        ELO: 1560
  #4 Grok 4.20                    ELO: 1546
  #5 GPT-5.2 Chat                 ELO: 1546
  #6 Claude Opus 4.6              ELO: 1508
  #7 Gemini 3 Flash               ELO: 1459
  #8 Gemini 3 Pro                 ELO: 1430
  #9 GPT-5.4 (High)               ELO: 1407
  #10 Gemini 3.1 Pro Preview      ELO: 1377

Stats: 1,038 API calls, 9.2M input tokens, 1.2M output tokens, 0 errors

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Apr 9, 2026
…oard

FINAL RESULTS (45 real head-to-head debates):
  #1 Claude Opus 4.6 (Thinking)   ELO: 1590
  #2 Grok 4.20 (Reasoning)        ELO: 1577
  #3 Grok 4.20 Multi-Agent        ELO: 1560
  #4 Grok 4.20                    ELO: 1546
  #5 GPT-5.2 Chat                 ELO: 1546
  #6 Claude Opus 4.6              ELO: 1508
  #7 Gemini 3 Flash               ELO: 1459
  #8 Gemini 3 Pro                 ELO: 1430
  #9 GPT-5.4 (High)               ELO: 1407
  #10 Gemini 3.1 Pro Preview      ELO: 1377

Stats: 1,038 API calls, 9.2M input tokens, 1.2M output tokens, 0 errors

Co-authored-by: Emre Gucer <emregucerr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants