-
Notifications
You must be signed in to change notification settings - Fork 2.3k
fix: guard output.output against undefined in tool.execute.after hooks #1724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
fix: guard output.output against undefined in tool.execute.after hooks #1724
Conversation
|
All contributors have signed the CLA. Thank you! ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 3 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Auto-approved: Minor additions of type checks to prevent errors, no regressions detected, aligns with criteria for safe changes.
|
I have read the CLA Document and I hereby sign the CLA |
|
recheck |
Three hooks crash with TypeError when output.output is undefined for external MCP tool results. Add null/type guards before calling string methods (.toLowerCase(), .startsWith(), .includes()) on output.output. Affected hooks: - comment-checker: output.output.toLowerCase() at line 95 - edit-error-recovery: output.output.toLowerCase() at line 47 - task-resume-info: output.output.startsWith() at line 24 The tool-output-truncator hook already had this guard (typeof check at line 42), so this aligns the other hooks with that pattern. Fixes code-yeongyu#1720
d9b9050 to
290cf3d
Compare
|
I have read the CLA Document and I hereby sign the CLA |
Summary
output.outputin 3 hooks that crash when it'sundefinedTypeError: undefined is not an object (evaluating 'output.output.toLowerCase')for external MCP toolsProblem
Three
tool.execute.afterhooks call string methods onoutput.outputwithout checking if it's defined:comment-checker/hook.tsoutput.output.toLowerCase()(line 95)edit-error-recovery/hook.tsoutput.output.toLowerCase()(line 47)task-resume-info/hook.tsoutput.output.startsWith()(line 24)When OpenCode passes
undefinedforoutput.output(observed with external MCP tools), all three crash withTypeError.Fix
Added
if (!output.output || typeof output.output !== "string") returnguard before accessingoutput.outputmethods. This matches the existing pattern intool-output-truncator.ts(line 42) which already had this guard.Context
output.outputfor themSummary by cubic
Guard output.output against undefined in tool.execute.after hooks to prevent crashes with external MCP tools. Fixes #1720.
Written for commit 290cf3d. Summary will update on new commits.