Bug Description
When commenting inside Huly on issues synced with GitHub, comments are not created on GitHub. The GitHub integration service (github-1 container) logs the following error:
TypeError: okit.rest.issues.createComment is not a function
at CommentSyncManager.createGithubComment (/usr/src/app/bundle.js:294043:47)
GitHub → Huly sync works fine; only Huly → GitHub comment creation is broken.
Root Cause
In services/github/pod-github/src/sync/comments.ts, the createGithubComment and updateComment methods obtain an Octokit instance via:
const okit = (await this.provider.getOctokit(ctx, chatMessage.modifiedBy)) ?? container.container.octokit
The user-scoped Octokit returned by getOctokit() may not have the .rest plugin properly available. This is the same class of bug that was fixed in #10442 for okit.graphql is not a function, where ensureGraphQLOctokit() was introduced as a guard. However, that fix only covered GraphQL calls and missed the two REST API calls (createComment and updateComment) in the same file.
Environment
- Self-hosted v0.7.382 on PostgreSQL
Fix
Apply the same safety pattern used in #10442: add an ensureRESTOctokit() function that validates the .rest plugin is available on the Octokit instance, falling back to the installation Octokit when it's not.
Bug Description
When commenting inside Huly on issues synced with GitHub, comments are not created on GitHub. The GitHub integration service (
github-1container) logs the following error:GitHub → Huly sync works fine; only Huly → GitHub comment creation is broken.
Root Cause
In
services/github/pod-github/src/sync/comments.ts, thecreateGithubCommentandupdateCommentmethods obtain an Octokit instance via:The user-scoped Octokit returned by
getOctokit()may not have the.restplugin properly available. This is the same class of bug that was fixed in #10442 forokit.graphql is not a function, whereensureGraphQLOctokit()was introduced as a guard. However, that fix only covered GraphQL calls and missed the two REST API calls (createCommentandupdateComment) in the same file.Environment
Fix
Apply the same safety pattern used in #10442: add an
ensureRESTOctokit()function that validates the.restplugin is available on the Octokit instance, falling back to the installation Octokit when it's not.