LearnNewsExamplesServices
Frontmatter
id7587
titleImplement Graceful Health Handling with Recovery
stateClosed
labels
enhancementai
assigneestobiu
createdAtOct 20, 2025, 10:47 PM
updatedAtOct 20, 2025, 11:24 PM
githubUrlhttps://github.com/neomjs/neo/issues/7587
authortobiu
commentsCount0
parentIssue7564
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtOct 20, 2025, 11:24 PM

Implement Graceful Health Handling with Recovery

Closed v11.0.0 enhancementai
tobiu
tobiu commented on Oct 20, 2025, 10:47 PM

Enhance the HealthService with transparent caching and update the MCP server startup to handle unhealthy states gracefully.

Acceptance Criteria

HealthService Changes:

  1. Add private caching fields: #cachedHealth, #lastCheckTime, #cacheDuration
  2. Refactor current healthcheck() logic into #performHealthCheck()
  3. Update healthcheck() to use cache (5 min TTL) before calling #performHealthCheck()
  4. Add ensureHealthy() method that throws if status is 'unhealthy'
  5. No changes to OpenAPI spec (caching is transparent)

MCP Server Changes:

  1. Update mcp-stdio.mjs startup:

    • Call healthcheck() on startup
    • If unhealthy: log warnings but don't abort
    • Inform user server will continue but tools may fail
  2. Update tool call handler:

    • Call HealthService.ensureHealthy() before callTool()
    • Catch and return error to agent if unhealthy
    • Use cached result (minimal overhead)

Benefits

  • Performance: Avoids redundant health checks
  • Resilience: Server doesn't crash on startup if gh missing
  • Recovery: User can run gh auth login and tools will work
  • UX: Clear errors guide users to fix issues
tobiu assigned to @tobiu on Oct 20, 2025, 10:47 PM
tobiu added the enhancement label on Oct 20, 2025, 10:47 PM
tobiu added the ai label on Oct 20, 2025, 10:47 PM
tobiu added parent issue #7564 on Oct 20, 2025, 10:47 PM
tobiu referenced in commit 29682a3 - "Implement Graceful Health Handling with Recovery #7587" on Oct 20, 2025, 11:22 PM
tobiu referenced in commit 4bba916 - "#7587 ticket md file update" on Oct 20, 2025, 11:24 PM
tobiu closed this issue on Oct 20, 2025, 11:24 PM