Skip to content

Commit 4a644dc

Browse files
fercgomesclaude
andcommitted
feat(bench): scenario drivers + safe bench-task targeting
--scenario switch|longout|thread; thread/longout navigate to the dedicated bench task by id and refuse to send turns into any other task. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 69dcc3c commit 4a644dc

1 file changed

Lines changed: 27 additions & 1 deletion

File tree

scripts/bench-memory-run.mjs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,33 @@ async function sendTurn(page, prompt, doneMarker) {
125125
return Date.now() - started;
126126
}
127127

128-
/** N cheap agent turns in the restored thread. */
128+
/**
129+
* Navigate to the dedicated local bench task before sending anything — the
130+
* restored-at-boot task can be a real work task, and benchmark turns must
131+
* never land in one.
132+
*/
133+
async function openBenchTask(page) {
134+
const taskId = arg("thread-task-id", "5feefee1-c818-4931-84c7-e4a68d37b4f0");
135+
const title = arg("thread-title", "Casual greeting");
136+
await page.evaluate((id) => {
137+
window.location.hash = `#/code/tasks/${id}`;
138+
}, taskId);
139+
await page.waitForTimeout(6000);
140+
const header = await page
141+
.locator("span.rt-truncate")
142+
.first()
143+
.textContent()
144+
.catch(() => "");
145+
if (!header?.includes(title)) {
146+
throw new Error(
147+
`refusing to send benchmark turns: open task is "${header}", expected "${title}"`,
148+
);
149+
}
150+
}
151+
152+
/** N cheap agent turns in the dedicated bench thread. */
129153
async function driveThread(page) {
154+
await openBenchTask(page);
130155
const turns = [];
131156
for (let i = 0; i < messageCount; i++) {
132157
const token = `pong-${label}-${i}`;
@@ -146,6 +171,7 @@ async function driveThread(page) {
146171
* exercising event streaming + conversation rendering, then a settle.
147172
*/
148173
async function driveLongOutput(page) {
174+
await openBenchTask(page);
149175
const token = `longout-${label}`;
150176
const ms = await sendTurn(
151177
page,

0 commit comments

Comments
 (0)