Skip to content

Make chain seed authority singular and fresh in CLI - #22

Open
tacticalnoot wants to merge 38 commits into
kalepail:mainfrom
tacticalnoot:chatgpt/chain-seed-authority-20260829
Open

Make chain seed authority singular and fresh in CLI#22
tacticalnoot wants to merge 38 commits into
kalepail:mainfrom
tacticalnoot:chatgpt/chain-seed-authority-20260829

Conversation

@tacticalnoot

@tacticalnoot tacticalnoot commented Aug 30, 2026

Copy link
Copy Markdown

The problem is seed authority: host time, worker-count-scaled polling, or an indefinitely cached RPC result should not decide what the CLI treats as the current seed window.

This PR now:

  • resolves seed_id from contract simulation / ledger time;
  • reads only the exact SeedById(seed_id) value;
  • moves seed refresh to one main-thread poll and broadcasts { seedId, seed } to workers;
  • renews a short monotonic freshness lease only from successful chain observations;
  • pauses workers, rejects new bests, and blocks normal/final submits when that lease expires;
  • resumes only from newly confirmed chain context;
  • keeps host-clock seed math diagnostic-only;
  • re-resolves chain state after relayer materialization.

The score contract intentionally accepts historical seed windows for up to 24 hours, so rollover draining remains valid. The lease addresses a different property: stale-but-still-valid history must not be mistaken for current authority after RPC disappears.

Reference: docs/SEED_EPOCH_CLOCK_AUTHORITY.md.

— Noot’s Raven 🐦‍⬛ — one fresh chain signal can keep every worker fast, aligned, and honest.

tacticalnoot commented Aug 30, 2026

Copy link
Copy Markdown
Author

The problem is authority: host-clock skew must never decide which seed_id farming or submission uses.

This PR moves that authority onto chain state across farming, relayer confirmation, and submission. The remaining design question is topology: one chain-authoritative poll should own the active {seedId, seed} and workers should consume that state rather than each independently re-querying RPC.

Would centralizing that poll in the main thread complete the authority model while removing worker-count-scaled RPC traffic?

Noot’s Raven 🐦‍⬛ — one trusted chain signal can keep every worker flying in formation. ✨

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

Copy link
Copy Markdown

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: e429f11bde

ℹ️ 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".

Comment thread cli/src/worker/game-worker.ts Outdated

Copy link
Copy Markdown
Author

@codex address that feedback

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

Copy link
Copy Markdown
Author

@codex review

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

Copy link
Copy Markdown

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: 0008e49b9e

ℹ️ 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".

Comment thread cli/src/commands/run.ts Outdated
Comment thread cli/src/commands/run.ts Outdated

Copy link
Copy Markdown
Author

@codex review

@tacticalnoot tacticalnoot changed the title Make chain seed_id authoritative in CLI Make chain seed authority singular and fresh in CLI Aug 30, 2026

Copy link
Copy Markdown
Author

@codex review

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

Copy link
Copy Markdown

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: a569d57dc3

ℹ️ 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".

Comment thread cli/src/commands/run.ts Outdated
Comment thread cli/src/commands/run.ts Outdated

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

Copy link
Copy Markdown

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: 80e961a3f2

ℹ️ 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".

Comment thread src/chain/seed.ts

Copy link
Copy Markdown
Author

@codex review

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

Copy link
Copy Markdown

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: f524235bc1

ℹ️ 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".

Comment thread cli/src/commands/run.ts

Copy link
Copy Markdown
Author

@codex review

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

Copy link
Copy Markdown

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: 653aa24d3d

ℹ️ 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".

Comment thread src/chain/seed.ts Outdated

Copy link
Copy Markdown
Author

@codex review

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

Copy link
Copy Markdown

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: dd5ec8940b

ℹ️ 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".

Comment thread cli/src/worker/game-worker.ts Outdated

Copy link
Copy Markdown
Author

@codex review

Fresh head: b3475d34. Please re-test the authority path as a state machine, especially pause/recovery to the same seed, epoch advance/rollback, transient RPC failure, and whether any rejected in-flight work can still influence later worker best state.

— Noot’s Raven 🐦‍⬛

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Copy Markdown
Author

@codex review

Please review current head c098aeaa (supersedes b3475d34). Focus on both sides of the worker message race: authority transition observed before completion, and stale completion occurring just before the queued transition is processed. Also re-check that no rejected score/config can influence later accepted work.

— Noot’s Raven 🐦‍⬛

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copy link
Copy Markdown
Author

The remaining race was cross-thread ordering: after pause and recovery to the same seed, an old result could reach the main thread before the worker observed the pause and still match the numeric seed.

Current head bdf6f609 carries a main-issued authorityGeneration through start, seed-context, and new-best; the main thread accepts only its current generation. The exact local head bundles both CLI entries successfully.

Would using that main-issued generation as the acceptance boundary close both sides of the delivery race?

— Noot’s Raven 🐦‍⬛ — one stamped authority era keeps yesterday’s work from landing in today’s window.

Copy link
Copy Markdown
Author

The same-seed recovery boundary is now a runnable regression at current head 9ec7cb9f.

It proves that the current seed and generation pass, while the same seed from the prior generation, another seed, or stale authority all fail admission. The focused Bun test passes 3/3, and both CLI entries bundle successfully.

Would this predicate be the right durable acceptance test for the cross-thread ordering boundary?

— Noot’s Raven 🐦‍⬛ — give every delayed result one gate it cannot outfly.

Copy link
Copy Markdown
Author

@codex review

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

Copy link
Copy Markdown

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: 9ec7cb9f2d

ℹ️ 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".

Comment thread cli/src/commands/run.ts
Comment thread src/chain/seed.ts

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: b4fe2869bc

ℹ️ 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".

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