Skip to content

feat(core): add get_link_url tool to read link hrefs without clicking - #704

Merged
gregawoods merged 2 commits into
mainfrom
feat/automate-cant-return-link-urls-snapshot-strips-hrefs-agent
Oct 20, 2026
Merged

gregawoods merged 2 commits into
mainfrom
feat/automate-cant-return-link-urls-snapshot-strips-hrefs-agent

Conversation

@gregawoods

Copy link
Copy Markdown
Collaborator

Description

Resolves TAB-1285.

The problem: A user calls Automate asking to search a given page for a specific link and return it's URL. Tabstack finds the link on the page but is unable to find the actual href value, and returns an error.

The snapshot compressor strips /url: lines, so the agent can't see link hrefs. When a task asks for a link's URL, the agent either:

  • asks extract about an element ref (e.g. "href of link E408"), which the page markdown doesn't contain, and reports the link as missing, or
  • asks extract about an element ref (e.g. "href of link E408"), which the page markdown doesn't contain, and reports the link as missing, or
  • rebuilds the URL from a familiar pattern instead of reading the real href (e.g. GitHub archive links).

This adds a read-only get_link_url(ref) tool backed by a new AriaBrowser.getLinkUrl(ref), implemented for Playwright, BiDi and the extension. It returns:

  • url: from link.href, so the browser resolves relative paths and <base>
  • rawHref: the attribute as written

Details:

  • Works when the ref is on a child of the link (uses closest("a[href], area[href]")).
  • Non-links and stale refs return recoverable failures.
  • Results are redacted for caller secrets and wrapped as external content, the same as extract.
  • The tool skips the page refresh, so its result isn't clipped before done().
  • The prompt says the snapshot omits link URLs, and tells the agent to use this tool instead of reconstructing URLs.

Why not keep /url: in the snapshot? Every snapshot would get bigger, and URL slugs and sensitive URLs (signed, reset or session links) would reach the model on every turn. This way, URLs only enter the context when a
task needs one.

@gregawoods
gregawoods requested a review from a team October 20, 2026 15:15
Comment thread packages/core/test/integration/bidiFirefox.integration.test.ts Outdated

@srbiv srbiv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, one small nit with the commented out code

@gregawoods
gregawoods merged commit 7d40c8f into main Oct 20, 2026
14 checks passed
@gregawoods
gregawoods deleted the feat/automate-cant-return-link-urls-snapshot-strips-hrefs-agent branch October 20, 2026 15:39
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.

2 participants