Restrict YouTrack "started working" comment to jetbrains-team - #177
Restrict YouTrack "started working" comment to jetbrains-team#177Sergey Pak (paksv) wants to merge 1 commit into
Conversation
The automated 'Hey, it's Junie by JetBrains! I started working...' comment posted to YouTrack issues was publicly visible to everyone, leaking internal status updates. It is now restricted to the jetbrains-team group only, using YouTrack's LimitedVisibility with a hardcoded group id (dynamic name->id lookup never resolves this group, per JetBrains/junie-agent#7105). Co-authored-by: Junie <junie@jetbrains.com>
|
Junie successfully finished! Restrict YouTrack Comments Visibility to JetBrains Team Summary of ChangesThis change introduces the ability to restrict YouTrack comment visibility to specific groups. It applies this restriction to the initial execution comment in the Junie workflow, limiting its visibility to the "jetbrains-team" group. Key AreasYouTrack Client Visibility Support
Junie Execution Initialization
Comments📝 Suggestions are shown in the inline comments below. The changes successfully introduce YouTrack comment visibility restrictions to prevent internal status leaks. I've suggested a critical improvement to Help us improve Junie code review (EAP): Share feedback |
| async addComment(issueId: string, text: string, restrictToJetBrainsTeam = false): Promise<string | null> { | ||
| try { | ||
| console.log(`Adding comment to YouTrack issue ${issueId}`); | ||
|
|
||
| const url = `${this.baseUrl}/api/issues/${issueId}/comments?fields=id`; | ||
| const body: Record<string, unknown> = { text }; | ||
| if (restrictToJetBrainsTeam) { | ||
| body.visibility = { | ||
| '$type': 'LimitedVisibility', | ||
| permittedGroups: [{ id: JETBRAINS_TEAM_GROUP_ID }], | ||
| }; | ||
| } |
There was a problem hiding this comment.
Consider also updating updateComment to handle restrictToJetBrainsTeam. Since Junie updates the initial "working" comment with final results, and that initial comment is now restricted, the update must explicitly clear the visibility (e.g., by setting visibility: null) to remain visible to the reporter.
Summary
The automated "Hey, it's Junie by JetBrains! I started working..." comment posted to YouTrack issues was publicly visible to everyone, leaking internal status updates (see JUNIE-3685). It is now restricted to the
jetbrains-teamgroup only.Changes
src/github/youtrack/client.ts:YouTrackClient.addCommentnow accepts an optionalrestrictToJetBrainsTeamflag. When set, it attaches YouTrack'sLimitedVisibilitypayload restricting the comment to thejetbrains-teamgroup (permittedGroups: [{id: "10-3"}]). The group id is hardcoded because, per the referenced upstream fix injunie-agent, the dynamic name→id lookup via/api/groupsnever resolves this group and silently falls back to public visibility.src/github/junie/prepare-junie.ts: the "started working" comment posted for YouTrack-triggered workflows now passestruefor this flag. The final success/failure feedback comment remains visible to the reporter as before.Verification
bun run typecheckpasses with no errors.bun test test/*.test.ts): 251/251 tests pass.test/integration/youtrack_integration.test.tssuite requires real YouTrack/GitHub credentials and was not run locally; it should be validated in CI to confirm the token belongs tojetbrains-teamso it can still locate the restricted comment.