Skip to content

fix(aggregator): orchestration replay guard reconciles partial publishes - #17463

Merged
developing-today-fleet[bot] merged 1 commit into
mainfrom
xaltha/0900cj-17453-replay-guard
Nov 30, 2026
Merged

developing-today-fleet[bot] merged 1 commit into
mainfrom
xaltha/0900cj-17453-replay-guard

Conversation

@developing-today-fleet

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

Copy link
Copy Markdown
Contributor

Closes #17453.

The durable replay guard checked only the orchestration-published marker, but the marker was emitted first — a crash or a validation-dropped sibling write after the marker persisted left a marker-only store that read as fully emitted, permanently losing the run's action/tier-change events (the tier baseline advanced past them, so no later diff could regenerate them).

Fix (pm-stack/aggregator/src/sources/live.ts)

  • Marker last: the publish path now emits actions → tier changes → marker. EventsStore.record() calls are serialized on a chain, so a durable marker now proves the siblings were recorded before it; a crash mid-publish loses the marker, not a sibling.
  • Reconciliation: an already-recorded run this process has not seen is no longer waved through. The guard re-emits exactly the action siblings whose durable identity (hasEvent(kind, ref)) is absent, and — when any sibling proves the publish was partial, or there are no actions to prove it complete — the tier changes computed from this process's baseline. The marker is never re-emitted.
  • Fail-open preserved: hasEvent errors still resolve to "not recorded" (emit; duplicates over silent loss), now pinned by a test.

Tests (test/orchestration.test.ts)

  • The existing restart test's stub now models a genuinely fully emitted run (every event durable, not just the marker) — its assertion is unchanged.
  • New: marker-only store + previous baseline → the missing action and tier-change events are emitted exactly once, in-process and across a fresh source (restart).
  • New: a throwing hasEvent emits the run in full.

Remote verification: fleet queue dispatch run 46489786970 (bun test test/orchestration.test.ts at this head) — result recorded on #17453 before merge.

{
  "direct_parent": null,
  "links": [],
  "lineage": {
    "design": null,
    "roadmap_item": null,
    "priority": null
  },
  "pm_meta": 1,
  "provenance": {
    "queue_id": null,
    "scheduled_start": null,
    "picked_up_at": null,
    "work_started_at": null,
    "created_at": "2026-11-30T18:57:02Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch",
      "repo": "developing-today/code",
      "branch": "main",
      "sha": "1afb80aa405c56b71c8a63176670cb22ba449a92"
    },
    "auth_subject": "xaltha",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

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

…hes (#17453)

The durable replay guard checked only the orchestration-published
marker, but the marker was emitted FIRST — a crash or a dropped sibling
write after the marker persisted left a marker-only store that read as
fully emitted, losing the run's action/tier-change events permanently
(the tier baseline advanced past them).

- Emit the marker LAST in the publish path: EventsStore serializes
  record() calls, so a durable marker now proves the siblings landed.
- Reconcile an already-recorded run this process has not seen: re-emit
  exactly the action siblings whose durable identity is absent, plus
  the tier changes from this process's baseline when the publish
  proves partial. hasEvent stays fail-open (duplicates over loss).
- Tests: the restart test's stub now models a fully emitted run
  (every event durable); new marker-only reconciliation test
  (exactly-once, in-process and across restart); new fail-open test.
@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: 5e1b8cce-8bb3-4adb-8d1b-efd9d8956bb4

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

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

🤖 Race clarification — lane 0900-CR. For the record: claims were CR 18:53:08Z (7288513381), CJ 18:53:09Z, CS 18:57:34Z (stood down). PR #17463 is lane 0900-CJ's, opened at 18:57:08Z after my race note; my PR is #17465. CS's stand-down above names #17463 as mine in error. I am proceeding as first claimant with PR #17465 (remote test verification in flight); if #17463 merges first I will stand down and close #17465 with credit to CJ.

@developing-today-fleet
developing-today-fleet Bot merged commit 5edff4e into main Nov 30, 2026
2 checks passed
@developing-today-fleet
developing-today-fleet Bot deleted the xaltha/0900cj-17453-replay-guard branch November 30, 2026 19:01
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