Skip to content

fix: resolve Windows stdin select crash and CLI string type coercion …#6

Open
Adityakk9031 wants to merge 2 commits into
robocurve:mainfrom
Adityakk9031:#5
Open

fix: resolve Windows stdin select crash and CLI string type coercion …#6
Adityakk9031 wants to merge 2 commits into
robocurve:mainfrom
Adityakk9031:#5

Conversation

@Adityakk9031

@Adityakk9031 Adityakk9031 commented Jul 21, 2026

Copy link
Copy Markdown

Fixes #5

Summary

Fixes runtime ValueError, TypeError, and silent boolean inversion errors when configuration options are passed as string key-value pairs (e.g. from Inspect Robots CLI flags like -P port=8000, -E control_hz=15.0, -E unattended=false).

_FromKwargs.from_kwargs() previously only parsed _FLOAT_TUPLE_FIELDS. Scalar string arguments were passed as raw str objects directly into frozen dataclasses (FrankaConfig and OpenpiConfig), failing type validation inside __post_init__ or evaluating "false" as truthy.

Proposed Changes

  • Type Coercion in _FromKwargs: Enhanced _FromKwargs.from_kwargs() in src/inspect_robots_franka/config.py to inspect dataclass field annotations and parse str inputs into target int, float, and bool types.
  • Boolean Handling: Parsed string booleans ("true", "false", "1", "0"), ensuring "false" correctly resolves to False.
  • Unit Tests: Added test_from_kwargs_parses_string_coercion_types() to tests/test_config.py.

Verification

  • Executed unit tests: python -m pytest -o pythonpath=src --cov=src (102 passed).
  • 100% statement and branch coverage maintained.

@Adityakk9031

Copy link
Copy Markdown
Author

@jeqcho have a look

@jeqcho

jeqcho commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Two things here. First, formatting is the only test failure: uv run ruff format . wants to touch src/inspect_robots_franka/config.py and tests/test_config.py, so run that, commit, push.

Second, the description says this fixes both the Windows stdin crash and the CLI coercion, but the diff only touches config.py and its tests. The stdin fix lives in #4. Could you trim the description to just the coercion work? Keeping each PR scoped to one issue makes both easier to land.

@Adityakk9031

Copy link
Copy Markdown
Author

@jeqcho please review again

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.

_FromKwargs.from_kwargs() fails to convert string arguments to int, float, and bool dataclass types

2 participants