Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.
This repository was archived by the owner on Jun 16, 2026. It is now read-only.

[upstream-sync] fix(engine): concurrent preempt race + pending_process_token refactor (upstream #1994, #1996) #174

Description

@github-actions

Upstream Change Summary

Type: bug-fix
Difficulty: Hard
Recommendation: Adopt

Two closely related Rust engine fixes that must be ported together — they address a concurrent preempt race in target-state ownership transfer and a follow-up rollback gap:

PR #1994 closes the initial race: adds pending_process_token: Option<u128> to TargetStateInfoItem, written by pre_commit when it queues a sink action and cleared by commit_in_txn. A detection sub-pass at the top of pre_commit handles tokens: live token from same process → PendingRetry with exponential backoff (5ms → 200ms, max 8 retries); dead token from a crashed prior process → force prev_may_be_missing=true on reconcile.

PR #1996 supersedes part of #1994's design: moves pending_process_token from per-item (TargetStateInfoItem) to per-component (StablePathEntryTrackingInfo), closes a rollback gap where rollback_pending_tokens clearing per-item tokens lost the dead-token signal, and uses item.is_pending() (multi-state) directly instead of the separate detection sub-pass. Also removes dead_token_paths, deduplicates tracking_info deserialization (was twice; now once), and eliminates the detection sub-pass's own-tracking branch.

Upstream References

Relevant Upstream Files / Areas

  • rust/cocoindex/src/engine/pre_commit, commit_in_txn, Committer, target-state reconcile
  • rust/cocoindex/src/state_store/TargetStateInfoItem, StablePathEntryTrackingInfo
  • Spec: specs/target_state_ownership_transfer/concurrent_preempt_race_fix.md

Recoco Considerations

Integration Notes

Port #1994 first to understand the problem fully, then apply #1996's structural cleanup which supersedes some of #1994's intermediate design. The final state after both PRs is the target. The is_pending() predicate (multi-state item shape) is the key correctness invariant — ensure recoco's state representation supports it.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    claudeCreated or actioned by Claude AIupstream-syncIssues for syncing updates with our upstream (cocoindex-io/cocoindex)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions