Skip to content

fix(helpers): resolve domain skills for subdomains and hyphenated hosts#165

Open
hnshah wants to merge 1 commit intobrowser-use:mainfrom
hnshah:fix/domain-skill-hostname-resolution
Open

fix(helpers): resolve domain skills for subdomains and hyphenated hosts#165
hnshah wants to merge 1 commit intobrowser-use:mainfrom
hnshah:fix/domain-skill-hostname-resolution

Conversation

@hnshah
Copy link
Copy Markdown

@hnshah hnshah commented Apr 23, 2026

Summary

goto() extracts domain skills by taking the first segment of the hostname (booking.combooking). This misses:

  • Hyphenated folders: booking.com → folder is booking-com, not booking
  • Subdomains: old.reddit.com → looks for old, should find reddit
  • Multi-segment hosts: itch.io → folder is itch-io, archive.org → folder is archive-org

Added _skill_dir() which tries a fallback chain:

  1. Each hostname segment left-to-right (old.reddit.com → try old, then reddit, then com)
  2. Full hostname hyphenated (booking.combooking-com)

Before / after

URL Before After
booking.com booking (missing) booking-com
old.reddit.com old (missing) reddit
itch.io itch (missing) itch-io
archive.org archive (missing) archive-org
reddit.com reddit reddit (unchanged)
github.com github github (unchanged)

Test plan

  • Unit-tested _skill_dir() against 11 URLs covering all cases
  • Live-tested with goto("https://www.booking.com") — returns domain_skills: ["scraping.md"]
  • Live-tested with goto("https://old.reddit.com") — returns domain_skills: ["scraping.md"]
  • Existing matches (github.com, reddit.com, stackoverflow.com) still resolve correctly

Summary by cubic

Fixes domain-skill resolution in goto() to correctly handle subdomains and hyphenated or multi-segment hosts. Adds _skill_dir() with a fallback search over hostname segments and the hyphenated full host.

  • Bug Fixes
    • Subdomains now resolve to the main domain folder (e.g., old.reddit.comreddit).
    • Hyphenated and multi-segment hosts resolve to the hyphenated folder (e.g., booking.combooking-com, itch.ioitch-io).
    • Returns domain_skills only when a matching folder exists; otherwise response is unchanged.

Written for commit a9299f7. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

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.

1 participant