GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(id): coordinator state machine + recovery for region-seam handoff (#3903) by dezren39 · Pull Request #9000 · developing-today/code

Conversation

@dezren39

@dezren39 dezren39 commented Nov 12, 2026 •
edited by blacksmith-sh Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Phase 4 of #3870 (issue #3903, task 5866), per design #2818 sections 5/6 and phased plan packet 4. Gate re-checked: phase 3 issue #3902 is CLOSED.

Adds pkgs/id/crates/id-worlds/src/world/coordinator.rs, the coordinator state machine on the phase-1 CoordinatorJournalEntry records:

  • start_handoff appends HandoffStarted before any side effect; handoffs serialized per entity; a handoff ID is never reused.
  • observe_export / observe_import correlate receipts by handoff_id + entity + source/target + prior epoch + module + schema + digest; duplicate receipts are idempotent, conflicting digests are integrity errors; import can never be observed before the export, and completion is never inferred from one side alone.
  • complete appends HandoffCompleted before switching the owner map; owner epoch and region-map epoch each increment exactly once.
  • cancel is legal only pre-export with proof no export exists; no post-export rollback.
  • recover replays the journal deterministically and rejects impossible journals; reconcile re-queries both receipts after a restart, appends missing observations, and completes only when both verify.
  • in_transit_status exposes the section 4 status-only response with the 60s stuck classification (Exports/ImportedAwaitingCoordinator/Stuck); a started handoff with no export stays at_source.

Tests: 13 new coordinator tests including restart-at-each-transition recovery, reconcile-from-both-receipts, one-side-alone refusal, cancel rules, and stuck classification. Full id-worlds lib suite: 729 passed, 0 failed. cargo clippy on the new module: no findings; rustfmt clean (the crate carries pre-existing fmt diffs in other files, untouched).

Client routing (packet 5) remains a separate follow-on; nothing here enables the handoff path end-to-end (per the phased plan, no packet before 5 does).

Closes #3903 on merge.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
repo-worker-tmp-code-b
feat(id): coordinator state machine + recovery for region-seam handoff (
d38afd6
#3903)
@dezren39
dezren39 requested a review from a team as a code owner November 12, 2026 19:31
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4e1a7ed7-243e-4ec2-80a3-b640e55ebae1
Commits

Reviewing files that changed from the base of the PR and between a5318f8 and 39bae6a.

Files selected for processing: 2

  • pkgs/id/crates/id-worlds/src/world/coordinator.rs
  • pkgs/id/crates/id-worlds/src/world/mod.rs
  • 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.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T21:48:14.744475Z 39bae6a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dezren39 dezren39 added work/assigned Queue worker lifecycle state queue/claimed Queue worker lifecycle state status/in-progress Queue worker lifecycle state labels Nov 12, 2026
chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Nov 12, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d38afd67ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/id/crates/id-worlds/src/world/coordinator.rs Outdated
Comment on lines +403 to +406
if self.active_by_id(handoff_id).is_some() {
return Err(CoordinatorError::InvalidTransition(
"handoff id is already in flight for another entity",
));

@chatgpt-codex-connector chatgpt-codex-connector Bot Nov 12, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject handoff IDs used by completed or cancelled transfers

After completion or cancellation removes a handoff from active, this check allows its ID to be reused. For example, completing A→B and starting B→A with the same ID succeeds here, but the shard transfer ledgers retain historical IDs for deduplication (WorldCore::validate_entity_export and validate_entity_import), so the new crossing conflicts with the previous transfer and cannot progress. Track previously used IDs across terminal transitions and recovery, and reject reuse before appending another start.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dezren39 dezren39 Nov 12, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in dc3f9af: the coordinator now tracks every handoff ID it has ever started (used_handoff_ids, populated in apply_started so live starts and journal replay share it). start_handoff rejects a previously used ID with InvalidTransition, and replay rejects a journal that reuses an ID with Integrity. Covered by handoff_ids_are_single_use_across_terminal_transitions and the model property test ID-uniqueness invariant.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/id/crates/id-worlds/src/world/coordinator.rs
Comment on lines +631 to +635
if let Some(receipt) = source_receipt {
self.observe_export(receipt, observed_at)?;
}
if let Some(receipt) = destination_receipt {
self.observe_import(receipt, observed_at)?;

@chatgpt-codex-connector chatgpt-codex-connector Bot Nov 12, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Correlate reconciliation receipts with the requested handoff

When two handoffs are active, reconcile(A, receipt_for_B, ...) passes the receipt to observation methods that select their own active handoff using the receipt's ID. Consequently, reconciliation for A can journal progress for B and return an outcome for A without reporting any mismatch. Validate both supplied receipts against the requested handoff_id before applying either observation, so receipts from concurrent recovery queries cannot mutate another transfer.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dezren39 dezren39 Nov 12, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in dc3f9af: reconcile now validates both supplied receipts against the requested handoff_id up front and returns ReceiptMismatch(handoff_id) before applying either observation, so a receipt for a concurrent handoff can no longer mutate it. Covered by reconcile_rejects_receipts_for_another_handoff.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/id/crates/id-worlds/src/world/coordinator.rs
Comment on lines +741 to +743
}
self.apply_started(entry);
Ok(())

@chatgpt-codex-connector chatgpt-codex-connector Bot Nov 12, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate replayed starts against recovered ownership

If a journal contains a stale or corrupted start, recovery checks only whether the entity already has an active handoff; it never verifies the source region, expected owner epoch or region-map epoch against the recovered map. A start claiming owner epoch 1 against a seeded owner at epoch 10, followed by otherwise matching observations and completion, is accepted and overwrites ownership with epoch 2. Validate these correlations and the live start preconditions before applying the entry, returning Integrity rather than allowing recovery to roll ownership backward.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dezren39 dezren39 Nov 12, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in dc3f9af: replay of HandoffStarted now validates the entry against recovered ownership before applying it - the entity must be a known owner and its region, owner epoch, and the entry region-map epoch must match the recovered map exactly (and source != target); any disagreement is Integrity. The completion replay check also verifies the source region. Covered by replay_rejects_a_start_that_disagrees_with_recovered_ownership.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/id/crates/id-worlds/src/world/coordinator.rs
Comment on lines +1102 to +1106
// after every protocol transition and rebuild from the journal.
for prefix in 1..=4 {
let live = match prefix {
1 => started(),
2 => exported(),

@chatgpt-codex-connector chatgpt-codex-connector Bot Nov 12, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add generated invariant tests for the coordinator

The new state machine is covered only by hand-written examples, including this fixed four-prefix restart test. Root AGENTS.md explicitly requires property tests for state-machine invariants and model-generated tests when a behavioral specification exists; examples alone do not satisfy that requirement. Add generated transition sequences and crash prefixes, checked against a reference model, covering replay equivalence, monotonic ownership epochs and handoff-ID uniqueness. These combinations are particularly important because the current examples miss terminal-ID reuse and inconsistent replayed starts.

AGENTS.md reference: AGENTS.md:L38-L42

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dezren39 dezren39 Nov 12, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in dc3f9af: added world::coordinator::model_tests, a proptest model-based suite generating transition sequences (starts, export/import observations with digest faults, completions, cancels, crash-recoveries, schema-mismatch probes) over a two-entity/three-ID universe, checked step-by-step against a reference model. Invariants asserted throughout: replay equivalence (recover of the live journal equals the live coordinator, including after every generated crash), monotonic owner and region-map epochs, and handoff-ID uniqueness; every crash prefix of the final journal is replayed as well. 17/17 coordinator tests pass locally.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
repo-worker-tmp-code-b
fix(id): single-use handoff IDs, correlated reconcile, strict replay,…
dc3f9af
… model tests (#3903)
@dezren39 dezren39 added queue/parked Queue task is parked (waiting on CI, time, or an event) status/parked Deliberately paused with a recorded resume condition and removed status/in-progress Queue worker lifecycle state queue/claimed Queue worker lifecycle state labels Nov 12, 2026
chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Nov 12, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc3f9af41a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/id/crates/id-worlds/src/world/coordinator.rs
Comment on lines +825 to +827
new_owner_epoch,
new_region_map_epoch,
..

@chatgpt-codex-connector chatgpt-codex-connector Bot Nov 12, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate completion module and schema during replay

When a recovered HandoffCompleted entry has a different program_module_hash or payload_schema from its journaled start, replay ignores both fields and switches ownership anyway. This accepts an inconsistent journal that the live complete() path could never produce, rather than stopping recovery with CoordinatorError::Integrity. Compare both completion fields with the active handoff before applying the ownership change.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dezren39 dezren39 Nov 12, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 39bae6a: replay of HandoffCompleted now binds the entry's program_module_hash and payload_schema and compares both against the active (journaled-start) handoff before applying the ownership switch; any disagreement returns CoordinatorError::Integrity, matching what the live complete() path could produce. Covered by the new test replay_rejects_completion_with_mismatched_module_or_schema (both fields, independently). Coordinator suite: 18/18 pass locally (cargo test -p id-worlds --lib world::coordinator, pkgs/id workspace).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot assigned dezren39 Nov 12, 2026
@dezren39 dezren39 mentioned this pull request Nov 12, 2026
id: implement #3870 phase 4 — coordinator state machine + recovery for region-seam handoff #3903
Closed
repo-worker-tmp-code-b
fix(id): validate completion module/schema during coordinator replay (#…
39bae6a
…3903)
@dezren39 dezren39 mentioned this pull request Nov 13, 2026
investigate: CPU/memory load over time + parallelism sweet spot on the sandbox VM #7011
Open
9 tasks
@dezren39 dezren39 removed status/parked Deliberately paused with a recorded resume condition queue/parked Queue task is parked (waiting on CI, time, or an event) labels Nov 13, 2026
@dezren39
dezren39 merged commit 7904547 into main Nov 13, 2026
20 of 26 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 deleted the queue/5866-3903-coordinator branch November 13, 2026 00:32
@dezren39 dezren39 removed the work/assigned Queue worker lifecycle state label Nov 13, 2026
This was referenced Nov 13, 2026
id: implement #3870 phase 5 — client/operations surface + gated enablement for region-seam handoff #3904
Closed
feat(id): phase 5 client/operations surface + gated enablement for region-seam handoff (#3904) #9175
Merged
id: implement: journaled region-seam export/import #3870
Closed
@dezren39 dezren39 mentioned this pull request Nov 21, 2026
Closure audit: every closed issue/PR verified; unmerged branches + unpushed worktrees inventoried #7079
Open
@dezren39 dezren39 added the audit:complete PR fully implemented spawning issue label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@dezren39 dezren39

Labels

audit:complete PR fully implemented spawning issue

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

id: implement #3870 phase 4 — coordinator state machine + recovery for region-seam handoff

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.