Skip to content

fix(scenarios): a replay maps the row a recorded run_action created to its live id - #35064

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35048-replay-action-created-id
Nov 18, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-35048-replay-action-created-id

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread
Fixes #35048
Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:场景卡回放(--driver recorded:F)现在会把录制里 run_action 新建出来的记录 id(答案里的 result.id)映射到回放应用给的新 id,原来只认 create_record 顶层 id。
  • 为什么改:travel_expense 的 file_and_submit_from_text 由动作建单、再按 id 提交;回放时提交带着旧 id 被拒 RECORD_NOT_FOUND,这道操作题每次回放都读成「未测」,问数技能迭代只能离线评分。
  • 风险与回滚:只动回放驱动里一个私有函数和一个判断,不影响真实运行与评分逻辑;回滚即 revert 本 PR。
  • 先看:packages/qa/scenarios/src/runner/driver.ts(createdIdOf 与 CREATING_TOOLS 判断);packages/qa/scenarios/test/runner/orchestrate.test.ts(新增两条回放用例)。
  • 两分钟验证:pnpm --filter @objectstack/scenarios exec vitest run test/runner/orchestrate.test.ts -t "replay re-sends",预期 10 条全绿。
  • 需要你做的:无,席位落地。

What changes

RecordedDriver re-sends a replayed turn's recorded writes and, for a row the recorded run created, sends later writes with the id the replayed app gave that row. It learned that id only from create_record answers (top-level id). run_action answers what the action body returned under result ({ ok, action, objectName, result: { id } }), so a row an action created kept its recorded id, and the follow-up write naming it was refused RECORD_NOT_FOUND on replay. That made the turn not faithful, and the operation read NOT MEASURED.

  • createdIdOf(tool, output) reads result.id on a run_action answer and the top-level id on a create_record answer, as before.
  • The remap runs for an applied answer of either door (CREATING_TOOLS), and still only for an applied one.
  • No other nested create shape (for example result.record.id) is read: nothing in the package knows such a shape.
  • createdIdOf and CREATING_TOOLS are module-private, so no published export changes (Clause-②: no). Changeset: patch @objectstack/scenarios.

Tests

Two cases go into the existing driver block of test/runner/orchestrate.test.ts (the runHalf replay describe), using a stand-in door modelled on the travel_expense build. Filing creates a claim. Submitting it is refused HOOK_ABORTED, or RECORD_NOT_FOUND for an id the app never gave.

  • Pin: a recorded run_action files a claim (result.id = cl-rec), the live app gives cl-live-0, and the recorded run_action submit_claim (same turn) plus a later turn's update_record naming cl-rec are re-sent naming cl-live-0.
  • Control: a create_record row is still remapped from its top-level id into a later update_record and a later run_action.

Ablation (scripts/ablation-replace.mjs, fix committed first, test imports src/ directly so no build sits between): each of the fix's two halves, ablated on its own, turns the pin red with the live failure text. The control stays green. Both restores are proven: blob equals HEAD and git diff HEAD is empty.

Acceptance notes

  • The live replay after the fix grades file_and_submit_from_text and fails it only on status (read "draft", declared "submitted"). The build's own demotravel_submit_claim answers HOOK_ABORTED (update('demotravel_expense_claim') does not recognise option 'status') in the recording as on replay. That is the authored action's defect, which the score now measures. It is not the replay's.
  • The first live "before" attempt was a no-op. It mutated the guard to c.name === 'create_record', which left CREATING_TOOLS unused, so the workspace build's DTS step refused (TS6133) before anything ran. It was redone with a compile-clean mutation (CREATING_TOOLS = ['create_record']), which is the pre-fix behaviour on this path.
  • node scripts/check-plugin-teardown-shape.mjs --self-test exited 3 locally (PREREQUISITE NOT MET: its positive-control commit is not in this shallow clone). That is NOT MEASURED locally and is CI's to read. It is unrelated to this diff.

Verification

All readings were taken on head 4aa292ec.

Live replay, before and after (travel_expense, ask, iter2 recording, --packages workspace)

Command: run-scenarios --only travel_expense --modes ask --template /mnt/project-files/issue-34687/ask-round-2026-11-17/build/travel_expense/template.json --ask-repeats 5 --packages workspace --driver recorded:/mnt/project-files/issue-34869/skill-iter/iter2/ask.rec.json (scratch --work/--out), under the shared verify lock.

Run-operations file_and_submit_from_text
before (CREATING_TOOLS ablated to create_record; workspace @ 4aa292ec + uncommitted changes) 2/2 · 4 not measured · 2 started from restored rows NOT MEASURED: run_action was refused HOOK_ABORTED in the recorded run and refused RECORD_NOT_FOUND on replay (x2)
after (workspace @ 4aa292ec) 2/3 · 3 not measured · 2 started from restored rows graded, fail: state:demotravel_expense_claim[trip="t121"].status read "draft", declared "submitted" (the only failed check)

The other five operations are the same in both runs: fix_meal_days pass, over_standard_without_reason pass, and three NOT MEASURED because the seed refused their rows. Run-问数 is 25/25 · 40 not measured in both.

Unit tests, typecheck, ablation
  • pnpm --filter @objectstack/scenarios typecheck, then vitest run --maxWorkers=2: VERDICT command-exit 0, Test Files 39 passed (39), Tests 1095 passed (1095). tsc --listFiles includes test/runner/orchestrate.test.ts.
  • Block run (-t "replay re-sends"): Tests 10 passed | 127 skipped.
  • Ablation A: anchor const holder = tool === 'run_action' ? answer.result : answer; was replaced with const holder = answer; (anchor 1 to 0, blob 8051b98b to 474a9f0f). Result: Tests 1 failed | 9 passed. The pin fails with ReplayNotFaithfulError: "run_action was refused HOOK_ABORTED in the recorded run and refused RECORD_NOT_FOUND on replay". Restored to blob 8051b98b == HEAD.
  • Ablation B: anchor if (CREATING_TOOLS.includes(c.name) && recorded === 'applied') { was replaced with if (c.name === 'create_record' ... (blob 8051b98b to b7f4e29d). Result: Tests 1 failed | 9 passed, with the same failure. Restored to blob 8051b98b == HEAD.
Gates
  • pnpm --filter '@objectstack/scenarios^...' build: VERDICT command-exit 0.
  • dispatch-gates --commands derived 64 commands. Each was run with its exit captured before any pipe. 63 exited 0 and check-plugin-teardown-shape.mjs --self-test exited 3 (shallow clone). dispatch-gates --ran: "64 derived famil(ies) accounted for — 63 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3)".
  • overlap-check: origin/main merges cleanly, and no open PR head shares a file. VERDICT clean exit 0.

Generated by Claude Code

…o its live id

The RecordedDriver read a created row's id only from a create_record answer's
top-level id. run_action answers what the action body returned under
result ({ok, action, objectName, result: {id}}), so a row an action created
kept its recorded id on replay and the later write naming it was refused
RECORD_NOT_FOUND. createdIdOf now reads result.id on a run_action answer, and
the remap runs for applied run_action calls as well as create_record.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufziH9rnXEpD9ne7yFhD
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/scenarios, touching 4 documentable anchor(s).

17 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: node scripts/docs-audit/affected-docs.mjs --json eb7b09d4d28ea0a878dea993d2fa5cc9226bc92f.

⛔ 10 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails.

What this run could not see
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 1 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json eb7b09d4d28ea0a878dea993d2fa5cc9226bc92f → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 443fa7aab24953334c61b6fbdae07bed4115da28 — the merge of head 4aa292ec54eba99d90e6700717ea31361ed41426 into base eb7b09d4d28ea0a878dea993d2fa5cc9226bc92f, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 443fa7aab24953334c61b6fbdae07bed4115da28 && git checkout 443fa7aab24953334c61b6fbdae07bed4115da28
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin eb7b09d4d28ea0a878dea993d2fa5cc9226bc92f 4aa292ec54eba99d90e6700717ea31361ed41426 && git checkout -B drift-repro eb7b09d4d28ea0a878dea993d2fa5cc9226bc92f && git merge --no-ff 4aa292ec54eba99d90e6700717ea31361ed41426

node scripts/docs-audit/affected-docs.mjs --json eb7b09d4d28ea0a878dea993d2fa5cc9226bc92f

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs eb7b09d4d28ea0a878dea993d2fa5cc9226bc92f → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufzfWpJ96QY9T7d8DvFg

L1: ACCEPT · 2026-11-18T01:06Z

Head-sha: 4aa292e
Reviewer: seat 3 L1-c, for card #35048 (os-dev report 6965784090).

席位核对

PR shape. Fixes #35048, base main. Three paths, +106/-11:

  • RecordedDriver in runner/driver.ts;
  • two cases in orchestrate.test.ts;
  • a @objectstack/scenarios patch changeset.

Not governed. CREATING_TOOLS is module-private, and createdIdOf stays unexported (its arity changed). So no export moves and no served MCP surface moves, and Clause-②: no holds under the seat's ruling. The replay's verdict on such a turn does move, from not measured to graded, which is the fix itself.

CI. It was still running when I read it (15 pending, nothing failed). This verdict holds on the condition that Lint & Repo Gates, TypeScript Type Check and Test Core finish green on this head.

The holder matches the real answer. createdIdOf(tool, output) reads result.id for run_action, and the top-level id for create_record. The runtime's run_action answer is { ok: true, action, objectName, recordId?, result }, with result being what the action body returned (domains/mcp.ts:2285). So an action that creates a row and returns it names that row at result.id. A non-object result, or one with no string id, yields undefined, so no mapping is made.

The guard. The remap runs only for a CREATING_TOOLS write recorded as applied, and only when both ids are present and differ. That leaves these cases harmless:

  • an action that answers the id of a row it only updated. A seeded row keeps the card's id on both runs, so was === now and nothing is mapped. A row the run created earlier maps to the mapping it already has.
  • a refused or unanswered write. That path is unchanged and handled by the faithfulness check above it.

Pins and ablation.

  • The pin. A run_action's result.id is remapped into the same turn's submit and into a later turn's update_record.
  • The control. create_record's top-level id is still remapped, into a later update_record and a later run_action.
  • The ablation. Reverting the holder, and separately the guard, each turns the pin red with ReplayNotFaithfulError (RECORD_NOT_FOUND on replay).

Live replay. On the iteration-2 recording, Run-operations goes from 2/2 with 4 not measured to 2/3 with 3 not measured. file_and_submit_from_text is now graded, and fails on the build's own HOOK_ABORTED submit (status draft against submitted). That is a real finding about the build that the replay used to hide, which is what #34996 needed unblocked.

Must-fix

None.

Should-fix

None.

Notes

  • N1. An action whose body creates several rows and returns only one id (or an array) maps only that one, or none. No card does this today. If one does, the turn reads not faithful again, loudly, and does not mis-grade. Not owed.

Next: o3-F (2) lands once the three aggregates are green. No seat L2 is owed. A later push owes an L1-c delta read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#3 · os-support-ai · session_01WGufziH9rnXEpD9ne7yFhD

Landing · area o3-F · 2026-11-18T01:25Z · #35048 replay remaps an action-created row

Probe Reading
L1 L1-c ACCEPT 6965831688 at 4aa292ec, no must-fix or should-fix; N1 (an action that creates several rows maps only the id it returns; the turn then reads not faithful) noted, not owed
L2 none owed: Clause-② no (no export, no served surface), per L1-c and the seat
Checks on head 4aa292ec all complete, 0 failure / cancelled
check-governed-merges.mjs --pr 35064 NOT governed; 117 changed lines ≤ 3000
K (first-parent, merge-base..origin/main) 14 < 15
Open findings none blocking

State change: ready for review + auto-merge (merge queue). #35048 closes on merge via Fixes. After the merge the ask loop's replayed operations grade the filing instead of reading it NOT MEASURED.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants