fix(coding-agent): handle stale extension contexts

fixes #3606
This commit is contained in:
Mario Zechner
2026-04-23 22:06:55 +02:00
parent 0cb8ff3843
commit f0cf8a59d2
9 changed files with 77 additions and 17 deletions

View File

@@ -164,7 +164,7 @@ export function createExtensionRuntime(): ExtensionRuntime {
invalidate: (message) => {
state.staleMessage ??=
message ??
"This extension instance is stale after session replacement or reload. Use the provided replacement-session context instead.";
"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(). For newSession, fork, and switchSession, move post-replacement work into withSession and use the ctx passed to withSession. For reload, do not use the old ctx after await ctx.reload().";
},
// Pre-bind: queue registrations so bindCore() can flush them once the
// model registry is available. bindCore() replaces both with direct calls.