mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
d1595781e1
This pull request addresses a bug related to a nil pointer dereference in 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 not configured, preventing potential nil pointer dereference panics. * Added a check in `toolsdk.go` to ensure task reporting dependencies are available before invoking the reporter, returning an appropriate error if not. ### Test Coverage: * Added `TestReportTaskNilPointerDeref` in `toolsdk_test.go` to verify that the system does not panic when task reporting dependencies are missing and instead returns a clear error message. * Added `TestReportTaskWithReporter` in `toolsdk_test.go` to validate correct behavior when a task reporter is configured, ensuring the handler processes the request as expected. Signed-off-by: Thomas Kosiewski <tk@coder.com>