Normalize empty worker namespace in step commands#3063
Conversation
Greptile SummaryThis PR fixes a namespace regression in the worker-side Key changes:
Minor issues found:
Confidence Score: 5/5Safe to merge — the fix is correct, minimal, and well-targeted; remaining findings are PEP 8 style nits. The core change is a minimal, surgically correct two-line fix that is well-understood (the No files require special attention beyond the minor style fixes in Important Files Changed
Reviews (1): Last reviewed commit: "Normalize empty worker namespace in step..." | Re-trigger Greptile |
Fixes #2734
PR Type
Summary
This fixes a namespace regression in the worker-side
stepandspin_steppaths. Whennamespace(None)is used to select the global namespace, the worker could receive an empty string instead, which caused client access inside the worker to fail withObject not in namespace ''.Issue
Fixes #2734
Reproduction
Runtime: local
Commands to run:
Root Cause
The runtime forwards the current namespace to worker-side commands in the step and spin-step paths using get_namespace() or "".
That preserves explicit namespaces, but it changes the meaning of the global namespace case. namespace(None) is intended to mean "no namespace
filtering", but once it reaches the worker as "", the worker-side code applies namespace(opt_namespace) and treats the empty string as a real namespace value instead of restoring None.
That breaks worker-side client access and leads to Object not in namespace ' ' .
Why This Fix Is Correct
This change restores the intended behavior by normalizing the empty worker-side namespace value back to None.
The fix is intentionally small:
1- it keeps the runtime-side behavior unchanged
2- it normalizes the namespace only at the worker boundary
3- it applies the same fix in both step and spin_step
Explicit non-empty namespaces continue to behave the same way.
Failure Modes Considered
Tests
Added an end-to-end regression test covering the real runtime and spin paths.
Executed:
python -m pytest test/unit/spin/test_spin.py -v -k global_namespace
I also ran:
python -m pytest test/unit/spin/test_spin.py -v
The full test_spin.py suite is blocked in my local environment by unrelated setup issues:
Non-Goals
This PR does not change broader namespace handling in the runtime, client, or metadata layers. It only restores the intended worker-side behavior for the empty-value case in step and spin_step.
AI Tool Usage
I used AI assistance during investigation and drafting. I reviewed, understood, and tested the final changes myself.