Skip to content

FE-1261: Recover prepared execution journals - #371

Merged
kostandinang merged 4 commits into
nextfrom
kostandin/fe-1261-recover-prepared-execution-journals
Jul 23, 2026
Merged

FE-1261: Recover prepared execution journals#371
kostandinang merged 4 commits into
nextfrom
kostandin/fe-1261-recover-prepared-execution-journals

Conversation

@kostandinang

@kostandinang kostandinang commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Stack context

FE-1261 is a repair beneath FE-1211's comparison-execution work.

Why

Direct lifecycle tools and superseding runs could leave run.json ahead of the prepared Petri journal, halting resumable comparison execution or misclassifying journal authority.

What

  • Reconcile causally valid trailing lifecycle facts without repeating completed effects.
  • Fail closed on unreadable or divergent journals while preserving valid parallel interleavings.
  • Prepare complete Petrinaut observation artifacts for superseding runs and report standalone journal failures accurately.

How to test

  • npm run test -- src
  • npm run build
  • npm run check:markdown-links
  • npm run check:skills
  • npm run check:promoted-run-paths

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kostandinang
kostandinang marked this pull request as ready for review July 23, 2026 16:21
@kostandinang kostandinang self-assigned this Jul 23, 2026
@cursor

cursor Bot commented Jul 23, 2026

Copy link
Copy Markdown

PR Summary

High Risk
Changes crash-durable Petri journal/marking authority, drive halt/resume semantics, and superseding run creation—core executor correctness paths where mistakes can corrupt or mis-classify run state.

Overview
Prepared runs can get run.json ahead of the Petri journal when lifecycle steps run outside drive() or after supersession. This PR adds reconcilePreparedLifecycleJournal to catch up a causally valid serial prefix (through report_init or a standalone slice_start) by appending missing transition events and refreshing marking.json, without re-running completed effects.

initializeReports, startSlice, and drive() call reconciliation before dispatch and around report_init / slice_start so those steps no longer double-append journal events. Blocked outcomes surface concrete reasons (petri_journal_gap, petri_input_unreadable, petri_marking_persist_failed, terminals, active parallel batch) instead of lumping many cases into parallel_batch_active.

createSupersedingRun now preparePetriObservation under the target run’s execution lease (rollback on failure) and documents the extra petrinaut side effects, matching execute_run_create.

Reviewed by Cursor Bugbot for commit 2d2c774. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/executor/slice-start.ts
Comment thread src/executor/petri-lifecycle-reconciliation.ts
Comment thread src/executor/run-supersession.ts Outdated
Comment thread src/executor/petri-lifecycle-reconciliation.ts Outdated
Comment thread src/executor/petri-lifecycle-reconciliation.ts Outdated

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2d2c774. Configure here.

state,
lifecycleTransitionIds: projectExecutorPetriTransitionHistory(state, plan)?.transitionIds,
plan,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale state skips journal repair

Medium Severity

After preparePetriObservation persists petriObservationPrepared, drive still passes the earlier in-memory state into reconcilePreparedLifecycleJournal. That helper treats the run as not_prepared and skips catch-up, so a lifecycle-ahead journal left by direct steps can still halt as petri_journal_gap instead of being repaired.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2d2c774. Configure here.

@kostandinang
kostandinang merged commit f6076ba into next Jul 23, 2026
7 checks passed
@kostandinang
kostandinang deleted the kostandin/fe-1261-recover-prepared-execution-journals branch July 23, 2026 17:40
@hash-worker hash-worker Bot mentioned this pull request Jul 23, 2026
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