Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(sync): report actual transfer count instead of "no files transferred"#42

Merged
bvisible merged 1 commit into
bvisible:mainfrom
MakksSh:main
Jun 18, 2026
Merged

fix(sync): report actual transfer count instead of "no files transferred"#42
bvisible merged 1 commit into
bvisible:mainfrom
MakksSh:main

Conversation

@MakksSh

@MakksSh MakksSh commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Problem

When AI agents use ssh_sync, the tool always reports "No files needed to be transferred" even when files are actually synced. This causes agents to:

  • Mistrust the sync result and run redundant verification checks
  • Retry the sync unnecessarily, assuming it failed
  • Get confused about deployment state and make incorrect decisions

Root cause

Two issues in rsync output parsing:

  1. --stats flag is only added when verbose is enabled. Without it, rsync produces no statistics lines, so the regex match returns null and filesTransferred stays at 0, triggering the false "no files" message.

  2. Regex patterns are written for rsync 2.x only. rsync 3.x (standard on modern distros) changed the output format from Number of files transferred: N to Number of regular files transferred: N. The old regex misses the word regular and never matches.

Fix

  • Always pass --stats to rsync regardless of verbose setting
  • Update regex to handle both rsync 2.x and 3.x output formats:
    • Number of (regular )?files transferred: N
    • Accept . as thousand separator in size/speed values for locale compatibility

Verified

Tested live with ssh_sync push to a remote server. Before fix: "No files needed to be transferred". After fix: "Files transferred: 1, Total size: 0.04 KB".

image

- Always pass --stats so transfer counts are present in output
- Update regex to match rsync 3.x "Number of regular files transferred"
- Accept dots as thousand separators in size/speed patterns
@bvisible bvisible merged commit 0ca1404 into bvisible:main Jun 18, 2026
5 checks passed
@bvisible

Copy link
Copy Markdown
Owner

Thanks a lot @MakksSh! 🙏 Merged and shipped in v3.6.3.

Spot-on diagnosis — the --stats-only-in-verbose bug plus the rsync 2.x/3.x wording mismatch (Number of regular files transferred) were exactly it. I added a small follow-up on top of your fix:

  • openrsync (the default /usr/bin/rsync on recent macOS) suffixes byte counts with B instead of bytes, so totalSize stayed 0 there — both suffixes are matched now (raw bytes even at 5 MB, no K/M/G).
  • locale thousands/decimal separators (, / .) are now parsed correctly for the file count, size and speed.
  • extracted the parsing into src/rsync-stats.js and added tests/test-sync-stats.js (46 assertions, incl. openrsync output captured live, GNU 2.x/3.x, US/EU locales).

Available now: npm i [email protected]. Much appreciated! 🚀

@MakksSh

MakksSh commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Great! I'm happy to help with the product's development! I use it regularly, and it solves many of my problems when working with agents. 🤝

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