Skip to content

fix: client robustness improvements (v1.0.3)#5

Merged
treezio merged 1 commit into
mainfrom
feat/client-robustness
May 4, 2026
Merged

fix: client robustness improvements (v1.0.3)#5
treezio merged 1 commit into
mainfrom
feat/client-robustness

Conversation

@treezio

@treezio treezio commented May 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Three patch-level fixes to improve reliability and correctness.

1. Request timeout (client.ts)

All API requests now time out after 30 seconds via AbortSignal.timeout(30_000). Previously a slow or unresponsive DriftHound API would stall an MCP tool call indefinitely. ping() already had a 5s timeout — this brings the same safety to all requests.

2. Graceful non-JSON error responses (client.ts)

If the API returns a non-JSON body on a non-2xx response (e.g. a 502 from a proxy returning HTML), response.json() was throwing a SyntaxError that masked the real HTTP error. Now falls back to HTTP <status>: <statusText>.

3. Remediation hint no longer assumes Terragrunt (get-environment-info.ts)

The remediation code block hardcoded terragrunt plan. Since the API response doesn't indicate which tool a project uses, it now shows terraform plan # or: terragrunt plan.

Test plan

  • All existing tests pass (npm test) ✅ 49/49
  • Manually verify timeout: point DRIFTHOUND_API_URL at a non-responsive host — tool call should fail after ~30s with a timeout error instead of hanging

🤖 Generated with Claude Code

- Add 30s AbortSignal timeout to all API requests in client.request()
- Gracefully handle non-JSON error responses instead of throwing SyntaxError
- Show both terraform/terragrunt options in remediation code block
- Bump version to 1.0.3

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@treezio treezio merged commit a290fae into main May 4, 2026
1 check passed
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.

1 participant