Skip to content

Persist accepted session input before acknowledgment - #2209

Open
Aaronontheweb wants to merge 1 commit into
feat/shorten-approval-drainfrom
feat/resume-interrupted-sessions
Open

Aaronontheweb wants to merge 1 commit into
feat/shorten-approval-drainfrom
feat/resume-interrupted-sessions

Conversation

@Aaronontheweb

Copy link
Copy Markdown
Collaborator

Scope

This PR adds the journal foundation for restart recovery. It stacks on #2202.

  • Persist each accepted request before its input acknowledgment.
  • Keep the input text, media, source ID, executable text, and original turn authority in the journal.
  • Keep ordered pending input and recent source IDs in session state and snapshots.
  • Consume input IDs when a reply completes, a tool batch starts, or a turn fails.
  • Reject a stable source retry without a second admission event.
  • Preserve old TurnRecorded and ToolBatchStarted fields for journal compatibility.

The OpenSpec change describes the complete recovery contract. This PR implements its admission foundation. The next stacked PR adds stop classification, the bounded manifest, and automatic wakeup. This PR does not resume a model call after a daemon restart.

Evidence

  • Netclaw.Actors.Tests: 4,025 passed, six skipped.
  • A journal replay test found the accepted input after its acknowledgment. The same test found one admission event after a source retry.
  • New and old protobuf event round trips passed.
  • dotnet slopwatch analyze: zero issues.
  • Header verification, openspec validate resume-interrupted-sessions --strict, and git diff --check passed.

Review focus

Check the input ack boundary, event replay, old journal compatibility, and source scope for deduplication.

This PR replaces #2204 so GitHub can link the same-repository branches as a stack.

@Aaronontheweb
Aaronontheweb added this pull request to stack #2212 September 19, 2026 13:58
@Aaronontheweb
Aaronontheweb marked this pull request as ready for review September 19, 2026 14:16
@Aaronontheweb Aaronontheweb added sessions LLM session actor, turn lifecycle, pipelines reliability Retries, resilience, graceful degradation labels Sep 19, 2026
public static string? SourceMessageKey(InputAdmitted evt)
=> string.IsNullOrWhiteSpace(evt.SourceMessageId)
? null
: $"{evt.TurnContext?.ChannelType ?? string.Empty}:{evt.TurnContext?.RequesterSenderId?.Value ?? string.Empty}:{evt.SourceMessageId}";
SessionId = _sessionId,
InputId = Guid.NewGuid().ToString("N"),
SourceMessageId = cmd.Source?.MessageId
?? cmd.Source?.ReminderId?.Value
InputId = Guid.NewGuid().ToString("N"),
SourceMessageId = cmd.Source?.MessageId
?? cmd.Source?.ReminderId?.Value
?? cmd.Source?.BackgroundJobId?.Value,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reliability Retries, resilience, graceful degradation sessions LLM session actor, turn lifecycle, pipelines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant