fix: add ValueError guard for timeout in _build_opencode_plugin - #3973
Open
Quratulain-bilal wants to merge 3 commits into
Open
Quratulain-bilal wants to merge 3 commits into
Quratulain-bilal wants to merge 3 commits into
Conversation
int(cfg.get('timeout', 60)) would crash on non-numeric user-provided
timeout values. Two other call sites in the same file already handle
this with try/except (TypeError, ValueError). This makes the third
call site consistent.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds defensive timeout parsing for OpenCode event plugins.
Changes:
- Falls back to 60 seconds when timeout conversion raises
TypeErrororValueError.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/events.py |
Guards OpenCode timeout conversion. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Balanced
…plugin Verify that a non-numeric timeout value (e.g. 'not-a-number') does not crash with TypeError/ValueError and falls back to the default 60s.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The regression test must assert the complete generated runEvent call uses the 60-second fallback.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Balanced
| plugin_path = tmp_path / ".opencode/plugin/speckit-events.ts" | ||
| assert plugin_path.is_file() | ||
| content = plugin_path.read_text() | ||
| assert "speckit.tdd.validate" in content |
mnriem
requested changes
Sep 17, 2026
mnriem
left a comment
Collaborator
There was a problem hiding this comment.
Please address Copilot feedback
…d test Addresses Copilot feedback: the regression test now verifies the exact runEvent() call uses the 60-second default, not just that the handler name is present. Assisted-by: GitHub Copilot (autonomous)
Contributor
Author
|
Hi @mnriem — I've addressed Copilot's feedback: the regression test now asserts the complete |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
int(cfg.get('timeout', 60)) crashes with an unhandled ValueError when a user provides a non-numeric timeout value in event configuration. Two other call sites in the same file already handle this gracefully with ry/except (TypeError, ValueError).
Fix
Added the same ry/except guard, making the third call site consistent.