Skip to content

Let agents raise the request deadline with PROOFLINE_REQUEST_TIMEOUT_MS - #14

Open
ap-beep-ship-it wants to merge 1 commit into
prooflinedev:mainfrom
ap-beep-ship-it:request-timeout-env
Open

ap-beep-ship-it wants to merge 1 commit into
prooflinedev:mainfrom
ap-beep-ship-it:request-timeout-env

Conversation

@ap-beep-ship-it

Copy link
Copy Markdown

Who this helps

People who run the stdio bridge with agents that call the slower Proofline tools. Codebase questions, architecture documents and plans on a large repository can take longer than the fixed 35 second deadline, and the agent then gets a timeout even though the server is still working. The same happens on slow or high latency networks. Today the only workaround is to patch the package. With this change they can set one variable in the agent's MCP env block:

"env": {
  "PROOFLINE_TOKEN": "YOUR_PROOFLINE_TOKEN",
  "PROOFLINE_REQUEST_TIMEOUT_MS": "120000"
}

What changed

  • configuration() reads an optional PROOFLINE_REQUEST_TIMEOUT_MS and returns it as timeout. Unset keeps 35000, so nothing changes for existing users.
  • post() uses config.timeout for the AbortSignal.timeout deadline. It falls back to 35000 if a caller passes a config without it, so direct users of bridge() keep working.
  • A timed-out request still returns the correlated JSON-RPC -32000 error with data.category: "timeout" and the bridge keeps running.
  • --help lists the variable, and the README explains when to use it and why it has limits.

Decisions

  • Only longer deadlines (35000 to 600000 ms). The existing timeout test already treats 35 seconds as a floor. A shorter deadline would cut off answers the server can legitimately take that long to produce, and because a write may still commit after the bridge gives up, it would make agents more likely to repeat a write blindly. The 10 minute cap keeps a typo from turning into a session that hangs for hours.
  • Strict parsing. Only plain digits are accepted. 60e3, 60000.5, +60000, padded values, hex and the empty string are refused rather than guessed at, so a bad value is caught at startup instead of silently becoming some other deadline. Refusing the empty string matches how PROOFLINE_BASE_URL is treated on main today.
  • The error names the variable. A bad value exits 1 before any request is sent and prints Set PROOFLINE_REQUEST_TIMEOUT_MS to a whole number of milliseconds from 35000 to 600000, or leave it unset. The existing generic message is kept for token and origin problems, so nothing new is printed for those and the value itself is never echoed.
  • No new dependencies. Still plain Node 22+ with node:test.

How I verified it

  • npm run check, npm test and npm run test:package all pass locally on Node 24.22.1, and node --test tests/*.test.js passes on Node 22.23.5 (the CI major).
  • New CLI tests in tests/bridge.test.js also run against the packed tarball through test:package:
    • with PROOFLINE_REQUEST_TIMEOUT_MS=120000, a preload asserts that every AbortSignal.timeout call gets exactly 120000 (and shortens it so the test stays fast). A stalled tools/call gets the correlated -32000 timeout, and the next tools/list still succeeds on the same stdio session.
    • ten invalid values each exit 1 with no stdout, the variable and range in stderr, and zero requests reaching the fixture server.
  • New tests/configuration.test.js covers the default, both range boundaries and the parsing edge cases against configuration() directly.
  • The existing timeout test is unchanged and still passes, which shows the default path is untouched.
  • Manual check: PROOFLINE_TOKEN=x PROOFLINE_REQUEST_TIMEOUT_MS=5 node src/cli.js prints the error above and exits 1, and --help shows the new line.

Slow tools such as codebase questions and plans on large repositories can
need more than 35 seconds. The bridge now reads an optional
PROOFLINE_REQUEST_TIMEOUT_MS (35000 to 600000, whole milliseconds) and
refuses anything else at startup with an error that names the variable.
The default is unchanged and timed-out requests still get the correlated
-32000 error.

This branch has not been deployed

No deployments
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