mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-03 01:46:55 +02:00
test: settle the post-response composer before seeding; give the TPA recorder adapter its infra helper
submitPlanSeed accepted a stale empty composer when the transcript recorded end_turn before the CLI repainted (late-repaint-typed-current fails 5/5 on the old helper, passes 5/5 now). The TPA recording fixture extracted recordE2E without isPreTurnInfraFailure, so every failed case threw before recording.
This commit is contained in:
1 parent
80c92c86ed
commit
3fc05932b7
4 files changed
+20
-9
No files matched your search
@@ -152,6 +152,9 @@ export async function submitPlanSeed(session: SeedSession, seed: string, opts: {
|
||||
});
|
||||
if (Date.now() >= opts.deadlineAt) throw new PlanSeedTimeout('Plan seed submission exhausted the existing case budget');
|
||||
session.sendKey('Enter'); // Separate input event after the acknowledged paste.
|
||||
// The transcript can record end_turn before the CLI repaints, so an empty
|
||||
// composer counts only when the same frame survives one more poll.
|
||||
let settled = '';
|
||||
await until(async () => {
|
||||
const owned = read();
|
||||
if (!owned || owned.pendingBytes) return false;
|
||||
@@ -178,13 +181,18 @@ export async function submitPlanSeed(session: SeedSession, seed: string, opts: {
|
||||
}
|
||||
if (row.type === 'user') for (const c of content(row)) if (c.type === 'tool_result') pending.delete(c.tool_use_id);
|
||||
}
|
||||
if (!complete || pending.size || owned.status.waitingFor) return false;
|
||||
const unsettled = () => { settled = ''; return false; };
|
||||
if (!complete || pending.size || owned.status.waitingFor) return unsettled();
|
||||
const frame = await session.currentScreen!();
|
||||
if (opts.isQuestionOrPermission(frame.text)) throw new Error('Plan seed response requires an answer before skill invocation');
|
||||
const input = composer(frame.text);
|
||||
if (frame.rawEnd !== session.mark() || !input
|
||||
|| input.line.replace(/^❯[ \u00a0]*/, '').trim() !== '') return false;
|
||||
|| input.line.replace(/^❯[ \u00a0]*/, '').trim() !== '') return unsettled();
|
||||
const fresh = read();
|
||||
return !!fresh && !fresh.pendingBytes && fresh.rows.length === owned.rows.length && !fresh.status.waitingFor;
|
||||
if (!fresh || fresh.pendingBytes || fresh.rows.length !== owned.rows.length || fresh.status.waitingFor) return unsettled();
|
||||
const signature = `${frame.rawEnd}:${fresh.rows.length}:${frame.text}`;
|
||||
if (signature === settled) return true;
|
||||
settled = signature;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user