Skip to content

bug(context-pivot): reset pending pivots when sessions change #746

Open

Description

@outlier27-cell

Problem

context-pivot clears pending and compacting on session_shutdown, but Pi can start a replacement session through session_start before an old compaction callback settles. The old in-memory compacting flag then makes the new Session's first context_pivot fail with "A context pivot is already in progress."

Minimal reproduction

  1. Start context_pivot in a session above the threshold, so the extension records a pending pivot and sets compacting.
  2. Start a replacement Pi session before the original compaction calls back.
  3. Call context_pivot in the new long-context session.
  4. The new Session is rejected by stale runtime state.

Expected behavior

Pending compaction state is session-local. A fresh session_start invalidates old pending state and allows a new eligible Session to pivot.

Proposed scope

Reset the existing generation/pending/compacting state at session start and add a lifecycle regression ensuring a second session can begin its own pivot.

Activity

  1. outlier27-cell commented on Oct 11, 2026

    @outlier27-cell
    ContributorAuthor

    I am claiming this focused lifecycle defect. I will add a second-session regression that starts a pending pivot, changes sessions, and verifies the new eligible session can start its own pivot.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions