Repository navigation
v0.8.0
Tracked-change review. Two new tools list a project's tracked changes, with their locations,
authors, and excerpts, and accept or reject them in one document, on both of Overleaf's document
protocols: every decision is checked before anything is sent, sent once, and verified on a fresh
read. The same work makes every document write safer: an OT write the account's access level cannot
make is refused before it is sent, a tracked write is checked for having been recorded as tracked
changes, and Overleaf's otUpdateError is classified rather than passed on. A document write now
changes only the words that differ where no comment or tracked change is in the way, so a tracked
write is usually one suggestion per changed group of words. Comments on non-ASCII text are now
located and verified correctly. The server registers 33 tools, two more than 0.7.x. Planned in
ROADMAP.md.
Added
list_tracked_changes, read-only: lists tracked changes withchangeId,type,start
andend(1-based line and UTF-16 column in the visible text),length, a boundedexcerpt
that never splits a surrogate pair,excerptTruncated,authorId,timestamp, and
pairedChangeIdfor the two halves of a replacement, per document with itsrevision,
protocol,totalChanges, andundecidableChangeswhen Overleaf stored a change without an id.
type,authorId,limit(totalMatched,truncated), andexcerptCharsshape the result.
WithfilePathit reads that document; without it, only the documents Overleaf's range index
lists with changes, andindexUnavailable: truewhen there is no index, never every document.
History-OT changes carry ids made up from the change itself (ht_...), valid only with the
listed revision.manage_tracked_changes, destructive: accepts or rejects tracked changes in one document,
given the listedrevision, thechangeIds, andconfirmCountequal to their number. Before
anything is sent it refuses a missing or differentconfirmCount(CONFIRMATION_MISMATCH),
access below owner or edit (PERMISSION_DENIED), a project without track changes
(REVIEW_UNSUPPORTED), a stale revision (REVISION_CONFLICT), an id that is not a live change
(NOT_FOUND,details.missingChangeIds), a change left out that overlaps a chosen one
(INVALID_ARGUMENT,details.overlappingChangeIds), and, for a ShareJS reject, a chosen change
that does not match the document text (PROTOCOL_UNSUPPORTED). A ShareJS accept goes through
Overleaf's accept route; a ShareJS reject and every history-OT decision is one untracked OT update
with no tracking metadata. The result is verified on a fresh join, and a decision that timed out
is observed, never resent. Returns the resultingrevision,remainingChangeCount,
trackChangesActive, andrecoveredAfterTimeout. The server now registers 33 tools.REVIEW_UNSUPPORTED, a new error code, withdetails.kindfeature_disabled(the
project's owner's plan or the deployment has no track changes),route_unavailable(Overleaf
has no accept route), ordocument_protocol(Overleaf refused the document's protocol). The
command line exits 3 for it, and 4 forPROTOCOL_UNSUPPORTEDwith
details.kind: "applied_untracked".- Command line:
tracked-changes list,tracked-changes accept, and
tracked-changes reject, shorthand for the two tools. - Protocol fixtures for review: a sanitized live capture of a ShareJS document with tracked
changes and a comment on non-ASCII text, a history-OT document with tracked changes written from
Overleaf's source together with the decision operations expected for it, and a test that fails
on a 24-hex id, an@, or a session cookie name in any file undertest/fixtures/protocol.
Changed
- An OT write that the account's access level cannot make is refused before it is sent.
Overleaf judges an update by its shape: one that only adds comments needs view access, one that
only makes tracked changes needs review access, and anything else needs owner or edit access.
An untrackedwrite_file,write_section,create_file, orsync_directorywrite from a
review-only collaborator, any write from a read-only one, and a history-OT comment status
change from either is nowPERMISSION_DENIED(exit 3) withdetails.accessLeveland
details.required, and nothing is sent. Before, Overleaf answerednot authorizedand
dropped the socket, which surfaced asREMOTE_ERROR. An access level this release does not
know may add comments only. otUpdateErroris classified, not passed on.update is too large, matched exactly, which
Overleaf sends to the sender alone after storing nothing, is nowUPDATE_TOO_LARGEwith
details.outcome: "not_applied", so the command line exits 4 for it rather than 1. Any other
otUpdateErrorreaches every client joined to the document and can follow the update being
applied, so it now leaves the write unconfirmed (OUTCOME_UNKNOWNwith
details.event: "otUpdateError"from the socket) and the write is observed on a fresh
connection, never resent, as after a timeout:write_file,write_section,create_file,
sync_directory,add_comment,set_comment_status, andmanage_tracked_changesthen return
the verified result withrecoveredAfterTimeout: true, orREMOTE_ERRORwith
details.outcome: "not_applied"and the error'sdetails.reason, orREVISION_CONFLICT, or
OUTCOME_UNKNOWN. Before, everyotUpdateErrorwasREMOTE_ERROR(exit 1) with no
observation. Overleaf drops the socket after the event, so it is no longer reused.- More of Overleaf's fixed socket error messages have a
details.reason, matched exactly:
realtime_error,null_bytes_in_op,doc_over_max_size,doc_too_large,ranges_too_large,
string_too_long,ops_not_loaded,too_many_ranges,unrecognized_op,
conflicting_deletes,op_too_old,op_at_future_version,version_missing,
delete_mismatch, andinvalid_hash. Anything else is stillunrecognized, and no upstream
text is quoted. - A tracked write is checked for being recorded as tracked changes. After a tracked
write_file,write_section,create_file, orsync_directorywrite verifies, every span it
inserted must lie inside tracked inserts by this account, and every span it deleted must be held
by a tracked delete by this account, unless that text was itself a tracked insert. Otherwise
the result isPROTOCOL_UNSUPPORTEDwithdetails.kind: "applied_untracked"and
details.liveRevision(exit 4), and nodetails.outcome, because the write applied: it is
live and never reverted. A tracked delete, of any author, that the deleted text spanned is
expected inside the merged delete, as Overleaf records it. If another update followed the write
before the check, such as a decision on its tracked changes, the ranges no longer describe it:
the result is thenREVISION_CONFLICTwithdetails.outcome: "unknown"and
details.liveRevision, and the text is live. A no-op write is not checked. Async_directory
failed entry for such a step carrieskind: "applied_untracked"beside itsdetails. - A document write changes only the words that differ, away from comments and tracked changes.
write_file,write_section,create_fileover an existing document, and async_directory
replacement used to send one span from the first difference to the last. They now compare the text
line by line and then word by word and send one update with an edit per changed group of words,
words one space apart counting as one group. A tracked write therefore records one suggestion per
changed word group, a deletion and an insertion side by side for a replacement, where two
separated word changes used to become one long insertion and one long deletion of everything
between them, and an untracked write no longer deletes and re-inserts the unchanged text between
edits. Word edits are sent only when none of them touches a comment or a tracked change: an edit
that would overlap one, or reach an end of one or a tracked deletion's point, is first cut down to
the characters that differ, and then, where it is the same text inserted or deleted at any of
several places along repeated text, moved up to 64 characters to a place clear of every range. An
edit that touches nothing leaves every range as it was, only moved along. If an edit still touches
a range, the write is one edit per changed run of lines on the same terms, and failing that the
single span, as before. After an untracked delete on the legacy editor (ShareJS), Overleaf merges
tracked deletions that share a point, and touching insertions by one author, across the whole
document. Editing never leaves such a pair, but a document converted from history-OT can, so an
untracked write to such a document sends the single span. As on ShareJS, a history-OT edit is
split around a character outside the Basic Multilingual Plane that it would only send again, which
Overleaf refuses in a history-OT insertion, so the single span on history-OT is split around such
characters too, where it used to be refused. The operations every write sends change accordingly;
results do not. A diff past its limits (an edit distance of 2,000 lines or words, a change more
than 1,000 code units inside one word, about 100 ms of work on a 2 MB document, or placement
looking at more than 4 million ranges), and a tracked write whose changes, one per deletion and
one per insertion, would take the document past Overleaf's limit of 2,000 tracked changes, fall
back to one edit per changed run of lines or to the single span, as before. Thewrite_file
description and the connect-time instructions now say so instead of "a minimal edit", and the
description says that a change touching a comment or tracked change is sent as one span. - ShareJS range text is decoded like the document's lines. Overleaf sends the text of a
ShareJS document's comment and tracked-change ranges as the Latin-1 reading of its UTF-8 bytes,
as it sends the lines; that text is now decoded the same way when the document is joined.
Positions, ids, and metadata are not encoded and are read as they are, and so is the text of the
project's range index, which is plain UTF-8. - The connect-time instructions (445 words) gain the tracked-change review steps, with
add_commentunder one Review paragraph, and are tightened elsewhere to stay under 450 words. - The three Agent Skills, and the command line page's examples, run
npx --yes overleaf-web-mcp@0.8, pinned to this minor version as they were pinned to 0.7.
Fixed
- Comments on non-ASCII text are located and verified correctly. On a ShareJS
(legacy editor) document, a comment anchored to text with a character outside ASCII, such as
"naïve café", was read back in its encoded form:list_commentsreported a wrongendand
quotedText, andadd_commentcreated the thread and attached it, then failed with
OUTCOME_UNKNOWNbecause the exact range could not be verified. Comment ranges are now decoded
as the document's lines are, so both report the range that was selected. - An unconfirmed document write is reported as not applied only when the original revision was
the last thing seen. When a document write fromwrite_file,write_section,create_file,
orsync_directorytimed out or lost its socket after sending, and a recovery read saw the
original revision but every later read failed until the recovery window ended, the error was
TIMEOUT(exit 4) orREMOTE_ERROR(exit 1) withdetails.outcome: "not_applied", although
the write could have applied after that sighting. It is nowOUTCOME_UNKNOWN(exit 5), as
the safety page already described
not_applied: the original revision stayed live throughout the recovery window. Comment writes
already worked this way. - A rate-limited project join is
RATE_LIMITED, notAUTH_EXPIRED. Overleaf allows one
account about 45 joins of one project a minute, andsync_directoryjoins about once per
upload, so a sync of a few dozen files could reach it. The refused join was reported as
AUTH_EXPIRED(exit 3), telling the caller to log in again although the session was fine. It is
nowRATE_LIMITED(exit 7), retryable, withdetails.reason: "join_rate_limited"; nothing was
sent. Wait a minute before trying again. Every other refused join is stillAUTH_EXPIRED.
Documentation
- The tool reference documents both new tools, the access check before a write, and
applied_untracked; the safety model listsREVIEW_UNSUPPORTEDand how a decision is checked,
sent, and verified; the command line page lists the new commands and exit codes; the usage
guide, internals page, and README cover reviewing tracked changes, and the comparison now marks
accepting and rejecting them as supported. The private API catalogue records the accept route,
how a reject is sent, the range encoding, the change shapes of both protocols, the
track-changes features, and whereotUpdateErrorcomes from, each marked as read in Overleaf's
source, confirmed live, or both. - The roadmap records what checking v0.8.0's ten open protocol questions found.
docs/development.mddescribes the opt-in live test of tracked-change review,
RUN_OVERLEAF_LIVE_TRACKED_REVIEW_TESTS=1, and the interface comparison's review task now
rejects a tracked change too.- A contributing guide,
CONTRIBUTING.md, also on the site and linked from the README: how to
ask a question, report a bug or a security problem without exposing a session or a manuscript,
set up, where code goes, the tests, and what a pull request needs. - The TypeScript and JavaScript sources are formatted with Prettier, and CI checks it with
npm run format:check;.git-blame-ignore-revsskips the reformat commit ingit blame.