Skip to content
PifeatureBackend3 files · +650 −55

Implement copyFiles API for huggingface.js bucket support

Session from pi-sessions on Hugging Face by julien-c · CC-BY-4.0 · condensed by Coders Talk

1h 27msession
1interventions
GOAL

Port the `copy_files`/bucket-copy feature from the huggingface_hub Python commit into the huggingface.js hub package, including CLI-style `hf://` handle parsing and unit tests.

  1. Prompt · +9m
    Check commit d82a7f7d... in huggingface_hub and implement the same feature (bucket copy) in this codebase
  2. Agent did · +9m
    Reviewed the huggingface_hub commit's diffs (hf_api.py, _buckets.py, cli/buckets.py, tests), studied existing hub package patterns (commit.ts, paths-info.ts, list-files.ts, download-file.ts), then wrote a first draft of copy-files.ts implementing parseHfCopyHandle and copyFiles.
  3. Agent did · +31m
    Exported copy-files from lib/index.ts, ran tsc and fixed type errors (const reassignment, missing repoType property, unused variable) until copy-files.ts compiled cleanly.
  4. Prompt · +36m
    Git commit it, no need to read any skill, just do a simple git commit
  5. Agent did · +39m
    Committed the new copy-files.ts and index.ts changes, then on request committed IDE-formatted code and removed unused RepoId/toRepoId imports as separate commits.
  6. Prompt · +51m
    Start a very simple .spec.ts file, testing only parseHfCopyHandle with 2 or 3 simple test cases
  7. Fail · +52m
    Initial tests failed: repoType returned 'datasets' instead of singular 'dataset', and bucket handle parsing only captured the first path segment instead of namespace/bucket-name.
  8. Agent did · +55m
    Fixed the repoType singularization and the bucket path slicing logic; all 3 tests passed, and the fixes plus spec file were committed.
  9. Intervention · +1h 2m
    Repeated the same rename request (ValueError to CopyHandleError) multiple times over ~1.5 hours with no useful response, then gave up on the model after it failed one of two edits and asked a generic clarifying question instead of just finishing the rename.
    Why: I asked the same simple rename three times and it kept stalling or giving vague follow-up questions instead of just doing the edit, so I lost patience and decided to try a different model.
  10. Outcome · +1h 27m
    Session ends with the ValueError→CopyHandleError rename still incomplete, developer repeating the request unanswered.
VERDICT

Next time I'd give the exact rename edit up front, including both call sites, instead of asking for it piecemeal so the agent doesn't half-apply it. The intervention that actually helped was writing the small spec.ts myself as a prompt - it immediately caught two real parsing bugs (repoType pluralization and bucket path slicing) that the agent then fixed correctly. The session fell apart at the end when a trivial rename got stuck in a loop and the model started asking clarifying questions instead of just doing the edit.

I tried this · 0

Discussion · 0

How Builds work