Skip to content

Conversation

@zafstojano
Copy link

Summary

  • Fixed CLI template generating clients with only 2 generic parameters instead of required 3
  • The template now correctly uses EnvClient[ActT, ObsT, State] matching the invariant
  • Added regression test to prevent future breakage

Test plan

  • All CLI tests pass (44/44)
  • Manual verification: openenv init test_env generates correct signature
  • Lint check passes

🤖 Generated with Claude Code

The CLI template was generating clients with only 2 generic parameters
(ActT, ObsT) instead of the required 3 (ActT, ObsT, StateT), violating
the EnvClient invariant. Added State as the third generic and a
regression test to prevent future breakage.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jan 27, 2026
@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Greptile Overview

Greptile Summary

This PR fixes a template bug where the CLI's openenv init command was generating client classes with only 2 generic parameters instead of the required 3, violating the system invariant that all clients must use EnvClient[ActT, ObsT, StateT].

Changes:

  • Fixed client.py template to include State as the third generic parameter
  • Added regression test test_init_client_uses_three_generics to prevent future breakage
  • The fix ensures generated clients match the pattern used by all other environments in the codebase (e.g., WebSearchEnv, MCPClientBase)

Impact:
This bug would have caused type errors for anyone using openenv init to create new environments. The fix restores compliance with the Generic Type Safety invariant documented in INVARIANTS.md.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The fix is straightforward and correct - it adds the missing third generic parameter to match the EnvClient base class signature. The change is validated by a regression test that explicitly checks for the correct signature. No logic changes, no security concerns, and it fixes a clear violation of the documented type safety invariant.
  • No files require special attention

Important Files Changed

Filename Overview
src/openenv/cli/templates/openenv_env/client.py Added missing State generic parameter to fix template client signature, now correctly matches EnvClient[ActT, ObsT, StateT] invariant
tests/test_cli/test_init.py Added regression test to verify generated clients use correct 3-parameter generic signature

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as openenv init
    participant Template as client.py template
    participant Generated as Generated client.py
    
    User->>CLI: openenv init test_env
    CLI->>Template: Read template with placeholders
    Note over Template: EnvClient[__ENV_CLASS_NAME__Action,<br/>__ENV_CLASS_NAME__Observation, State]
    CLI->>CLI: Replace __ENV_CLASS_NAME__<br/>with TestAction, TestObservation
    CLI->>Generated: Write client.py
    Note over Generated: EnvClient[TestAction,<br/>TestObservation, State]
    Generated-->>User: ✓ Correct 3-parameter signature
Loading

@zafstojano
Copy link
Author

zafstojano commented Jan 28, 2026

tagging @burtenshaw @Darktex for visibility :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant