Skip to content

fix(cli): list Team projects in one request and transfer files in parallel - #1703

Merged
phernandez merged 5 commits into
mainfrom
fix/1604-fast-webdav-transfer
Oct 9, 2026
Merged

phernandez merged 5 commits into
mainfrom
fix/1604-fast-webdav-transfer

Conversation

@phernandez

Copy link
Copy Markdown
Member

Fixes #1604.

Deploy order: this depends on basicmachines-co/basic-memory-cloud#2400 being deployed first. Without it, the service answers the new Depth: infinity listing one level deep. When a project has subdirectories, the client detects that and stops with an explicit error. It does not fall back to the per-directory walk.

Why

Team bm cloud push/pull took minutes on real projects. A 680-file project needed 103 serial PROPFINDs at about 0.9 s each just to list, and then each file moved one at a time. Per the agreed plan on the issue, Team members keep push/pull, the WebDAV path gets faster, and no code is deleted.

Change

  • Listing. list_project_files sends one PROPFIND with Depth: infinity for the project. Each file's project-relative path comes from its percent-encoded href. The display name is now only a consistency check: a mismatch raises.
  • The client rejects hrefs outside the project and duplicate self entries.
  • Unsupported service. If any collection in the listing has no file under it, the service ignored the Depth header. The client stops with "does not yet support the recursive listing … Retry after the cloud service has been updated."
  • Oversized project. A 403 carrying DAV:propfind-finite-depth (the cloud's cap) becomes a clear error naming the cause.
  • Transfers. Files move through an asyncio.TaskGroup of at most TRANSFER_CONCURRENCY = 8 workers that share one iterator, so the task count stays bounded for any plan size.
    • The first failure cancels the transfers still in flight. Each file still lands atomically: a staged rename on pull, a single PUT on push.
    • Transfer failures surface as one WebdavError naming each failed file and the count transferred before the stop.
    • A local OSError still propagates as itself, chained to the group.
  • Unchanged. Plan and conflict detection, etag and size comparison, _check_plan, --on-conflict, create-only writes (If-None-Match: *, exclusive local create), never-delete semantics, the push-side re-list, and the fix(cli): wait out rate limits during a WebDAV transfer #1532 rate-limit retries.

Verification

  • just fast-check is clean (ruff, format, ty).
  • BASIC_MEMORY_TESTMON_SELECT_FLAGS="--import-mode=importlib" just fast-test tests/cli/cloud/ passed (184).
  • New tests:
    • one PROPFIND with Depth: infinity is sent, and nested paths are parsed from hrefs, including percent-encoded ones and a directory named like its parent;
    • a one-level answer is refused, and so is the finite-depth 403;
    • hrefs outside the project and contradicted display names are rejected;
    • pull and push both reach exactly 8 transfers in flight and never more;
    • a failed transfer cancels the 7 in-flight siblings, leaves no files behind, and reports the file;
    • an end-to-end bm cloud pull against a one-level server exits 1 with the explicit message after sending one Depth: infinity request.

CLI help text is unchanged, so just man-regen is not needed. CHANGELOG is untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T15:37:01.483043Z df4b089 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8be86d884d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/cli/commands/cloud/webdav_transfer.py
@phernandez
phernandez force-pushed the fix/1604-fast-webdav-transfer branch from 8be86d8 to 7181e12 Compare October 9, 2026 14:56
@phernandez phernandez added this to the v0.24.0 milestone Oct 9, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7181e1299f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/cli/commands/cloud/webdav_transfer.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7fa5a9a7ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/cli/commands/cloud/webdav.py Outdated
Comment thread src/basic_memory/cli/commands/cloud/webdav.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1fcdce374e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/cli/commands/cloud/webdav.py
phernandez and others added 5 commits October 9, 2026 10:31
…allel

Team `bm cloud push`/`pull` were slow for two reasons (#1604):

- Listing walked the project with one Depth: 1 PROPFIND per directory,
  serially. `list_project_files` now sends one `Depth: infinity` PROPFIND
  and reads each file's project-relative path from its href.
- Files moved one at a time. They now move through a task group of at
  most TRANSFER_CONCURRENCY (8) workers. The first failure cancels the
  rest and is reported as one WebdavError that names each failed file
  and how many files were transferred.

The client does not fall back to the per-directory walk. If the service
answers one level deep, the client stops and says the service does not
support recursive listings yet. If the service refuses with
DAV:propfind-finite-depth, the client says the project is too large for
one listing. Conflict detection, create-only writes, --on-conflict, the
additive semantics and rate-limit retries are unchanged.

Requires basicmachines-co/basic-memory-cloud#2400 to be deployed first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea
Signed-off-by: phernandez <paul@basicmachines.co>
Push and pull now run eight transfers at once, and each one held its whole
file in memory: download_file read response.content and push read the
file with read_bytes(). Peak memory grew with the number of files in
flight.

Downloads now stream straight into the staged temp file beside the
destination. Uploads read the file in 1 MiB chunks and declare
Content-Length up front, so the service can still refuse an oversized
file before reading it. The rate-limit retry helper streams responses and
opens a fresh body for each attempt. Error bodies are still read in full
because the error message quotes them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea
Signed-off-by: phernandez <paul@basicmachines.co>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea
Signed-off-by: phernandez <paul@basicmachines.co>
With keep-both, a conflict copy's name can also be a new file in the
plan. Both transfers are create-only, so with concurrent workers the one
that finished first won the name and the conflict copy could be refused.
Transfers are now grouped by destination, and each group runs in plan
order on one worker, so the conflict copy claims the name as it did when
transfers ran serially.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea
Signed-off-by: phernandez <paul@basicmachines.co>
…bodies

An upload retry re-opened the source path, so a file replaced during a
Retry-After wait could be sent under the original Content-Length and
mtime. The file is now opened once; each attempt rewinds that handle,
and size and mtime come from fstat on it.

A streamed 3xx response was left unread, so describing the failure
raised ResponseNotRead instead of naming the status. Every non-2xx
response is now read before it is handed back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01APFUk2bjEwMptMQqpRhjea
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez force-pushed the fix/1604-fast-webdav-transfer branch from 1fcdce3 to df4b089 Compare October 9, 2026 15:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df4b0899d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/basic_memory/cli/commands/cloud/webdav_transfer.py
@phernandez
phernandez merged commit 22407e6 into main Oct 9, 2026
36 checks passed
@phernandez
phernandez deleted the fix/1604-fast-webdav-transfer branch October 9, 2026 15:57
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.

Team push/pull: owner-only over rclone, remove WebDAV transfer

1 participant