Skip to content

fix(hermes): resume interrupted turns after a gateway restart (RIG-12326) - #248

Open
rigel-mintaka wants to merge 1 commit into
mainfrom
harness/rig-12326-resume-interrupted-turns-after-a-gateway
Open

rigel-mintaka wants to merge 1 commit into
mainfrom
harness/rig-12326-resume-interrupted-turns-after-a-gateway

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What does this do

After a gateway restart, Hermes resumes a turn that was interrupted mid-run instead of leaving it unknown until someone runs /discard. Startup settlement auto-resumes the interrupted admission and releases the pre-claim before handler dispatch. The turns queued behind it then run in order.

One case still waits for explicit recovery: a turn that was compressing its transcript when the gateway crashed. Its state may be half-published, so it stays unknown and its followers stay blocked. The compression publish now marks the admission that compressed, in the same transaction. Startup holds only that admission, not later turns on a conversation compressed earlier. Reset children resume normally.

Why do we need it

Every gateway restart left Nemo's in-flight turn stuck until Matt ran /discard by hand. Matt ruled to auto-resume after a crash and drop the "never replay started work" rule.

Summary

  • run_startup.py: resume interrupted admissions and fence the one that was compressing.
  • hermes_state_compression.py: record the compressing admission inside the publish transaction.
  • session_authority*.py: owner lookup is guarded per store.
  • test_restart_resume_pending.py: covers resume, a second compression, reset then compress, compress then reset, and an earlier compression followed by a worker turn.

Verification

On macpro2013: 77 passed, 3 failed across six files. All three also fail on main ea056ebd: test_journey_compress_restart_fifo [graceful] and [crash] (SUMMARY_RETAINED_FACTS), and the open-prompts [crash] WebSocket handshake timeout. Six review rounds; the last is clean at 1fc6621c. Probes p1–p6 run against the real reset and compression paths: in-flight compressions stay unknown, and reset children and later turns auto-resume.

Risks

A wrong fence would either replay a half-compressed turn or hold a healthy one at unknown. The probes cover both directions.

Rollback: revert this commit.

Spec impact

Spec-impact: none.

Checks skipped: nebula has no pre-push hook config; GitHub Actions ci.yaml runs its checks

Refs RIG-12326

Co-authored-by: Matt Wilkinson matt@rigel.build

…326)

Startup settlement auto-resumes an interrupted admission and releases the
pre-claim before handler dispatch, so followers run without /discard.
A turn that was compressing when the gateway crashed stays unknown: the
compression publish marks that admission in the same transaction, and
startup holds only marked admissions. Reset children resume normally.

Refs: RIG-12326
Co-Authored-By: Matt Wilkinson <matt@rigel.build>

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Nov 23, 2026

Copy link
Copy Markdown

RIG-12326

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

Review rounds (one review agent each):

  • r1–r3: earlier findings fixed (head-only [kill] failure, compression-child resume).
  • r4 (62438793): 0H/2M/2L. M1 second compression not recorded; M2 reset child held at unknown; L1 unbounded follower wait; L2 per-store lookup guard. Fixed in 1f7ff883.
  • r5 (1f7ff883): 0H/1M/1L. M3 earlier compression held a later worker turn at unknown; L7 reset test used a fake reset. Fixed in 1fc6621c with an explicit per-admission compression mark written in the publish transaction.
  • r6 (1fc6621c): 0H/0M/0L. Probes p1–p6 pass on the real reset and compression paths.

Only the commit message changed since 1fc6621c (subject and trailers), so the head below is cleared without a new review.

Step-up signal: plain implement (Impl12326) stalled 17 min reading and was cancelled; the slice moved to implement-hard.

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

All-clear at f6ebdc5
Base: main

@rigel-mintaka

Copy link
Copy Markdown
Contributor Author

Rebased-head retest at f6ebdc51 (on main ea056ebd, which includes nebula#130): 90 passed, 2 failed. The two failures are test_journey_compress_restart_fifo [graceful] and [crash] (SUMMARY_RETAINED_FACTS), which also fail on main. The open-prompts [crash] case passed. No new failure from the rebase. Hold lifted.

This branch had an error being deployed

1 failed deployment
ci — f6ebdc51 Deployed Nov 23, 2026 by rigel-mintaka via CI (aarch64-linux) #1176
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