Repository navigation
fix(health_check): catch transport errors from the job-token fallback - #827
Conversation
A refused GET /job after GET /user returns 401 left health_check as JSON-RPC -32603. Report that failure with the same transport-error result as GET /user. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Summary
Merge Risk: ⚪ Minimal · up to The fallback now returns a structured error when its connection fails. No actionable merge-blocking risk remains after normal checks. Pre-merge checks |
|
|
Cursor CLI review (gitlab-mcp-maintainer, 89efdc7): no serious issues. The catch only covers transport throws from the |
Why
CodeRabbit flagged on #825 that
health_checkdoes not catch transport errors from the job-token fallback. WhenGET /userreturns 401/403 and a job token is configured,authenticateWithJobTokenFallbackAsynccallsGET /job. If that request fails at the transport level (ECONNREFUSED, DNS, TLS, timeout),health_checkrejects and the client gets a JSON-RPC-32603 fetch failederror instead of the structured result introduced in #811.What changed
index.ts: wrap the job-token fallback call inhealth_checkwith the sametry/catchused forGET /user, returninghealthCheckTransportErrorResult(error)(status: "error",error.kind/code/message, URL credentials redacted by the existing shared helper).test/test-health-check.ts: new test — job token +GET /user401 +GET /jobconnection refused → structuredstatus: "error"result withECONNREFUSED, no secret in the output.No other tools or auth behavior change.
User impact
health_checkwith a job token now returns astatus: "error"result instead of a JSON-RPC error when the/jobfallback cannot connect. This changes the error shape users see, so it needs maintainer confirmation before merge.Tests
npm run build,tsc --noEmit,npm run check:skill-sync: passtest/test-health-check.ts: 17/17 passnpm run test:mock: pass/user401 then/jobrefused: before (main)-32603 fetch failed→ afterstatus:"error",kind:"network",code:"ECONNREFUSED"user:pass@in URL:status:"error", credentials shown as[REDACTED](unchanged)