Skip to content

fix(aggregator): reconcile partially emitted orchestration publishes instead of suppressing them - #17465

Closed
developing-today-fleet[bot] wants to merge 1 commit into
mainfrom
xaltha/0900cr-17453-replay-guard
Closed

developing-today-fleet[bot] wants to merge 1 commit into
mainfrom
xaltha/0900cr-17453-replay-guard

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Fix

The orchestration replay guard in pm-stack/aggregator/src/sources/live.ts treated a durable orchestration-published marker as proof a run was fully emitted — but the marker was emitted first, before the run's action/tier-change events, through a fire-and-forget writer. A crash or validation drop after the marker persisted lost the siblings permanently, and the guard silently advanced the tier baseline past the gap.

  • Marker last: the publish marker is now the completion record, emitted after the run's action and tier-change events.
  • Reconcile, don't suppress: when the marker is already durable, every action event whose durable identity is absent is emitted exactly once; if any action proved missing, the tier diff against the in-memory baseline is re-emitted with it (tier-change events share (kind, ref) across runs and cannot be checked individually — a visible duplicate over a silent, permanent loss).
  • Fail-open preserved: hasEvent failures still catch to false (duplicates over silent loss), now pinned by a test.

Tests (pm-stack/aggregator/test/orchestration.test.ts):

  • The existing restart test now models a genuinely fully emitted run (all events durable, not marker-only — the old fixture was exactly the partial state this issue names).
  • New regression test: marker-only partial publish with a previous tier baseline → the missing action and tier-change events are emitted exactly once, the marker is not re-emitted, and a later read emits nothing.
  • New fail-open test: a throwing hasEvent still emits the full set.

Remote verification (aggregator test suite at PR head) dispatched separately; results on #17453.

Closes #17453

🤖 Lane 0900-CR (xaltha, wave 0900)


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

…instead of suppressing them

The replay guard treated a durable orchestration-published marker as
proof a run was fully emitted. The marker was emitted FIRST, before
the run's action and tier-change events, through a fire-and-forget
writer — so a crash or a validation drop after the marker persisted
lost the sibling events permanently, and the guard silently advanced
the in-memory tier baseline past the gap (#17453).

- Emit the marker LAST: it is now the completion record for the run's
  full event set.
- When the marker is already durable, reconcile instead of
  suppressing: emit every action event whose durable identity is
  absent, exactly once; if any action proved missing the publish was
  partial, so the tier diff against the in-memory baseline is
  re-emitted with it (tier-change events share (kind, ref) across
  runs and cannot be checked individually — a visible duplicate over
  a silent, permanent loss).
- hasEvent failures stay fail-open (catch to false): duplicates over
  silent loss, now pinned by a test.
- The existing restart test now models a genuinely fully emitted run
  (all events durable, not marker-only); new regression test seeds a
  marker-only partial publish and expects the missing action and
  tier-change events exactly once, with no marker re-emission.

Closes #17453
@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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: 458c0d0b-b96e-44ec-8772-02ae7892ad5e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • 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

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.

aggregator(events): orchestration replay guard checks only the publish marker — a partially emitted publish loses its action/tier-change events permanently (PR #4489 residual)

1 participant