Skip to content

Commit 9a99d16

Browse files
committed
rpc: log pullOnce watermark divergence at debug level
The inline retry path in pullOnce silently recovers from a cross- side watermark divergence by resetting cursors and retrying. A one-shot divergence is normal (a wsd respawn under the same WebSocket, mid-flight test harness state) and the recovery is the intended behavior. A persistently broken remote, however, will trip the retry on every pull and silently degrade to repeated baseline re-syncs, with no operator-visible signal. Add a console.debug() so the divergence shows up in logs without creating noise on the well-behaved happy path. The fields capture which cursor diverged and which got reset, so a developer chasing "why does this workspace keep re-syncing" has enough context to correlate with the remote's lifecycle.
1 parent 7ca0d5b commit 9a99d16

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

packages/rpc/src/sync-driver.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,22 @@ async function pullOnceImpl(
159159
// down before we get here.
160160
await fetchResult.stream.cancel().catch(() => {});
161161
maybeDispose(fetchResult);
162+
// Surface the divergence at debug level so an operator with
163+
// log access can spot a persistently broken remote. We do not
164+
// throw: a one-shot divergence is normal after a wsd restart
165+
// under the same WebSocket, and the inline reset + retry is
166+
// the intended recovery. A persistently-lying remote will log
167+
// this on every pull, which is the operational signal that
168+
// something upstream is wedged.
169+
console.debug("[pullOnce] cross-side watermark divergence; resetting and retrying", {
170+
backend,
171+
appliedPushRev,
172+
localPushRev,
173+
remoteRev,
174+
sinceRev,
175+
resetPushRev: appliedPushRev < localPushRev,
176+
resetFetchRev: remoteRev < sinceRev,
177+
});
162178
if (appliedPushRev < localPushRev) {
163179
writeWatermark(db, "pushRev", 0, backend);
164180
}

0 commit comments

Comments
 (0)