LearnNewsExamplesServices
Frontmatter
id7930
titleBug: GitHub HealthService fails in standalone SDK scripts
stateClosed
labels
invalidai
assigneestobiu
createdAtNov 29, 2025, 5:23 PM
updatedAtNov 29, 2025, 5:42 PM
githubUrlhttps://github.com/neomjs/neo/issues/7930
authortobiu
commentsCount1
parentIssue7914
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtNov 29, 2025, 5:42 PM

Bug: GitHub HealthService fails in standalone SDK scripts

Closed v11.14.0 invalidai
tobiu
tobiu commented on Nov 29, 2025, 5:23 PM

Bug: GitHub HealthService fails in standalone SDK scripts

Context

When running standalone agent scripts (e.g., ai/agents/pm.mjs) directly via node, GH_HealthService.healthcheck() consistently reports authentication failure (GitHub Authentication failed. Check GH_TOKEN.), even when:

  1. gh CLI is installed and authenticated globally.
  2. dotenv is correctly loaded in the script.
  3. Other services like GH_IssueService (which also use gh) work perfectly fine.

This suggests a flaw in how HealthService executes its checks or interprets the environment in a standalone context versus the npm run-managed MCP server context.

Reproduction

  1. Create a script using GH_HealthService from ai/services.mjs.
  2. Run it via node my-script.mjs.
  3. Observe failure.

Goal

Fix GH_HealthService so it correctly detects the gh CLI status in standalone Node.js scripts, ensuring reliable "gatekeeping" for agents.

tobiu added the bug label on Nov 29, 2025, 5:23 PM
tobiu added the ai label on Nov 29, 2025, 5:23 PM
tobiu added parent issue #7914 on Nov 29, 2025, 5:23 PM
tobiu cross-referenced by #7914 on Nov 29, 2025, 5:24 PM
tobiu assigned to @tobiu on Nov 29, 2025, 5:40 PM
tobiu referenced in commit bad28f9 - "Bug: GitHub HealthService fails in standalone SDK scripts #7930" on Nov 29, 2025, 5:40 PM
tobiu
tobiu Nov 29, 2025, 5:41 PM

Input from Gemini 2.5 Agent:

✦ # Resolution: Not a Bug

This issue was caused by incorrect consumption of the HealthService API in the pm.mjs script, not a defect in the service itself.

Root Cause

The GH_HealthService.healthcheck() method returns a structured object:

{
    status: 'healthy',
    githubCli: {
        authenticated: true,
        // ...
    }
}

The pm.mjs script was checking ghHealth.authenticated (which is undefined) instead of ghHealth.githubCli.authenticated.

Fix

The script has been updated to check the correct property. Debugging confirmed that gh auth status was executing correctly and returning valid output all along.

Closing as invalid/resolved.

tobiu removed the bug label on Nov 29, 2025, 5:41 PM
tobiu added the invalid label on Nov 29, 2025, 5:41 PM
tobiu closed this issue on Nov 29, 2025, 5:42 PM