Files
gstack/test/helpers/context-restore-fragment.ts
T
Garry Tanandcapy-ai[bot] f4536ed4d5 v1.91.222.0 test: daily flaky-fix pass: qa-only late clock, fragment-match verdict, install-admission timeout, ff-update reap, judge parse diagnostics (GSTA-91) (#3413)
* test: flaky-fix pass — fragment-match reads the agent's report, ff-update reap counts its own sleepers, install-admission gets a measured timeout, judge parse errors name the judge (GSTA-91)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(qa-only): late scenarios freeze the fixture clock during setup and register their real outer budget (GSTA-91)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(harness): record the llm-judge parse-message change as non-behavioral (GSTA-91)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
2026-10-25 23:39:42 +00:00

35 lines
1.3 KiB
TypeScript

/**
* Verdict for the context-restore-fragment-match E2E: which checkpoint did the
* agent restore? The evidence is the agent's own report (top-level assistant
* text plus the final result), never tool output. Restore has to inspect the
* candidates to find the one whose title matches, so every checkpoint body can
* appear in Bash or Read output without being the restored context.
*/
export interface FragmentRestoreRun {
output?: string;
transcript?: any[];
}
export function agentReport(result: FragmentRestoreRun): string {
const parts: string[] = [];
for (const event of result.transcript || []) {
if (event?.type !== 'assistant' || event.parent_tool_use_id) continue;
for (const block of event.message?.content || []) {
if (block?.type === 'text' && typeof block.text === 'string') parts.push(block.text);
}
}
if (result.output) parts.push(result.output);
return parts.join('\n');
}
export function fragmentRestoreVerdict(
result: FragmentRestoreRun,
markers: { restored: string; others: string[] },
): { loadedTarget: boolean; didNotLoadOthers: boolean } {
const report = agentReport(result);
return {
loadedTarget: report.includes(markers.restored),
didNotLoadOthers: markers.others.every((marker) => !report.includes(marker)),
};
}