Skip to content

fix: unstick /autoclip runs and Settings key entry - #50

Merged
SomeRandmGuyy merged 2 commits into
mainfrom
devin/1789013883-media-fetch-sandbox-reaper
Sep 16, 2026
Merged

SomeRandmGuyy merged 2 commits into
mainfrom
devin/1789013883-media-fetch-sandbox-reaper

Conversation

@SomeRandmGuyy

@SomeRandmGuyy SomeRandmGuyy commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Agent tab: keep polling the run detail in hidden tabs. Each poll ticks the background media-fetch job; React Query pauses interval refetches in hidden tabs by default, so a run left in another tab never advanced (reproduced on prod: 0 server calls in 30 s while hidden). Note: Chrome still throttles background-tab timers to ~1/min after a few minutes, so this only narrows the gap — server-driven ticking is the real fix (see below).
  • media-fetch-job: a run parked as MEDIA_FETCH with no job state now fails visibly on the first tick instead of returning idle forever. Two such zombie runs (started 2026-09-09/10, empty outputs) sat in Waiting on prod; both cancelled by hand.
  • media-fetch-job: transient tick errors were only console.error'd and retried silently until the 4 h deadline. They now show on the run as "Retrying (attempt N) after a transient error: …" (attempts 1, 2, 4, 8…) and the run fails after 30 consecutive transient errors (~12 min).
  • Settings: Higgsfield status reads through loadHiggsfieldCreds (the generic settings reader treats *_API_KEY/*_SECRET names as encrypted and returned null, so a freshly saved key showed Not configured). Crayo Test no longer surfaces the bare UNAUTHORIZED code that renders as the app's "Please sign in" message. Test is disabled while a card has unsaved text, since it only ever checks the stored key.

Observed on prod (2026-09-16)

A fresh /autoclip on a 4:59 video (3 clips) sat in "Sandbox started. Installing yt-dlp + ffmpeg…" for 15 min with ~140 polls and never got the tick's own "Installing…" line — i.e. every tick threw before reaching progress(), and the transient path swallowed it. Vercel runtime logs are 403 on this plan, so the third change is what makes the reason visible. Run cancelled.

Follow-up (not in this PR)

  • Ticks should not depend on a browser tab: chain a follow-up tick server-side (e.g. waitUntil + delayed self-call) or run the ops cron more often than the Hobby plan allows.
  • Runs list has no timestamps; a week-old Waiting row looks fresh.

Test plan

  • tsc --noEmit clean on touched files
  • node --test src/lib/media-fetch.test.ts 8/8
  • Headless Firefox on local dev: Crayo Test → "Save a Crayo API key first"; Higgsfield Save → card shows stored/Disconnect; Test disabled while typing
  • Prod after deploy: start /autoclip on https://www.youtube.com/watch?v=vrY1THC_NQE (3 clips) and read the retry line, or watch it finish

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 16, 2026

Copy link
Copy Markdown

Deployment failed for project clippyos with the following error:

Hobby accounts are limited to daily cron jobs. This cron expression (*/15 * * * *) would run more than once per day. Upgrade to the Pro plan to unlock all Cron Jobs features on Vercel.

Learn More: https://vercel.link/3Fpeeb1

@vercel

vercel Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clippyos Ready Ready Preview Sep 16, 2026 2:40am UTC

Request Review

- Agent tab: keep polling the run detail in hidden tabs; each poll ticks the
  background media-fetch job, and React Query pauses interval refetches by
  default, so a run left in another tab never advanced.
- media-fetch-job: a run parked as MEDIA_FETCH with no job state now fails
  visibly on the first tick instead of returning idle forever.
- Settings: Higgsfield status read through its own loader (the generic
  settings reader treated *_API_KEY/*_SECRET as encrypted and returned null,
  so a saved key showed Not configured); Crayo Test no longer maps to the
  app's 'Please sign in' message; Test is disabled while a card has unsaved
  text since it only ever checks the stored key.

Co-Authored-By: Claude <noreply@anthropic.com>
…ry loop

A tick that failed on a transient sandbox/API error only console.error'd,
released the lock, and returned idle — so a recurring error retried
silently until the 4-hour deadline while the run showed no new progress.
Now the retry is written to the run as an observe line (attempts 1, 2, 4,
8…) and the run fails visibly after 30 consecutive transient errors.

Co-Authored-By: Claude <noreply@anthropic.com>
@SomeRandmGuyy
SomeRandmGuyy merged commit cff95b0 into main Sep 16, 2026
2 of 6 checks passed

This branch was successfully deployed

1 active deployment
Preview – clippyos — 97c541c4 Deployed Sep 16, 2026 by vercel[bot]
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