Skip to content

fix(ai): read the host of a URL word in the search query check #7329

Done

Description

@dan-petty

Problem Description

The check of a web search query reads the host of each word of the query (_host_of in src/devops_cli/ai/web_search.py). It parses the word with urlsplit(f"//{word}"). For a word that is a URL with a scheme, such as https://docs.example.com/page, that call gives the scheme https as the host. So the check of a URL word does not read the host that the word names, and its result for the word differs from its result for the bare host.

Reproduction Steps

  1. Call _host_of("docs.example.com"): the result is docs.example.com.
  2. Call _host_of("https://docs.example.com/page"): the result is https.

Expected vs Actual Behavior

  • Expected: the check reads the same host for a bare host, for a host with a port and for a URL with a scheme, a port, a path or brackets.
  • Actual: a word with a scheme reads as the host https or http.

Proposed Fix

Read the host of a word with the standard URL parser in the form that fits the word: a word that holds a scheme is parsed as a URL, and each URL that a word holds inside its path or its query is read too. Tests give each form of a word and the host that the check must read.

Acceptance Criteria

  • Test first: for one host, the check gives the same result for the bare host, the host with a port, and a URL of that host with a scheme, with a port, with a path and in a longer word. The test fails on the base.
  • A test: the result for a word with no host does not change.
  • docs/roadmap/alternatives.md and each other page that describes the check stay correct.

Environment Diagnostics

devops-cli 0.223.0, Python 3.14.

Dependencies

None.

Alternatives check of 2026-11-26: none.
Tool: none found.
Reason: Searches found only URL parsers and link extractors (yarl, urlextract, linkify-it-py); each assumes a scheme or a public suffix, so none reads the host for every word form, and the fix stays in the existing urlsplit helper.

Lacks:

  • No one host for bare, port, bracketed and scheme words
  • No reading of URLs embedded in a word's path or query
  • Needs a public suffix, so a bare service name finds no URL

Activity

  1. added
    type/bug
    scope/ai
    on Nov 26, 2026
  2. dan-petty commented on Nov 26, 2026

    @dan-petty
    OwnerAuthor
  3. added
    source/agent
    status/new
    value/medium
    effort/low
    priority/p2-medium
    owner/agent
    status/in-progress
    and removed
    status/new
    on Nov 26, 2026
  4. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    The result in the alternatives block of the issue body changed. Before this check: no check. A person decides what the new result means for the item.

    Searches (5)

    Tools considered:

    Searches run:

    • python extract urls from text library linkify-it-py urlextract, results: 5
    • python library parse hostname from url or bare host with port, results: 5
    • urlextract pypi find urls in text, results: 5
    • yarl python URL host property parse url, results: 5
    • urlsplit with scheme returns scheme as hostname fix parse bare host port urllib, results: 5

    Sources:

  5. added
    status/in-review
    and removed
    status/in-progress
    on Nov 26, 2026
  6. removed
    status/in-review
    owner/agent
    on Nov 26, 2026
  7. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-26 19:52 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/aisource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions