Skip to content

fix: emit terminal event for operation failures - #1007

Merged
tomdps merged 1 commit into
mainfrom
codex/fix-operation-terminal-event
Aug 12, 2026
Merged

fix: emit terminal event for operation failures#1007
tomdps merged 1 commit into
mainfrom
codex/fix-operation-terminal-event

Conversation

@tomdps

@tomdps tomdps commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • emit one current-run CLUSTER_FAILED event when a cluster operation chain fails
  • let the existing terminal subscription own cluster shutdown
  • cover both operation-validation failure paths with exact-one-terminal assertions

Root cause

CLUSTER_OPERATIONS failures emitted only the nonterminal CLUSTER_OPERATIONS_FAILED diagnostic before stopping directly. Foreground result writers therefore saw no authoritative terminal event and rejected the retained result.

Validation

  • focused integration tests: 2 passing
  • full test suite: 2,901 passing, 18 pending
  • typecheck and lint (no errors)
  • Opcore and Opcore Zero clean
  • independent review: approved with no P0-P3 findings

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown

Greptile Summary

The PR terminalizes failed cluster-operation chains with one current-run CLUSTER_FAILED event and delegates shutdown to the existing terminal subscription.

  • Scopes terminal-event deduplication to the current cluster run.
  • Removes direct shutdown from the operation-failure handler.
  • Adds integration assertions for exactly one terminal failure event across both validation-failure paths.

Confidence Score: 5/5

The PR appears safe to merge with operation failures now producing the terminal event required by result consumers while preserving shutdown behavior.

Current-run boundaries exclude historical terminal records, synchronous message delivery reaches the pre-registered shutdown subscriber, and the updated tests cover both validation-failure paths.

Important Files Changed

Filename Overview
src/orchestrator.js Adds current-run terminal-event guarding and routes operation failures through the established terminal shutdown subscription without an accepted defect.
tests/integration/orchestrator-flow.test.js Extends both operation-validation failure scenarios with exact-one CLUSTER_FAILED assertions.

Sequence Diagram

sequenceDiagram
  participant Op as CLUSTER_OPERATIONS handler
  participant Bus as MessageBus / Ledger
  participant Terminal as CLUSTER_FAILED subscription
  participant Cluster as Orchestrator.stop
  Op->>Op: Operation chain rejects
  Op->>Bus: Publish CLUSTER_OPERATIONS_FAILED
  Op->>Bus: Query current-run terminal events
  alt No terminal event exists
    Op->>Bus: Publish CLUSTER_FAILED
    Bus->>Terminal: Deliver terminal event synchronously
    Terminal->>Cluster: stop(clusterId)
  else Current run already terminal
    Op-->>Op: Suppress duplicate terminal event
  end
Loading

Reviews (1): Last reviewed commit: "fix: emit terminal event for operation f..." | Re-trigger Greptile

@tomdps
tomdps enabled auto-merge August 12, 2026 15:23
@tomdps
tomdps added this pull request to the merge queue Aug 12, 2026
Merged via the queue into main with commit ee21e68 Aug 12, 2026
12 checks passed
@tomdps
tomdps deleted the codex/fix-operation-terminal-event branch August 12, 2026 15:46
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 6.39.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant