Skip to content

Fix remote flashgrep overwrite on SFTP hosts#780

Open
wgqqqqq wants to merge 1 commit into
GCWing:mainfrom
wgqqqqq:codex/fix-remote-flashgrep-upload
Open

Fix remote flashgrep overwrite on SFTP hosts#780
wgqqqqq wants to merge 1 commit into
GCWing:mainfrom
wgqqqqq:codex/fix-remote-flashgrep-upload

Conversation

@wgqqqqq
Copy link
Copy Markdown
Collaborator

@wgqqqqq wgqqqqq commented May 19, 2026

What changed

This PR narrows the remote flashgrep bundle replacement path in RemoteWorkspaceSearchService::ensure_remote_flashgrep_binary.

When the bundled binary hash differs from the remote binary hash, BitFun no longer writes directly to the final remote binary path over SFTP. Instead it now:

  1. uploads the new bundle to a fresh temporary file in the same directory
  2. replaces the target binary with mv -f temp target
  3. keeps the existing chmod 755 step on the final path

Why

On the affected remote host, SFTP accepts uploads to new files but rejects opening an existing file for overwrite/truncate with a generic Failure error.

We reproduced all three cases against the saved Alibaba Cloud remote connection:

  • creating a new file in .bitfun/bin succeeds
  • overwriting the existing flashgrep-x86_64-unknown-linux-musl via SFTP fails
  • uploading to a temp file and then renaming it into place succeeds

That failure happens before the remote stdio daemon starts, so repository status/search requests fail during flashgrep bundle refresh.

Scope

This change only affects the remote flashgrep bundle installation path when BitFun decides the remote binary must be replaced.

It does not change:

  • remote search protocol behavior
  • stdio daemon startup/shutdown semantics
  • the no-op path when the remote binary hash already matches

Validation

  • cargo check -p bitfun-core
  • Reproduced the failing SFTP overwrite behavior on the saved Alibaba Cloud remote workspace
  • Verified that upload temp file + mv -f target succeeds on the same host

@wgqqqqq wgqqqqq changed the title [codex] Fix remote flashgrep binary upload over SFTP Fix remote flashgrep binary upload over SFTP May 19, 2026
@wgqqqqq wgqqqqq changed the title Fix remote flashgrep binary upload over SFTP [codex] Fix remote flashgrep overwrite on SFTP hosts May 19, 2026
@wgqqqqq wgqqqqq changed the title [codex] Fix remote flashgrep overwrite on SFTP hosts Fix remote flashgrep overwrite on SFTP hosts May 19, 2026
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.

1 participant