Skip to content

fix: validate effort value before subprocess spawn (#834)#1046

Open
ashishpatel26 wants to merge 2 commits into
anthropics:mainfrom
ashishpatel26:fix/issue-834-effort-validation-v2
Open

fix: validate effort value before subprocess spawn (#834)#1046
ashishpatel26 wants to merge 2 commits into
anthropics:mainfrom
ashishpatel26:fix/issue-834-effort-validation-v2

Conversation

@ashishpatel26

Copy link
Copy Markdown

Summary

Invalid effort strings (e.g. effort="ultra") previously reached the CLI and produced an opaque ProcessError. The valid values (low, medium, high, xhigh, max) were undocumented at the Python layer.

  • Add _VALID_EFFORT_VALUES frozenset constant in subprocess_cli.py
  • Validate effort in _build_command and raise ValueError with the full list of valid values before the subprocess is spawned
  • Add tests for valid values, invalid values, and None

Test plan

  • test_valid_effort_values_accepted
  • test_invalid_effort_raises_value_error
  • test_effort_none_skipped
  • python -m pytest tests/test_transport.py -v

Fixes #834

Invalid effort strings previously caused an opaque ProcessError from
the CLI. Now _build_command raises ValueError with a clear message
listing valid values before the subprocess is ever spawned.

Also ensure ClaudeAgentOptions.effort docstring lists all five valid
values including 'xhigh'.
Invalid effort strings previously caused an opaque ProcessError from
the CLI. Now _build_command raises ValueError with a clear message
listing valid values before the subprocess is ever spawned.
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.

ClaudeAgentOptions.effort typings are outdated, and CLI validation failures are surfaced as opaque ProcessError

1 participant