Skip to content

feat: Google Docs anchored comments support (REST API bug workaround) #585

@dbernaltbn

Description

@dbernaltbn

Problem

The Google Drive REST API comments.create does not anchor comments to specific text in the Docs UI, even though the anchor data is saved. This is a known Google bug: issuetracker.google.com/issues/491884714.

The comment is created but appears as "orphaned" (not attached to any text), which makes it useless for document review workflows.

Attempted Workarounds

1. CDP / Playwright browser automation

  • WSL2→Windows CDP connection is unreliable: Chrome responds intermittently even on localhost
  • Requires maintaining: Chrome debug flags, Windows firewall rules, netsh portproxy, Python websocket clients
  • Not viable for a CLI tool

2. Console JS script

  • Current fallback: paste a script into Chrome DevTools console
  • Uses copy() to manage clipboard, user presses ArrowDown to advance
  • Semi-manual: user still needs Ctrl+F, Ctrl+Alt+M, Enter, etc.
  • Works but not a proper CLI solution

Desired Feature

A gog docs add-comment (or similar) command that:

  1. Takes document ID, anchor text (to search), and comment text
  2. Programmatically opens a browser tab to the document
  3. Finds the anchor text, opens the comment UI, pastes the comment, and submits
  4. Works reliably from WSL2, macOS, and native Linux

Potential approaches

  • Use the built-in OpenClaw browser tooling if available
  • Bundle a lightweight CDP client that works reliably
  • Explore if the Docs API has any newer endpoint that properly anchors comments (unlikely given Google bug status)

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions