Skip to content

UI gate: block in-flight requests on hidden/inactive browser tabs #8160

Description

@cstns

Add a guard on the browser side that refuses to execute in-flight requests when the tab is hidden or inactive. This is defense in depth: even if the session cache has stale presence data, the browser is the final enforcer.

Behavior per caller type:

  • Third-party agents: hard fail with a descriptive error, so the agent can prompt the user to switch back to the tab
  • First-party agents: queue the action until the tab is refocused, then execute (the user started a conversation intentionally and shouldn't be penalized for briefly switching tabs)

The in-flight request payload should carry a property indicating whether the request originates from a first-party or third-party caller, so the gate can differentiate.

Visibility/focus tracking uses the Page Visibility API (visibilitychange event) and window.focus/blur events.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions