Skip to content

fix(browser): refuse a 21st page annotation with a visible limit instead of dropping the oldest - #35979

Merged
AmoabaKelvin merged 6 commits into
mainfrom
browser-annotation-limit-fix
Oct 29, 2026
Merged

AmoabaKelvin merged 6 commits into
mainfrom
browser-annotation-limit-fix

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​46 $\color{#cf222e}{\Huge{\mathbf{−}}}$​37 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9
Prod 16 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​77 $\color{#cf222e}{\Huge{\mathbf{−}}}$​33 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​44

ELI5

A browser page can hold 20 annotations. When you added a 21st, Orca quietly threw away your first one and still showed "20 annotations". Now Orca stops at 20 and tells you why: picking another element shows "Limit of 20 annotations reached. Send, delete or clear some to add more." Nothing you wrote disappears.

What Changed

  • Before: addBrowserPageAnnotation appended the new note and then ran .slice(-20), so the oldest note was evicted with no notice. The tray count stayed at 20 and the page markers renumbered.
  • After: the store refuses an add once the page holds GRAB_BUDGET.annotationsMaxPerPage notes. Nothing is evicted.
  • In Annotate mode on a full page, clicking an element shows a red grab toast with the limit, and no draft card opens. You never type feedback that can't be saved. The browser pane's annotate banner says the same thing once the page is full, so you can see the limit before you click.
  • isBrowserAnnotationPageFull in src/shared/browser-grab-types.ts is the one rule the store, the hook and the banner all call.
  • The new string is translated in all 11 locale catalogs.

Both the browser pane and the HTML doc preview add annotations through the same hook (useBrowserPageGrabAnnotations), so both get the toast.

Why

The cap has a reason to exist. Every annotation goes into the agent prompt with up to ~13 KB of context: an HTML snippet of up to 4 KB, a comment of up to 2 KB, selectors, paths and nearby text. Twenty notes are already ~300 KB in the worst case, so raising the cap would only make the prompt bigger. Nothing on the wire or in persistence needs 20: annotations live only in renderer memory, and terminal input is chunked rather than capped.

So I kept 20 and made the limit visible. Alternatives considered:

  • Raise the cap: this moves the silent drop to a later count and grows the prompt.
  • Keep everything and trim at send time: this hides the loss inside the sent prompt instead of the tray.
  • Refuse when Add is clicked: the user loses the comment they just typed.

Refusing in the store fixes the fact at its owner. The check when an element is picked spares the user from typing a note that can't be saved.

Linked Issue

Fixes #26670

Visual Proof

All annotations below were added through the real UI in a hidden dev build, on a local page with 25 boxes. Notes 1–19 were scripted clicks before recording started; the 20th and 21st are on camera.

BEFORE (main): after the 21st note (Box 23) the tray still says 20, Box 1's note is gone, and the markers renumber.

before.mp4

AFTER (this branch): the banner states the limit at 20. Picking Box 23 shows the red limit toast and opens no card, and the tray still starts with Box 1.

after.mp4

Testing

  • Hidden dev build on macOS, driven over CDP (videos above). On main the BEFORE run drops note Linux support #1 at the 21st add. This branch refuses the add and keeps Linux support #1.

  • browser.test.ts: the store refuses notes past the cap, and the first 20 survive. Fails on main.

  • use-browser-page-grab-annotations.test.tsx:

    • At the cap, picking an element shows an error toast and opens no draft. Fails without the hook change.
    • A selection that loading already cancelled shows no limit toast. This is a review finding, and the test fails without the payload identity check.
  • browser-annotation-retention.test.ts: the eviction tests are gone, because nothing is evicted now. The delete/clear marker-pruning check those tests carried is kept.

  • check:code-quality:changed, check:react-doctor:changed and verify-localization-extraction all pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Codex and Claude reviewed one round with no P0/P1. Two P2s were accepted and fixed:

  • The message said "copy", which doesn't free a slot. It now names send, delete and clear.
  • A navigation-cancelled selection could still raise the toast. The limit check now uses the same payload identity check as the draft path.

From simplify, I skipped having the store return whether it accepted the note. A draft only opens below the cap, and that draft's own Add is the only thing that raises the count, so a refusal can't hit an open draft.

CodeRabbit:

  • Named the placeholder {{limit}} (fixed in e221ceb).
  • Kept the 11 locale translations, since the PO automation isn't built yet (reply in thread).
  • Skipped one Minor about truncation of the banner text in narrow panes.

To try (worktree /Users/kelvinamoaba/orca/workspaces/orca/browser-annotation-limit, pnpm dev):

  • Open any page in a browser tab, turn on Annotate and add 20 annotations. The banner switches to the limit message.
  • Click a 21st element. A red toast with the limit appears and no card opens. The tray still starts with your first note.
  • Delete one note from the tray, click an element again, and the card opens.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Cross-platform / remote: renderer-only change. Client-hosted and remote pages run the same hook and store. There is no wire or persistence change, so mixed client and server versions are unaffected.
  • Mobile: mobile has no browser annotations.
  • Folder workspaces: the limit is per browser page and doesn't depend on the workspace type.
  • Known, not changed here: the grab toast is centred on the picked element with no clamping. On an element at the pane's left edge, a long message like this one is clipped. That positioning is unchanged by this PR.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…age instead of dropping the oldest

The store evicted the oldest note once a page held 20, so feedback vanished unseen. It now refuses the add; picking an element on a full page shows a limit toast instead of opening a draft, and the annotate banner states the limit.
@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the latest placeholder change stays consistent across the message and catalogs.

Summary

The PR refuses annotations beyond 20 without removing saved notes. It adds a limit message to the picker and browser banner.

  • Full browser pages keep their 20 notes and explain how to make room.

Reviews (3) · Last reviewed commit: "fix(i18n): name the annotation limit pla..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The change prevents browser pages from exceeding the configured annotation limit. When a page is full, the store refuses new annotations, and the capture hook shows an error toast instead of opening a draft. The page banner displays a limit message, with translations added for supported locales. Tests cover store behavior and capture attempts, including a capture cancelled during loading.

Priority: Normal

Severity of issue fixed: Medium

Merge Risk: Moderate · up to e221c

Before merging, address the narrow-pane limit message and remove the hand-edited target translations so localization automation remains authoritative.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main behavior change: refusing a 21st page annotation and showing a visible limit instead of dropping the oldest annotation.
Linked Issues check Passed [#26670] asks that a 21st browser or HTML preview annotation no longer silently evict the oldest. It accepts either a clear block with a message or a visible warning before any drop. At head, `addBrow…
Out of Scope Changes check Passed The changes map to [#26670]. They include the shared limit rule, the store refusal in browser-page-metadata-actions.ts, the hook toast and draft guard, the banner limit text, the new `browserAnnotat…
Description check Passed The pull request description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, review findings, platform con…
Full details: Linked Issues check

Explanation

[#26670] asks that a 21st browser or HTML preview annotation no longer silently evict the oldest. It accepts either a clear block with a message or a visible warning before any drop. At head, addBrowserPageAnnotation in browser-page-metadata-actions.ts returns the existing state when isBrowserAnnotationPageFull(existing.length) is true. The .slice(-...) eviction is removed, so no annotation is dropped. isBrowserAnnotationPageFull in src/shared/browser-grab-types.ts returns true at GRAB_BUDGET.annotationsMaxPerPage (20). In use-browser-page-grab-annotations.ts, an annotate selection at the cap shows the error toast from browserAnnotationLimitMessage() and does not set a pending draft. The payload identity check keeps a cancelled selection from raising the toast. The banner change and the 11 locale catalogs supply the visible limit message. The reported tests cover refusal, retention of the first 20 notes, toast behavior, and the cancelled-selection case. I did not re-read the test files at head, so the test claims rest on the PR description. #18990 is related context only and is not a directly linked requirement.

Full details: Out of Scope Changes check

Explanation

The changes map to [#26670]. They include the shared limit rule, the store refusal in browser-page-metadata-actions.ts, the hook toast and draft guard, the banner limit text, the new browserAnnotationLimitMessage helper, and the limit string in the locale catalogs. The retention test removes eviction-specific assertions and keeps delete and clear marker-pruning checks. None of these changes add unrelated behavior. The PR does not implement the reload or tab-switch persistence work from #18990. Minor residual note: the hook path shows 'Annotation added' after a pending draft submits. The PR states a draft cannot open at the cap, so the store refusal does not occur on that path. This note does not change the scope verdict.

Full details: Description check

Explanation

The pull request description is complete and follows the repository template. It explains the user impact, implementation, rationale, linked issue, visual proof, testing, review findings, platform considerations, and checklist status. The full lint, typecheck, test, and build commands are not marked as run locally, but the description states that CI may cover them.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 8 files. (11 skipped: 11 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a032f1b2-454c-4db5-bbce-b0cb69f9c762
Commits

Reviewing files that changed from the base of the PR and between 5cd7b5d and 6bf0d7a.

Files selected for processing: 18
  • src/renderer/src/components/browser-pane/annotate/use-browser-page-grab-annotations.test.tsx
  • src/renderer/src/components/browser-pane/annotate/use-browser-page-grab-annotations.ts
  • src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-banners.tsx
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/store/slices/browser-annotation-retention.test.ts
  • src/renderer/src/store/slices/browser.test.ts
  • src/renderer/src/store/slices/browser/browser-page-metadata-actions.ts
  • src/shared/browser-grab-types.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Keep the annotation-limit message readable in narrow panes. · browser-page-chrome-banners.tsx:89

src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-banners.tsx:89
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep the annotation-limit message readable in narrow panes.

When annotation mode has no pending payload and the page is full, browserAnnotationLimitMessage() is rendered in a truncate span beside the annotation controls. The message can therefore become visually truncated in a narrow pane. It remains available as ordinary text to assistive technologies, but sighted users have no visible way to reveal the clipped text. Allow the message to wrap or provide a keyboard-accessible way to view it.


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fdcc1a10-3654-41f5-b44a-6070d0a50cae
Commits

Reviewing files that changed from the base of the PR and between 6bf0d7a and 9f0ca32.

Files selected for processing: 3
  • src/renderer/src/components/browser-pane/annotate/browser-annotation-limit-message.ts
  • src/renderer/src/components/browser-pane/annotate/use-browser-page-grab-annotations.ts
  • src/renderer/src/components/browser-pane/assemble-chrome/browser-page-chrome-banners.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 758172df-646e-470e-928a-f2bfdbf4247f
Commits

Reviewing files that changed from the base of the PR and between 9f0ca32 and e221ceb.

Files selected for processing: 12
  • src/renderer/src/components/browser-pane/annotate/browser-annotation-limit-message.ts
  • src/renderer/src/i18n/locales/de.json
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/pt.json
  • src/renderer/src/i18n/locales/ru.json
  • src/renderer/src/i18n/locales/tr.json
  • src/renderer/src/i18n/locales/zh-Hant.json
  • src/renderer/src/i18n/locales/zh.json
Files skipped from review as they are similar to previous changes: 2
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/de.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Comment thread src/renderer/src/i18n/locales/es.json Resolved
@AmoabaKelvin
AmoabaKelvin merged commit 0cdb7b3 into main Oct 29, 2026
50 checks passed
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.

[Bug]: Browser/HTML preview annotations silently drop the oldest after 20

1 participant