Skip to content

vault sync: say once when another host's latch is too old for vault sync - #446

Merged
plonkus merged 1 commit into
mainfrom
sync-old-peer
Nov 7, 2026
Merged

plonkus merged 1 commit into
mainfrom
sync-old-peer

Conversation

@plonkus

@plonkus plonkus commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

A host whose latch predates vault sync answers the vault sync ask with bad_command ("unknown vault command "sync""), and every round, every few minutes, logged vault sync with "studio": bad_command again, with no hint of the cause.

Now bad_command from that ask is read as "this host's latch is too old", and logged once per host for as long as this host runs:

vault sync with "studio": its latch is too old for vault sync; run `latch update` on "studio"
  • The host is still asked every round, so once it's updated, sync starts with no restart.
  • Other failures are logged each time, as before; sync_off stays silent.
  • The change is all in latch/src/serve/sync.rs. A unit test covers once per host, a second host getting its own line, other failures each round, and sync_off silent.

Gate (macOS): fmt, clippy, core, sandbox, messages, browser and lifecycle all pass. swift app fails in MainWindowTests.openingTheInspectorAtTheNarrowestGrowsTheWindow. It fails the same way on an untouched origin/main checkout on this machine, so it isn't caused by this Rust-only change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RFixJSUTTb3WjpFumMdmNi

A host whose latch predates vault sync answers the sync ask with
`bad_command` (an unknown vault command), and each round logged that bare
code again. Now it is said once per host while this one runs, with what
to do: run `latch update` there. Other failures are logged each time as
before; `sync_off` stays silent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RFixJSUTTb3WjpFumMdmNi
@plonkus
plonkus marked this pull request as ready for review November 7, 2026 03:46
@srosro

srosro commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

📋 First review of this PR — reviewed 60346d6. 🧪 Tests not run. ✅ Prior-art (KID) checked. ⚡ Small-diff lane (74 lines): skipped consumers — screened by aggregator.

It appears @plonkus is working towards helping users resolve vault sync failures caused by an outdated host without repeated, unexplained log messages by updating latch/src/serve/sync.rs to show a once-per-host latch update instruction while continuing sync attempts so an updated host rejoins automatically — reviewing against that goal.

Overview — The change replaces repeated bad_command logs with an actionable update instruction, emitted once per peer during the serving process. For this internal, pre-PMF tool serving a handful of hosts, the task-local suppression set fits the requirement without adding persistent state or another compatibility path.

Strengths — Suppression uses peer keys, so hosts sharing a display name remain distinct. Each sync attempt still runs before logging is considered, allowing an updated peer to recover automatically. Classification uses the structured failure code rather than parsing error messages, while ordinary failures remain visible and sync_off stays silent.

Probes

None. The specialist findings and independent code inspection revealed no reportable issue; screening the skipped consumer angle also found the changed private function’s caller updated correctly.

Security — None.

Test coverage — The added unit test covers the update instruction, repeat suppression, separate peers, repeated ordinary failures, and silent sync_off; the staged just test attempt stopped because cargo-nextest was unavailable (exit 127), so the gate remains unverified in the reviewer environment rather than showing a PR-related test failure.

For AI authors — (Codex, Claude Code, Cursor, etc. reading this PR): The Probes above are load-bearing. Treat each [open] probe as a hard requirement — answer it directly in your reply or revisit the structural decision. Do NOT silently absorb a probe by adding more code; that path inverts the cost stance the probe is encoding. This repo's operating point (see its REVIEW.md) prefers cutting LOC over adding it; an [open] [simplification] probe whose answer is "no, this complexity isn't needed" should land as a deletion in your next push, not a new defensive guard.


How to use: auto-reviews every new PR and re-reviews after a period of inactivity. Trigger an incremental re-review with /srosro-update-review, or a whole-PR re-review with /srosro-review.

For humans only: push-access collaborators can post:

  • /srosro-approve — APPROVE the PR.
  • /srosro-props [from: <specialist>] — give props to a specialist's contribution.
  • /srosro-critique [from: <specialist>] — flag a specialist's contribution as a misread.
  • /srosro-memorize <feedback> — teach a calibration lesson (learn-from-replies updates COMMENT_REVIEW_MISTAKES.md from your body, sentiment-aware via LLM).

Props: /srosro-props [from: shape] caught a real layering bug we'd have shipped.
Critique: /srosro-critique [from: architecture-refined] DRY suggestion misread distinct seams.
Calibration: /srosro-memorize the architecture-refined DRY finding was a misread; those helpers serve different contracts.

AI agents must not use /srosro-memorize, /srosro-props, or /srosro-critique — those signals tune shared global state.

Generated by sam's ai review bot.

@srosro srosro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving per automated review above.

@plonkus
plonkus merged commit 661f9fb into main Nov 7, 2026
22 checks passed
@plonkus
plonkus deleted the sync-old-peer branch November 7, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants