Visitar URL original
fix(cli): apply configured API request timeout by jdalton · Pull Request #1621 · SocketDev/socket-cli · GitHub
Skip to content

fix(cli): apply configured API request timeout - #1621

Open
John-David Dalton (jdalton) wants to merge 1 commit into
v1.xfrom
fix/direct-api-timeout-v1
Open

John-David Dalton (jdalton) wants to merge 1 commit into
v1.xfrom
fix/direct-api-timeout-v1

Conversation

@jdalton

@jdalton John-David Dalton (jdalton) commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Make direct Socket API requests honor SOCKET_CLI_API_TIMEOUT, including redirects and stalled response bodies.

Add HTTPS integration tests for configured and unset timeouts, redirects, and response-body stalls. Generate a disposable localhost certificate in os.tmpdir() that expires after three minutes; no certificate or private key is committed.

mikeraymonf13-creator

This comment was marked as spam.

@jdalton
John-David Dalton (jdalton) force-pushed the fix/direct-api-timeout-v1 branch 10 times, most recently from c189096 to 21db608 Compare November 11, 2026 17:48
@jdalton

Copy link
Copy Markdown
Contributor Author

Cursor (@cursor) review

@cursor

cursor Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes core outbound HTTPS request behavior for all direct API paths; mis-tuned timeouts could break long-running scans, though invalid env values are ignored and integration tests cover key edge cases.

Overview
Direct Socket API calls now honor SOCKET_CLI_API_TIMEOUT when it is a finite positive value. apiFetch accepts an optional per-request timeout, applies it via node:https request options, surfaces ETIMEDOUT on header and stalled-body failures, and carries the same timeout through redirects (including non-preserving 302-style hops).

queryApi, queryApiSafeTextWithStatus, and sendApiRequest automatically attach the resolved configured timeout; raw apiFetch without that helper still has no default unless a caller passes timeout explicitly. Timeout failures in text/JSON reads now return clearer causes instead of generic read/parse errors.

Adds a unit test for resolveConfiguredSocketApiTimeout and a loopback HTTPS integration suite that generates a short-lived localhost cert and exercises GET/POST, idle bodies, unset config, explicit overrides, and 302/307 redirect behavior.

Reviewed by Cursor Bugbot for commit 4488885. Configure here.

cursor[bot]

This comment was marked as resolved.

@jdalton
John-David Dalton (jdalton) force-pushed the fix/direct-api-timeout-v1 branch 3 times, most recently from fafe2a0 to 4488885 Compare November 12, 2026 04:47
@jdalton

Copy link
Copy Markdown
Contributor Author

Cursor (@cursor) review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 4488885. Configure here.

Comment thread src/utils/api.mts Resolved
@jdalton
John-David Dalton (jdalton) force-pushed the fix/direct-api-timeout-v1 branch 3 times, most recently from 364fa79 to 05e22f4 Compare November 12, 2026 15:27
Honor configured timeout for direct CLI API calls and carry it across redirects.

Assisted-by: Codex:GPT-6

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

Development

Successfully merging this pull request may close these issues.

2 participants