Skip to content

fix(cli): a custom user-agent header is the agent of the probes that send no custom headers - #1156

Merged
nc9 merged 2 commits into
mainfrom
fix/1152-custom-ua-probes
Oct 26, 2026
Merged

nc9 merged 2 commits into
mainfrom
fix/1152-custom-ua-probes

Conversation

@nc9

@nc9 nc9 commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Closes #1152.

Repro (local server logging each request, isolated home, -H "user-agent: UAPROBE/1.0"): the internal link check (HEAD requests) and the soft-404 confirmation sent the crawl's random sticky browser agent, because crawl.config.userAgent is resolved from [crawler] user_agent only while the crawl itself sent the header. The controllers now resolve the agent as user_agent or the custom User-Agent header (new customUserAgent helper, case-insensitive, last spelling wins).

After the fix the only requests not carrying the header are the reachability check before the crawl, the cloaking probe's browser fetch and the AI agent access probe's Claude-User fetch; docs/configuration/crawler.mdx now names these exceptions.

Docs: crawler.mdx updated. Skill: no change needed.

@claude

claude Bot commented Oct 26, 2026

Copy link
Copy Markdown

Review of #1156: the fix looks correct and scoped. I read the diff and the code around it. I did not run tests or the CLI.

  • (low) audit.ts:975, crawl.ts:254: the two controllers now carry the same copied resolve-and-comment block. A shared helper would keep them from drifting apart. This is fine to leave for a follow-up.
  • (low) Tests: only customUserAgent has a unit test. Nothing checks that the controllers pass the header's agent to the link check and soft-404 probes. This is the regression the PR fixes. A small test on the resolved agent would catch a revert.
  • (nit) resolveStickyUserAgent reports source: "config" when the agent comes from a header. If uaSource appears in logs or output, the header-derived case reads as [crawler] user_agent. Check that this wording is acceptable.
  • (nit) A header agent now skips the sticky pin. That seems intended, since the header is sent verbatim. The docs could state it.

Correctness: mergedConfig.crawler.headers already includes the CLI -H values merged via mergeHeaderRecords. The "last spelling wins" behaviour therefore matches what goes out on the wire. The CHANGELOG and docs updates are present. The commit and PR conventions look fine.

…send no custom headers #1152

The internal link check and the soft-404 confirmation took the crawl's random sticky agent while the crawl sent the -H value. The crawl's agent is now the custom header when one is set. Docs and CHANGELOG say which requests keep their own agent.

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 force-pushed the fix/1152-custom-ua-probes branch from 06772da to 5046208 Compare October 26, 2026 11:49
@claude

claude Bot commented Oct 26, 2026

Copy link
Copy Markdown

Review of #1156. The fix looks correct and small. I found nothing that should block the merge.

  • (low) apps/cli/src/controllers/audit.ts:975, crawl.ts:254: the new wiring has no test. customUserAgent is unit-tested, but nothing checks that the link check and the soft-404 probe send the header-derived agent. A regression where user_agent or the header stops reaching crawl.config.userAgent would pass CI. A CLI test using a local server that logs the User-Agent of each request would cover it. Check that it fails with the fix reverted.
  • (low) The same two-line block is copied into audit.ts and crawl.ts, including the comment. A shared helper such as resolveConfiguredUserAgent(crawler) would stop the two controllers drifting apart.
  • (low) When both user_agent and a custom User-Agent header are set, user_agent wins for the probes, while the crawl sends the header. That precedence is not new, but the docs could state it. crawler.mdx only describes the header-only case.
  • (nit) customUserAgent returns value.trim(). A header value that is only whitespace becomes "", so the sticky random agent is used again. That seems right, and the test covers it. mergeHeaderRecords already de-duplicates case-insensitively, so the loop over Object.entries could just do a lookup.
  • (nit) A custom agent now returns source: "config", so it is never persisted as the project's sticky pin. That is the intended behaviour. It might deserve a line in the PR description.

@github-actions

Copy link
Copy Markdown
Contributor

Auto-review did not complete

The claude-review job failed before posting a review. This PR has not been auto-reviewed. Run a review manually (/review) before merging.

  • Result: success / is_error=true after 4 turns, 0 permission denial(s), $0.09
  • Job log

Partial findings recovered from the session (incomplete, unverified, and NOT a merge signal):

Show partial review

You've hit your session limit · resets 1:40pm (UTC)

@nc9
nc9 merged commit 6bd3b22 into main Oct 26, 2026
14 of 15 checks passed
@nc9
nc9 deleted the fix/1152-custom-ua-probes branch October 26, 2026 12:56
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.

custom -H user-agent: five probe-style requests still send the built-in agent

1 participant