deepseek-harness/docs/rfc/implemented/testing
Tianyi Cui b3d40d427e Persist the seed boundary so fork-child replay routes correctly
A fork subagent seeds its child session with a prefix of the parent's log, and
that seed becomes the child's persisted log — so a fork child's .jsonl begins
with the PARENT's events, including the parent's assistant/chunk events. The
snapshot replay harness derived a child's script from its whole log, which would
replay the parent's recorded responses as the child's model calls. Spawn-only
scenarios never hit it, but a fork snapshot would mis-route silently.

Record the seed boundary and skip the inherited prefix at replay:

- SessionHeader gains an optional `seedLength` (how many leading events were
  inherited via a seed), threaded through CreateSessionOptions/CreateAgentOptions
  meta and stamped by the fork backend (= seeded-prefix length; absent for spawn).
  It is EXPLICIT, never inferred from seed.length: a resume seeds the whole stored
  log, so the resume path passes the persisted boundary back.
- Both persistence backends round-trip it: JSONL header line, SQLite seed_length
  column. The SQLite table change bumps SCHEMA_VERSION 2->3; per the pre-release
  stance the backend rejects an older user_version on open with NO migration.
- llm-replay's parseSessionHeader reads seedLength and loadSessionScripts derives
  a child script from events AFTER the boundary. seedLength is 0 for spawn, so
  spawn replay is byte-for-byte unchanged.

Closes the routing-correctness gap the per-session snapshot replay RFC under-
stated; a recorded fork scenario remains a future addition but now derives
correctly. RFC: docs/rfc/implemented/testing/2026-06-22-fork-child-replay-seed-boundary.md.

Regression coverage: a fork child fixture whose seeded prefix carries a parent
chunk (derived script must exclude it, proven red without the slice); a seedLength
persistence round-trip through the shared coordinator contract (both backends);
the fork backend stamping it; resume preserving it from the persisted header.
2026-06-22 20:55:32 +08:00
..
2026-06-11-property-based-testing.md fix review findings: correct the property-suite invariant description 2026-06-21 11:02:08 +08:00
2026-06-19-acp-snapshot-tests.md Merge branch 'worktree-simplify-snapshot-goldens' into worktree-simplify-extract-examples 2026-06-21 18:38:50 +08:00
2026-06-19-real-api-e2e-ci.md Fix doc cross-links for the hierarchy; add package-path + shape gates 2026-06-20 23:12:14 +08:00
2026-06-20-remove-redundant-snapshot-log-goldens.md test(snapshot): use session.jsonl as the only session-log artifact (drop session.golden.jsonl) 2026-06-21 10:36:57 +08:00
2026-06-22-fork-child-replay-seed-boundary.md Persist the seed boundary so fork-child replay routes correctly 2026-06-22 20:55:32 +08:00
2026-06-22-subagent-snapshot-replay.md Persist the seed boundary so fork-child replay routes correctly 2026-06-22 20:55:32 +08:00