fix: pop opencode kwargs before passing to parent class#9
Conversation
Moved extraction of 'opencode_provider' and 'opencode_model' from kwargs to before the parent class initialization, using pop to avoid passing them to BaseEngineer. This ensures only relevant arguments are sent to the parent and clarifies initialization logic.
There was a problem hiding this comment.
Additional Comments (1)
-
src/reverse_api/opencode_engineer.py, line 50 (link)style: After popping opencode_provider and opencode_model from kwargs, using kwargs.get('verbose', True) still works but could be inconsistent. Consider also popping 'verbose' if it's meant to be consumed here.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
1 file reviewed, 1 comment
|
@puru2901is thank you! congrats on getting 5/ 5 (the first pr getting this score on the repo haha)! |
@kalil0321 Thanks! Happy to contribute 🙌 Great project btw. I had fun debugging it while learning how it works! |
…-version Knocks out items #3, #4, #9 of the agent-friendliness backlog (#62). Schema version stays at 1 since the contract has not shipped to prod — fields are added in place rather than bumping versions. Item #3 — Stable `usage` subset Different SDKs (Claude / OpenCode / Copilot) emit different keys for the same concepts (cache_creation_input_tokens vs cache_write_tokens, estimated_cost_usd vs total_cost vs total_cost_usd, etc). New helper `_normalize_usage()` maps SDK-native keys into a stable subset {input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, total_cost_usd} and parks the SDK-native dict under `usage.raw` for power users. Wrappers can rely on the top-level keys without breaking when the user switches SDK. Item #4 — Machine-readable `error_kind` Previously agents had to pattern-match on prose like "[Errno 13] Permission denied: '/x'" to decide whether to retry / abort / surface to the user. New `error_kind` field on every `agent --json` and `engineer --json` payload, with a fixed enum: misuse | config_invalid | permission_denied | network | engine_failure | interrupted | unknown Inferred via `_classify_error()` which uses isinstance checks on exceptions (KeyboardInterrupt, PermissionError, ConnectionError, TimeoutError) and substring fallback on plain messages. Misuse paths now pass `error_kind_hint="misuse"` explicitly. Item #9 — `--json-schema-version` Top-level `reverse-api-engineer --json-schema-version` prints the schema version (currently `1`) and exits 0. Lets a wrapper query the contract version without having to invoke a real run. Bonus: KeyboardInterrupt now formats as the literal "interrupted" in the `error` field (str(KeyboardInterrupt()) is empty); empty exception messages fall back to the class name. Tests: 9 new tests in test_cli_followups.py (TestSchemaV2Normalization, TestJsonSchemaVersionFlag) + updated existing tests to assert on the normalized usage shape and the new error_kind field. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…-version Knocks out items #3, #4, #9 of the agent-friendliness backlog (#62). Schema version stays at 1 since the contract has not shipped to prod — fields are added in place rather than bumping versions. Item #3 — Stable `usage` subset Different SDKs (Claude / OpenCode / Copilot) emit different keys for the same concepts (cache_creation_input_tokens vs cache_write_tokens, estimated_cost_usd vs total_cost vs total_cost_usd, etc). New helper `_normalize_usage()` maps SDK-native keys into a stable subset {input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, total_cost_usd} and parks the SDK-native dict under `usage.raw` for power users. Wrappers can rely on the top-level keys without breaking when the user switches SDK. Item #4 — Machine-readable `error_kind` Previously agents had to pattern-match on prose like "[Errno 13] Permission denied: '/x'" to decide whether to retry / abort / surface to the user. New `error_kind` field on every `agent --json` and `engineer --json` payload, with a fixed enum: misuse | config_invalid | permission_denied | network | engine_failure | interrupted | unknown Inferred via `_classify_error()` which uses isinstance checks on exceptions (KeyboardInterrupt, PermissionError, ConnectionError, TimeoutError) and substring fallback on plain messages. Misuse paths now pass `error_kind_hint="misuse"` explicitly. Item #9 — `--json-schema-version` Top-level `reverse-api-engineer --json-schema-version` prints the schema version (currently `1`) and exits 0. Lets a wrapper query the contract version without having to invoke a real run. Bonus: KeyboardInterrupt now formats as the literal "interrupted" in the `error` field (str(KeyboardInterrupt()) is empty); empty exception messages fall back to the class name. Tests: 9 new tests in test_cli_followups.py (TestSchemaV2Normalization, TestJsonSchemaVersionFlag) + updated existing tests to assert on the normalized usage shape and the new error_kind field. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
OpenCodeEngineer.init() was passing opencode_provider and opencode_model to BaseEngineer.init(), which doesn't accept them. This caused a TypeError when using the opencode SDK. Fixed by using pop() to extract these kwargs before calling super().
Moved extraction of 'opencode_provider' and 'opencode_model' from kwargs to before the parent class initialization, using pop to avoid passing them to BaseEngineer. This ensures only relevant arguments are sent to the parent and clarifies initialization logic.
Greptile Summary
OpenCodeEngineerconstructor to usekwargs.pop()for extracting OpenCode-specific parameters before parent class initializationopencode_providerandopencode_modelto prevent them from being passed toBaseEngineerImportant Files Changed
Confidence score: 5/5