Skip to content

fix: add timeout to client request in convertScratchToXbp function#3090

Merged
nighca merged 1 commit into
goplus:devfrom
go-wyvern:convert-timeout
Apr 28, 2026
Merged

fix: add timeout to client request in convertScratchToXbp function#3090
nighca merged 1 commit into
goplus:devfrom
go-wyvern:convert-timeout

Conversation

@go-wyvern
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings April 28, 2026 01:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a longer request timeout for the Scratch → XBuilder conversion API call so larger/longer conversions don’t fail due to the shared client’s default 10s timeout.

Changes:

  • Introduce a convertTimeout constant (60s) for Scratch conversion.
  • Pass timeout: convertTimeout to the /util/sb2xbp binary POST request.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a 60-second timeout for the Scratch-to-XBuilder project conversion API call. The feedback suggests increasing this timeout to 5 minutes to ensure that larger projects (up to 32MB) have sufficient time for both upload and backend processing, especially on slower network connections.

Comment thread spx-gui/src/apis/sb2xbp.ts
Copy link
Copy Markdown
Contributor

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

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

This PR adds a 60-second explicit timeout to the Scratch conversion request, which is clearly the right direction — the default 10-second client timeout is far too short for a server-side file conversion of up to 32 MB. A few things worth addressing:

Comment thread spx-gui/src/apis/sb2xbp.ts
const convertTimeout = 60 * 1000 // 60s

/**
* Convert Scratch project (.sb2/.sb3) to XBuilder project (.xbp) via backend `/scratch-convert` endpoint.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The JSDoc (line 9 in the new file) says the endpoint is /scratch-convert but the actual call uses /util/sb2xbp — these don't match. Pre-existing, but worth fixing while touching this file.

Also, the comment "timeout behavior are consistent with other APIs" is no longer accurate after this change: this call now uses a custom 60-second timeout vs. the shared 10-second default. Suggested update:

 * Uses shared `client` so token and Sentry headers are consistent with other APIs.
 * A custom 60-second timeout is applied because Scratch conversion is significantly slower than typical API calls.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@xgopilot Draft a pull request to go-wyvern:convert-timeout to fix comment here.

Copy link
Copy Markdown
Contributor

@fennoai fennoai Bot Apr 28, 2026

Choose a reason for hiding this comment

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

Summary

Fixed the JSDoc comment in spx-gui/src/apis/sb2xbp.ts:

  1. Corrected endpoint path: /scratch-convert/util/sb2xbp
  2. Updated timeout description to accurately reflect the custom 60-second timeout

Permission Required

Hi @nighca! I've prepared the changes but need permission to push to the fork.

View Details & Solution

Target: go-wyvern/builder (fork)

Push blocked:

remote: Permission to go-wyvern/builder.git denied to fennoai[bot].
fatal: unable to access 'https://github.com/go-wyvern/builder.git/': The requested URL returned error: 403

Recommended Solution: Install GitHub App

  1. Install xgopilot
  2. Select repository: go-wyvern/builder
  3. Click "Install"
  4. Return here and comment

View job run

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The fix is prepared but I couldn't push to go-wyvern/builder — the GitHub App (fennoai[bot]) doesn't have write access to that fork.

@xgopilot Push it to a temporary branch for goplus/builder instead of branch for go-wyvern/builder.

Copy link
Copy Markdown
Contributor

@fennoai fennoai Bot Apr 28, 2026

Choose a reason for hiding this comment

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

Created PR #3092 with the JSDoc fixes for sb2xbp.ts:

  • Corrected endpoint path: /scratch-convert/util/sb2xbp
  • Updated timeout description to reflect the custom 60-second timeout (no longer claims timeout behavior is consistent with other APIs)

@go-wyvern can cherry-pick or copy the change from that PR into the convert-timeout branch.

View job run

@nighca nighca merged commit 375dc79 into goplus:dev Apr 28, 2026
8 checks 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.

3 participants