From a3411ae40ec196a8452431f500e400391e38e129 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 19:44:21 +0000 Subject: [PATCH] fix(mcp): accept GitHub's 200 answer to a dispatch and retry an unsent job at once GitHub now answers repository_dispatch with 200, so every job was started but recorded as not sent. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01TXFXQJroZAF74W4gg57vyH --- src/community.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/community.js b/src/community.js index 6a75790..3a2f9e8 100644 --- a/src/community.js +++ b/src/community.js @@ -137,13 +137,14 @@ const refPath = (id, f = "meta.json") => `community/refs/${id}/${f}`; /** The source video's reference frames: extracted once per video by the render workflow. */ async function reference(src, info, { now, dispatch, wait }) { let meta = await getJson(refPath(src.id)); - const stuck = m => m && m.status !== "ready" && now - Date.parse(m.requested) > RETRY_MS; + // a job that could not be started is tried again at once; one that started gets RETRY_MS to answer + const stuck = m => m && m.status !== "ready" && (m.notSent || now - Date.parse(m.requested) > RETRY_MS); if (!meta || stuck(meta)) { if (!info.video) return { status: "missing" }; meta = { status: "preparing", video: info.video, requested: iso(now), info: { title: info.title, author: info.author, authorUrl: info.authorUrl } }; await putJson(refPath(src.id), meta); if (!(await dispatch("reference", src.id, { video: info.video }).catch(() => false))) { - meta = { ...meta, status: "failed", reason: "The video could not be sent to be read right now; try again later." }; + meta = { ...meta, status: "failed", notSent: true, reason: "The video could not be sent to be read right now; try again later." }; await putJson(refPath(src.id), meta); } } @@ -347,7 +348,8 @@ export async function dispatchJob(kind, id, extra = {}, fetcher = fetch) { method: "POST", headers: { authorization: `Bearer ${token}`, accept: "application/vnd.github+json", "content-type": "application/json", "user-agent": "hypercodemotion-mcp" }, body: JSON.stringify({ event_type: "community-render", client_payload: { kind, id, mcp: PUBLIC_URL, ...extra } }) }); - return r.status === 204; + // GitHub answers 204, or 200 with the run's details + return r.ok; } const num = (v, min, max) => Number.isFinite(v) && v >= min && v <= max;