Skip to content

Tests: stub _unmerge_flags_on_error in the merged hub destination harness - #14961

Merged
danielhanchen merged 2 commits into
mainfrom
tests-merged-hub-unmerge-flags
Oct 23, 2026
Merged

danielhanchen merged 2 commits into
mainfrom
tests-merged-hub-unmerge-flags

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Two save test harnesses fail on main since #14823, 18 tests in tests/test_merged_hub_destination.py (Backend CI) and 7 in tests/saving/test_save_method_lora_routing.py (every Core matrix cell):

E   NameError: name '_unmerge_flags_on_error' is not defined

Both harnesses rebuild unsloth_generic_save and its neighbours from unsloth/save.py by AST and runs them against a stub namespace. #14823 wrapped the merge in with relative, _unmerge_flags_on_error(streamed): (save.py:6531), and the new helper is not in that namespace. Saving itself is unaffected: in save.py the helper is defined at module level.

Change

Stub _unmerge_flags_on_error as contextlib.nullcontext(), next to the existing lora_relative_to_original_base stub in each harness, and list it in the routing harness's _GENERIC_SAVE_STUBBED_HELPERS, which test_every_helper_the_generic_save_calls_is_loaded_or_stubbed checks. The helper only unmerges FSDP2 streamed layers when a save raises, and these fixtures never stream. Pulling in the real function instead does not work here, because the harness strips decorators and it is a @contextmanager. Test-only change.

Testing

  • tests/test_merged_hub_destination.py on main: 18 failed, 38 passed. With this change: 56 passed.
  • tests/saving/test_save_method_lora_routing.py on main: 7 failed. With this change, both files: 114 passed.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T11:39:41.877139Z 25b6874 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 948a1fa561

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 25b68748fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 6875840 into main Oct 23, 2026
@danielhanchen
danielhanchen deleted the tests-merged-hub-unmerge-flags branch October 23, 2026 11:45
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