Skip to content

feat: Turn ownership during writes - #806

Open
sr07asthana wants to merge 8 commits into
mainfrom
sr-AGE-2198
Open

sr07asthana wants to merge 8 commits into
mainfrom
sr-AGE-2198

Conversation

@sr07asthana

@sr07asthana sr07asthana commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #

Changes

How was this tested?

Checklist

  • I have read the contributing guidelines
  • pnpm build, pnpm test, pnpm typecheck, pnpm lint:ci, and pnpm format:check pass locally
  • Tests added/updated where it makes sense
  • No hand-edits to generated code (packages/trueforge-sdk, python/trueforge_sdk, .github/fern/openapi/openapi.json, docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge
  • Docs / .env.example updated if configuration or behavior changed

Note

Medium Risk
Touches core session-store write paths and multi-replica turn execution; wrong caller updates are now rejected, but any code still calling progress APIs without the new field will fail at compile/runtime.

Overview
Running-turn progress mutations now require expected_active_executor_id to match the turn’s active_executor_id, so only the owning replica can append events, update snapshots, or finish the turn. TurnHandle centralizes this via turnWriteScope() on every store write during execution.

Cancel/freeze (freezeAndGetTurn) is unchanged and stays unfenced, so another node can still stop a turn when the owner is gone. A stale or wrong replica gets TurnExecutorMismatchError instead of corrupting state.

The contract spans ISessionStore, in-memory, Postgres, and SQLite (progress fences renamed from “running only” to running + owner), with contract tests and a patch changeset for core/trueforge.

Reviewed by Cursor Bugbot for commit 708cc7c. Bugbot is set up for automated code reviews on this repo. Configure here.

@changeset-bot

changeset-bot Bot commented Sep 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 708cc7c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@truefoundry/trueforge-core Patch
@truefoundry/trueforge Patch

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant