Where does the bug appear (feature/product)?
Cloud Agent (GitHub, Slack, Web, Linear)
Describe the Bug
Where does the bug appear?
Cursor Automations / scheduled overnight runs (Background Agent style GitHub token in automation sandbox). Product surface: scheduled Automation draft-pr-hygiene-sweep on repo beakerteeter/CP-Product-Advisory.
Describe the Bug
Our overnight Draft PR Hygiene sweep runs:
node scripts/draft-pr-hygiene-sweep.mjs
which calls:
gh pr close <N> --comment "…"
Every close fails first on GraphQL addComment with:
Resource not accessible by integration
Result: 0 closed, backlog ~40–42 stale app/cursor + cursor/* draft PRs accumulating nightly.
Confirmed NOT an install misconfig
Owner verified Cursor GitHub App install on beakerteeter/CP-Product-Advisory already shows Issues: write and Pull requests: write. We will not reinstall (known community anti-pattern / reinstall loop).
This matches Cursor staff/community reports that the runtime installation token handed to agents/automations is intentionally narrower than the App install permissions visible in GitHub settings so dashboard/install can show Write while gh pr comment / addComment still 403.
Related community threads (same class of gap):
- Background Agents spawned via API cannot post PR comments or reviews despite correct GitHub App permissions
- Cloud Agent unable to edit PR description or add comment
- Cursor cloud agent access to github issues (related thread; URL omitted due new-user link limit)
Ask
Please make the scheduled Automation / overnight runtime token honor App-granted Issues:write + Pull requests:write, or expose an explicit PR Comment capability so gh pr close --comment works for close-only hygiene sweeps.
Alternatively document the supported path for Automations (e.g. secret named exactly GH_TOKEN / GITHUB_TOKEN for gh) if App-scoped tokens will stay conservative.
Steps to Reproduce
- Install Cursor GitHub App on a private repo with Issues write + Pull requests write.
- Schedule an Automation that runs
gh pr close <open-cursor-draft> --comment "hygiene". - Observe GraphQL addComment → Resource not accessible by integration; PR remains open.
- Confirm App install UI still shows Issues/PR write (no reinstall needed).
Expected
gh pr close --comment succeeds when App install grants Issues write + Pull requests write (or when PR Comment capability is enabled).
Actual
addComment 403 via integration token; 0 PRs closed overnight.
Evidence (our desk)
- Overnight Proof Log · Draft PR Hygiene · Run Date 2026-09-26: FAILED — 42 failed closes, 0 closed (URL omitted due new-user link limit)
- Policy/script:
scripts/draft-pr-hygiene-sweep.mjs+docs/engineering/2026-09/hub-sync-auto-merge.mdin the CP-Product-Advisory repository (URL omitted due new-user link limit)
Impact
Stale Cursor automation draft PRs accumulate; overnight hygiene Broken every night until runtime token includes comment/close scopes.
Workaround status
Not applying personal PAT into overnight automation yet (prefer platform fix). Willing to try documented GH_TOKEN secret path for Automations if that is the supported interim.
Steps to Reproduce
- Install Cursor GitHub App on a private repo with Issues write + Pull requests write.
- Schedule an Automation that runs
gh pr close <open-cursor-draft> --comment "hygiene". - Observe GraphQL addComment → Resource not accessible by integration; PR remains open.
- Confirm App install UI still shows Issues/PR write (no reinstall needed).
Operating System
Other
Version Information
Scheduled Automation runtime; no IDE version applicable.
Does this stop you from using Cursor
No - Cursor works, but with this issue