Skip to content

fix webui trainer callable globals#2876

Merged
bghira merged 1 commit into
mainfrom
agent/process-keeper-callable-sys-global
Jul 23, 2026
Merged

fix webui trainer callable globals#2876
bghira merged 1 commit into
mainfrom
agent/process-keeper-callable-sys-global

Conversation

@bghira

@bghira bghira commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

Ports the callable globals fix from whitejt2/SimpleTuner@2041c01 and adds a regression test.

The subprocess callable reconstruction path can rebuild a function with a globals dictionary that lacks sys. The generated runner script imports and uses sys, so providing it in the reconstructed callable globals prevents valid callables from failing when their serialized globals do not carry sys explicitly.

Validation

  • .venv/bin/python -m unittest tests.test_process_keeper.TestProcessLifecycle.test_callable_payload_reconstruction_provides_sys_global -v
  • .venv/bin/python -m unittest tests.test_process_keeper -v

@bghira
bghira marked this pull request as ready for review July 23, 2026 14:13
@bghira
bghira requested a review from Copilot July 23, 2026 14:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR ports a fix to the subprocess “callable” payload reconstruction so reconstructed functions always have sys available in their globals, preventing failures when the serialized callable globals omit sys. It also adds a regression test to ensure the callable reconstruction path completes successfully in that scenario.

Changes:

  • Ensure callable reconstruction initializes globals_dict with sys (in addition to __builtins__) before applying serialized globals metadata.
  • Add a regression test that submits a reconstructed function lacking sys in its globals and asserts the job completes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
simpletuner/simpletuner_sdk/process_keeper.py Seeds reconstructed callable globals with sys to prevent NameError when executing serialized callables missing sys.
tests/test_process_keeper.py Adds a regression test covering callable payload reconstruction when sys is absent from the callable’s serialized globals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bghira
bghira merged commit f708577 into main Jul 23, 2026
3 checks passed
@bghira
bghira deleted the agent/process-keeper-callable-sys-global branch July 23, 2026 14:18
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.

3 participants