You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b76df9a
Browse filesBrowse the repository at this point in the historyBrowse files
fix(scenarios): a recorded replay re-sends each turn's recorded writes before the read-back (#33764)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoEDtPjXPciS3z2UwV39x6wK)_
Clause-②: yes (widening) — new export `ReplayNotFaithfulError` and new
optional field `AskTask.callTool`, both reached through `./runner`
(`src/runner/index.ts` re-exports `driver.ts`)
Metadata-protocol: none
Fixes#33737
## 维护者速读
- 改了什么:录制重放(`--driver
recorded:`)现在会把录制里每个回合的写入(新建/修改/删除/调用动作)按原顺序、以同一角色重新发给新启动的应用,再读回结果;读操作不重发。
- 为什么改:以前重放只回放模型的回答、不发写入,所以「应当成功」的操作在重放里一律读不到数据、判失败(haiku crm 实跑 3/5,重放
1/4),操作分无法重评。
-
风险与回滚:只影响重放驱动,实跑驱动不变;重放时若应用的回答与录制不同(被拒的码不同、成功变失败等),该题/操作记为「未测量」并写明是哪个调用,绝不判失败。回滚即还原本
PR。
- 先看:`packages/qa/scenarios/src/runner/driver.ts` 的
`RecordedDriver.ask`(重发与比对),`src/runner/orchestrate.ts` 的 `runHalf`(把应用的
MCP 门交给驱动、接住不一致)。
- 两分钟验证:`pnpm --filter @objectstack/scenarios exec vitest run
test/runner/orchestrate.test.ts`,应见 55 项全过,其中新的 eval#1 重放组 8 项。
- 需要你做的:无,席位落地。
## What changes
- `RecordedDriver.ask` re-sends the recorded turn's write calls
(`create_record`, `update_record`, `delete_record`, `run_action`) to the
booted app, in recorded order, through the new optional
`AskTask.callTool` (the runner's own MCP door as the turn's persona),
before it hands the turn back, so the runner's read-back finds what the
recorded run wrote. Reads are never re-sent.
- A recorded refused write is re-sent too and must meet the same refusal
(same code; a flow refusal stays a flow refusal; an uncoded error stays
uncoded).
- A row the recorded run created gets a new id in the replayed app; a
later recorded write naming the recorded id, in the same turn or a later
one, is sent with the new id.
- The replay is not faithful, and the turn measures nothing
(`ReplayNotFaithfulError`), when the app answers a re-sent write
otherwise than the recorded run did, or when a recorded write has no
recorded answer (the turn was cut short; nothing of that turn is
re-sent). `runHalf` records the question or operation NOT MEASURED with
the reason naming each call, keeps the recorded turn summary, and never
grades it a fail.
- `runHalf` gives every question and operation turn the door (`callTool`
bound to the persona's key through `AppHarness.callTool`). Live drivers
ignore it; a caller that only re-reads a recording (no door) gets the
turn back and nothing is sent.
- README: one sentence on the replay in the runner's Driver paragraph.
Changeset `33737-replay-resends-recorded-writes.md` (patch).
## Measurement (read-only, before the change)
- Recordings: all 79 `*.rec.json` under the eval seat's runs
(`/mnt/project-files/eval/runs/`, 2026-11-14/15): 533 recorded write
calls, every one in an operation turn, every one with its recorded
answer (0 without), 0 turns mixing answered and unanswered writes. Each
call carries the tool name and its input, and the step key names the
persona, so a faithful re-send is possible for every call. 2 writes name
a row created earlier in the same turn (create then update), which the
id remap covers.
- eval#1's reading reproduced on `main` `53f5a4c9`: haiku
`crm_account_with_contacts` replay, Run-operations `1/4 · 1 not
measured`; `add_contact` "0 row(s) read back", `move_eli` read "ac3",
declared "ac1", audit actor "admin".
- Same recording on this branch (`5bdadc88`): Run-operations `3/4 · 1
not measured`, Iterate the same; `add_contact` and `move_eli` pass, as
in the live run. `contact_bad_email` stays the existing build-denial NOT
MEASURED, as on `main`. Build 27/27, 问数 8/9 unchanged.
## Tests
- New top-level describe in `test/runner/orchestrate.test.ts` replaying
the verbatim eval#1 turns (fixture
`test/runner/fixtures/eval-haiku-crm-replay.recording.json`, four
operation turns of the haiku crm recording, reads included) through
`runHalf` against a fake MCP door that behaves as that build:
`add_contact` reads its row back and passes, `move_eli` passes with its
audit actor; the app receives exactly the recorded writes in order, each
as its persona, and no read; a recorded refused delete and create are
re-sent and refused again; an app that answers otherwise makes the
operation NOT MEASURED naming the call, with no grade and no error.
Driver-level: the created-id remap (same turn and later turn), the
unanswered-write turn (nothing sent, not faithful), a door that throws,
and a turn read without a door.
- The four eval-r1 build-denial replay tests now see the replay's
re-sent writes beside the runner's probes; their fake app answers the
re-sends as that build did, and their grades are unchanged.
## Acceptance notes
- `move_eli` on `main` read the audit actor as "admin": the replay's app
had only the seed's writes. With the re-send the audit actor is the
persona again.
- A question turn's recorded writes are re-sent as well (the driver
cannot tell a question from an operation, and re-sending keeps the app
state later turns read the same as the live run's); the 79 recordings
hold none.
- Two local replays of the branch scaffolded a project whose install did
not complete (`npx objectstack` 404, "no project was installed"); the
scaffold precedes every driver call, and the third run with `--work` on
a fixed directory completed. Not investigated further; noted in case it
recurs.
## Verification
<details><summary>Package and gates on 58da7e9 (re-run after the main
merge on 20d149c)</summary>
- `pnpm --filter @objectstack/scenarios build`, `typecheck`, `test`:
exit 0, Test Files 32 passed, Tests 790 passed (after the merge:
typecheck + test exit 0, 790/790).
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 62 derived families, all run, each exit 0
(`check-plugin-teardown-shape --self-test` after fetching its fixture
commit; `check:dual-build-cjs-loads` after `turbo run build
--filter=./packages/**`); `--ran` reconciliation: 62 derived, 62 run, 0
NOT-MEASURED, 0 UNRUN.
- eslint on the three changed sources: exit 0.
</details>
<details><summary>Ablation (one, on the re-send)</summary>
`node scripts/ablation-replace.mjs` replaced the re-send guard in
`RecordedDriver.ask` with an unconditional `return turn` (anchor 1 → 0,
blob e66c589 → 32a70041): `orchestrate.test.ts` went red, 10 failed
(the 7 new replay tests that send, and 3 of the 4 build-denial tests).
Restored by the tool; `git diff HEAD` empty afterwards.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L9qiby9eoofRB23PSVqcuM)_
<!-- signed: epic:#33595#1 · os-tesla · session_01L9qiby9eoofRB23PSVqcuM
-->
---------
Co-authored-by: Claude <noreply@anthropic.com>
fix(scenarios): a recorded replay re-sends each turn's recorded writes, so an applied operation reads back what the run wrote
6
+
7
+
Clause-②: yes (widening) — new export `ReplayNotFaithfulError` and new optional field `AskTask.callTool` (`./runner`)
8
+
Metadata-protocol: none
9
+
10
+
`--driver recorded:FILE` handed back the recorded turn and sent nothing, so the freshly booted app never received the agent's writes: every `applied` operation read back no row and failed on replay ("0 row(s) read back"), and the operations half of a re-scored run was false fails.
11
+
12
+
The replay now re-sends a turn's recorded writes (`create_record`, `update_record`, `delete_record`, `run_action`) to the booted app, in recorded order, as the turn's persona, through the runner's own MCP door, before the runner reads the operation back. Reads are never re-sent. A recorded refused write is re-sent too and must meet the same refusal again. A row the recorded run created gets a new id in the replayed app, and a later recorded write naming the old id is sent with the new one. When the app answers a re-sent write otherwise than it answered the recorded run, or a recorded write has no recorded answer (the turn was cut short, so whether it wrote is unknown, and nothing of that turn is re-sent), the turn's question or operation is not measured, with the call named in the reason, never a fail. Live drivers are unchanged.
thrownewReplayNotFaithfulError(key,`the recording holds no answer to ${names} (the turn was cut short), so whether it wrote is unknown; nothing was re-sent`,turn);
if(broken.length>0)thrownewReplayNotFaithfulError(key,`the booted app answered a re-sent write otherwise than the recorded run: ${broken.join('; ')}`,turn);
/** Why this turn was not asked: its expected answer changes without the rows the seed could not load ({@link seedDependence}). Not measured, never a fail. */
147
+
/**
148
+
* Why this turn measures nothing: it was not asked, because its expected
149
+
* answer changes without the rows the seed could not load ({@link seedDependence});
150
+
* or it was replayed and the replay was not faithful (`ReplayNotFaithfulError`). Never a fail.
0 commit comments