Skip to content

feat(runtime): automatic parent-session rollover with resumable state #1081

Description

@tseom-dev

Problem

Long-running goal sessions can reach their hard context boundary while work is still open. Same-session compaction helps, but it does not create a successor parent session, so continuation still depends on manual checkpoint/replay.

Expected behavior

Before the parent session reaches its terminal context boundary, Senpi should create exactly one successor parent session and automatically resume it from a durable checkpoint.

The checkpoint should preserve:

  • latest user goal and queued steering
  • todo item states and active pointer
  • cwd, model, and runtime configuration
  • child-task/monitor/wakeup references without duplicating work
  • predecessor/successor linkage visible to the operator

Safety requirements

  • rollover is idempotent under retries and process restart
  • no open task is silently promoted to complete
  • a failed handoff remains recoverable from the predecessor checkpoint
  • live child work is reattached or explicitly marked unavailable, never duplicated silently
  • manual checkpoint/replay remains available as a fallback

Acceptance tests

  1. Simulate a parent session crossing a configurable rollover threshold.
  2. Verify one successor is created and linked in both directions.
  3. Verify pending/in-progress/completed todo states and the active pointer are identical after resume.
  4. Verify a crash between checkpoint creation and successor activation replays exactly once.
  5. Verify child task and monitor references are restored without duplicate execution.
  6. Verify the successor continues automatically without requiring the operator to paste a handoff.

Current workaround: bounded manual checkpoint and replay. That mitigates loss but does not satisfy automatic parent-session rollover.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions