fix(codex): reconcile cold connections without resuming queued goals

This commit is contained in:
2026-10-20 18:33:20 +01:00
parent b3bcfa3826
commit d564765ca5
14 changed files with 355 additions and 34 deletions
+6
View File
@@ -152,6 +152,12 @@ try {
await page.click('.chat-bg-task');
await eventually(()=>page.evaluate("document.querySelector('.chat-bg-task-output')?.textContent==='Controlled background output'"));
if(process.env.PIPELINES_CAPTURE_DIR) await page.screenshot(join(process.env.PIPELINES_CAPTURE_DIR,'harness-background-output.png'));
await page.fill('#chatInput','Keep this draft through readback');
await page.evaluate("window.__resyncComposer=document.querySelector('#chatInput')");
assert.equal((await fetch(`http://${target}/fixture-resync`,{method:'POST'})).status,204);
await emit({kind:'resync'});
await eventually(()=>page.evaluate("document.querySelector('#chatTranscript').textContent.includes('Authoritative resync evidence')"));
assert.equal(await page.evaluate("document.querySelector('#chatInput')===window.__resyncComposer && document.querySelector('#chatInput').value==='Keep this draft through readback'"),true);
assert.deepEqual(await page.evaluate("window.__errors"), []);
console.log("Model dialog, stable activity mark, keyboard/caret, Back restoration, send-to-bottom and all recovered approvals/questions passed.");
} finally {
+12 -1
View File
@@ -1,6 +1,6 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { applyChatForm, applyChatPermission, chatApprovalCards, chatPendingForms, approvalCard } from '../src/chat.js';
import { applyChatForm, applyChatPermission, chatApprovalCards, chatPendingForms, approvalCard, applyChatEvent } from '../src/chat.js';
test('parallel approvals stay independently actionable and resolve by identity',()=>{
let thread={};
@@ -12,6 +12,17 @@ test('parallel approvals stay independently actionable and resolve by identity',
assert.deepEqual(chatApprovalCards(thread),[]);
});
test('native turn identity rejects late completion and resync preserves queued intent',()=>{
let thread=applyChatEvent({messages:[],queued:true},{kind:'step',step:{status:'started',turn_id:'new'}},1);
thread={...thread,queued:true};
assert.equal(applyChatEvent(thread,{kind:'resync'}),thread);
thread=applyChatEvent(thread,{kind:'step',step:{status:'ended',turn_id:'old'}},2);
assert.equal(thread.running,true);
assert.equal(thread.queued,true);
thread=applyChatEvent(thread,{kind:'step',step:{status:'ended',turn_id:'new'}},3);
assert.equal(thread.running,false);
});
test('Codex session-scoped approval is never described as a permanent grant',()=>{
const card=approvalCard({request_id:'a',always_label:'Allow for session',resolved:true,decision:'always'},'');
assert.equal(card.headline,'Allowed for session');