fix(python): fix CodeBox(memory_mib=...) crash due to positional arg mismatch#245
fix(python): fix CodeBox(memory_mib=...) crash due to positional arg mismatch#245DorianZheng merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in CodeBox.__init__ where positional arguments were being passed to SimpleBox.__init__, causing parameter misalignment. The SimpleBox parent class has a rootfs_path parameter between image and memory_mib that CodeBox doesn't have, causing all subsequent positional arguments to shift incorrectly (e.g., memory_mib=1024 was being interpreted as rootfs_path=1024, leading to a TypeError).
Changes:
- Changed
CodeBox.__init__to pass keyword arguments tosuper().__init__()instead of positional arguments - This aligns
CodeBoxwith the convention used by all otherSimpleBoxsubclasses in the codebase
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Self-review: This PR looks correct. The bug: The fix switches to keyword arguments, which maps correctly regardless of parameter order. No other callers affected — |
CodeBox.__init__ passed arguments positionally to super().__init__(), but SimpleBox has rootfs_path as the 2nd parameter. This caused memory_mib to map to rootfs_path, cpus to memory_mib, etc. CodeBox(memory_mib=1024) crashed with: TypeError: argument 'rootfs_path': 'int' object cannot be cast as 'str' Fix: pass keyword arguments so parameters map correctly regardless of SimpleBox's parameter order. Closes #228 Co-Authored-By: Claude Opus 4.6 <[email protected]>
449d83f to
c1e54d5
Compare
Summary
CodeBox.__init__passing positional args toSimpleBox.__init__, which hasrootfs_pathas the 2nd parameter — causingmemory_mibto map torootfs_pathTest plan
CodeBox(memory_mib=1024)no longer crashes withTypeErrorCodeBox(cpus=2)correctly sets CPU count instead of silently misassigningCloses #228
🤖 Generated with Claude Code