Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(forge): stop reporting five seconds left on a job past its estimate
nirholasd6491e44c640
diff --git a/api/_mcp-studio/studio-shape.js b/api/_mcp-studio/studio-shape.jsindex e1ed9fd83..c55a04bc0 100644--- a/api/_mcp-studio/studio-shape.js+++ b/api/_mcp-studio/studio-shape.js@@ -131,7 +131,14 @@ export function shapePoll(data, base, jobId, title, { pollPath = STUDIO_POLL_PAT// estimate the poll carries (falling back to the lane's total estimate)// instead of leaving the caller with N identical frames.const t = titleSuffix(title);- const etaRemaining = Number(data?.eta_remaining_seconds ?? data?.eta_seconds);+ // eta_remaining_seconds is dropped upstream once a job outruns its estimate.+ // The lane's TOTAL estimate is not a stand-in at that point: it would restate+ // a whole fresh countdown on a job already past it. Fall back to the total+ // only on a frame carrying no elapsed reading at all, which is the first one.+ const hasElapsedReading = Number.isFinite(Number(data?.elapsed_seconds));+ const etaRemaining = Number(+ hasElapsedReading ? data?.eta_remaining_seconds : (data?.eta_remaining_seconds ?? data?.eta_seconds),+ );const elapsed = Number(data?.elapsed_seconds);return {status: 'pending',diff --git a/api/gpt-forge.js b/api/gpt-forge.jsindex 424ca46d8..1fb0e7b7d 100644--- a/api/gpt-forge.js+++ b/api/gpt-forge.js@@ -3087,8 +3087,22 @@ async function pollJob(req, res, jobId) {...(etaSeconds != null? {eta_seconds: etaSeconds,- eta_remaining_seconds:- elapsedSeconds != null ? Math.max(5, etaSeconds - elapsedSeconds) : etaSeconds,+ // Only claim a countdown while there is one left to claim. A+ // floor here (this used to be Math.max(5, ...)) makes every+ // poll past the estimate report the same "roughly 5s to go"+ // for as long as the job actually runs: measured 2026-09-09,+ // a 12.5-minute self-host job reported 5s remaining for its+ // final 11 minutes, to the ChatGPT widget and the custom GPT+ // alike. That is a fabricated reading, not a slow one. Past+ // the estimate the key is simply absent and every consumer+ // falls back to its honest "it keeps running in the+ // background" copy, with elapsed_seconds still carrying the+ // real, moving number.+ ...(elapsedSeconds == null+ ? { eta_remaining_seconds: etaSeconds }+ : etaSeconds - elapsedSeconds > 0+ ? { eta_remaining_seconds: etaSeconds - elapsedSeconds }+ : {}),}: {}),...(cold ? { cold_start: true, cold_start_seconds: coldStartSecondsFor(meta?.backend) } : {}),diff --git a/tests/api/3d-studio.test.js b/tests/api/3d-studio.test.jsindex 46f571a5b..16b251740 100644--- a/tests/api/3d-studio.test.js+++ b/tests/api/3d-studio.test.js@@ -192,6 +192,38 @@ describe('shape helpers — Actions wire contract', () => {expect(shapePoll(POLL_DONE, 'https://three.ws', SUBMIT_QUEUED.job_id, 'x').watchUrl).toBeUndefined();});+ it('shapePoll never fabricates a countdown on a job that has outrun its estimate', async () => {+ const { shapePoll } = await import('../../api/3d/studio.js');++ // Inside the estimate: report the real remaining time.+ const early = shapePoll(+ { status: 'running', eta_seconds: 200, eta_remaining_seconds: 140, elapsed_seconds: 60 },+ 'https://three.ws',+ 'f1.a.b',+ );+ expect(early.etaSeconds).toBe(140);+ expect(early.elapsedSeconds).toBe(60);++ // Past it, /api/gpt-forge drops eta_remaining_seconds. The lane's TOTAL+ // estimate must NOT step in as a substitute: doing so restates a whole+ // fresh countdown on a job already 11 minutes past it, which is what made+ // the widget and the custom GPT both say "roughly 5s to go" for the final+ // 11 minutes of a measured 12.5-minute generation.+ const late = shapePoll(+ { status: 'running', eta_seconds: 200, elapsed_seconds: 760 },+ 'https://three.ws',+ 'f1.a.b',+ );+ expect(late.etaSeconds).toBeUndefined();+ // The honest, moving number survives so the caller can still show progress.+ expect(late.elapsedSeconds).toBe(760);++ // The very first frame carries no elapsed reading; the lane's total+ // estimate is the best available answer there and is still forwarded.+ const first = shapePoll({ status: 'queued', eta_seconds: 200 }, 'https://three.ws', 'f1.a.b');+ expect(first.etaSeconds).toBe(200);+ });+it('shapePoll maps done/running/failed forge shapes cleanly, echoing the title into arUrl', async () => {const { shapePoll } = await import('../../api/3d/studio.js');const done = shapePoll(POLL_DONE, 'https://three.ws', SUBMIT_QUEUED.job_id, 'a tiny fox');