Skip to content

fix: restore compatibility with Antigravity v1.21.6 DOM changes#6

Merged
optimistengineer merged 3 commits intooptimistengineer:mainfrom
jacob-bd:fix-antigravity-1.21.6
Mar 28, 2026
Merged

fix: restore compatibility with Antigravity v1.21.6 DOM changes#6
optimistengineer merged 3 commits intooptimistengineer:mainfrom
jacob-bd:fix-antigravity-1.21.6

Conversation

@jacob-bd
Copy link
Copy Markdown
Contributor

Summary

Restores full Remoat compatibility with Antigravity IDE v1.21.6, which shipped a visual redesign of the agent panel that changed the DOM in three ways, breaking the bot.

Related Issues

Closes #

Type of Change

  • Bug fix

What Changed

1. Model picker — <div><button> (cdpService.ts)

Antigravity v1.21.6 changed model dropdown items from <div class="cursor-pointer"> to <button> elements and added a w-full class. The old selectors found nothing, making /model return an empty list.

Fix: Switched getUiModels(), getCurrentModel(), and setUiModel() to tag-agnostic :is(button, div) selectors with w-full scoping to work across both old and new markup.

2. Context readiness — cascade-panel context removed (cdpService.ts)

waitForCascadePanelReady() polled for a CDP execution context named cascade-panel (a sandboxed iframe Antigravity used for the agent panel). That context was removed in v1.21.6 — the panel now renders directly in the main workbench context. The bot would hang forever waiting for a context that no longer exists.

Fix: Updated the readiness check to query the main workbench DOM for #conversation instead.

3. Telegram 400 parse error — orphan </pre> tag (htmlToTelegramMarkdown.ts)

Antigravity renders markdown pipe tables as bare <pre>raw text</pre> blocks (not <pre><code>). Two bugs in the HTML formatter combined to produce an orphan </pre> closing tag, causing Telegram to reject messages with 400 Bad Request: Unexpected end tag:

  • Missing bare <pre> handler — only <pre><code> pairs were handled. Bare <pre> blocks fell through; stripUnsupportedTags stripped the opening <pre> but kept </pre>.
  • <p[^>]*> regex matched <pre> tags<p + [^>]* matches re + >, making <pre> look like <p re>. The paragraph replacement ate the <pre> opening tag.

Fix: Added an explicit bare <pre> handler (runs after <pre><code>). Added \b word boundary to the <p> and <div> block-level regexes.

Checklist

  • Code follows the project's style guidelines
  • Self-reviewed the diff
  • Added/updated tests (tests/utils/htmlToTelegramMarkdown.test.ts, tests/services/cdpService.test.ts)
  • npm test and npm run build pass locally — 704/704 tests passing
  • Updated relevant documentation (if applicable)

jacob-bd added 3 commits March 27, 2026 20:37
…l class)

- Model list items changed from <div> to <button> in 1.21.6+
- Use tag-agnostic 'button, div' selector with class-based filtering
- Add 'w-full' to class filter to exclude non-model button matches
- Add #conversation element check to waitForCascadePanelReady
  (1.21.6+ has no separate cascade-panel context; chat DOM is in main context)
…> regex collision

Two bugs in htmlToTelegramHtml:
1. Bare <pre>content</pre> blocks (Antigravity renders pipe tables as <pre>)
   had no handler — the <pre><code> regex skipped them — leaving an orphan
   </pre> closing tag that caused Telegram 400 'Unexpected end tag' errors.
   Fix: add explicit bare <pre> handler after the <pre><code> handler.

2. The <p[^>]*> regex was matching <pre> tags (since 'pre' starts with 'p').
   This caused the <pre> opening tag to be eaten by the paragraph replacement,
   leaving only the </pre> closing tag = malformed HTML. Same issue for <div>/<divider>.
   Fix: add \b word boundary after the element name in <p> and <div> regexes.
- htmlToTelegramMarkdown: 3 new tests covering bare <pre> orphan tag bug
  and <p[^>]*> regex collision with <pre> tags
- cdpService: update fixture and assertion to reflect removal of the
  cascade-panel context; top workbench context (id 1) is now primary
@optimistengineer optimistengineer merged commit 755e57f into optimistengineer:main Mar 28, 2026
optimistengineer added a commit that referenced this pull request Mar 28, 2026
@jacob-bd jacob-bd deleted the fix-antigravity-1.21.6 branch March 31, 2026 22:37
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