From fcb33e019a696a359040759efd2f00d64b4529df Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Wed, 11 Feb 2026 17:58:39 +0000 Subject: [PATCH] fix: add X-Tigris-Consistent headers to rclone commands Add --header-download and --header-upload with X-Tigris-Consistent: true to all rclone commands (bisync, sync, check, ls) to ensure consistent reads from Tigris origin region instead of stale edge cache. This fixes stale read issues for non-US users where edge nodes return outdated file content during bisync operations. Fixes #557 Co-authored-by: Paul Hernandez Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> --- .../cli/commands/cloud/rclone_commands.py | 22 ++++++++++++++++++- tests/test_rclone_commands.py | 13 +++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/basic_memory/cli/commands/cloud/rclone_commands.py b/src/basic_memory/cli/commands/cloud/rclone_commands.py index c1991ec5..8215452d 100644 --- a/src/basic_memory/cli/commands/cloud/rclone_commands.py +++ b/src/basic_memory/cli/commands/cloud/rclone_commands.py @@ -212,6 +212,10 @@ def project_sync( remote_path, "--filter-from", str(filter_path), + "--header-download", + "X-Tigris-Consistent: true", + "--header-upload", + "X-Tigris-Consistent: true", ] if verbose: @@ -287,6 +291,10 @@ def project_bisync( str(filter_path), "--workdir", str(state_path), + "--header-download", + "X-Tigris-Consistent: true", + "--header-upload", + "X-Tigris-Consistent: true", ] # Add --create-empty-src-dirs if rclone version supports it (v1.64+) @@ -356,6 +364,10 @@ def project_check( remote_path, "--filter-from", str(filter_path), + "--header-download", + "X-Tigris-Consistent: true", + "--header-upload", + "X-Tigris-Consistent: true", ] if one_way: @@ -393,6 +405,14 @@ def project_ls( if path: remote_path = f"{remote_path}/{path}" - cmd = ["rclone", "ls", remote_path] + cmd = [ + "rclone", + "ls", + remote_path, + "--header-download", + "X-Tigris-Consistent: true", + "--header-upload", + "X-Tigris-Consistent: true", + ] result = run(cmd, capture_output=True, text=True, check=True) return result.stdout.splitlines() diff --git a/tests/test_rclone_commands.py b/tests/test_rclone_commands.py index 0af195b4..e7c3609a 100644 --- a/tests/test_rclone_commands.py +++ b/tests/test_rclone_commands.py @@ -130,6 +130,9 @@ def test_project_sync_success(tmp_path): assert "--filter-from" in cmd assert str(filter_path) in cmd assert "--dry-run" in cmd + assert "--header-download" in cmd + assert "X-Tigris-Consistent: true" in cmd + assert "--header-upload" in cmd assert kwargs["text"] is True @@ -214,6 +217,9 @@ def test_project_bisync_success(tmp_path): assert "--compare=modtime" in cmd assert "--workdir" in cmd assert str(state_path) in cmd + assert "--header-download" in cmd + assert "X-Tigris-Consistent: true" in cmd + assert "--header-upload" in cmd def test_project_bisync_requires_resync_first_time(tmp_path): @@ -369,6 +375,9 @@ def test_project_check_success(tmp_path): assert result is True cmd, kwargs = runner.calls[0] assert cmd[:2] == ["rclone", "check"] + assert "--header-download" in cmd + assert "X-Tigris-Consistent: true" in cmd + assert "--header-upload" in cmd assert kwargs["capture_output"] is True assert kwargs["text"] is True @@ -407,6 +416,10 @@ def test_project_ls_success(): project = SyncProject(name="research", path="app/data/research") files = project_ls(project, "my-bucket", run=runner, is_installed=lambda: True) assert files == ["file1.md", "file2.md", "subdir/file3.md"] + cmd, _ = runner.calls[0] + assert "--header-download" in cmd + assert "X-Tigris-Consistent: true" in cmd + assert "--header-upload" in cmd def test_project_ls_with_subpath():