Skip to content

fix(uploads): background queue + per-attempt timeout + My packages visibility - #23

Merged
criptogus merged 1 commit into
mainfrom
claude/fix-mcp-oauth-callback-brZDc
May 23, 2026
Merged

criptogus merged 1 commit into
mainfrom
claude/fix-mcp-oauth-callback-brZDc

Conversation

@criptogus

Copy link
Copy Markdown
Owner

Summary

Root cause of "skills never come back": the SkillForge author pipeline spent 10–30s per file in serverless with no per-attempt timeout, so a multi-file MCP upload blew the ~35s budget mid-loop and the caller saw a 504 with zero packages persisted.

  • Process the FIRST file inline; persist the rest to a new package_upload_jobs queue table. The MCP upload_packages response now includes queued: [{id, filename}] and a next_step that explains the background drain.
  • Add per-attempt AbortSignal.timeout(12s) inside generateDraft so a single hung model fails fast and the fallback chain actually runs. Trim the chain to 3 models for predictable upper-bound latency.
  • New cron-callable /api/jobs/drain-upload-queue (CRON_SECRET-gated) wired in vercel.json to run every minute. Also bumps maxDuration on the MCP route to 60s.
  • Surface in-flight jobs on /account/packages with a polling list so the user watches the queue drain instead of staring at an empty page.
  • Add the missing "My packages" link to both desktop and mobile nav.

Test plan

  • Set CRON_SECRET in Vercel envs (any random string) so the cron auth gate is enabled.
  • Apply migration 20260525000000_package_upload_jobs.sql.
  • After deploy, upload 3 files via MCP upload_packages: response should show uploaded: 1, queued_count: 2, plus the two queued ids.
  • Navigate to /account/packages (now reachable from the Account menu): "Upload queue" section should show the queued files; refresh every 5s until they flip to "done" / appear as packages.
  • Confirm Vercel "Crons" tab shows /api/jobs/drain-upload-queue hitting once per minute with 200 ok.

https://claude.ai/code/session_019gMoupKKTVydpNwiiACQRd


Generated by Claude Code

…sibility

Root cause of "skills never come back": the SkillForge author pipeline
spent 10-30s per file in serverless functions with no per-attempt
timeout, so a 5-file MCP upload blew the ~35s budget mid-loop and the
caller saw a 504 with zero packages persisted.

Changes:
- Process the FIRST file inline; persist the rest to a new
  `package_upload_jobs` queue table (RLS: owners read; service-role
  writes). The MCP `upload_packages` response now includes
  `queued: [{id, filename}]` and a `next_step` that explains the
  background drain.
- Add per-attempt `AbortSignal.timeout(12s)` inside `generateDraft` so a
  single hung model fails fast and the fallback chain actually runs.
  Trim the chain to 3 models for predictable upper-bound latency.
- New cron-callable `/api/jobs/drain-upload-queue` endpoint, wired in
  `vercel.json` to run every minute (CRON_SECRET-gated). Also bumps
  `maxDuration` on the MCP route to 60s.
- Surface in-flight jobs on `/account/packages` with a polling list so
  the user watches the queue drain instead of staring at an empty page.
- Add the missing "My packages" link to both desktop and mobile nav.

https://claude.ai/code/session_019gMoupKKTVydpNwiiACQRd
@criptogus
criptogus marked this pull request as ready for review May 23, 2026 03:02
@criptogus
criptogus merged commit 4bbcb98 into main May 23, 2026
1 check 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.

2 participants