Skip to content

Add recover() method to Probot to fix stuck initialization state#14

Draft
Copilot wants to merge 3 commits intocopilot/process-heavy-datafrom
copilot/fix-recover-function-issue
Draft

Add recover() method to Probot to fix stuck initialization state#14
Copilot wants to merge 3 commits intocopilot/process-heavy-datafrom
copilot/fix-recover-function-issue

Conversation

Copy link

Copilot AI commented Mar 4, 2026

When #initialize() fails, initializationState permanently sticks at INITIALIZING, making every subsequent auth(), getNodeMiddleware(), etc. return the original rejected promise with no retry path — short of constructing a new Probot instance.

Changes

  • src/probot.ts: Adds public async recover() to Probot. Resets initializationState → UNINITIALIZED and replaces the settled DeferredPromise with a fresh one, then calls #initialize() to retry. No-ops if already INITIALIZED. No existing lines removed.

  • test/probot.test.ts: Adds a recover test suite — simulates a first-init failure via a custom Octokit subclass that throws on its first construction, asserts auth() rejects, calls recover(), then asserts auth() succeeds.

Usage

const probot = new Probot({ appId, privateKey });

try {
  await probot.auth(); // throws if init failed (e.g. transient Redis error)
} catch (e) {
  await probot.recover(); // resets state and retries initialization
  const octokit = await probot.auth(); // succeeds
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • bad.n8kk48m.proxy
    • Triggering command: /opt/hostedtoolcache/node/24.13.1/x64/bin/node /opt/hostedtoolcache/node/24.13.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/probot/probot/node_modules/tinypool/dist/entry/process.js (dns block)
  • bad.nq1mv9s.proxy
    • Triggering command: /opt/hostedtoolcache/node/24.13.1/x64/bin/node /opt/hostedtoolcache/node/24.13.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/probot/probot/node_modules/tinypool/dist/entry/process.js (dns block)
  • smee.io
    • Triggering command: /opt/hostedtoolcache/node/24.13.1/x64/bin/node /opt/hostedtoolcache/node/24.13.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/probot/probot/node_modules/tinypool/dist/entry/process.js (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.13.1/x64/bin/node /opt/hostedtoolcache/node/24.13.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/probot/probot/node_modules/tinypool/dist/entry/process.js -p 1/x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/sh (dns block)
    • Triggering command: /opt/hostedtoolcache/node/24.13.1/x64/bin/node /opt/hostedtoolcache/node/24.13.1/x64/bin/node --conditions node --conditions development /home/REDACTED/work/probot/probot/node_modules/tinypool/dist/entry/process.js -p modules/@npmcli/run-script/lib/node-gyp-bin/sh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Pull Request: #13 explai problme fix recover snd no deletions


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits March 4, 2026 09:36
Co-authored-by: nigelfpowers <202913696+nigelfpowers@users.noreply.github.com>
When Probot initialization fails, initializationState gets permanently stuck
as INITIALIZING with no way to retry. Add a public recover() method that
resets the initialization state and retries, enabling recovery from transient
failures without creating a new Probot instance.

No existing code was deleted; only additions were made.

Co-authored-by: nigelfpowers <202913696+nigelfpowers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix recover function without deletions Add recover() method to Probot to fix stuck initialization state Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants