Skip to content

feat(docs): propose document edits as suggestions instead of changing the text - #1355

Open
MuncleUscles wants to merge 2 commits into
openclaw:mainfrom
MuncleUscles:docs-suggest
Open

MuncleUscles wants to merge 2 commits into
openclaw:mainfrom
MuncleUscles:docs-suggest

Conversation

@MuncleUscles

Copy link
Copy Markdown

What Problem This Solves

People and agents who edit a shared Google Doc with gog can only change the text directly. Collaborators can't review a proposed change before it lands, and an automated edit can't be accepted or rejected the way a human suggestion can.

User Impact

You can now propose edits as pending suggestions that the document's owners accept or reject in Google Docs.

  • --suggest on docs insert, delete, update, find-replace, edit, format, insert-page-break, insert-section-break, section-columns, and insert-table (empty table only). Without the flag these commands still edit directly.
  • New docs suggestions insert for a plain-text suggestion at an explicit offset, and docs suggestions batch for a JSON array of Docs requests (up to 500 requests, 4 MiB). gog supplies the pinned revision and suggestion mode; callers cannot override them.
  • --revision pins the document revision and is required with explicit offsets. A stale revision is refused rather than rebased.
  • Request types Google rejects in suggestion mode, and incompatible options (such as --pageless, Markdown conversion, and local image uploads), fail locally with a pointer to the guide.

Why This Change Was Made

Google Docs can apply a batch update in suggestion mode against a required revision. gog resolves anchors, matches, and tab selectors from the inline-suggestions view, the view the write applies to, so existing suggestions count correctly in offsets. Read and write are pinned to the same revision, so a concurrent edit can't shift where a suggestion lands. Accepting, rejecting, or deleting suggestion threads is out of scope.

Evidence

Live check against a real Google account on a throwaway document (since trashed):

  • insert, update, delete, and format with --suggest, plus a suggestions batch italic change, each returned a pending suggestion ID. docs suggestions list showed the insertions and deletions.
  • The "without suggestions" view still showed the original text, and the "suggestions accepted" view showed the intended result.
  • Reusing a revision after the document changed was refused by Google (400, revision mismatch). A deleteTab request in a batch was rejected locally before any API call.
  • Observed Google behavior: when update --suggest replaces text, Google also attaches a text-style suggestion covering all style fields to the inserted run. gog sends only a delete and an insert. The accepted result is correct.

Local fixtures: unit tests cover suggestion insert, batch, and the shared write path (revision pinning, stale-revision rejection, request-type allowlist, input limits, incompatible-flag errors). go build, go vet, go test ./..., the Node script tests in make test, and make lint pass on macOS arm64 with Go 1.27.4.

Not checked live: tabs other than the first, header/footer/footnote segments, tables, page and section breaks, find-replace/edit across all tabs.

@MuncleUscles
MuncleUscles requested a review from a team as a code owner November 27, 2026 14:56
@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. impact:other This issue has meaningful maintainer-visible impact outside the owned taxonomy. clawsweeper:intake:feature Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 27, 2026
@clawsweeper

clawsweeper Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Adds opt-in Google Docs suggestion writes, revision pinning, structured suggestion batches, and raw suggestion views.

Example: Propose replacing “old wording” with “new wording” in a shared document.

  • Before: The update command changes the document text directly.
  • After: Adding --suggest creates a pending change that collaborators can review in Google Docs.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is coherent on inspection, with no identified P0–P2 defect, but required real-behavior evidence is not inspectable and product scope remains undecided.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: CLI edits immediately change shared documents, leaving collaborators without a pending proposal to accept or reject.
Reason: Reviewable automated edits have clear value, but the proposed public commands and structured-operation scope have no recorded owner decision.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this PR adds a distinct suggestion-writing capability absent from current main; its new public CLI surface needs an owner decision.

Reviewed head: 1ffd9c7879db22aa9f82debd234e94e637413fc4
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should suggestion writing launch across the proposed text, formatting, structured, and raw-batch surfaces, or start with a narrower text-editing scope?
  • Recommendation: Start with text suggestions: Approve suggestion mode on existing text-editing commands first and defer structured operations and additional entry points.
  • Why: This is a new public capability with several flags and commands, and neither this PR nor the related discussion records owner approval of its scope.

Before merge

  • Add real behavior proof - The body reports a real-account run of the changed Docs writer on macOS arm64, including pending IDs, preview comparisons, and revision rejection, but supplies only narrative assertions; attach inspectable terminal output, logs, or a recording and redact IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

  • [P3] [P3] Add the required reference and contributor credit — CHANGELOG.md:5

Tests

  • Missing end-to-end proof: Provide redacted shipped-CLI output showing saved suggestions and rejected/accepted previews, stale-revision refusal, and representative tab, segment, and structural behavior retained in the approved scope.
Agent review details

How this fits together

Docs commands resolve document targets and build API requests; the new shared writer submits revision-pinned suggestions and returns confirmed suggestion IDs.

flowchart LR
  A[CLI command and flags] --> B[Inline document snapshot]
  B --> C[Target and request planning]
  C --> D[Revision pinned suggestion writer]
  D --> E[Google Docs API]
  E --> F[Confirmed suggestion IDs]
Loading

Technical review

Best possible solution:

Use the existing Docs mutation planners with a shared revision-pinned suggestion writer and an owner-approved command surface.

Do we have a high-confidence way to reproduce the issue?

This is a feature addition; source inspection confirms current main exposes suggestion reading but no dedicated suggestion-writing mode.

Is this the best way to solve the issue?

The shared writer and reuse of existing planners fit the subsystem, while the overlapping insertion entry points and breadth of structured operations warrant an owner scope decision.

Full review comments:

  • [P3] [P3] Add the required reference and contributor credit — CHANGELOG.md:5
    The new Unreleased entry omits a PR or issue reference and contributor thanks, both explicitly required by root AGENTS.md line 40; add the link to this PR and credit MuncleUscles.
    Confidence: 1

Overall correctness: patch is correct
Overall confidence: 0.83

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against cfee06622536.

Provenance checked

  • Suggestion listing keeps the original intent (76fb1ee: Expose pending insertions and deletions through a deliberately read-only list command.)
  • Existing editing commands keeps the original intent (848b1e9: Split editing operations into focused files while preserving their CLI and request behavior.)
  • Raw document output keeps the original intent (c24b7dc: Preserve canonical Google JSON, unknown fields, explicit values, and existing tab projection contracts.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

  • Current main only lists suggestions: The base command exposes suggestions list; its merged implementation deliberately scoped the feature to reading pending suggestions. (internal/cmd/docs_suggestions.go:14, cfee06622536)
  • Pinned suggestion submission: The introduced writer sets SUGGEST with requiredRevisionId, reuses the existing non-retrying batch transport, and checks thread-save state and per-request suggestion acknowledgements. (internal/cmd/docs_suggestions_write.go:210, 1ffd9c7879db)
  • Imported SDK contract verified: The patch imports docs/v1 from the existing v0.316.0 dependency; that version defines WriteControl.WriteMode and the response acknowledgement fields used here. (docs/v1/docs-gen.go:7519, 35ecdc151456)
  • Authoritative API behavior: Google documents SUGGEST writes, inline indexing, unsupported operations, and partial thread-save failures in its suggestions guide.
  • Discussion and proof reviewed: The full PR body describes a disposable-document live check and explicitly identifies untested variants, but includes no terminal output, logs, recording, or artifact; comments contain only bot status messages and reviews contain no owner approval. (1ffd9c7879db)
  • Applicable repository policy: The complete root AGENTS.md was read; no nested AGENTS.md, maintainer notes, or pr-simplify skill were found, and the changelog rule requires references and contributor thanks. (AGENTS.md:40, 1ffd9c7879db)

Likely related people:

  • Peter Steinberger: Raw commit 76fb1ee adds internal/cmd/docs_suggestions.go:14 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 76fb1eecedae; files: internal/cmd/docs_suggestions.go)
  • chrischall: Raw commit 3a1b155 adds internal/cmd/docs_insert_table.go:17 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 3a1b15592f47; files: internal/cmd/docs_insert_table.go)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach captured behavior evidence for the approved scope.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 27, 2026, 10:11 AM ET / 15:11 UTC.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact:other This issue has meaningful maintainer-visible impact outside the owned taxonomy. P2 Normal priority bug or improvement with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant