Repository navigation
Conversation
OpenCode reads its config as JSONC, so comments and trailing commas are legal in opencode.json. The installer parsed it as strict JSON and answered any parse error with an empty object, so Install wrote the file back holding only the ZenNotes entry and every provider and setting the user had was gone (#1104). The installer now reads the file with jsonc-parser and edits the mcp entry in place, so comments, key order and layout survive both Install and Uninstall. A file it cannot parse is never written: it throws with the line and column, the way a broken ~/.claude.json already does, and Settings shows the message. A lone opencode.jsonc is edited instead of starting a second config beside it. jsonc-parser is bundled into main, not externalized.
…peable A Connect to Remote Vault that the server turned down (a gateway let the Cloudflare Access headers through, but no ZenNotes token was given) reported the error with window.alert. On Windows that is a native message box, and after OK the window came back without keyboard focus: shortcuts and Enter still worked, but no text field took typing, so the next try's server URL could not be edited until the app restarted (#1106). The next try also opened on http://localhost:7878 again, since a failed try saves no profile and leaves no current remote. The three remote flows that alerted (Quick Connect, connecting a saved remote, changing the remote vault folder) now say so in the app's own dialog: ConfirmModal gains a one-button notice mode, reached through noticeApp, and the message goes through humanIpcError so it no longer starts with Electron's "Error invoking remote method" wrapper. Quick Connect remembers the address it last tried until a server takes it, for this session only; it is a typing aid, not a setting, and the token and headers are not kept. The other window.alert calls in app-core are left as they were.
…omes back A remote vault keeps nothing on this machine, so while its server cannot be reached a save fails and the editor's buffer is the only copy of the edit. persistNote caught that failure, logged it to the console and stopped: the note kept the same small dot every pending save shows, nothing tried again when the server returned (the reconnect's resync deliberately leaves dirty buffers alone, expecting a save that never came), and quitting threw the edit away (#1108). A failed save is now remembered per note with its reason. The header says Not saved instead of the dot, an error toast stays up until the note lands, and the store retries on its own: after 2, 5, 15 and 30 seconds, then once a minute, and at once when the change feed reconnects or the OS reports the network back. The retry reads the server first. If the note moved away from what this edit started from, someone else saved it in the meantime, so their version is kept beside it as "Note (server copy)" before ours is written, the same keep-both outcome Cloud sync gives a conflict. The server has no conditional write, so that check and the save are two requests, not one atomic step. Quitting or closing a window while a note is not saved now asks first. The renderer reports how many such notes it holds and main asks at the top of before-quit, before the remote watcher and Cloud sync are stopped, because a quit cancelled any later would leave them stopped in an app that keeps running. It stands aside during an update install and a Windows session end. This does not keep an offline copy of the vault, which is what #1108 asks for; that needs the server's help (per-note versions and a conditional write) and is a design of its own. The website docs mirror of the new manual entry is still owed.
A remote vault keeps nothing on this computer, so while its server cannot be reached its notes do not open, and 2.91.0's retry only holds an edit in the window's memory until the server answers again. #1108 asks for what ZenNotes Cloud already gives a local vault: a copy that opens and saves offline and reaches the server when it comes back, keeping both versions when two devices really did disagree. The design makes the copy a real folder the app owns under userData, opened through the local-vault code path, so search, tasks, databases and workflows work offline without touching the 91 remote branches in main. Cloud's sync engine keeps it in step with the server unchanged; znserver learns the subset of Cloud's protocol the engine needs (per-item revisions, a sequenced change log with deletes as tombstones, mutations that refuse a stale base) plus a reconcile for edits made on the server's disk behind its back. The mirror is never treated as a local vault and never seeded, since anything written into it would upload to the user's server. The smallest first slice is useful on its own: a content hash on note reads and writes and an optional base hash on /api/notes/write that answers 409, which makes the 2.91.0 retry, the TUI autosave and the CLI and MCP edits atomic with no stored server state. The doc covers each repo's share, what of Cloud is reused, compatibility with older servers and clients, the phases and the risks, and records Adib's decisions of November 23. Nothing is built.
…e meanwhile 2.91.0's retry reads the server before it saves again, and when the note moved away from what the edit started from it keeps the server's version as "Note (server copy)". But the check and the save were two requests: a save from another device that landed between them was written over, with nothing kept (#1108). The same race sat in every read, change and write back against a server: appending from the desktop or the web client, and the bundled `zn` and MCP tools that append, prepend, insert, replace and toggle a task. A server with conditional writes (znserver `supportsConditionalNoteWrites`) returns a note's `sha256` with each read and write, and refuses a write that sends it back as `baseSha256` with 409 when the note changed. The retry now saves on the hash of the read it just made; a refusal means someone saved that instant, so it retries at once, a few times, and its next read keeps their version beside ours as before. The read, change and write helpers go through one shared routine (`rewriteNoteOnServer`) that redoes the change on the newer text when refused, since appending a line or replacing a word is a function of the body, so nobody's edit is lost and none is written over. Clients never hash on their own side: they echo the server's value, which names the bytes on disk whatever JSON did to the body. An older server returns no hash, so nothing is sent and every write is unconditional, exactly as before. Ordinary saves stay unconditional for now; only the retry and the read, change and write paths send a base. The phones' remote client (portable-vault) and the Go `zn` TUI are not changed here. How to test locally: run a znserver built from feat/conditional-note-writes, connect the desktop to it, open a note, stop the server, type a line, then start the server and, the instant it is back, change the note's file on the server. The note keeps your line and "Note (server copy)" holds the other text. Against an older server the same steps save your line as before.
…and an OpenCode install that keeps your settings 2.91.0's changes a user can see are two: a remote vault no longer loses an edit made while its server is away (Not saved, saved again when the server is back, a server copy kept on conflict, a quit that asks first; #1108, 3422803 and f7f585f), and Install for OpenCode changes only its own entry in opencode.json (#1104, 3105527). The Windows address-field fix (#1106) is too narrow to lead the window and stays in the release notes.
zn 0.18.2 (ZenNotes/tui v0.18.2, ZenNotes/tui#60) names the version it read on every edit it makes through a self-hosted server, so its CLI and MCP edits and its terminal app's saves never write over a save another device just made, the same protection this release gives the app's own retry (f7f585f). The pin is that release's signed terminal-release.json, verified against zn-release-1 and copied byte for byte; the staged binary reports zn v0.18.2. The in-app help's CLI card names 0.18.2 and desktop 2.91.0.
The 2.91.0 gate's full uncached run failed two note-actions tests once. A failed save arms a retry timer (2, 5, 15, 30 seconds, then a minute; 3422803), and the check that the vault and host are still the ones the save failed in ran only when the timer fired, taking whatever host was live by then. A test file whose store outlives it (vi.resetModules) left such timers running, and under load they fired inside a later test and wrote the old buffer through that test's bridge: the rename-hold test saw a write of the earlier test's "Keep unsaved.", the vault-switch test an earlier "See [[Renamed]].". Users cannot hit it as a write: the retry saves through persistNote, which honors the rename and move holds, a rename first saves its dirty notes and refuses if that fails, and a vault switch clears the dirty state and save errors. What did leak was the old vault's "Couldn't save" toast, which stayed up after a switch. The timer now captures the folder-action context when it is scheduled (scheduleSaveRetry). If the vault or host has changed by the time it fires, it clears its retry state, takes its toast down and stops. Two tests, a replaced host and a changed vault, fail without this. A stale comment in retryFailedSaves that still said the server has no conditional write now describes both servers.
This branch was successfully deployed
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.
ZenNotes 2.91.0: a remote vault keeps edits made while its server is away, Install for OpenCode keeps your config, and a failed connect no longer locks the address field on Windows. Bundles zn 0.18.2. Gate: every check passed on
82360d73(Cloud UI tests waived); Adib's go recorded.baseSha256when the server supports conditional writes (f7f585f; server side Conditional note writes and a watcher fix for vault switches znserver#85)