Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
retry an answer with no usable section once as a whole instead of once per section
[._.]/ Adam Eivyf7e99700b6ef
diff --git a/server/services/musicVideo/documentGeneration.js b/server/services/musicVideo/documentGeneration.jsindex bd6f4cd01f..436f4e2b96 100644--- a/server/services/musicVideo/documentGeneration.js+++ b/server/services/musicVideo/documentGeneration.js@@ -343,7 +343,16 @@ async function runAuthoring(projectId, { providerId, model, effort, sectionId =// of a multi-section answer, or reaches for Math.random despite the rules).const takeAnswer = async (askedIds) => {const rejected = new Map();- const returned = returnedSections(run.text, askedIds, { lenient: true, rejected });+ let returned = returnedSections(run.text, askedIds, { lenient: true, rejected });+ // An answer with no usable section at all (a refusal, a truncated stream, prose) gets one+ // retry of the same request, not one call per section.+ if (!returned.size && !rejected.size && askedIds.length > 1) {+ console.log(`🎬 Music-video document: no usable section in the answer for ${askedIds.join(', ')}; asking once more`);+ run = await runBatch(`${withFeedback(promptFor(askedIds))}\n\nYour previous answer contained no usable section functions. Return every requested section as the JSON described above.`);+ returned = returnedSections(run.text, askedIds, { lenient: true, rejected });+ // Still nothing: fail now rather than fan out a call per section.+ if (!returned.size) acceptedSections(run.text, askedIds);+ }for (const [id, source] of returned) updated.set(id, source);for (const id of askedIds.filter((sectionId) => !returned.has(sectionId))) {const reason = rejected.get(id) || 'it was missing from the answer or its JSON did not parse';diff --git a/server/services/musicVideo/documentGeneration.test.js b/server/services/musicVideo/documentGeneration.test.jsindex 9575f40c87..d30bb1b133 100644--- a/server/services/musicVideo/documentGeneration.test.js+++ b/server/services/musicVideo/documentGeneration.test.js@@ -186,6 +186,15 @@ describe('treatment-driven mixed-media document authoring', () => {expect(manifest.sections.find((s) => s.id === 'intro').source).toContain('#123456');});+ it('retries an answer with no usable section once as a whole, then fails without a call per section', async () => {+ const id = await fixture();+ h.calls = 0;+ h.onSubmit = async () => { h.response = 'I cannot help with that.'; };+ await expect(generateMixedMediaDocument(id, { providerId: 'stub-provider' })).rejects.toMatchObject({ code: 'MISSING_SECTION_SOURCE' });+ expect(h.calls).toBe(2);+ expect(h.prompt).toContain('contained no usable section functions');+ });+it('names the prompt size when authoring times out with no output (#10515)', async () => {const id = await fixture();h.onSubmit = async () => { throw new Error('API execution timed out after 600000ms with no stream progress'); };