Skip to content

[CLI] Space hot-reload: AX improvements#4049

Open
cbensimon wants to merge 11 commits intomainfrom
spaces-hot-reload-wait
Open

[CLI] Space hot-reload: AX improvements#4049
cbensimon wants to merge 11 commits intomainfrom
spaces-hot-reload-wait

Conversation

@cbensimon
Copy link
Copy Markdown
Contributor

@cbensimon cbensimon commented Apr 3, 2026

Main fix

Space backend webhook handler is sometimes (very rarely) lagging behind the "synchronous limit" defined internally in moon-landing. Let's make hot-reload still work in this case

Misc

See cursor summary


Note

Medium Risk
Moderate risk: changes affect the hf spaces hot-reload upload flow and add polling/strict SHA validation, which could cause new CLI failures or waits if backend propagation differs or sha is unavailable.

Overview
Improves hf spaces hot-reload reliability by capturing the Space’s current running SHA, passing it as parent_commit during the upload, and polling space_info until the reported SHA advances to the new hot-reload commit (failing fast if it never matches).

Enhances CLI ergonomics: --local-file is now a PATH/Path option, adds a non-interactive fallback when no TTY is available (persist temp checkout + instructions), and prints a short post-commit sync hint when hot-reloading from a local path.

Adds a small hot-reload client tweak by setting a default httpx client timeout, and updates the generated CLI docs accordingly.

Reviewed by Cursor Bugbot for commit 47d616a. Bugbot is set up for automated code reviews on this repo. Configure here.

@cbensimon cbensimon requested a review from hanouticelina April 3, 2026 19:23
@bot-ci-comment
Copy link
Copy Markdown

bot-ci-comment bot commented Apr 3, 2026

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Co-authored-by: célina <hanouticelina@gmail.com>
@cbensimon cbensimon changed the title [CLI] Space hot-reload: wait for up-to-date infos [CLI] Space hot-reload: AX improvements Apr 7, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 47d616a. Configure here.

local_path = local_file
filename = local_file if filename is None else filename
local_path = str(local_file)
filename = local_path if filename is None else filename
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Path type change breaks path_in_repo on Windows

Low Severity

Changing local_file from str | None to Path | None means str(local_file) uses OS-specific path separators. On Windows, str(Path('src/app.py')) produces 'src\\app.py'. When filename is not provided, local_path (with backslashes) is assigned to filename and used as path_in_repo in upload_file. The downstream _validate_path_in_repo only normalizes forward slashes, so backslashes pass through to the Hub API, potentially creating a file with a malformed repo path. Previously, local_file was a raw str preserving the user's forward slashes.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 47d616a. Configure here.

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