Cut Live variant two output latency

This commit is contained in:
Paul Bakaus
2026-07-13 12:09:39 -07:00
parent 265502a125
commit 7a3ef022d9
4 changed files with 290 additions and 12 deletions
+16 -7
View File
@@ -455,7 +455,6 @@ describe('Codex Live worker supervisor ownership and lifecycle', () => {
generationEpoch: 1,
});
const first = '<main><div data-impeccable-variants="codexprogress"><style data-impeccable-css="codexprogress">@scope ([data-impeccable-variant="1"]) { h1 { color: red; } }</style><div data-impeccable-variant="original"><h1>Original</h1></div><div data-impeccable-variant="1"><h1>One</h1></div></div></main>';
const second = '<main><div data-impeccable-variants="codexprogress"><style data-impeccable-css="codexprogress">@scope ([data-impeccable-variant="1"]) { h1 { color: red; } }\n@scope ([data-impeccable-variant="2"]) { h1 { color: green; } }</style><div data-impeccable-variant="original"><h1>Original</h1></div><div data-impeccable-variant="1"><h1>Mutated One</h1></div><div data-impeccable-variant="2"><h1>Two</h1></div></div></main>';
const final = '<main><div data-impeccable-variants="codexprogress"><style data-impeccable-css="codexprogress">@scope ([data-impeccable-variant="1"]) { h1 { color: red; } }\n@scope ([data-impeccable-variant="2"]) { h1 { color: green; } }\n@scope ([data-impeccable-variant="3"]) { h1 { color: blue; } }</style><div data-impeccable-variant="original"><h1>Original</h1></div><div data-impeccable-variant="1"><h1>Mutated One again</h1></div><div data-impeccable-variant="2"><h1>Mutated Two</h1></div><div data-impeccable-variant="3"><h1>Three</h1></div></div></main>';
const client = fakeClient();
let turn = 0;
@@ -473,11 +472,21 @@ describe('Codex Live worker supervisor ownership and lifecycle', () => {
onStarted?.(`turn-${turn}`);
const prompt = input.find((item) => item.type === 'text').text;
prompts.push(prompt);
const artifactPath = JSON.parse(prompt.match(/Return exactly one file whose path is ("[^"]+")/)[1]);
const message = JSON.stringify({
files: [{ path: artifactPath, content: turn === 1 ? first : turn === 2 ? second : final }],
...(turn === 1 ? { plan } : {}),
});
const message = turn === 2
? JSON.stringify({
sourceDelta: {
variantId: 2,
markup: '<h1>Two</h1>',
css: '@scope ([data-impeccable-variant="2"]) { h1 { color: green; } }',
},
})
: (() => {
const artifactPath = JSON.parse(prompt.match(/Return exactly one file whose path is ("[^"]+")/)[1]);
return JSON.stringify({
files: [{ path: artifactPath, content: turn === 1 ? first : final }],
...(turn === 1 ? { plan } : {}),
});
})();
await Promise.all([
onAgentMessage?.(message),
onAgentMessage?.(message),
@@ -507,7 +516,7 @@ describe('Codex Live worker supervisor ownership and lifecycle', () => {
id: sessionId,
count: 3,
action: 'impeccable',
scaffold: { file: 'src/App.jsx' },
scaffold: { file: 'src/App.jsx', styleMode: 'scoped' },
});
assert.equal(checkpoints.length, 3);