Repository navigation
List tracked changes and refuse edits that would touch a pending suggestion - #10
Merged
Merged
Conversation
Edits that change text inside a collaborator's pending suggestion silently rewrite or remove it, and Overleaf mails the author that the suggestion was rejected. joinDoc already returns ranges.changes; parse them, expose them (listTrackedChanges, CLI 'changes', MCP overleaf_list_tracked_changes), and check every text edit against fresh ranges before sending. The check throws TrackedChangeConflictError; SDK/CLI can skip it with overwriteTrackedChanges, the MCP server has no override so an agent asks a human.
Restoring the whole document cannot recreate tracked changes, so the test would drop them; the overwrite guard refuses it. Record the live check of edge inserts in CLAUDE.md.
lonetis
pushed a commit
that referenced
this pull request
Nov 9, 2026
Releases what landed since 0.3.0: - tracked changes: list a document's pending suggestions (SDK listTrackedChanges, CLI `changes`, MCP overleaf_list_tracked_changes), and refuse by default any edit that would touch one (TrackedChangeConflictError; override with overwriteTrackedChanges / --overwrite-tracked-changes) (#10) - security: cookie-carrying REST requests stay on the Overleaf origin; @modelcontextprotocol/sdk ^1.32.2 and zod ^4, npm audit clean (#11) A minor bump rather than 0.3.1: the default edit behaviour changes, and 0.3.1 was published and then unpublished on npm, so that number can never be reused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016k8nQbcXiTztFcEngHqwxs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When an agent edits text that sits inside a collaborator's pending tracked change, the suggestion is silently rewritten or removed, and Overleaf emails its author that the suggestion was rejected. Neither the agent nor the user can see that this is about to happen: the edit tools only see plain text. This is the main thing keeping us from letting an agent work on a shared paper.
joinDoc {encodeRanges:true}already returnsranges.changes; this PR reads them.What
listTrackedChanges(SDK),claudeleaf changes <project> <path>(CLI),overleaf_list_tracked_changes(MCP, read-only). Each entry has kind (insert/delete), text, offset/line/column, author (from the project's owner/members) and timestamp.submitre-joins the doc to get fresh ranges and checks the op against them (src/trackedChanges.ts, pure). If the op would touch a pending suggestion it throwsTrackedChangeConflictError(with.changes) and nothing is sent.EditOptions.overwriteTrackedChanges(SDK) and--overwrite-tracked-changes(CLI). The MCP tools deliberately have no override, so an agent has to ask a human.main.tex) skips itself whenmain.texhas suggestions, since the restore cannot recreate them.Things you may want to decide differently
joinDocround trip. Happy to make it opt-in instead.Tested
test/trackedChanges.test.ts) and for the session paths (refuses and sends nothing, reads fresh ranges, override, comments unaffected).npm testagainst that project: 135 passed, 1 skipped.