Repository navigation
fix(log): a fork mints its own executionId and records forkedFrom - #178
davidkpiano wants to merge 3 commits into
Conversation
forkEventLog and store.fork gave the fork its parent's executionId, so a
forked thread's calls got the parent's callKeys and a cache keyed on them
could return the parent's result. The fork's init entry now gets a fresh
executionId and forkedFrom: { executionId, logIndex }. The in-memory,
Durable Object and file stores fork through forkEventLog, and the
conformance suite checks the lineage.
🦋 Changeset detectedLatest commit: 337efa8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Fork log lineage src/event-log.ts, src/event-log.test.ts |
forkEventLog assigns a fresh execution ID to the fork’s init entry and adds forkedFrom metadata. Other selected entries remain unchanged. The test checks the metadata and verifies that the source log is unchanged. |
Store integration and conformance src/event-log-store.ts, src/event-log-store-conformance.ts, src/event-log-store.test.ts, examples/cloudflare-agent-host/event-log-store.ts, examples/code-review-loop/file-store.ts, .changeset/fork-lineage.md, docs/event-log.md |
The stores use forkEventLog to create fork prefixes. Conformance checks verify lineage metadata, copied entries, and source preservation. The changeset and event-log documentation describe the store contract and snapshot-resume behavior. |
Runtime lineage and resume validation src/run-agent.ts, src/run-agent.test.ts, src/policy-decider.ts, src/text-logic.ts, docs/decisions.md, docs/hosts.md |
Stored-thread matching checks init-entry execution IDs. Version bridging accepts a parent snapshot only while the fork remains at its cutoff. Tests and documentation cover fork-specific call keys, version bridges, and request-fingerprint checks. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant EventLogStore
participant forkEventLog
participant runAgent
EventLogStore->>forkEventLog: source prefix and cutoff
forkEventLog-->>EventLogStore: prefix with new init lineage
EventLogStore->>runAgent: forked events and parent snapshot
runAgent->>runAgent: validate parent snapshot against fork cutoff
Possibly related PRs
- statelyai/agent#174: Both PRs change event-log resume validation and snapshot compatibility.
- statelyai/agent#173: Both PRs address policy thread identity across call keys and changed policy input.
Suggested reviewers: claude
Merge Risk: 
Minimal · up to 337ef
-
No merge-blocking issue is established; this change is mergeable after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 61.54% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 11 files. (2 skipped: 2 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
…ed fork bridges with its parent's snapshot
A fork kept its parent's
executionId, so a forked thread's calls got the sameinfo.callKeyas the parent's calls at the same site. An executor cache keyed oncallKeycould hand the fork its parent's result.Change
forkEventLoggives the fork's init entry a freshmetadata.executionIdandmetadata.forkedFrom: { executionId, logIndex }. Every other entry is copied as is.store.forkgoes throughforkEventLog: the in-memory store, the Durable Object store inexamples/cloudflare-agent-host, and the file store inexamples/code-review-loop.assertEventLogStoreConformancehas a new case: two forks of one thread each get their own id,forkedFromnames the parent and cutoff, later entries are unchanged, and the source is untouched. Its fixtures now start with a real init entry.Behavior changes
forkthat copies rows verbatim now fails the conformance suite. The changeset says so.agentMeta.logIdno longer matches, so the resume folds the fork's log instead of taking the fast path.hosts.mdused to say a fork could reuse the parent's cached results by key; it now says a fork's keys never match its parent's.callKeyplus a fingerprint" advice stays. A version bridge still keeps the lineage id, so a migrated machine can ask something else under the same key.createPolicyDeciderthread-hash rationale is reworded to match.Verification
next'sforkEventLog.vitest --run: 139 files, 1665 tests pass.typecheck,lint,format:check,knip,docs:check,typecheck:example-packages, andtest:cloudflare(the DO store runs the conformance suite) pass.Summary by CodeRabbit
New Features
Documentation