Skip to content

fix: stop sending the page URL with chat messages and never reject a request over its UI context - #10040

Merged
nishantmonu51 merged 3 commits into
mainfrom
nishant/fix-chat-long-page-url
Oct 21, 2026
Merged

nishantmonu51 merged 3 commits into
mainfrom
nishant/fix-chat-long-page-url

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator

Since #9881 every chat message sent the full page URL as ui_page_path, and the server failed the whole request with InvalidArgument when it exceeded 2048 bytes. Explore and canvas URLs carry dashboard state and are allowed to grow to about 13 KB, so an IN filter with roughly 75 values made chat unusable on that page. The query string also shipped filter values to the LLM for no benefit.

  • The page path was only a label in the system message that lists clickable UI actions, and both agents already know what the user is viewing from their own context (explore or canvas name for the analyst agent, current file for the developer agent). The client no longer sends ui_page_path, the server ignores it, and UIContext only carries the actions. The proto field stays for wire compatibility.
  • uiContextFromPB now truncates oversized labels and drops malformed actions instead of returning an error; the UI context is best-effort metadata for click_ui and should never fail a chat request.
  • The label limit counts characters rather than bytes, matching the browser's truncation, so non-ASCII labels no longer fail the request either.

Steps to reproduce (before the fix):

  1. Open an explore dashboard and add an IN filter with about 100 values, until location.href.length is over 2048.
  2. Open the chat sidebar and send any message. It fails with invalid UI context: ui_page_path exceeds 2048 bytes.
  3. Remove values until the URL is under 2048 and chat works again.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

…request over its UI context

Since #9881 every chat message sent the full page URL (pathname, query and hash) as ui_page_path, and the server failed the whole request with InvalidArgument when it exceeded 2048 bytes. Explore and canvas URLs carry dashboard state and are allowed to grow to about 13 KB, so an IN filter with roughly 75 values was enough to make chat unusable on that page. The query string also shipped filter values to the LLM for no benefit.

The page path was only ever a label in the system message that lists the clickable UI actions. Both agents already know what the user is viewing from their own context (the analyst context carries the explore or canvas name plus filters, dimensions, measures and time range; the developer context carries the current file), so the path is dropped entirely: the client no longer sends ui_page_path, the server ignores it, and UIContext only carries the actions. The proto field is kept for wire compatibility.

The remaining UI context is optional, best-effort metadata for the click_ui tool, so uiContextFromPB now truncates oversized labels and drops malformed actions instead of returning an error. The label limit counts characters rather than bytes, matching the browser's truncation, so non-ASCII labels no longer fail the request either.

@AdityaHegde AdityaHegde 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.

  1. We would need some kind of priority instead of a hard 100 limit. Definitely needs a follow up.
  2. Right now, we would need some kind of signal to know the 100 limit is reached. Issue will get hidden if sometime down the line we hit the limit and new actions are not sent to agent.
  3. Lets add deprecated to ui_page_path params in proto.

Comment thread web-common/src/features/chat/core/ui-actions.ts Outdated
Comment thread runtime/server/chat.go Outdated
Comment thread runtime/server/chat.go Outdated
…tion, log dropped actions, deprecate ui_page_path

- Truncate labels by code point in the browser. String.slice counts UTF-16 code units and can split an emoji into a lone surrogate, which protojson rejects, so the whole chat request failed with a 400.
- Validate actions before applying the 100 cap so malformed entries cannot crowd out valid ones, and log a warning whenever actions are dropped so a page that outgrows the cap is noticed.
- Mark ui_page_path as deprecated in the proto and regenerate the affected bindings.
@nishantmonu51

Copy link
Copy Markdown
Collaborator Author

Addressed in 005f0c9:

  1. Agree the cap needs a priority scheme; I will open a follow-up issue for that.
  2. The server now logs a warning with received, kept and limit counts whenever any action is dropped, so hitting the limit is visible in the runtime logs. Tests assert the log.
  3. ui_page_path is marked deprecated in both request messages, with the Go, swagger and TypeScript bindings regenerated.

…-page-url

# Conflicts:
#	proto/gen/rill/runtime/v1/api.pb.go
@nishantmonu51
nishantmonu51 merged commit deb0c45 into main Oct 21, 2026
18 of 20 checks passed
@nishantmonu51
nishantmonu51 deleted the nishant/fix-chat-long-page-url branch October 21, 2026 11:31
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