@sentry/junior-github 0.262.0 → 0.264.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,7 @@ var GITHUB_DEPLOYMENT_MATCH_FIELDS = eventMatchFieldsSchema.parse({
35
35
  });
36
36
  var GITHUB_DEPLOYMENT_SOURCE_IDENTIFIER = {
37
37
  format: "deployment-source:owner/repo[:environment]:<full-commit-sha>",
38
- pattern: /^deployment-source:[^\s/:#]+\/[^\s/:#]+(?::[^\s:]+)?:[0-9a-f]+$/
38
+ pattern: String.raw`^deployment-source:[^\s/:#]+\/[^\s/:#]+(?::[^\s:]+)?:[0-9a-f]+$`
39
39
  };
40
40
  function gitHubDeploymentSourceResource(input) {
41
41
  const commitSha = input.commitSha.toLowerCase();
@@ -88,7 +88,7 @@ var GITHUB_ISSUE_COMMENT_MATCH_FIELDS = eventMatchFieldsSchema2.parse({
88
88
  });
89
89
  var GITHUB_ISSUE_IDENTIFIER = {
90
90
  format: "owner/repo#number",
91
- pattern: /^[^\s/:#]+\/[^\s/:#]+#\d+$/
91
+ pattern: String.raw`^[^\s/:#]+\/[^\s/:#]+#\d+$`
92
92
  };
93
93
  function gitHubIssueResource(input) {
94
94
  return {
@@ -186,7 +186,7 @@ var GITHUB_PULL_REQUEST_MATCH_FIELDS = eventMatchFieldsSchema3.parse({
186
186
  });
187
187
  var GITHUB_PULL_REQUEST_IDENTIFIER = {
188
188
  format: "owner/repo#number",
189
- pattern: /^[^\s/:#]+\/[^\s/:#]+#\d+$/
189
+ pattern: String.raw`^[^\s/:#]+\/[^\s/:#]+#\d+$`
190
190
  };
191
191
  function gitHubPullRequestResource(input) {
192
192
  return {
@@ -214,7 +214,7 @@ var GITHUB_RELEASE_EVENTS = ["release.published"];
214
214
  var GITHUB_RELEASE_SUGGESTED_EVENTS = ["release.published"];
215
215
  var GITHUB_RELEASE_SOURCE_IDENTIFIER = {
216
216
  format: "release-source:owner/repo[:tag]",
217
- pattern: /^release-source:[^\s/:#]+\/[^\s/:#]+(?::[^\s:]+)?$/
217
+ pattern: String.raw`^release-source:[^\s/:#]+\/[^\s/:#]+(?::[^\s:]+)?$`
218
218
  };
219
219
  function gitHubReleaseSourceResource(input) {
220
220
  const repo = input.repo.toLowerCase();
@@ -238,7 +238,7 @@ function gitHubReleaseSourceSubscribable(input) {
238
238
  // src/events/repository.ts
239
239
  var GITHUB_REPOSITORY_IDENTIFIER = {
240
240
  format: "owner/repo",
241
- pattern: /^[^\s/:#]+\/[^\s/:#]+$/
241
+ pattern: String.raw`^[^\s/:#]+\/[^\s/:#]+$`
242
242
  };
243
243
  function gitHubRepositoryResource(input) {
244
244
  return {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Return a denial message when a bash command clones a GitHub repository
2
+ * Return a redirect message when a bash command clones a GitHub repository
3
3
  * without `github_cloneRepository`. Return undefined for other commands.
4
4
  */
5
- export declare function githubCloneCommandDenial(command: string): string | undefined;
5
+ export declare function githubCloneCommandRedirect(command: string): string | undefined;
@@ -6,6 +6,12 @@
6
6
  */
7
7
  import { type EgressHookContext, type EgressResponseHookContext } from "@sentry/junior-plugin-api";
8
8
  import { type GitHubGrant } from "./credential-support.js";
9
- export declare function githubGraphqlPermissionDeniedMessage(bodyText: string): string | undefined;
10
- export declare function shouldInspectGitHubGraphqlResponse(ctx: EgressResponseHookContext): boolean;
9
+ /**
10
+ * Classify a GitHub response as a permission denial.
11
+ *
12
+ * Returns a message only when GitHub says that the credential lacks access.
13
+ * Other GitHub refusals return undefined, so the runtime does not call them
14
+ * permission problems.
15
+ */
16
+ export declare function githubPermissionDeniedMessage(ctx: EgressResponseHookContext): Promise<string | undefined>;
11
17
  export declare function githubGrantForEgress(ctx: EgressHookContext): Promise<GitHubGrant>;
@@ -10,7 +10,7 @@ export declare const GITHUB_DEPLOYMENT_MATCH_FIELDS: Record<string, {
10
10
  /** The identifier shape that `gitHubDeploymentSourceResource` builds. */
11
11
  export declare const GITHUB_DEPLOYMENT_SOURCE_IDENTIFIER: {
12
12
  format: string;
13
- pattern: RegExp;
13
+ pattern: string;
14
14
  };
15
15
  /** Build the stable deployment-source identity shared by tools and webhooks. */
16
16
  export declare function gitHubDeploymentSourceResource(input: {
@@ -13,7 +13,7 @@ export declare const GITHUB_ISSUE_COMMENT_MATCH_FIELDS: Record<string, {
13
13
  /** The identifier shape that `gitHubIssueResource` builds. */
14
14
  export declare const GITHUB_ISSUE_IDENTIFIER: {
15
15
  format: string;
16
- pattern: RegExp;
16
+ pattern: string;
17
17
  };
18
18
  /** Build the stable issue identity shared by tools and webhooks. */
19
19
  export declare function gitHubIssueResource(input: {
@@ -31,7 +31,7 @@ export declare const GITHUB_PULL_REQUEST_MATCH_FIELDS: Record<string, {
31
31
  /** The identifier shape that `gitHubPullRequestResource` builds. */
32
32
  export declare const GITHUB_PULL_REQUEST_IDENTIFIER: {
33
33
  format: string;
34
- pattern: RegExp;
34
+ pattern: string;
35
35
  };
36
36
  /** Build the stable pull request identity shared by tools and webhooks. */
37
37
  export declare function gitHubPullRequestResource(input: {
@@ -4,7 +4,7 @@ export declare const GITHUB_RELEASE_SUGGESTED_EVENTS: string[];
4
4
  /** The identifier shape that `gitHubReleaseSourceResource` builds. */
5
5
  export declare const GITHUB_RELEASE_SOURCE_IDENTIFIER: {
6
6
  format: string;
7
- pattern: RegExp;
7
+ pattern: string;
8
8
  };
9
9
  /** Build the stable release-source identity shared by tools and webhooks. */
10
10
  export declare function gitHubReleaseSourceResource(input: {
@@ -2,7 +2,7 @@ import type { SubscribableResource } from "@sentry/junior-plugin-api";
2
2
  /** The identifier shape that `gitHubRepositoryResource` builds. */
3
3
  export declare const GITHUB_REPOSITORY_IDENTIFIER: {
4
4
  format: string;
5
- pattern: RegExp;
5
+ pattern: string;
6
6
  };
7
7
  /** Build the stable repository identity shared by tools and webhooks. */
8
8
  export declare function gitHubRepositoryResource(input: {
package/dist/index.js CHANGED
@@ -51,7 +51,7 @@ import {
51
51
  readGrantPermissions,
52
52
  requireEnv,
53
53
  resolveUserAccount
54
- } from "./chunk-VEN7LFRI.js";
54
+ } from "./chunk-KWVC6CU5.js";
55
55
 
56
56
  // src/plugin.ts
57
57
  import {
@@ -4708,10 +4708,10 @@ async function prepareWorkspace(ctx) {
4708
4708
 
4709
4709
  // src/clone-command.ts
4710
4710
  import { parseShellCommands } from "@sentry/junior-plugin-api";
4711
- var CLONE_DENIAL_MESSAGE = "Use github_cloneRepository to clone GitHub repositories, not git clone or gh repo clone. It checks for a matching Workspace first.";
4711
+ var CLONE_REDIRECT_MESSAGE = "Use github_cloneRepository to clone GitHub repositories, not git clone or gh repo clone. It checks for a matching Workspace first.";
4712
4712
  var GIT_OPTIONS_WITH_VALUE = /* @__PURE__ */ new Set(["-C", "-c"]);
4713
- function githubCloneCommandDenial(command) {
4714
- return parseShellCommands(command).some(isGitHubClone) ? CLONE_DENIAL_MESSAGE : void 0;
4713
+ function githubCloneCommandRedirect(command) {
4714
+ return parseShellCommands(command).some(isGitHubClone) ? CLONE_REDIRECT_MESSAGE : void 0;
4715
4715
  }
4716
4716
  function isGitHubClone([program, ...args]) {
4717
4717
  if (program === "gh") {
@@ -4950,6 +4950,50 @@ function shouldInspectGitHubGraphqlResponse(ctx) {
4950
4950
  const contentType = ctx.response.headers.get("content-type");
4951
4951
  return contentType ? /\bjson\b/i.test(contentType) : false;
4952
4952
  }
4953
+ var GITHUB_ERROR_BODY_LIMIT_BYTES = 4 * 1024;
4954
+ var GITHUB_ACCESS_DENIED_MESSAGE = "Resource not accessible by integration";
4955
+ var GITHUB_ACCEPTED_PERMISSIONS_PATTERN = /^[a-z_]+=[a-z]+(?:\s*[,;]\s*[a-z_]+=[a-z]+)*$/;
4956
+ function githubErrorMessage(bodyText) {
4957
+ if (!bodyText) {
4958
+ return void 0;
4959
+ }
4960
+ try {
4961
+ const parsed = JSON.parse(bodyText);
4962
+ return isRecord(parsed) && typeof parsed.message === "string" ? parsed.message.trim() : void 0;
4963
+ } catch {
4964
+ return void 0;
4965
+ }
4966
+ }
4967
+ async function githubForbiddenPermissionDeniedMessage(ctx) {
4968
+ const sso = ctx.response.headers.get("x-github-sso");
4969
+ if (sso?.startsWith("required")) {
4970
+ const url = sso.match(/\burl=(https:\/\/github\.com\/\S+)/)?.[1];
4971
+ return `GitHub requires SAML SSO authorization for this credential.${url ? ` Authorize it at ${url}` : ""}`;
4972
+ }
4973
+ const message = githubErrorMessage(
4974
+ await ctx.response.readText(GITHUB_ERROR_BODY_LIMIT_BYTES)
4975
+ );
4976
+ if (message !== GITHUB_ACCESS_DENIED_MESSAGE) {
4977
+ return void 0;
4978
+ }
4979
+ const accepted = ctx.response.headers.get("x-accepted-github-permissions")?.trim();
4980
+ return [
4981
+ `GitHub denied access: ${message}.`,
4982
+ ...accepted && GITHUB_ACCEPTED_PERMISSIONS_PATTERN.test(accepted) ? [`This endpoint accepts these GitHub permissions: ${accepted}.`] : []
4983
+ ].join(" ");
4984
+ }
4985
+ async function githubPermissionDeniedMessage(ctx) {
4986
+ if (ctx.response.status === 403) {
4987
+ return await githubForbiddenPermissionDeniedMessage(ctx);
4988
+ }
4989
+ if (!shouldInspectGitHubGraphqlResponse(ctx)) {
4990
+ return void 0;
4991
+ }
4992
+ const bodyText = await ctx.response.readText(
4993
+ GITHUB_GRAPHQL_RESPONSE_BODY_LIMIT_BYTES
4994
+ );
4995
+ return bodyText ? githubGraphqlPermissionDeniedMessage(bodyText) : void 0;
4996
+ }
4953
4997
  var PULL_REQUEST_COMMENT_REACTIONS_PATH = /^\/repos\/[^/]+\/[^/]+\/(issues|pulls)\/comments\/[^/]+\/reactions(?:\/[^/]+)?$/;
4954
4998
  var GITHUB_BODY_WRITES = [
4955
4999
  {
@@ -5467,9 +5511,9 @@ function githubPlugin(options = {}) {
5467
5511
  if (ctx.tool.name !== "bash") {
5468
5512
  return;
5469
5513
  }
5470
- const cloneDenial = typeof ctx.tool.input.command === "string" ? githubCloneCommandDenial(ctx.tool.input.command) : void 0;
5471
- if (cloneDenial) {
5472
- ctx.decision.deny(cloneDenial);
5514
+ const cloneRedirect = typeof ctx.tool.input.command === "string" ? githubCloneCommandRedirect(ctx.tool.input.command) : void 0;
5515
+ if (cloneRedirect) {
5516
+ ctx.decision.redirect(cloneRedirect);
5473
5517
  return;
5474
5518
  }
5475
5519
  const botName = requireEnv(botNameEnv);
@@ -5502,16 +5546,13 @@ function githubPlugin(options = {}) {
5502
5546
  return githubGrantForEgress(ctx);
5503
5547
  },
5504
5548
  async onEgressResponse(ctx) {
5505
- if (!shouldInspectGitHubGraphqlResponse(ctx)) {
5506
- return;
5507
- }
5508
- const bodyText = await ctx.response.readText(
5509
- GITHUB_GRAPHQL_RESPONSE_BODY_LIMIT_BYTES
5510
- );
5511
- if (!bodyText) {
5512
- return;
5549
+ if (ctx.response.status === 403) {
5550
+ ctx.log.warn("github.egress.upstream_forbidden", {
5551
+ "app.github.accepted_permissions": ctx.response.headers.get("x-accepted-github-permissions") ?? void 0,
5552
+ "app.github.sso": ctx.response.headers.get("x-github-sso") ?? void 0
5553
+ });
5513
5554
  }
5514
- const message = githubGraphqlPermissionDeniedMessage(bodyText);
5555
+ const message = await githubPermissionDeniedMessage(ctx);
5515
5556
  if (message) {
5516
5557
  ctx.permissionDenied(message);
5517
5558
  }
package/dist/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeGitHubEvents
3
- } from "./chunk-VEN7LFRI.js";
3
+ } from "./chunk-KWVC6CU5.js";
4
4
  export {
5
5
  normalizeGitHubEvents
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-github",
3
- "version": "0.262.0",
3
+ "version": "0.264.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -32,7 +32,7 @@
32
32
  "drizzle-orm": "^0.45.2",
33
33
  "marked": "^18.1.2",
34
34
  "zod": "^4.5.4",
35
- "@sentry/junior-plugin-api": "0.262.0"
35
+ "@sentry/junior-plugin-api": "0.264.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@oxlint/plugins": "1.79.0",
@@ -35,7 +35,8 @@ Use `git` and `gh` for repository work.
35
35
  - Push before `github_createPullRequest`. Never ask for a token for bot pushes.
36
36
  - When an error names a tool, use it. Change permissions only when GitHub rejected the request.
37
37
  - Stop for an unclear target, missing access, destructive work, or a GitHub permission failure.
38
- - Unless the user opts out, push completed work and open a PR. Open it ready for review when the work is complete and the checks pass. Open a draft only when work, checks, or decisions remain.
38
+ - Code changes always end in a pushed branch and a PR. Do not ask whether to open one. Skip it only when the user opts out or asks for investigation only.
39
+ - Open the PR ready for review when the work is complete and the checks pass. Open a draft when work, checks, or decisions remain. A scope or follow-up question is not a reason to stop: open the PR, and name the question in the PR body and the report.
39
40
  - Report repo, branch, PR, checks, and skipped checks.
40
41
 
41
42
  Do not install or repair the GitHub plugin from this skill.
@@ -10,7 +10,8 @@ Guide evidence-first GitHub repository work from inspection through a reviewable
10
10
  - Preserve unrelated work; reject destructive Git operations except `--force-with-lease` pushes to branches Junior pushed or the requester named.
11
11
  - Treat shallow clones as inspection checkouts; deepen before history work; never force-push around missing ancestry.
12
12
  - Install dependencies with the lockfile frozen mode before verification when needed.
13
- - Finish completed edits with a pushed PR unless the user opts out; default draft.
13
+ - Finish every code change with a pushed PR, without asking, unless the user opts out or asked for investigation only. Open it ready when work and checks are done; open a draft when work, checks, or decisions remain. An open scope question goes in the PR body, not in a stop.
14
+ - After each push to a branch with an open PR, check mergeability. Resolve conflicts without asking, by merging the PR base branch (usually the default branch). Never rebase for this. GitHub sends no event for a new conflict, and conflicted PRs get no new checks.
14
15
  - Write conventional PR titles and short plain-English bodies; keep check results out of the PR body.
15
16
  - Report exact validation and permission failures.
16
17
 
@@ -34,7 +35,7 @@ Should not trigger for issue-only ops, non-GitHub ticketing, product telemetry,
34
35
  1. Run the repository skill validator.
35
36
  2. Confirm all referenced files exist.
36
37
  3. Confirm `SKILL.md` stays a router (workflow detail lives in references).
37
- 4. Confirm code-edit completion defaults to a draft PR.
38
+ 4. Confirm code-edit completion always opens a PR, and an open scope question does not stop it.
38
39
 
39
40
  ## Maintenance
40
41
 
@@ -45,6 +45,7 @@ If the user omits `owner/repo`, run `jr-rpc config get github.repo`. Then pass `
45
45
  | Resolve review thread | `github_resolvePullRequestReviewThread` |
46
46
  | Inline review comment | `gh api repos/owner/repo/pulls/NUMBER/comments --method POST --input comment.json` |
47
47
  | View PR / checks | `gh pr view NUMBER --repo owner/repo` / `gh pr checks NUMBER --repo owner/repo` |
48
+ | PR mergeability | `gh pr view NUMBER --repo owner/repo --json mergeable,baseRefName` |
48
49
  | Diff PR | `gh pr diff NUMBER --repo owner/repo` |
49
50
  | List runs | `gh run list -R owner/repo --workflow WORKFLOW` |
50
51
  | View / watch run | `gh run view RUN_ID -R owner/repo` / `gh run watch RUN_ID -R owner/repo --exit-status` |
@@ -7,7 +7,7 @@
7
7
  | GraphQL cannot find the repository | Check `owner/repo` and the GitHub App installation. |
8
8
  | `junior-auth-required` with `user-write` | Follow the private OAuth prompt. Never ask for a pasted token. |
9
9
  | `git push` returns 401 or 403 | Check the remote and repository. Retry once, then report the installation access failure. |
10
- | `permission_denied` has `source: "upstream"` | GitHub rejected the request. Report the grant, account, or SSO details. |
10
+ | `permission_denied` has `source: "upstream"` | Read GitHub's error. Report an access problem only if it says access denied or SSO. |
11
11
  | Other 403 response | Read the error and use the tool it names. |
12
12
  | `gh auth status` shows no token scopes | This is normal for GitHub App user tokens. Check App permissions instead. |
13
13
  | `github_createPullRequest` returns 401 or 403 | Report the installation access failure. Do not use user OAuth. |
@@ -27,5 +27,5 @@
27
27
  - Retry a transport failure once after you check the repository.
28
28
  - Do not repeat 401, 403, 404, or validation failures.
29
29
  - A `user-read` or `user-write` failure needs private App OAuth.
30
- - An `installation-*` failure needs an App permission or installation fix.
30
+ - An `installation-*` access denial needs an App permission or installation fix.
31
31
  - Use structured `permission_denied` details when present.
@@ -34,6 +34,11 @@ Open this when making repository edits, not for read-only inspection.
34
34
  1. Reuse the current non-default branch or create a focused branch.
35
35
  2. Commit with repo conventions, else `<type>(<scope>): <Subject>` imperative present, no agent branding.
36
36
  3. Push with `git push -u origin BRANCH`.
37
+ If the branch has an open PR, check that it can merge. Do this after every push, including fixes for review feedback or failed checks. A conflicted PR gets no new checks, so no event shows it.
38
+ - Run `gh pr view NUMBER --repo owner/repo --json mergeable,baseRefName`.
39
+ - `UNKNOWN`: GitHub is still calculating it. Wait about 5 seconds and check again, up to 3 times. If it stays `UNKNOWN`, report that and continue.
40
+ - `CONFLICTING`: resolve it now. Do not ask first. GitHub checks mergeability against the PR base (`baseRefName`), which is usually the default branch. Fetch the base and merge `origin/BASE` into the PR branch. Do not rebase. Resolve each conflict so that both the PR change and the base branch change stay intact. Run the checks again, push, and check mergeability again.
41
+ - In the report, name the files that had conflicts and say how you resolved them.
37
42
  4. Resolve the actual default branch.
38
43
  5. Update an existing PR for the branch with `github_updatePullRequest`, or create with `github_createPullRequest` (`draft: true` only when work, checks, or decisions remain; otherwise ready for review).
39
44
  6. PR title matches the current dominant change, same conventional form as commits.
@@ -2,19 +2,19 @@
2
2
 
3
3
  Use this table to recover quickly while keeping operations deterministic.
4
4
 
5
- | Symptom | Likely cause | Fix |
6
- | ---------------------------------------------------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
7
- | `unknown command "issue"` from `gh` | CLI version too old or wrong binary in the plugin runtime. | Verify `gh --version`; if it is unavailable or too old, report that the GitHub plugin runtime dependency is not available. |
8
- | `Missing required option --repo` | Repo not passed and no default was resolved. | Resolve with `jr-rpc config get github.repo`; pass `--repo owner/repo` explicitly when missing. |
9
- | Command affects or authenticates against the wrong repo | Stale `github.repo` default or authenticated command missing explicit repo. | Pass `--repo owner/repo` for the target repository, or update `github.repo` before retrying. |
10
- | `GraphQL: Could not resolve to a Repository` | Repo slug is wrong or inaccessible. | Validate `owner/repo` and confirm app installation on target repository. |
11
- | 401 Unauthorized | Issued GitHub credentials were rejected upstream. | Verify the target repo, then use the grant/auth signal to distinguish stale user OAuth from app installation or host env setup. |
12
- | `junior-auth-required provider=github grant=user-write` | User-to-server OAuth is missing or stale for a human-identity operation. | Follow the private OAuth prompt; do not ask the user to paste or manage tokens manually. |
13
- | 403 without `permission_denied` where `source: "upstream"` | The runtime may have rejected an unsupported route before contacting GitHub. | Read the response body. Follow any required-tool instruction; do not ask for GitHub permissions unless the failure is confirmed upstream. |
14
- | `permission_denied` with `source: "upstream"` | GitHub rejected the injected installation credential. | Verify the target, accepted permissions, and App installation scope; do not request user OAuth for a bot-owned issue operation. |
15
- | 404 Not Found | Issue number or repo is wrong. | Validate repo + issue ID with `gh issue view NUMBER --repo owner/repo`. |
16
- | Issue label mutation fails | Wrong REST payload or wrong repo context. | Use the allowlisted issue labels endpoint with an explicit `owner/repo` path and valid JSON input. |
17
- | Comment command fails with empty body | JSON input is missing a non-empty `body`. | Ensure the REST comment payload contains a non-empty `body` before retrying. |
5
+ | Symptom | Likely cause | Fix |
6
+ | ---------------------------------------------------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7
+ | `unknown command "issue"` from `gh` | CLI version too old or wrong binary in the plugin runtime. | Verify `gh --version`; if it is unavailable or too old, report that the GitHub plugin runtime dependency is not available. |
8
+ | `Missing required option --repo` | Repo not passed and no default was resolved. | Resolve with `jr-rpc config get github.repo`; pass `--repo owner/repo` explicitly when missing. |
9
+ | Command affects or authenticates against the wrong repo | Stale `github.repo` default or authenticated command missing explicit repo. | Pass `--repo owner/repo` for the target repository, or update `github.repo` before retrying. |
10
+ | `GraphQL: Could not resolve to a Repository` | Repo slug is wrong or inaccessible. | Validate `owner/repo` and confirm app installation on target repository. |
11
+ | 401 Unauthorized | Issued GitHub credentials were rejected upstream. | Verify the target repo, then use the grant/auth signal to distinguish stale user OAuth from app installation or host env setup. |
12
+ | `junior-auth-required provider=github grant=user-write` | User-to-server OAuth is missing or stale for a human-identity operation. | Follow the private OAuth prompt; do not ask the user to paste or manage tokens manually. |
13
+ | 403 without `permission_denied` where `source: "upstream"` | The runtime may have rejected an unsupported route before contacting GitHub. | Read the response body. Follow any required-tool instruction; do not ask for GitHub permissions unless the failure is confirmed upstream. |
14
+ | `permission_denied` with `source: "upstream"` | GitHub rejected the forwarded request. | Read GitHub's error first. If the message says GitHub denied access, verify the target, App permissions, and installation scope. Do not request user OAuth for a bot-owned issue operation. |
15
+ | 404 Not Found | Issue number or repo is wrong. | Validate repo + issue ID with `gh issue view NUMBER --repo owner/repo`. |
16
+ | Issue label mutation fails | Wrong REST payload or wrong repo context. | Use the allowlisted issue labels endpoint with an explicit `owner/repo` path and valid JSON input. |
17
+ | Comment command fails with empty body | JSON input is missing a non-empty `body`. | Ensure the REST comment payload contains a non-empty `body` before retrying. |
18
18
 
19
19
  ## Retry guidance
20
20