feat(md-exports): Return helpful markdown 404 for agent requests#17868
Open
sergical wants to merge 1 commit into
Open
feat(md-exports): Return helpful markdown 404 for agent requests#17868sergical wants to merge 1 commit into
sergical wants to merge 1 commit into
Conversation
When AI agents request a non-existent .md page (e.g., /platforms/javascript/ai-monitoring.md), they currently get a 0-byte 404 response with no guidance. This adds a dynamic catch-all route that returns a proper markdown 404 with YAML frontmatter, sibling page suggestions from doctree.json, and links to llms.txt/index.md. Static .md files in public/md-exports/ still take priority — the catch-all only fires when no pre-generated file exists. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
rahulchhabria
approved these changes
May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DESCRIBE YOUR PR
When AI agents request a non-existent
.mdpage (e.g.,/platforms/javascript/ai-monitoring.md), they currently get a 0-byte 404 response — a dead end with no guidance on where to go next.This adds a dynamic catch-all route at
app/md-exports/[...path]/route.tsthat returns a proper markdown 404 with:doctree.jsonllms.txt,index.md, andplatforms.mdExample response for
/platforms/javascript/ai-monitoring.md:Key design decisions:
.mdfiles inpublic/md-exports/still take priority — the catch-all only fires when no pre-generated file existsdocs.sentry.ioanddevelop.sentry.devviaisDeveloperDocsdoctree.jsonincluded inoutputFileTracingIncludesfor Vercel deploymentContext: ~7,500 markdown rewrites/month from agent traffic (99.97% via User-Agent detection). Agent 404s on
.mdrequests were completely invisible — no metrics, no spans, no logs — because the static file miss bypasses all instrumentation.IS YOUR CHANGE URGENT?
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST