- Notifications
You must be signed in to change notification settings - Fork1k
Commitd159578
authored
fix: fix nil pointer dereference in ReportTask (#19045)
This pull request addresses a bug related to a nil pointer dereferencein the task reporting functionality.### Bug Fixes and Error Handling:* Updated `RegisterTools` in `mcp.go` to skip registering the`ReportTask` tool in the remote MCP context when a task reporter is notconfigured, preventing potential nil pointer dereference panics.* Added a check in `toolsdk.go` to ensure task reporting dependenciesare available before invoking the reporter, returning an appropriateerror if not.### Test Coverage:* Added `TestReportTaskNilPointerDeref` in `toolsdk_test.go` to verifythat the system does not panic when task reporting dependencies aremissing and instead returns a clear error message.* Added `TestReportTaskWithReporter` in `toolsdk_test.go` to validatecorrect behavior when a task reporter is configured, ensuring thehandler processes the request as expected.Signed-off-by: Thomas Kosiewski <tk@coder.com>1 parent6bf2ec3 commitd159578
3 files changed
+64
-2
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
79 | 79 |
| |
80 | 80 |
| |
81 | 81 |
| |
82 |
| - | |
| 82 | + | |
| 83 | + | |
83 | 84 |
| |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
84 | 89 |
| |
85 | 90 |
| |
86 |
| - | |
87 | 91 |
| |
88 | 92 |
| |
89 | 93 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
253 | 253 |
| |
254 | 254 |
| |
255 | 255 |
| |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
256 | 260 |
| |
257 | 261 |
| |
258 | 262 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
686 | 686 |
| |
687 | 687 |
| |
688 | 688 |
| |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + |
0 commit comments
Comments
(0)