You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
utils/robots-txt: stacked user-agent lines, empty Disallow groups and inline comments are misparsed #1078
parseRobotsTxt in packages/utils/src/robots-txt.ts (used by the crawler for RobotsTxtData, so by ax/ai-crawlers, ax/content-signals and the indexability rules) reads three common robots.txt shapes differently from RFC 9309 and from how crawlers read them.
Stacked user-agent lines lose all but the last. RFC 9309 section 2.1: consecutive user-agent lines start one group. The parser flushes on every user-agent line and only keeps a group that has rules, so
parses to one group for ClaudeBot. GPTBot falls through to *, and ax/ai-crawlers reports it as allowed. This is the format our own robots.txt generator (/tools/robots-txt-generator) writes, so a file made there is misread by the audit.
A group with an empty Disallow: is dropped.User-agent: GPTBot + Disallow: (allow everything) yields no group, so GPTBot inherits a User-agent: * / Disallow: / group and is reported as blocked.
Inline comments stay in the path.Disallow: / # no training stores the path / # no training, which is not a root block, so the bot is reported as allowed.
Found while building the AI crawler access checker (squirrelscan/repo#3127), which parses groups per RFC 9309 and carries a parity test that flips when this is fixed.
Acceptance Criteria
Consecutive User-agent lines share the rules that follow them; ax/ai-crawlers reports both GPTBot and ClaudeBot blocked for the stacked example above
A group whose only rule is an empty Disallow: is kept, so the named bot is allowed even when * is blocked
# and everything after it on a line is ignored, so Disallow: / # comment is a root block
Unit tests in packages/utils cover all three shapes, and isRobotsTxtDisallowed gives the same answers for them
I’d like to work on this. I’ll keep the change scoped to the three acceptance cases: stacked User-agent lines sharing the following rules, retaining an explicit empty Disallow: group, and stripping inline comments. I’ll add focused parser and isRobotsTxtDisallowed coverage in packages/utils and run the relevant package tests and checks.
Activity
WilliamK112 commentedon Oct 23, 2026
I’d like to work on this. I’ll keep the change scoped to the three acceptance cases: stacked
User-agentlines sharing the following rules, retaining an explicit emptyDisallow:group, and stripping inline comments. I’ll add focused parser andisRobotsTxtDisallowedcoverage inpackages/utilsand run the relevant package tests and checks.