fix(hf_push): dispatch dataset vs model after the permission prompt - #16
Open
arthi-arumugam-git wants to merge 1 commit into
Open
fix(hf_push): dispatch dataset vs model after the permission prompt#16arthi-arumugam-git wants to merge 1 commit into
arthi-arumugam-git wants to merge 1 commit into
Conversation
agent.py imported _execute_hf_push, which commit 1594e14 split into _execute_hf_push_dataset and _execute_hf_push_model. The permission path is the first push to any new repo, so approving the prompt raised ImportError before anything reached the Hub. Fixes Liquid4All#15. The two replacements take different arguments, so this is more than a rename. The call site now mirrors the dispatch at the end of handle_hf_push: it uses _detect_hf_repo_type, honours an explicit repo_type from the tool call, and falls back to detection. That also fixes a second problem on the same path. It previously assumed dataset, globbed for parquet and indexed parquet_files[0], which raises IndexError on a model folder, so a plain rename would have left model pushes broken. It also treated parquet_files as paths, where handle_hf_push treats them as names relative to target. Adds two tests, both failing on main: a dataset folder reaching _execute_hf_push_dataset, and a model folder with only config.json reaching _execute_hf_push_model.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15.
agent.pyimported_execute_hf_push, which commit1594e14("auto-detect dataset vs model") split into_execute_hf_push_datasetand_execute_hf_push_model. The call site was missed, so approving anhf_pushpermission prompt raisedImportErrorbefore anything reached the Hub.handle_hf_pushreturnsPERMISSION_REQUIREDon the first push to a given repo, so this is the path every new user takes.Why it is more than a rename
@marekolszewski flagged in the issue that the two replacements take different arguments. They do, and there were two further problems on that path:
It assumed dataset. The old code globbed for parquet unconditionally and indexed
parquet_files[0]. A model folder has no parquet, so a plain rename to_execute_hf_push_datasetwould have turned theImportErrorinto anIndexErrorfor model pushes.It treated
parquet_filesas paths._detect_hf_repo_typereturns file names;handle_hf_pushbuilds the path astarget / parquet_files[0]. The old code built its own list of full paths, so the two representations differed.The change
The call site now mirrors the dispatch at the end of
handle_hf_push: it honours an explicitrepo_typefrom the tool call, falls back to_detect_hf_repo_type, and calls whichever executor applies with that function's own argument order. Nothing new is invented; it is the working path's logic, reused.If detection comes back
Noneit returns a validation failure rather than guessing.handle_hf_pushrejects that case before ever prompting, so reaching it here means the folder changed between the prompt and the answer.Tests
Two, both failing on
mainatagent.py:2190:_execute_hf_push_datasetwithdata.parquetresolved correctlyconfig.jsonreaching_execute_hf_push_model, which is the case a rename would have left brokenIdentical failure count; the 90 are pre-existing TUI keyboard tests, unrelated to this path. Passed goes up by exactly the two tests added here.
One thing worth your call
The root cause is that these two paths duplicate each other, and
1594e14updated only one of them. This PR keeps them separate and makes them agree, which is the smaller change. The alternative is to have_handle_hf_push_permissionre-invokehandle_hf_pushonce permission is granted, so there is only ever one dispatch and this cannot recur.I went with mirroring because it is the minimal fix for a filed bug. Happy to do the collapse instead if you would prefer it.