Skip to content

Warned when a producer's attempt goes backwards on a read. - #35

Open
moedash wants to merge 2 commits into
moe/AI-198-if-py-9-nexus-consumerfrom
moe/AI-198-if-py-10-backwards-attempt-warning
Open

moedash wants to merge 2 commits into
moe/AI-198-if-py-9-nexus-consumerfrom
moe/AI-198-if-py-10-backwards-attempt-warning

Conversation

@moedash

@moedash moedash commented Oct 3, 2026

Copy link
Copy Markdown
Owner

This PR makes a stream reader say so when a producer's attempt number goes backwards, instead of yielding the older generation as ordinary data.

What changed?

  • AttemptTracker takes an optional warn callback. When a record arrives from an attempt lower than one already delivered for the same producer, it reports it with the topic, the position and both attempt numbers.
  • RecordDecoder passes its existing warn through, so every provider's reader gets this for free.
  • Two cases in test_streams_internals.py: one for a backwards attempt, and one showing that a repeat of the current attempt stays quiet.

Part of AI-198 (epic AI-37).

Why?

Attempts only ever rise on one producer. A lower one means the store handed back two generations out of order, and a consumer that renders it as the current answer shows something stale. The external mirror of this interface already carried this fix. It lands here so both chains behave the same.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

poe lint is clean and the internals cases pass, the two new ones included.

Attempts only rise on one producer, so a lower one means the store reordered two generations. Saying so beats rendering the stale one as current.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Changelog entry rides another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant