Skip to content

fix(cli): improve publish timeout and error handling#550

Open
MunemHashmi wants to merge 1 commit intoopenclaw:mainfrom
MunemHashmi:fix/533-publish-timeout-error-handling
Open

fix(cli): improve publish timeout and error handling#550
MunemHashmi wants to merge 1 commit intoopenclaw:mainfrom
MunemHashmi:fix/533-publish-timeout-error-handling

Conversation

@MunemHashmi
Copy link

Summary

Fixes #533

  • Increased upload timeout: multipart form uploads (apiRequestForm + curl form path) now use a 120s timeout instead of the default 15s. Regular API requests (search, whoami, etc.) remain at 15s.
  • Better timeout error messages: changed from bare "Timeout" to "Request timed out after Ns" so users can understand what happened and how long was waited.
  • Normalized non-Error throws: fetchWithTimeout now catches non-Error objects (e.g. DOMException thrown by AbortController.abort() in some runtimes) and wraps them into proper Error instances with { cause }. This prevents the misleading "Non-error was thrown: \"Timeout\"" message from p-retry.

Root cause

The publish command sends a multipart form upload via apiRequestForm, which used the same 15s REQUEST_TIMEOUT_MS as simple GET requests. Large skill bundles easily exceed this. When the AbortController fires, some JS runtimes throw a DOMException (not an Error), which p-retry can't handle and produces the confusing "Non-error was thrown" message.

Test plan

  • bun run test — 605/605 pass (including 1 new test for non-Error normalization)
  • bun run lint — 0 warnings, 0 errors
  • bun run build — successful

…aw#533)

- Increase upload timeout from 15s to 120s for multipart form uploads
  (apiRequestForm and curl-based form upload). Regular API requests
  remain at 15s.
- Improve timeout error message from bare "Timeout" to
  "Request timed out after Ns" so users know what happened.
- Normalize non-Error throws (e.g. DOMException from AbortController
  across runtimes) into proper Error instances, preventing the
  misleading "Non-error was thrown" message from p-retry.
- Preserve the original error as `cause` on the wrapped Error.
@vercel
Copy link
Contributor

vercel bot commented Feb 27, 2026

@MunemHashmi is attempting to deploy a commit to the Amantus Machina Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

Improves timeout handling for CLI publish operations by increasing the upload timeout from 15s to 120s for multipart form uploads. This prevents timeouts when publishing large skill bundles. Also enhances error messages to show actual timeout duration (Request timed out after 120s instead of just Timeout) and normalizes non-Error throws from AbortController into proper Error instances to prevent confusing p-retry error messages.

  • Adds separate UPLOAD_TIMEOUT_MS (120s) constant for form uploads while keeping REQUEST_TIMEOUT_MS (15s) for regular API requests
  • Updates fetchWithTimeout to accept configurable timeout and provide descriptive error messages
  • Wraps non-Error exceptions (like DOMException) in proper Error instances with cause field for better error tracking
  • Applied timeout changes to both fetch-based and curl-based code paths
  • Added test coverage for non-Error normalization behavior

Confidence Score: 5/5

  • This PR is safe to merge with no identified risks
  • The changes are focused, well-tested (605/605 passing tests including new coverage), and backward compatible. The implementation correctly addresses the timeout issue for large file uploads while maintaining existing behavior for regular API requests. Error handling improvements prevent confusing error messages without changing the underlying retry logic.
  • No files require special attention

Last reviewed commit: 91c8ca7

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.

clawhub publish times out on upload despite successful auth

1 participant