No request timeout - a stalled Forgejo request hangs the tool call forever #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
forgejoRequestinsrc/forgejo-client.jscallsfetch(url, { method, headers, body })with nosignal. Node has no default fetch timeout, so if the instance stops responding mid-request (Cloudflare in front of git.trtmn.io, Tailscale route flapping, a hung upstream) the promise never settles. The MCP tool call hangs indefinitely with no error surfaced to the caller.This compounds in
src/issue-helpers.js:fetchAllPagesloops up toMAX_PAGES(10) sequential requests, socreate_issuecan issue up to 20 requests (labels plus milestones) with no per-request bound.Suggested fix
Add a bounded, overridable timeout:
Wrap the call so an abort surfaces as a clear message rather than a bare
TimeoutError, e.g.Forgejo request timed out after 30000ms: GET /repos/.... Make sure the error text never includes the Authorization header or token.Also worth considering
fetchrejects on network errors (DNS failure, connection refused) andJSON.parsecan throw on a malformed body that is nonetheless labelledapplication/json. Both currently propagate as raw exceptions out of the tool handler. Catching them inforgejoRequestand returning a structured{ ok: false, status: 0, data: message }would give callers consistent shape.Severity
Medium - reliability. No data loss, but a hung tool call is indistinguishable from a stuck session.