Skip to content

feat(chat): check the page after each reply and fix what it finds - #1174

Merged
ankit merged 7 commits into
v4from
claude/chat-look-and-fix
Oct 5, 2026
Merged

ankit merged 7 commits into
v4from
claude/chat-look-and-fix

Conversation

@ankit

@ankit ankit commented Oct 5, 2026

Copy link
Copy Markdown
Owner

After a reply's edits apply, Chat now checks the page and, when it finds problems, the model gets one more apply_css call to fix them within the same reply. The user still sees one reply, and Undo takes back both calls together.

  • The check finds text the edits made hard to read, large surfaces left in the old colors after a theme, declarations the page overrides, and selectors that matched nothing.
  • Feedback names the cause, not the symptom: how many of a selector's elements are affected, which of the reply's selectors painted the background, and which of its variables set the text color.
  • A fix that makes text hard to read is undone.
  • The eval harness reads the fix rule from the tool module, so it runs the loop as the extension does.

Review notes: the loop lives in store/chat.ts; the check in page-bridge/chat/style-check.ts.

Eval (yarn eval:chat --base v4 --runs 3, Sonnet 5.5 low): checks 81% → 86%, unreadable 0.8 → 0, zero-match 0.6 → 0.1, cost per reply $0.028 → $0.037. The gain is all on themes (Dracula's topic pills and buttons); layout cases are unchanged.

Testing: lint, typecheck, Jest, Storybook interaction tests.

🤖 Generated with Claude Code

ankit and others added 2 commits October 5, 2026 17:51
After a reply's edits apply, the editor checks the page for text they
made hard to read, surfaces a theme left in the old colors, declarations
the page overrides, and selectors that matched nothing. When it finds
any, the model makes one more apply_css call within the same reply,
which stays one turn for Undo.

The check names the cause, not the symptom: how many of a selector's
elements are affected, which of the reply's selectors painted the
background, and which of its variables set the text color. A fix that
makes text hard to read is undone. The eval harness reads when to fix
from the tool module, so it runs the loop as the extension does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- The page check reuses countMatches and the outline's isVisible, splits
  selector lists with the shared splitter, stops sampling at 3 elements,
  skips the contrast scan when no edit can change contrast, and works out
  who painted or colored text only for the problems it reports.
- A reply keeps its stop function on itself, a fix that's taken back
  comes to null instead of a marker, and one function builds the turn
  for one call or several.
- Providers share one call-id rule, and toolResultFor always takes the
  call it describes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown

Bundle size

No change to what the popup or content scripts load.

Bundle Size Change Gzip Change
Popup 161.2 KB – 45.9 KB –
fonts/fonts.css 2.9 KB – 458 B –
popup/index.css 20.4 KB – 4.8 KB –
popup/index.js 138.0 KB – 40.7 KB –
Content script (document_start) 66.9 KB – 17.9 KB –
editor/index.js 35.9 KB – 9.2 KB –
inject-css/index.js 31.0 KB – 8.7 KB –

ankit and others added 5 commits October 5, 2026 18:09
The tool result already names each problem, so the prompt no longer lists
them; the three ways to fix one are a list of their own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…roblem

The page check listed at most six examples, so when a variable colored a
hundred texts the fix round only saw the few listed and changed the
variable on just those. Text one of the reply's variables colors is now one
problem with how many texts it covers, and the fix changes the variable
where it was set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The color math gets its own module and tests; unreadable text, clashing
surfaces and declarations with no effect each get a file, and the eval
harness finds the check as a folder too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
unreadable, clashing and no-effect become unreadable-text, missed-surface
and overridden-declaration, in their problem types, files and functions,
and each check states its rule and thresholds. The eval summary's columns
follow, and still count the earlier names from older checkouts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ankit
ankit merged commit 32d74c4 into v4 Oct 5, 2026
5 checks passed
@ankit
ankit deleted the claude/chat-look-and-fix branch October 5, 2026 22:43
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