Skip to content

fix(session-recap): avoid stale ctx.hasUI calls after session replacement#1

Open
alpertarhan wants to merge 1 commit into
mainfrom
fix/stale-context-after-session-replacement
Open

fix(session-recap): avoid stale ctx.hasUI calls after session replacement#1
alpertarhan wants to merge 1 commit into
mainfrom
fix/stale-context-after-session-replacement

Conversation

@alpertarhan

Copy link
Copy Markdown
Owner

Fixes pi-mono issue #3021 where session-recap crashes with stale ctx error after session replacement commands like /reload.

…ment

Avoid calling ctx.hasUI on contexts that may be stale after session
replacement (reload, fork, switchSession). Instead, track uiActive state
in the extension and only use ctx.hasUI in session_start where the
context is guaranteed fresh. This fixes the error:

  This extension ctx is stale after session replacement or reload.
  Do not use a captured pi or command ctx after ctx.newSession(),
  ctx.fork(), ctx.switchSession(), or ctx.reload().

Fixes: pi-mono/issues#3021
@alpertarhan alpertarhan force-pushed the fix/stale-context-after-session-replacement branch from 8d94698 to eeeeff4 Compare May 11, 2026 14:06
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