ravensight-playtest 0.12.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -1
- package/docs/MOBILE.md +1 -1
- package/package.json +3 -3
- package/src/api/client.js +10 -1
- package/src/cli.js +29 -2
- package/src/commands/hosted.js +15 -0
- package/src/commands/run.js +89 -8
- package/src/run/anygame/index.js +1 -1
- package/src/run/args.js +24 -0
- package/src/run/budgetReserve.js +70 -8
- package/src/run/choiceCheck.js +26 -7
- package/src/run/drivers/web.js +136 -5
- package/src/run/judge.js +19 -5
- package/src/run/livesite/browser.js +316 -0
- package/src/run/livesite/hosts.js +107 -0
- package/src/run/livesite/network.js +117 -0
- package/src/run/livesite/options.js +167 -0
- package/src/run/livesite/resolver.js +78 -0
- package/src/run/livesite/run.js +113 -0
- package/src/run/personaLoop.js +282 -32
- package/src/run/proxyClient.js +5 -1
- package/src/run/redaction.js +191 -0
- package/src/run/report.js +5 -2
- package/src/run/reportChecks.js +119 -26
- package/src/run/resume.js +30 -3
- package/src/run/sdkSession.js +114 -0
- package/src/run/state.js +3 -1
- package/src/run/stillWatch.js +123 -0
- package/src/run/tooFast.js +116 -0
- package/src/run/transcript.js +3 -1
- package/src/run/usage.js +3 -1
package/src/run/personaLoop.js
CHANGED
|
@@ -6,14 +6,16 @@ import { prepareMessages, repairLastTurn, frozenEnds, frozenEnd, createCacheLayo
|
|
|
6
6
|
import { callStepWithRetry, ProxyError, STEPS } from './model.js';
|
|
7
7
|
import { RUN_FILES } from './paths.js';
|
|
8
8
|
import { requestBytes, reserveDecision } from './budgetReserve.js';
|
|
9
|
-
import { measureActInput } from './inputMeasurement.js';
|
|
9
|
+
import { measureActInput, supportsImageMeasurement } from './inputMeasurement.js';
|
|
10
10
|
import { completionClaim, completionCriteria, completionPrompt, completionRepairPrompt, MAX_COMPLETION_TEXT } from './completion.js';
|
|
11
11
|
import { createScreenshotKeeper } from './screenshots.js';
|
|
12
|
-
import { checkBriefChoice, screensForCheck, writeChoiceIntoMarkdown, CHOICE_CHECK_FILE } from './choiceCheck.js';
|
|
12
|
+
import { checkBriefChoice, choiceCheckRequest, insertUnderHeading, screensForCheck, writeChoiceIntoMarkdown, CHOICE_CHECK_FILE, CHOICE_CHECK_MAX_TOKENS } from './choiceCheck.js';
|
|
13
|
+
import { thinkingTime, timerExpiryClaim, tooFastLine, tooFastNote } from './tooFast.js';
|
|
13
14
|
import { declinedAnswer, declinedPrompt, declinedStopDetail, NEUTRAL_RESTATEMENT } from './refusal.js';
|
|
14
15
|
import { createPlayClock, clockStopDetail, timeLeftAside } from './playClock.js';
|
|
15
16
|
import { appendNormalisedMarkdown, checkEvidence, createReportValidator, lintMarkdownSections, normaliseEnums, normaliseEvidence, normaliseReproSteps, repairInstruction, REQUIRED_MARKDOWN_SECTIONS, stampReport, stripTrailingToolMarkup, writeReportFiles } from './report.js';
|
|
16
17
|
import { assertNoSecrets, scanForSecrets } from './secretScan.js';
|
|
18
|
+
import { redactText } from './redaction.js';
|
|
17
19
|
import { ACTION_TOOLS, NEW_TOOL_NAMES, REPORT_TOOLS, executeTool, expectationOf, modelFrameOf, toolResult, toolsFor, NEWEST_TOOL_NAMES } from './tools.js';
|
|
18
20
|
import {
|
|
19
21
|
CAPABILITY_HEADING, DIALOGS_HEADING, EVIDENCE_HEADING, MAX_WIN_CONTINUES, RUNNER_FINDINGS_HEADING, WIN_TEXT,
|
|
@@ -36,13 +38,15 @@ import { sweepTurnedAway } from './claimGate.js';
|
|
|
36
38
|
import { claimShape, judgeIssue, legacyIssue, impressionOf } from './judge.js';
|
|
37
39
|
import { EVENTS_RULE, eventsBlock, eventsReportLines, eventsUsage, withEventEvidence } from './events.js';
|
|
38
40
|
import { memoryBlock, extractLocalNotes, gameMemoryBody } from './gameMemory.js';
|
|
39
|
-
import { CLAIM_SYSTEM, CLAIM_WIRE, claimText, claimRead, claimMessage } from './claimwords.js';
|
|
40
|
-
import { claimCheckSystem, claimReply, claimFormatRepair, MAX_CLAIM_REPLY_TEXT } from './claimProtocol.js';
|
|
41
|
+
import { CLAIM_SYSTEM, CLAIM_WIRE, checkSaid, claimText, claimRead, claimMessage } from './claimwords.js';
|
|
42
|
+
import { CLAIM_FAULT_SYSTEM, claimCheckSystem, claimReply, claimFormatRepair, MAX_CLAIM_REPLY_TEXT } from './claimProtocol.js';
|
|
41
43
|
import { captureNotes, createCaptureWatch, rewriteStaleEvidence, staleSentence } from './captureCheck.js';
|
|
42
44
|
import { gameRefusal } from './gameRefusal.js';
|
|
43
45
|
import { BUILT_IN_NOISE, expectedNoiseForPrompt, isExpectedNoise } from './noise.js';
|
|
44
|
-
import { cutFindingFrames, moodOf, replayCapabilityNote, replayFindings, replayWebFindings, screenOf, traceWebInputs } from './reportChecks.js';
|
|
46
|
+
import { cutFindingFrames, moodOf, replayCapabilityNote, replayFindings, replayWebFindings, screenOf, traceWebInputs, watchClaimsStill } from './reportChecks.js';
|
|
45
47
|
import { pngFingerprint, screenDelta, significant } from './pixels.js';
|
|
48
|
+
import { watchWebStill } from './stillWatch.js';
|
|
49
|
+
import { refusedEventsBody, refusedReportInstruction, sessionRefusal } from './sdkSession.js';
|
|
46
50
|
import { mkdtemp } from 'node:fs/promises';
|
|
47
51
|
import os from 'node:os';
|
|
48
52
|
import { MIN_PASSWORD_CHARS } from '../briefLocal.js';
|
|
@@ -317,7 +321,7 @@ export async function runPersona(args) {
|
|
|
317
321
|
// not send, findings it watched happen, dialogs and their answers, and the
|
|
318
322
|
// edge behaviour checks. Kept out here so a report written from the step
|
|
319
323
|
// log after a failure still carries them.
|
|
320
|
-
const honesty = { capability: createCapabilityLedger(), findings: [], dialogs: [], edge: null, video: null, traceSteps: new Map(), tester: createTesterLedger() };
|
|
324
|
+
const honesty = { capability: createCapabilityLedger(), findings: [], dialogs: [], edge: null, video: null, traceSteps: new Map(), tester: createTesterLedger(), timing: createTiming() };
|
|
321
325
|
let imageBudget = maxImages;
|
|
322
326
|
|
|
323
327
|
await mkdir(path.join(runDirectory, 'screenshots'), { recursive: true });
|
|
@@ -426,8 +430,24 @@ export async function runPersona(args) {
|
|
|
426
430
|
if (args.signal?.aborted || heartbeat?.canceled) throw new Error('The playthrough was interrupted before reporting.');
|
|
427
431
|
onProgress({ phase: 'reporting', persona: persona.slug });
|
|
428
432
|
|
|
433
|
+
// A web run's replays: the watch the claim judge asks for a claim that nothing happens (./stillWatch.js), and the replay of
|
|
434
|
+
// the findings after the report, which writes the watch's results as they are rather than playing them again.
|
|
435
|
+
const playMs = Date.parse(endedAt) - Date.parse(startedAt);
|
|
436
|
+
const differs = (a, b) => { const delta = screenDelta(a, b); return delta === null || significant(delta); };
|
|
437
|
+
const webReplay = args.replayFindings !== false && Array.isArray(driver.webTrace) && typeof args.replayDriver === 'function'
|
|
438
|
+
? { trace: driver.webTrace, traceSteps: honesty.traceSteps, makeDriver: args.replayDriver, target, viewport, playMs, signal: args.signal, fingerprint: pngFingerprint, differs,
|
|
439
|
+
tempDir: () => mkdtemp(path.join(os.tmpdir(), 'rs-replay-')), watch: (replayDriver, at) => watchWebStill(replayDriver, { ...at, fingerprint: pngFingerprint, differs }) }
|
|
440
|
+
: null;
|
|
441
|
+
const watchedStill = new Map();
|
|
442
|
+
const stillReplay = webReplay ? async wanted => {
|
|
443
|
+
const answered = await watchClaimsStill({ wanted, ...webReplay });
|
|
444
|
+
for (const { id, title } of wanted) if (answered.get(id)?.replay) watchedStill.set(id, { title, replay: answered.get(id).replay });
|
|
445
|
+
return answered;
|
|
446
|
+
} : null;
|
|
447
|
+
|
|
429
448
|
const written = await reportPhase({
|
|
430
449
|
claimGate: args.claimGate === 'legacy' ? 'legacy' : 'judge',
|
|
450
|
+
stillReplay,
|
|
431
451
|
client,
|
|
432
452
|
jobId,
|
|
433
453
|
runId,
|
|
@@ -459,11 +479,14 @@ export async function runPersona(args) {
|
|
|
459
479
|
// the step log per finding. It never changes the report or fails the run.
|
|
460
480
|
if (args.replayFindings !== false) {
|
|
461
481
|
const replayed = Array.isArray(driver.webTrace)
|
|
462
|
-
? replayWebFindings({ report: written.report, index: written.index || [], traceSteps: honesty.traceSteps, trace: driver.webTrace, makeDriver: args.replayDriver, target, viewport, playMs
|
|
463
|
-
fingerprint: pngFingerprint, differs
|
|
482
|
+
? replayWebFindings({ report: written.report, index: written.index || [], traceSteps: honesty.traceSteps, trace: driver.webTrace, makeDriver: args.replayDriver, target, viewport, playMs, transcript, signal: args.signal,
|
|
483
|
+
fingerprint: pngFingerprint, differs, tempDir: () => mkdtemp(path.join(os.tmpdir(), 'rs-replay-')),
|
|
484
|
+
// A finding placed at an input that changed nothing is watched on the last replay, as on a cloud run; a claim the judge
|
|
485
|
+
// already had watched is written as it was (only the judge's watched claims say nothing happens by their words).
|
|
486
|
+
...(webReplay ? { watch: webReplay.watch } : {}), prior: watchedFor(written.report, watchedStill),
|
|
464
487
|
// [tester hook] The probes that found something are run once more at the end of this one replay (./testerProbes.js probeObserver).
|
|
465
488
|
observer: probeObserver({ probes: honesty.probes, report: written.report, actionRecords, signal: args.signal }) })
|
|
466
|
-
: replayFindings({ report: written.report, index: written.index || [], traceSteps: honesty.traceSteps, runDirectory, driver, playMs
|
|
489
|
+
: replayFindings({ report: written.report, index: written.index || [], traceSteps: honesty.traceSteps, runDirectory, driver, playMs, transcript, signal: args.signal });
|
|
467
490
|
await replayed
|
|
468
491
|
.then(pass => {
|
|
469
492
|
// A game that started differently on replay is a limit of the runner: a capability note, never a finding.
|
|
@@ -486,6 +509,8 @@ export async function runPersona(args) {
|
|
|
486
509
|
// What the game's own events measured, for usage.json (./events.js eventsUsage).
|
|
487
510
|
const eventRun = gameEventsRun(honesty);
|
|
488
511
|
outcome.gameEvents = eventRun ? eventsUsage(eventRun) : null;
|
|
512
|
+
// A session the server refused: no game events, and why, in usage.json too.
|
|
513
|
+
if (honesty.sdkSession) outcome.gameEvents = { ...(outcome.gameEvents || { total: 0 }), sessionRefused: { status: honesty.sdkSession.status, error: honesty.sdkSession.error, key: honesty.sdkSession.key, tagged: honesty.sdkSession.tagged } };
|
|
489
514
|
// The notes this run hands on to the next playtest of the game, when the game's memory asked for them (./gameMemory.js).
|
|
490
515
|
if (memory && memory.save === true) {
|
|
491
516
|
const handed = gameMemoryBody(memory, extractLocalNotes({ digest: honesty.anygame ? honesty.anygame.digest() : null, turnedAway: written.turnedAway || [] }));
|
|
@@ -543,7 +568,8 @@ export async function runPersona(args) {
|
|
|
543
568
|
// them, they may be symptoms of the crash, and what report.json holds
|
|
544
569
|
// becomes findings, analyst memory and graph nodes on the server.
|
|
545
570
|
findings: [],
|
|
546
|
-
|
|
571
|
+
// A live site that did not load or refused the sign-in already says what happened and what to change.
|
|
572
|
+
reason: error && error.plainReason ? detail : `The run stopped on an error before its report was written: ${detail}`,
|
|
547
573
|
bareReason: 'The run stopped on an error before its report was written.'
|
|
548
574
|
});
|
|
549
575
|
}
|
|
@@ -768,6 +794,53 @@ export function aboutRunnerLimit(finding) {
|
|
|
768
794
|
return RUNNER_LIMIT_TEXT.test(`${(finding && finding.title) || ''}\n${(finding && finding.description) || ''}`);
|
|
769
795
|
}
|
|
770
796
|
|
|
797
|
+
/* ------------------------------------- a game timer the playtester's own thinking ran out (./tooFast.js) */
|
|
798
|
+
|
|
799
|
+
/** Why the runner moves a finding to the [too_fast] capability note; see ./tooFast.js. */
|
|
800
|
+
export const TOO_FAST_REASON = 'a game timer that ran out while the playtester was still deciding, a limit of the runner [too_fast], not the game';
|
|
801
|
+
|
|
802
|
+
/** The run's record of the turns the game kept running through while the model thought. */
|
|
803
|
+
export function createTiming() {
|
|
804
|
+
return { running: 0, thinkMs: [] };
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Whether the game kept running while the playtester thought: a native run, a
|
|
809
|
+
* web page that is not a frozen canvas, --realtime. On such a run a game timer
|
|
810
|
+
* can run out between two inputs however they are played.
|
|
811
|
+
*
|
|
812
|
+
* @param {Object|null} honesty
|
|
813
|
+
* @returns {boolean}
|
|
814
|
+
*/
|
|
815
|
+
export function realTimeRun(honesty) {
|
|
816
|
+
return Boolean(honesty && honesty.timing && honesty.timing.running > 0);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/** A note of the persona's that says a game timer ran out on it (praise and the runner's own lines aside). */
|
|
820
|
+
export function timerNote(note) {
|
|
821
|
+
return Boolean(note && !note.automatic && note.kind !== 'good' && timerExpiryClaim(note.text));
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/** What the report step is told on a run whose game kept running while the playtester thought. */
|
|
825
|
+
export function tooFastPrompt(timing) {
|
|
826
|
+
const pace = timing && timing.turns > 0 && timing.medianSeconds !== null ? `: about ${timing.medianSeconds} s a turn, up to ${timing.maxSeconds} s` : '';
|
|
827
|
+
return `The game kept running while you decided${pace}. A game timer or countdown that ran out between your inputs (a "Time is up" screen, a question, a life or a round lost to the clock, a timing window too tight to answer in) is a limit of this runner, not of the game: write it in "What this run didn't cover" as a line starting with [too_fast], never as a finding of any severity or category. The runner moves a finding that says so.`;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Say what was moved as the [too_fast] capability note: a line under "What
|
|
832
|
+
* this run didn't cover" (which `run` prints with its fix) and the runner's own
|
|
833
|
+
* capability list.
|
|
834
|
+
*
|
|
835
|
+
* @returns {string} the markdown with the line
|
|
836
|
+
*/
|
|
837
|
+
function sayTooFast({ markdown, moved, honesty, transcript = null }) {
|
|
838
|
+
const timing = thinkingTime(honesty && honesty.timing ? honesty.timing.thinkMs : []);
|
|
839
|
+
const note = tooFastNote(timing);
|
|
840
|
+
if (honesty && honesty.capability && honesty.capability.add(note) && transcript) transcript.write({ kind: 'capability_note', input: note.input, reason: note.reason });
|
|
841
|
+
return insertUnderHeading(String(markdown || ''), "## What this run didn't cover", tooFastLine(moved, timing));
|
|
842
|
+
}
|
|
843
|
+
|
|
771
844
|
async function playLoop({
|
|
772
845
|
// The observation and action lines of the transcript, kept for the report
|
|
773
846
|
// step's "Actions you took" list and for a partial report.
|
|
@@ -816,6 +889,8 @@ async function playLoop({
|
|
|
816
889
|
log = () => {}
|
|
817
890
|
}) {
|
|
818
891
|
const system = buildSystem({ skill, persona, brief, localBrief, intentNotes, driverName, target, maxActions, runId });
|
|
892
|
+
// How long the model thought on each turn the game kept running through (./tooFast.js).
|
|
893
|
+
const timing = honesty.timing || (honesty.timing = createTiming());
|
|
819
894
|
const identity = runIdentity({ persona, runId });
|
|
820
895
|
const secrets = secretsOf(localBrief);
|
|
821
896
|
const noisePatterns = (localBrief && Array.isArray(localBrief.expected_noise)) ? localBrief.expected_noise : [];
|
|
@@ -922,22 +997,34 @@ async function playLoop({
|
|
|
922
997
|
const recentActUnits = [];
|
|
923
998
|
|
|
924
999
|
/**
|
|
925
|
-
* Whether the next act turn would leave too little for the report.
|
|
926
|
-
* from the act request about to be sent and the report
|
|
927
|
-
* be built now
|
|
1000
|
+
* Whether the next act turn would leave too little for the report phase.
|
|
1001
|
+
* Sized from the act request about to be sent and the report phase's
|
|
1002
|
+
* requests as they would be built now: the brief choice check, the report
|
|
1003
|
+
* request (sent twice when report.md and report.json come in two turns) and
|
|
1004
|
+
* a claim check for each issue noted so far; see ./budgetReserve.js.
|
|
928
1005
|
*/
|
|
929
1006
|
const reserveCheck = () => {
|
|
930
1007
|
const spend = modelBudgetUsd ? ledger.spendEstimate() : null;
|
|
931
1008
|
if (!spend) return { stop: false, known: false, figures: {} };
|
|
932
1009
|
const prepared = withPlayCacheBreakpoint(prepareMessages(messages, { maxImages: imageBudget, keepObservations, layout: cacheLayout }), cacheLayout);
|
|
933
1010
|
const measured = measureActInput({ messages: prepared, max_tokens: ACT_MAX_TOKENS, stream: true, system, tools: completionRepairPending ? [] : playTools }, inputMeasurement, { controller });
|
|
1011
|
+
const actionLog = actionLogFrom(actionRecords);
|
|
934
1012
|
const reportRequest = buildReportRequest({
|
|
935
1013
|
skill: reportSkill || skill, schemas, persona, brief, localBrief, intentNotes, driverName, target, runId, jobId,
|
|
936
|
-
play: { actionsTaken: actions, quitReason: 'budget_exhausted', quitDetail: RESERVE_STOP_DETAIL, actionLog
|
|
1014
|
+
play: { actionsTaken: actions, quitReason: 'budget_exhausted', quitDetail: RESERVE_STOP_DETAIL, actionLog, records: actionRecords,
|
|
937
1015
|
completionClaim: completionAccount, completionAttempts },
|
|
938
|
-
notes, observations, screenshots
|
|
1016
|
+
notes, observations, screenshots, honesty
|
|
939
1017
|
});
|
|
940
1018
|
const reportChars = requestBytes({ messages: reportRequest.messages, max_tokens: REPORT_MAX_TOKENS, stream: true, system: reportRequest.system, tools: REPORT_TOOLS });
|
|
1019
|
+
// The choice check and a claim check each send one picture: sized with the newest one play has, at the server's
|
|
1020
|
+
// advertised image reserve. Without that rule (an older server, a controller with its own catalog) a picture would
|
|
1021
|
+
// be counted as its encoded length, which no call of the report phase was ever reserved at; they are sized without
|
|
1022
|
+
// it there, as before 0.13.0, and a refused check still costs only the check.
|
|
1023
|
+
const frame = controller === 'standard' && supportsImageMeasurement(inputMeasurement) ? newestFrame(prepared) : null;
|
|
1024
|
+
const choiceRequest = brief ? choiceCheckRequest({ briefText: choiceBriefText({ brief, intentNotes, secrets }), actionText: scrubSecrets(actionLogLines(actionLog), secrets), records: actionRecords, frame }) : null;
|
|
1025
|
+
const choice = choiceRequest ? measureActInput({ ...choiceRequest, max_tokens: CHOICE_CHECK_MAX_TOKENS, stream: true }, inputMeasurement, { controller }) : null;
|
|
1026
|
+
const claimCount = claimChecksAhead(notes, { realTime: realTimeRun(honesty) });
|
|
1027
|
+
const claim = claimCount > 0 ? measureActInput(claimCheckSizingRequest(frame), inputMeasurement, { controller }) : null;
|
|
941
1028
|
const decision = reserveDecision({
|
|
942
1029
|
usdMax: modelBudgetUsd,
|
|
943
1030
|
spend,
|
|
@@ -948,7 +1035,9 @@ async function playLoop({
|
|
|
948
1035
|
// The tools-free completion repair turn cannot read the cached prompt.
|
|
949
1036
|
actUncached: completionRepairPending,
|
|
950
1037
|
reportChars,
|
|
951
|
-
reportMaxTokens: REPORT_MAX_TOKENS
|
|
1038
|
+
reportMaxTokens: REPORT_MAX_TOKENS,
|
|
1039
|
+
choice: choice ? { chars: choice.chars, imageUnits: choice.imageUnits, maxTokens: CHOICE_CHECK_MAX_TOKENS } : null,
|
|
1040
|
+
claims: claim ? { count: claimCount, chars: claim.chars, imageUnits: claim.imageUnits, maxTokens: CLAIM_CHECK_MAX_TOKENS } : null
|
|
952
1041
|
});
|
|
953
1042
|
if (decision.known) Object.assign(decision.figures, { act_measurement: measured.measurement, act_images: measured.images, act_image_units: measured.imageUnits });
|
|
954
1043
|
return decision;
|
|
@@ -1134,7 +1223,13 @@ async function playLoop({
|
|
|
1134
1223
|
ledger.record({ model: answer.model, usage: answer.usage, ms: Date.now() - askedAt });
|
|
1135
1224
|
transcript.write({ kind: 'usage', step: 'act', turn: turns, ...usageLine(answer.usage) });
|
|
1136
1225
|
// The time the model took is play time only when the game ran through it.
|
|
1137
|
-
|
|
1226
|
+
const thoughtMs = Date.now() - askedAt;
|
|
1227
|
+
const frozenWhileThinking = Boolean(driver && driver.frozenBetweenActions);
|
|
1228
|
+
clock.thought(thoughtMs, frozenWhileThinking);
|
|
1229
|
+
if (!frozenWhileThinking) {
|
|
1230
|
+
timing.running += 1;
|
|
1231
|
+
timing.thinkMs.push(thoughtMs);
|
|
1232
|
+
}
|
|
1138
1233
|
recentActUnits.push(ledger.lastCallUnits || 0);
|
|
1139
1234
|
if (recentActUnits.length > 3) recentActUnits.shift();
|
|
1140
1235
|
// The warn turn is a turn the developer paid for, so its tool calls are
|
|
@@ -1767,6 +1862,13 @@ async function playLoop({
|
|
|
1767
1862
|
const kept = driver.gameEvents.record();
|
|
1768
1863
|
if (kept.total > 0) transcript.write({ kind: 'game_events', total: kept.total, kept: kept.kept, clock: kept.clock, names: kept.names });
|
|
1769
1864
|
}
|
|
1865
|
+
// The game's own SDK asked for its session and the server refused it, so none of its events reached the run (./sdkSession.js).
|
|
1866
|
+
const refusal = driver && typeof driver.sdkSessions === 'function' ? sessionRefusal(await Promise.resolve().then(() => driver.sdkSessions()).catch(() => null)) : null;
|
|
1867
|
+
if (refusal) {
|
|
1868
|
+
honesty.sdkSession = refusal;
|
|
1869
|
+
transcript.write({ kind: 'game_events_refused', status: refusal.status, error: refusal.error, key: refusal.key, tagged: refusal.tagged, times: refusal.times });
|
|
1870
|
+
log(refusedEventsBody(refusal));
|
|
1871
|
+
}
|
|
1770
1872
|
if (completionRepairPending) transcript.write({ kind: 'brief_completion_repair_unavailable', reason: quitReason, detail: quitDetail, independently_verified: false });
|
|
1771
1873
|
return {
|
|
1772
1874
|
actionsTaken: actions,
|
|
@@ -1825,6 +1927,8 @@ async function reportPhase({
|
|
|
1825
1927
|
endedAt,
|
|
1826
1928
|
// 'judge' (the claim judge) or 'legacy' (a run whose findings decide money elsewhere: ./judge.js legacyIssue).
|
|
1827
1929
|
claimGate = 'judge',
|
|
1930
|
+
// A web run's watch of a claim that nothing happens, asked by the judge (./stillWatch.js); null for any other run.
|
|
1931
|
+
stillReplay = null,
|
|
1828
1932
|
log
|
|
1829
1933
|
}) {
|
|
1830
1934
|
// The report step never sees the test account: it has nothing to sign in
|
|
@@ -1842,7 +1946,7 @@ async function reportPhase({
|
|
|
1842
1946
|
client,
|
|
1843
1947
|
jobId,
|
|
1844
1948
|
runId,
|
|
1845
|
-
briefText:
|
|
1949
|
+
briefText: choiceBriefText({ brief, intentNotes, secrets }),
|
|
1846
1950
|
actionText: scrubSecrets(actionLogLines(play.actionLog), secrets),
|
|
1847
1951
|
records: play.records || [],
|
|
1848
1952
|
frame: play.finalFrame || null,
|
|
@@ -1882,6 +1986,12 @@ async function reportPhase({
|
|
|
1882
1986
|
// still fits.
|
|
1883
1987
|
const escalate = shouldEscalate(persona) && !play.budgetWarned && !play.budgetExceeded && !play.reserveStopped;
|
|
1884
1988
|
let maxTokens = REPORT_MAX_TOKENS;
|
|
1989
|
+
// A warned run has a fifth of its budget left at most. A first report cut off
|
|
1990
|
+
// at the ceiling spends most of that and leaves no room to ask again
|
|
1991
|
+
// (pt_run_e4b5ec8995a5ae70ef74: cut off at 4096, then only 2229 fit, so the
|
|
1992
|
+
// report came from the notes and the run read as out of budget). So the
|
|
1993
|
+
// first ask already says how much room there is.
|
|
1994
|
+
if (play.budgetWarned) askWithinBudget(messages, maxTokens);
|
|
1885
1995
|
let shrunk = false;
|
|
1886
1996
|
let lastCandidate = null;
|
|
1887
1997
|
// The largest output ceiling a turn has already been cut off at. A retry
|
|
@@ -2011,7 +2121,7 @@ async function reportPhase({
|
|
|
2011
2121
|
? { ...reproFixed.report, partial: true, quit_reason: 'cost_cap', quit_detail: play.quitDetail }
|
|
2012
2122
|
: reproFixed.report;
|
|
2013
2123
|
const capped = normalised ? capNetworkOnlyFindings(stampReport(reportCandidate, facts), { notes, screenshots }) : null;
|
|
2014
|
-
const runnerDrop = capped ? dropRunnerRejectedFindings(capped, { notes, observations }) : { report: null, dropped: [] };
|
|
2124
|
+
const runnerDrop = capped ? dropRunnerRejectedFindings(capped, { notes, observations, realTime: realTimeRun(honesty) }) : { report: null, dropped: [] };
|
|
2015
2125
|
for (const entry of runnerDrop.dropped) {
|
|
2016
2126
|
transcript.write({ kind: 'finding_dropped', id: entry.finding.id, severity: entry.finding.severity, title: entry.finding.title, reason: entry.reason });
|
|
2017
2127
|
}
|
|
@@ -2160,7 +2270,7 @@ async function reportPhase({
|
|
|
2160
2270
|
let impressions = [];
|
|
2161
2271
|
if (!shrunk && !play.budgetExceeded) {
|
|
2162
2272
|
const impressionsAllowed = Boolean(reportSchema && reportSchema.properties && reportSchema.properties.impressions);
|
|
2163
|
-
const checked = await checkClaimsAgainstScreenshots({ client, jobId, runId, report, screenshots, runDirectory, ledger, transcript, log, frames, measured: new Set(mergedAnchors(honesty).keys()), observations, notes, index: where, run: eventRun, impressionsAllowed: impressionsAllowed && claimGate !== 'legacy', gate: claimGate, secrets });
|
|
2273
|
+
const checked = await checkClaimsAgainstScreenshots({ client, jobId, runId, report, screenshots, runDirectory, ledger, transcript, log, frames, measured: new Set(mergedAnchors(honesty).keys()), observations, notes, index: where, run: eventRun, impressionsAllowed: impressionsAllowed && claimGate !== 'legacy', gate: claimGate, secrets, stillReplay });
|
|
2164
2274
|
report = checked.report;
|
|
2165
2275
|
turnedAway = checked.turnedAway;
|
|
2166
2276
|
impressions = checked.impressions;
|
|
@@ -2177,6 +2287,9 @@ async function reportPhase({
|
|
|
2177
2287
|
markdown = rewriteMarkdown(markdown, droppedByRunner.map(entry => entry.finding), report.findings || [], RUNNER_DROPPED_SECTION);
|
|
2178
2288
|
log(`dropped ${droppedByRunner.length} finding(s) the runner's evidence rules refuse: ${droppedByRunner.map(entry => `${entry.finding.id} (${entry.reason})`).join(', ')}`);
|
|
2179
2289
|
}
|
|
2290
|
+
// A game timer the playtester's own thinking ran out is said as the [too_fast] capability note it is.
|
|
2291
|
+
const timerMoved = droppedByRunner.filter(entry => entry.reason === TOO_FAST_REASON).map(entry => ({ id: entry.finding.id, title: entry.finding.title }));
|
|
2292
|
+
if (timerMoved.length > 0) markdown = sayTooFast({ markdown, moved: timerMoved, honesty, transcript });
|
|
2180
2293
|
// The uploaded pair agree: report.md says the severity report.json does.
|
|
2181
2294
|
if (downgradedByRunner.length > 0) markdown = rewriteDowngradedMarkdown(markdown, downgradedByRunner);
|
|
2182
2295
|
// A claim the checks turned away, or kept as an impression, leaves every part of report.md that stood on it as an issue.
|
|
@@ -2189,6 +2302,8 @@ async function reportPhase({
|
|
|
2189
2302
|
const lines = eventsReportLines(eventRun, { findings: report.findings || [], turnedAway });
|
|
2190
2303
|
if (lines.length > 0) markdown = replaceSection(markdown, EVENTS_HEADING, lines.slice(2).join('\n').replace(/\s+$/, ''));
|
|
2191
2304
|
}
|
|
2305
|
+
// The game's own SDK was refused its session: said plainly where its events would be, never left to read as benign.
|
|
2306
|
+
if (honesty && honesty.sdkSession && !(eventRun && eventRun.gameEvents && eventRun.gameEvents.total > 0)) markdown = replaceSection(markdown, EVENTS_HEADING, refusedEventsBody(honesty.sdkSession));
|
|
2192
2307
|
// What a screenshot shows comes from the picture: one taken while the picture lagged the game says so.
|
|
2193
2308
|
markdown = rewriteStaleEvidence(markdown, (screenshots || []).filter(shot => shot && shot.stale && shot.relativePath));
|
|
2194
2309
|
if (choiceCheck) {
|
|
@@ -2248,6 +2363,16 @@ async function reportPhase({
|
|
|
2248
2363
|
return { report, markdown, lint, index: honest.index, turnedAway };
|
|
2249
2364
|
}
|
|
2250
2365
|
|
|
2366
|
+
/**
|
|
2367
|
+
* The watch results the judge's replay made, for the findings of the written
|
|
2368
|
+
* report that are the claims it watched (the same id and title: a runner's own
|
|
2369
|
+
* finding added after the judge may take the id of a claim it turned away).
|
|
2370
|
+
*/
|
|
2371
|
+
export function watchedFor(report, watched) {
|
|
2372
|
+
const findings = report && Array.isArray(report.findings) ? report.findings : [];
|
|
2373
|
+
return new Map([...watched].filter(([id, entry]) => findings.some(finding => finding && finding.id === id && finding.title === entry.title)).map(([id, entry]) => [id, entry.replay]));
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2251
2376
|
/** The heading of the report's section on the game's own events, the hosted runner's own. */
|
|
2252
2377
|
export const EVENTS_HEADING = '## Measured from the game\'s own events';
|
|
2253
2378
|
|
|
@@ -2344,6 +2469,74 @@ export const CLAIM_SEVERITIES = Object.freeze(['blocker', 'major', 'minor', 'cos
|
|
|
2344
2469
|
/** Output ceiling for one claim check: the answer is a few words ("as designed" may quote the game's message). */
|
|
2345
2470
|
export const CLAIM_CHECK_MAX_TOKENS = 32;
|
|
2346
2471
|
|
|
2472
|
+
/* The report phase's calls as the budget reserve sizes them during play (./budgetReserve.js reportPhaseUnits). */
|
|
2473
|
+
|
|
2474
|
+
/** The brief as the choice check is shown it (./choiceCheck.js): the brief and its design intent notes, the brief's secrets taken out. */
|
|
2475
|
+
export function choiceBriefText({ brief, intentNotes, secrets = [] }) {
|
|
2476
|
+
return scrubSecrets(`${briefForPrompt(brief)}\n${intentNotesForPrompt(brief, intentNotes)}`, secrets);
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
/**
|
|
2480
|
+
* The newest picture in a request's messages, as a frame (`{data, mediaType}`), or null when it has none: what
|
|
2481
|
+
* the choice check and a claim check are sized with during play, one picture each, as they send.
|
|
2482
|
+
*
|
|
2483
|
+
* @param {Array<Object>} messages
|
|
2484
|
+
* @returns {{data: string, mediaType: string}|null}
|
|
2485
|
+
*/
|
|
2486
|
+
export function newestFrame(messages) {
|
|
2487
|
+
const pictureOf = block => (block && block.type === 'image' && block.source && block.source.type === 'base64' && typeof block.source.data === 'string'
|
|
2488
|
+
? { data: block.source.data, mediaType: block.source.media_type || 'image/png' } : null);
|
|
2489
|
+
for (const message of [...(Array.isArray(messages) ? messages : [])].reverse()) {
|
|
2490
|
+
for (const block of [...(Array.isArray(message && message.content) ? message.content : [])].reverse()) {
|
|
2491
|
+
const found = pictureOf(block) || (block && block.type === 'tool_result' && Array.isArray(block.content) ? [...block.content].reverse().map(pictureOf).find(Boolean) : null);
|
|
2492
|
+
if (found) return found;
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
return null;
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
/**
|
|
2499
|
+
* How many claim checks the report phase can be expected to make: one for each issue the persona noted (a bug,
|
|
2500
|
+
* something confusing, a suggestion), at most MAX_CLAIM_CHECKS. The report's issues come from those notes; a
|
|
2501
|
+
* repeated note counts again, which only keeps more back. Console lines, expected noise and waiting notes are
|
|
2502
|
+
* never asked about, and on a run whose game kept running while the model thought nor is a timer the
|
|
2503
|
+
* playtester ran out: the runner moves it to the [too_fast] note before any check.
|
|
2504
|
+
*
|
|
2505
|
+
* @param {Array<Object>} notes
|
|
2506
|
+
* @param {{realTime?: boolean}} [options]
|
|
2507
|
+
* @returns {number}
|
|
2508
|
+
*/
|
|
2509
|
+
export function claimChecksAhead(notes = [], { realTime = false } = {}) {
|
|
2510
|
+
const issues = (Array.isArray(notes) ? notes : []).filter(note => note && !note.automatic && !note.expected_noise && ['bug', 'confusing', 'suggestion'].includes(note.kind)
|
|
2511
|
+
&& !(realTime && timerNote(note)));
|
|
2512
|
+
return Math.min(MAX_CLAIM_CHECKS, issues.length);
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
/** The widest claim a check asks about: the longest title and description claimText keeps, and three facts. */
|
|
2516
|
+
const WIDEST_CLAIM = Object.freeze({ severity: 'blocker', title: 'x'.repeat(160), description: 'x'.repeat(1200), facts: ['x'.repeat(100), 'x'.repeat(100), 'x'.repeat(100)] });
|
|
2517
|
+
|
|
2518
|
+
/**
|
|
2519
|
+
* One claim check's request at its largest, for the budget reserve: the longest question claimText asks (of each
|
|
2520
|
+
* kind it asks), the longer system prompt, and one picture.
|
|
2521
|
+
*
|
|
2522
|
+
* @param {{data: string, mediaType: string}|null} frame
|
|
2523
|
+
* @returns {Object} a request body
|
|
2524
|
+
*/
|
|
2525
|
+
export function claimCheckSizingRequest(frame) {
|
|
2526
|
+
const questions = [{ cls: 'absence', fault: true }, { cls: 'other', fault: true }, { cls: 'layout', fault: false }, { cls: 'other', fault: false }].map(moment => claimText(WIDEST_CLAIM, moment));
|
|
2527
|
+
const question = questions.reduce((longest, text) => (text.length > longest.length ? text : longest), '');
|
|
2528
|
+
const system = [CLAIM_SYSTEM, CLAIM_FAULT_SYSTEM].reduce((longest, text) => (text.length > longest.length ? text : longest), '');
|
|
2529
|
+
return {
|
|
2530
|
+
messages: [{ role: 'user', content: [
|
|
2531
|
+
...(frame && frame.data ? [{ type: 'image', source: { type: 'base64', media_type: frame.mediaType || 'image/png', data: frame.data } }] : []),
|
|
2532
|
+
{ type: 'text', text: question }
|
|
2533
|
+
] }],
|
|
2534
|
+
max_tokens: CLAIM_CHECK_MAX_TOKENS,
|
|
2535
|
+
stream: true,
|
|
2536
|
+
system
|
|
2537
|
+
};
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2347
2540
|
/**
|
|
2348
2541
|
* The screenshot a finding's claim is checked against: of those it cites, the
|
|
2349
2542
|
* one taken nearest after the latest observation it cites (the later of two on
|
|
@@ -2408,7 +2601,7 @@ export function citedAfterScreenshot(finding, screenshots) {
|
|
|
2408
2601
|
*
|
|
2409
2602
|
* @returns {Promise<{report: Object, turnedAway: Array<Object>, impressions: Array<Object>}>}
|
|
2410
2603
|
*/
|
|
2411
|
-
export async function checkClaimsAgainstScreenshots({ client, jobId, runId, report, screenshots, runDirectory, ledger, transcript, log = () => {}, frames = new Map(), measured = new Set(), observations = [], notes = [], index = null, run = null, impressionsAllowed = true, gate = 'judge', secrets = [] }) {
|
|
2604
|
+
export async function checkClaimsAgainstScreenshots({ client, jobId, runId, report, screenshots, runDirectory, ledger, transcript, log = () => {}, frames = new Map(), measured = new Set(), observations = [], notes = [], index = null, run = null, impressionsAllowed = true, gate = 'judge', secrets = [], stillReplay = null }) {
|
|
2412
2605
|
if (!report || !Array.isArray(report.findings)) return { report, turnedAway: [], impressions: [] };
|
|
2413
2606
|
const placedIndex = Array.isArray(index) ? index : attachWhereToLook(report, { observations, notes, screenshots }).index;
|
|
2414
2607
|
const where = new Map(placedIndex.map(entry => [entry.id, entry]));
|
|
@@ -2519,6 +2712,28 @@ export async function checkClaimsAgainstScreenshots({ client, jobId, runId, repo
|
|
|
2519
2712
|
transcript.write({ kind: 'claim_check', id: finding.id, screenshot: shot.relativePath, ...on, ...(placed.look ? { look: true } : {}), ...record });
|
|
2520
2713
|
checks.set(finding, { ...record, picture: shot.relativePath });
|
|
2521
2714
|
}
|
|
2715
|
+
// A claim that nothing happens, which its picture did not contradict or explain: what the run measured of its input, and a replay
|
|
2716
|
+
// that watched the screen while game time ran (./stillWatch.js, the hosted gate's evidence). Only a web run has the hook.
|
|
2717
|
+
const still = new Map();
|
|
2718
|
+
if (gate !== 'legacy' && typeof stillReplay === 'function') {
|
|
2719
|
+
const wanted = judged.filter(finding => shapes.get(finding).cls === 'stuck' && !['opposite', 'as_designed'].includes(checkSaid(checks.get(finding) || null)));
|
|
2720
|
+
if (wanted.length > 0) {
|
|
2721
|
+
let answered = new Map();
|
|
2722
|
+
let failed = null;
|
|
2723
|
+
try {
|
|
2724
|
+
answered = await stillReplay(wanted.map(finding => ({ id: finding.id, title: finding.title, action: Number.isInteger(where.get(finding.id)?.action) ? where.get(finding.id).action : null })));
|
|
2725
|
+
} catch (error) {
|
|
2726
|
+
failed = String(error && error.message ? error.message : error).split('\n')[0].slice(0, 120);
|
|
2727
|
+
log(`the watch of a claim that nothing happens could not run (${failed}); such a claim is not confirmed by it.`);
|
|
2728
|
+
}
|
|
2729
|
+
for (const finding of wanted) {
|
|
2730
|
+
const answer = (answered instanceof Map && answered.get(finding.id)) || { measured: null, replay: null };
|
|
2731
|
+
still.set(finding, answer);
|
|
2732
|
+
// The control's name comes from the run's own inputs, kept in memory unscrubbed: scrubbed here like every other line.
|
|
2733
|
+
transcript.write(scrubSecrets({ kind: 'still_check', id: finding.id, measured: answer.measured || null, replay: answer.replay || null, ...(failed ? { error: failed } : {}) }, secrets));
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
}
|
|
2522
2737
|
const turnedAway = [];
|
|
2523
2738
|
const impressions = [];
|
|
2524
2739
|
const findings = [];
|
|
@@ -2529,7 +2744,7 @@ export async function checkClaimsAgainstScreenshots({ client, jobId, runId, repo
|
|
|
2529
2744
|
// A run whose findings decide money elsewhere (a fix's verify, a Labs scenario) keeps the gate it had: see ./judge.js legacyIssue.
|
|
2530
2745
|
const outcome = gate === 'legacy'
|
|
2531
2746
|
? legacyIssue(finding, { check: checks.get(finding) || null, marked: Boolean(placed.marked) })
|
|
2532
|
-
: judgeIssue(finding, { check: checks.get(finding) || null, run, step, marked: Boolean(placed.marked) });
|
|
2747
|
+
: judgeIssue(finding, { check: checks.get(finding) || null, run, step, marked: Boolean(placed.marked), still: still.get(finding) || null });
|
|
2533
2748
|
transcript.write({ kind: 'claim_judged', id: finding.id, route: outcome.route, outcome: outcome.outcome, cls: outcome.cls, ...(outcome.basis ? { basis: outcome.basis } : {}), ...(outcome.impression ? { impression: outcome.impression.kind } : {}), ...(outcome.evidence ? { evidence: outcome.evidence } : {}) });
|
|
2534
2749
|
if (outcome.route === 'finding') { findings.push(finding); continue; }
|
|
2535
2750
|
if (outcome.route === 'impression') {
|
|
@@ -2599,6 +2814,7 @@ export function buildReportRequest({ skill, schemas = [], persona, brief, localB
|
|
|
2599
2814
|
...(honesty && honesty.anygame ? [...honesty.anygame.reportLines(), ''] : []),
|
|
2600
2815
|
CAPABILITY_NOTES_INSTRUCTION,
|
|
2601
2816
|
...(capabilityPrompt(driverName, honesty ? honesty.capability.list() : []) ? ['', capabilityPrompt(driverName, honesty ? honesty.capability.list() : [])] : []),
|
|
2817
|
+
...(realTimeRun(honesty) ? ['', tooFastPrompt(thinkingTime(honesty.timing.thinkMs))] : []),
|
|
2602
2818
|
...(honesty && honesty.findings.length > 0 ? ['', `The runner itself saw these happen and adds them to the report as its own findings, with their steps and evidence. Do not write a finding of your own for the same thing; you may refer to them in "Top issues" by their title:\n${honesty.findings.map(finding => `- [${finding.severity}] ${finding.title}: ${finding.description}`).join('\n')}`] : []),
|
|
2603
2819
|
'Notes of kind dialog record a browser dialog the game opened and how it was answered. They are context: a finding only when what the game did after the answer was wrong.',
|
|
2604
2820
|
play.completionClaim
|
|
@@ -2610,6 +2826,7 @@ export function buildReportRequest({ skill, schemas = [], persona, brief, localB
|
|
|
2610
2826
|
'',
|
|
2611
2827
|
'Network notes (failed requests the runner recorded, with the URL and the status; list them under a "Network notes" heading in report.md when there are any):',
|
|
2612
2828
|
networkNoteLines(notes),
|
|
2829
|
+
...(honesty && honesty.sdkSession ? [refusedReportInstruction(honesty.sdkSession)] : []),
|
|
2613
2830
|
'',
|
|
2614
2831
|
'Each note carries "after": the URL and title of the observation that followed it. A blocker or major finding must cite the observation index where the failure is visible, as evidence {"type": "transcript_step", "ref": "observation N"}, and must not be contradicted by its note\'s "after" state or by a later persona note: if the next screen or a later note shows the game working, it is not a blocker or a major. Cite a note as {"type": "transcript_step", "ref": "note N"}.',
|
|
2615
2832
|
'Make each finding one independently supported claim, with a title and description that say the same thing. Describe directly visible content separately from a claim that something fails to change, finish or respond over time. Cite the observation that supports each claim. Do not infer that a game or value is stuck from one still picture. Preserve a temporal claim and its supporting observations when it is what you observed; do not silently replace it with a different static claim. Report only the behavior and content actually observed.',
|
|
@@ -2640,6 +2857,21 @@ export function shorterReportInstruction(maxTokens) {
|
|
|
2640
2857
|
+ 'and a report.md of about 250 words that keeps its four sections. Write the files in one turn and do not restate the notes.';
|
|
2641
2858
|
}
|
|
2642
2859
|
|
|
2860
|
+
/** What a warned run's first report request says: the room it has, before anything is cut off. */
|
|
2861
|
+
export function withinBudgetReportInstruction(maxTokens) {
|
|
2862
|
+
return `This run is near its model budget, so the report has to fit in ${maxTokens} output tokens. Keep it short: at most 5 findings, each description and repro step one or two short sentences, `
|
|
2863
|
+
+ 'and a report.md of about 250 words that keeps its four sections. Write the files in one turn and do not restate the notes.';
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2866
|
+
function askWithinBudget(messages, maxTokens) {
|
|
2867
|
+
const last = messages[messages.length - 1];
|
|
2868
|
+
if (!last || last.role !== 'user') return;
|
|
2869
|
+
const text = withinBudgetReportInstruction(maxTokens);
|
|
2870
|
+
const content = typeof last.content === 'string' ? [{ type: 'text', text: last.content }] : [...(last.content || [])];
|
|
2871
|
+
if (content.some(block => block && block.type === 'text' && block.text === text)) return;
|
|
2872
|
+
messages[messages.length - 1] = { ...last, content: [...content, { type: 'text', text }] };
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2643
2875
|
/** Add the shorter-report instruction to the last user message, which is the next request's question. */
|
|
2644
2876
|
function askShorter(messages, maxTokens) {
|
|
2645
2877
|
const last = messages[messages.length - 1];
|
|
@@ -3095,9 +3327,10 @@ function completionReportNote(play) {
|
|
|
3095
3327
|
* screenshot list and says plainly that it is partial, rather than
|
|
3096
3328
|
* inventing a persona verdict nobody gave.
|
|
3097
3329
|
*/
|
|
3098
|
-
export function renderFallbackMarkdown({ persona, driverName, target, notes, screenshots, actions = [], actionRecords = [], play, reason, usage = null }) {
|
|
3330
|
+
export function renderFallbackMarkdown({ persona, driverName, target, notes, screenshots, actions = [], actionRecords = [], play, reason, usage = null, leftOut = [] }) {
|
|
3099
3331
|
const good = notes.filter(note => note.kind === 'good');
|
|
3100
|
-
|
|
3332
|
+
// `leftOut`: notes that are not issues of the game (a timer the playtester ran out, ./tooFast.js), said elsewhere.
|
|
3333
|
+
const bad = notes.filter(note => (note.kind === 'bug' || note.kind === 'confusing') && !leftOut.includes(note));
|
|
3101
3334
|
const network = notes.filter(note => note.automatic && note.url);
|
|
3102
3335
|
const list = entries => (entries.length > 0
|
|
3103
3336
|
? entries.map(note => `- **${note.kind}${note.severity ? `/${note.severity}` : ''}**: ${note.text}`).join('\n')
|
|
@@ -3309,8 +3542,13 @@ async function writePartialReport({ outcome, runDirectory, persona, driverName,
|
|
|
3309
3542
|
// is the scale's midpoint when it wrote none. `partial` still tells a reader
|
|
3310
3543
|
// that no report step judged it.
|
|
3311
3544
|
const mood = moodFromNotes(notes);
|
|
3545
|
+
// On a run whose game kept running while the playtester thought, a timer it ran out is the [too_fast] capability
|
|
3546
|
+
// note, never a finding: A1 of the November 19 mobile proofs ended here with its timer notes as major findings.
|
|
3547
|
+
const timerNotes = realTimeRun(honesty) ? notes.filter(timerNote) : [];
|
|
3548
|
+
const timing = thinkingTime(honesty && honesty.timing ? honesty.timing.thinkMs : []);
|
|
3549
|
+
if (timerNotes.length > 0 && honesty && honesty.capability) honesty.capability.add(tooFastNote(timing));
|
|
3312
3550
|
const report = stampReport({
|
|
3313
|
-
findings: findings || notesToFindings(notes, screenshots),
|
|
3551
|
+
findings: findings || notesToFindings(notes.filter(note => !timerNotes.includes(note)), screenshots),
|
|
3314
3552
|
sentiment: mood.sentiment,
|
|
3315
3553
|
would_continue: mood.wouldContinue,
|
|
3316
3554
|
partial: true
|
|
@@ -3338,13 +3576,18 @@ async function writePartialReport({ outcome, runDirectory, persona, driverName,
|
|
|
3338
3576
|
actionRecords,
|
|
3339
3577
|
play,
|
|
3340
3578
|
reason,
|
|
3341
|
-
usage: ledger.toReportUsage()
|
|
3579
|
+
usage: ledger.toReportUsage(),
|
|
3580
|
+
leftOut: timerNotes
|
|
3342
3581
|
});
|
|
3343
|
-
const
|
|
3582
|
+
const combined = preservedMarkdown
|
|
3344
3583
|
? ['# Playtest (partial report draft)', '',
|
|
3345
3584
|
'The run reached its model budget before this draft could be completed and checked. It is preserved below for review.',
|
|
3346
3585
|
'', preservedMarkdown, '', '---', '', fallbackMarkdown].join('\n')
|
|
3347
3586
|
: fallbackMarkdown;
|
|
3587
|
+
// The [too_fast] line goes in the first "What this run didn't cover", the one `run` reads its capability notes from.
|
|
3588
|
+
const markdown = timerNotes.length > 0
|
|
3589
|
+
? insertUnderHeading(combined, "## What this run didn't cover", tooFastLine(timerNotes.map(note => ({ id: `note ${notes.indexOf(note) + 1}`, title: note.text })), timing))
|
|
3590
|
+
: combined;
|
|
3348
3591
|
// What the runner saw happen is kept even in a report nobody reviewed: a
|
|
3349
3592
|
// crash it watched is true whatever became of the report step.
|
|
3350
3593
|
const honest = writeHonesty({ report, markdown, honesty, driverName, notes, screenshots, observations });
|
|
@@ -3395,7 +3638,7 @@ async function writeSomeReport({ log, bareReason = BUDGET_PARTIAL_REASON, ...rep
|
|
|
3395
3638
|
}
|
|
3396
3639
|
|
|
3397
3640
|
async function writePartialMarkdown({ runDirectory, persona, driverName, target, notes, screenshots, play, reason }) {
|
|
3398
|
-
const markdown = stampGeneratedAt(renderFallbackMarkdown({ persona, driverName, target, notes, screenshots, play, reason }), new Date().toISOString(), reportFacts({ persona, driverName, target, play }));
|
|
3641
|
+
const markdown = redactText(stampGeneratedAt(renderFallbackMarkdown({ persona, driverName, target, notes, screenshots, play, reason }), new Date().toISOString(), reportFacts({ persona, driverName, target, play })));
|
|
3399
3642
|
assertNoSecrets('report.md', markdown);
|
|
3400
3643
|
await writeFile(path.join(runDirectory, RUN_FILES.reportMd), markdown, 'utf8');
|
|
3401
3644
|
}
|
|
@@ -3594,7 +3837,7 @@ export function observationTitle(observation) {
|
|
|
3594
3837
|
/** How report.md lists what the runner dropped. */
|
|
3595
3838
|
export const RUNNER_DROPPED_SECTION = Object.freeze({
|
|
3596
3839
|
heading: '## Dropped by the runner (driver errors, runner limits, waiting notes or expected noise only)',
|
|
3597
|
-
explanation: 'The runner removes a blocker or major whose only cited observations are driver errors (the runner could not carry out an action; the game did nothing wrong), a finding that is about a limit of the runner itself (what its screen text did not show, a target it could not find), and any finding cited only by waiting notes or by console noise the brief says to expect. They are not sent to the server. They are kept here so you can judge them yourself.',
|
|
3840
|
+
explanation: 'The runner removes a blocker or major whose only cited observations are driver errors (the runner could not carry out an action; the game did nothing wrong), a finding that is about a limit of the runner itself (what its screen text did not show, a target it could not find, a game timer that ran out while it was still deciding), and any finding cited only by waiting notes or by console noise the brief says to expect. They are not sent to the server. They are kept here so you can judge them yourself.',
|
|
3598
3841
|
emptyNote: '- Nothing here that the runner kept. See the dropped findings below.'
|
|
3599
3842
|
});
|
|
3600
3843
|
|
|
@@ -3607,14 +3850,18 @@ export const RUNNER_DROPPED_SECTION = Object.freeze({
|
|
|
3607
3850
|
* Texas run filed "the season loop is fully blocked" from three strict mode
|
|
3608
3851
|
* failures, with a screenshot of the screen working.
|
|
3609
3852
|
* - Any finding whose transcript evidence is only waiting notes.
|
|
3853
|
+
* - On a run whose game kept running while the model thought (`realTime`), a
|
|
3854
|
+
* finding that says a game timer ran out or left too little time
|
|
3855
|
+
* (./tooFast.js): the playtester was slower than a player, which is the
|
|
3856
|
+
* [too_fast] capability note (TOO_FAST_REASON), never a finding.
|
|
3610
3857
|
*
|
|
3611
3858
|
* A finding with no transcript evidence is left to the other checks.
|
|
3612
3859
|
*
|
|
3613
3860
|
* @param {Object} report
|
|
3614
|
-
* @param {{notes?: Array, observations?: Array}} context
|
|
3861
|
+
* @param {{notes?: Array, observations?: Array, realTime?: boolean}} context
|
|
3615
3862
|
* @returns {{report: Object, dropped: Array<{finding: Object, reason: string}>}}
|
|
3616
3863
|
*/
|
|
3617
|
-
export function dropRunnerRejectedFindings(report, { notes = [], observations = [] } = {}) {
|
|
3864
|
+
export function dropRunnerRejectedFindings(report, { notes = [], observations = [], realTime = false } = {}) {
|
|
3618
3865
|
if (!report || !Array.isArray(report.findings)) return { report, dropped: [] };
|
|
3619
3866
|
const byIndex = new Map(observations.map(entry => [entry.index, entry]));
|
|
3620
3867
|
// The runner's console-error screenshot of a moment whose every console
|
|
@@ -3662,7 +3909,10 @@ export function dropRunnerRejectedFindings(report, { notes = [], observations =
|
|
|
3662
3909
|
for (const finding of report.findings) {
|
|
3663
3910
|
// Praise is never about a limit; anything else that talks about the
|
|
3664
3911
|
// runner's own tools is a capability note the persona filed as a finding.
|
|
3665
|
-
const reason = finding ?
|
|
3912
|
+
const reason = !finding ? null
|
|
3913
|
+
: finding.severity !== 'praise' && aboutRunnerLimit(finding) ? 'about a limit of the runner, not the game'
|
|
3914
|
+
: finding.severity !== 'praise' && realTime && timerExpiryClaim(`${finding.title || ''}\n${finding.description || ''}`) ? TOO_FAST_REASON
|
|
3915
|
+
: verdict(finding);
|
|
3666
3916
|
if (reason) dropped.push({ finding, reason });
|
|
3667
3917
|
else findings.push(finding);
|
|
3668
3918
|
}
|
package/src/run/proxyClient.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { redactText } from './redaction.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* The one HTTP client for Ravensight's model proxy.
|
|
3
5
|
*
|
|
@@ -138,7 +140,9 @@ export function createProxyClient({ baseURL, authToken, timeoutMs = 300000, fetc
|
|
|
138
140
|
response = await fetchImpl(url, {
|
|
139
141
|
method: 'POST',
|
|
140
142
|
headers: { 'Content-Type': 'application/json', Accept: 'text/event-stream', Authorization: `Bearer ${authToken}`, ...headers },
|
|
141
|
-
|
|
143
|
+
// A live URL run's sign-in secrets are replaced as the very last step (./redaction.js), so a
|
|
144
|
+
// site that prints the test account on screen still never shows it to the model.
|
|
145
|
+
body: redactText(JSON.stringify(body)),
|
|
142
146
|
signal: controller.signal
|
|
143
147
|
});
|
|
144
148
|
} catch (error) {
|