Closed Bug 2022050 Opened 2 months ago Closed 2 months ago

fetching ai response inconsistently checks adjacent tab at various times

Categories

(Core :: Machine Learning: Frontend, defect)

defect

Tracking

()

VERIFIED FIXED
151 Branch
Tracking Status
firefox150 + verified
firefox151 --- verified

People

(Reporter: Mardak, Assigned: omarg)

References

(Blocks 1 open bug)

Details

(Whiteboard: [genai][chat])

Attachments

(2 files)

we might end up sending/saving the wrong tab/page information

bug 2012536 gets the current page when fetching ai response

https://searchfox.org/firefox-main/rev/7b1a35d6c70c08d2966c6c8dfc9aa9c04319f721/browser/components/aiwindow/ui/components/ai-window/ai-window.mjs#856,921-924,942,961

whereas bug 2011266 populates context chips with the current tab

https://searchfox.org/firefox-main/rev/7b1a35d6c70c08d2966c6c8dfc9aa9c04319f721/browser/components/urlbar/content/SmartbarInput.mjs#6229,6237

we probably want to unify on one as the source of truth not dependent on the specific timing of when we fetch or for other uses like for bug 2015919

To be clear this can lead to the LLM summarizing the wrong tab / being given information the user did not expect the LLM to have.

Type: task → defect
Assignee: nobody → ogonzalez
Status: NEW → ASSIGNED
Blocks: 2024028
Pushed by ogonzalez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/03cc7c153be1 https://hg.mozilla.org/integration/autoland/rev/e0455e9c6501 normalize current tab url querying for chat and context chips r=ai-frontend-reviewers,urlbar-reviewers,ai-models-reviewers,Mardak,jteow
Pushed by rperta@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/f832494ff471 https://hg.mozilla.org/integration/autoland/rev/5f885a404c3d Revert "Bug 2022050 - normalize current tab url querying for chat and context chips r=ai-frontend-reviewers,urlbar-reviewers,ai-models-reviewers,Mardak,jteow" for causing bc failures at browser_smartwindow_context_url.js

Backed out for causing bc failures at browser_smartwindow_context_url.js
Backout link
Push with failures
Failure log(s)
Failure log(s)

Flags: needinfo?(ogonzalez)
Pushed by ogonzalez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/9510ecfd5402 https://hg.mozilla.org/integration/autoland/rev/6d3e8246b98c normalize current tab url querying for chat and context chips r=ai-frontend-reviewers,urlbar-reviewers,ai-models-reviewers,Mardak,jteow

Fixed a test that needed more updates.
Fixed some window leaks from unresolved async calls in browser_smartwindow_context_url.js

Flags: needinfo?(ogonzalez)
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch

[Tracking Requested - why for this release]:
Required for Smart Window Feature Fx150 MVP launch.

NI @rdoghi to help QA in Nightly Fx151 before uplifting to beta @Omar will be great if you can add test steps in bug or patch for fix verification thanks!

Flags: qe-verify+
Flags: needinfo?(rdoghi)
Flags: needinfo?(ogonzalez)

I'm not sure how to best verify this from the interface side.

The bug was to ensure that all LLM requests that are triggered from a user's prompt always reference the currently selected tab as was selected at the time of prompting.

Before the changes different parts of the code would directly access the browser's selected tab, which could potentially change after submitting the user prompt.

I suppose the only thing that would potentially surface to the interface was if the conversation response from the LLM referenced an incorrect tab, but I don't have reliable way to reproduce that.

Flags: needinfo?(ogonzalez)

Hi, I tried to reproduce this issue but without success, all I can say is that in our latest builds the correct tab is being summarized even though I tried switching tabs between submitting a prompt, each time the current active tab was summarized. Im not sure if I should mark this Verified since I wasnt able to reproduce this issue to begin with but maybe somebody else can close it. Based on our latest builds this issue is Verified as fixed.

Flags: needinfo?(rdoghi)

The patch landed in nightly and beta is affected.
:omarg, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(ogonzalez)
Attachment #9560897 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: Potential to submit wrong tab data during a conversation, which could expose private data the user did not intend to submit to an LLM backend in the course of a Smart Window chat conversation.
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: yes
  • Needs manual QE testing?: yes
  • Steps to reproduce for manual QE testing: 1. Open Smart Window
  1. Navigate to a URL
  2. Open a second tab, navigate to a different URL
  3. Start a conversation in the tab on the second site, asking it to summarize the page or something that would respond using context of the current page
  4. Immediately after pressing Enter try switching to the first tab
  5. Switch back to the second tab where the conversation was started
  6. The summary should always be based on the tab/site adjacent to the chat when the tab is chosen

Note: This was an edge case that was hard to replicate in UI, but a possibility based on the code implementation. The patch removes accessing the selectedTab's URL at various points in the lifetime of an LLM prompt, making sure it only takes the selectedTab's URL when the prompt is submitted by the user.

  • Risk associated with taking this patch: low
  • Explanation of risk level: Does not affect the user experience of chat. Does not change the underlying integrations with the LLM backend, just reduces times the LLM response cycle tries to access the selectedTab's URL to one, at prompt submission.
  • String changes made/needed?: None.
  • Is Android affected?: no
Flags: needinfo?(ogonzalez)
Attachment #9560897 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [uplift][qa-ver-needed-c151/b150]
QA Contact: rdoghi

Verified as fixed in our latest BEta 150.0b4 and our latest Nightly build 151.0a1 (2026-03-30)

Status: RESOLVED → VERIFIED
QA Whiteboard: [uplift][qa-ver-needed-c151/b150] → [uplift][qa-ver-done-c151/b150]
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: