Make postprocessed_action a genuinely optional step-output field - #1
Make postprocessed_action a genuinely optional step-output field#1eeshsaxena wants to merge 1 commit into
Conversation
BaseTextEnvStepOutput declared postprocessed_action as 'Optional[str] = None', but a default value on a TypedDict field is a no-op: the key stayed in __required_keys__. Every step() implementation omits it (for example the gsm8k env returns only observations/reward/done/metadata), so the declared type did not match how the output is actually built. Move the always-present fields into a required base and mark postprocessed_action optional via a total=False subclass, keeping the class name and stdlib-only typing (skyrl-gym targets Python 3.10, before typing.NotRequired). Add a test asserting the required/optional split.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe step output TypedDict now separates required fields from the optional ChangesText environment output contract
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi! Gentle nudge on this one whenever you have some bandwidth. It's a small, self-contained fix ( |
BaseTextEnvStepOutputdeclarespostprocessed_actionasOptional[str] = None, but a default value on aTypedDictfield is a no-op, so the key stays required:Every
step()implementation omits it, e.g. the gsm8k env returnsBaseTextEnvStepOutput(observations=[], reward=reward, done=done, metadata={}), so the declared type doesn't match how the output is actually constructed and a type checker flags each of those returns for a missing key.I moved the always-present fields into a required base and marked
postprocessed_actionoptional via atotal=Falsesubclass. This keeps the public class name and uses only stdlib typing (skyrl-gym targets Python 3.10, beforetyping.NotRequired). After the change the four core fields stay required andpostprocessed_actionis optional.Added
tests/test_base_text_env.pyasserting the required/optional split; it fails onmainand passes here.Summary by CodeRabbit
Bug Fixes
postprocessed_actionis optional when not provided.Tests
postprocessed_action.