From 432eba1b49b35e9c49ed09ff4e13caec93bfba3b Mon Sep 17 00:00:00 2001 From: "Snow Lee (Sungwon)" Date: Tue, 18 Aug 2026 22:04:27 -0700 Subject: [PATCH] fix(cli): a plain bdrive sync clears the last session's note (BEA-107) (#172) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An explicit `bdrive sync` never touched the stored session note, so a hand edit made after `bdrive sync --note claude-session-abc` was still stamped with that note under its 30-minute TTL — attributed to the agent in `bdrive log`, and grouped inside that session in hub History (which also feeds the agent-run rollback story). The fix is a branch deleted, not added: `SaveNote("")` already routes to `ClearNote`, so dropping the `Changed("note")` guard makes one unconditional call both set and clear. Clearing the *store* is what leaves the cycle unstamped — scan falls back to `LoadNote` whenever `Session.Note` is empty. The --hook path has its own SaveNote and the daemon calls Cycle directly, so agent- and daemon-driven syncs keep the note until the TTL expires. Co-authored-by: Claude Opus 5 (1M context) --- README.md | 2 +- cmd/bdrive/cmds.go | 24 ++++--- cmd/bdrive/session_stamp_test.go | 73 ++++++++++++++++++++++ web/docs/src/content/docs/reference/cli.md | 7 ++- 4 files changed, 95 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 88fc715..68ec5e6 100644 --- a/README.md +++ b/README.md @@ -256,7 +256,7 @@ hub's own storage, never something a syncing client points at directly: | `bdrive forget ...` | Stop syncing a path *and* remove it from the hub — adds the rule to `.bdriveignore` (which syncs) and prunes in one step. Local files are never touched, here or on teammates' devices | | `bdrive url [path]` | Internal hub link for a file/folder (sign-in + membership required; `--sync` pushes first; no arg = project home). Computed locally | | `bdrive share ` | Public URL for a synced file (`--list`, `--revoke`, `--expires`) | -| `bdrive sync [folder]` | Run one sync cycle now. `--note ` stamps session context (e.g. an agent session id) onto changes — shown in `bdrive log` and hub history; keeps applying to daemon-committed changes until `--note-ttl` (default 30m) expires. `--prune` also removes from the hub what `.bdriveignore` now excludes (files stay on disk everywhere). `--hook