@alphacoder-v0/pi-loops 0.22.5 → 0.22.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ All notable changes to pi-loops are documented here. The format follows
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.22.6] - 2026-10-20
9
+
10
+ ### Fixed
11
+ - **A finished loop run no longer leaves the shared extensions stale.** Every run in one project
12
+ shares one loaded extension set, and a finished run's `session.dispose()` invalidated the
13
+ runtime those extensions captured at load time. The restore that was meant to undo it read a
14
+ flag pi keeps in a closure, so it never did anything: from the second run on, every `pi.*`
15
+ call from a shared extension threw "This extension ctx is stale", an extension that gates
16
+ tool calls (pi-permission-system, say) blocked every tool call, and the event-bus listeners
17
+ the extensions registered at load were gone. The shared runtime is now never invalidated; each
18
+ run's own ExtensionRunner still is. The cost: a listener an extension adds inside a per-run
19
+ handler is kept for the life of the host. `test/sdk-runner.test.ts`: *a finished run does not
20
+ leave the shared extensions stale for the next run*. [#81](https://github.com/alphacoder-v0/pi-loops/pull/81)
21
+ by [@advaitpaliwal](https://github.com/advaitpaliwal).
22
+
8
23
  ## [0.22.5] - 2026-09-28
9
24
 
10
25
  ### Changed
package/README.md CHANGED
@@ -38,7 +38,7 @@ the first sign of credentials that do not work should not be an empty inbox tomo
38
38
 
39
39
  ```bash
40
40
  pi install npm:@alphacoder-v0/pi-loops # from npm, following new releases
41
- pi install git:github.com/alphacoder-v0/pi-loops@v0.22.5 # or from GitHub, at a pinned tag
41
+ pi install git:github.com/alphacoder-v0/pi-loops@v0.22.6 # or from GitHub, at a pinned tag
42
42
  pi install /path/to/pi-loops # or a local checkout — `pi install .` in this repo
43
43
  pi -e /path/to/pi-loops # or none of them: try it for one run, installing nothing
44
44
  ```
package/README.zh-CN.md CHANGED
@@ -45,7 +45,7 @@ pi-loops 自己没有任何运行时依赖。
45
45
 
46
46
  ```bash
47
47
  pi install npm:@alphacoder-v0/pi-loops # 从 npm 装,跟着新版本走
48
- pi install git:github.com/alphacoder-v0/pi-loops@v0.22.5 # 或者从 GitHub 装,钉住一个 tag
48
+ pi install git:github.com/alphacoder-v0/pi-loops@v0.22.6 # 或者从 GitHub 装,钉住一个 tag
49
49
  pi install /path/to/pi-loops # 或者本地检出;本仓库里就是 pi install .
50
50
  ```
51
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphacoder-v0/pi-loops",
3
- "version": "0.22.5",
3
+ "version": "0.22.6",
4
4
  "description": "An automation layer for pi: cron + stateful loops with a triage inbox, maker/checker verification, dynamic triggers, MCP notifications and tools, lifecycle hooks, session archives. A non-invasive pi extension.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/sdk-runner.ts CHANGED
@@ -111,15 +111,12 @@ export function subSessionResources(req: Pick<SubagentRequest, "cwd">, deps: Pic
111
111
  // staleness, which is what that message is really about, is untouched. The cost is that
112
112
  // a `pi.*` action between runs reaches the most recently created session instead of
113
113
  // throwing; pi rebinds those to the live session on the next run (`runner.js:160-175`).
114
- // Only the staleness half is neutralised: the same call also runs pi's event-bus
115
- // unsubscribers, and dropping those would leak every subscription a shared extension made,
116
- // run after run, in a host that lives for days.
117
- const invalidate = base.runtime.invalidate.bind(base.runtime);
118
- base.runtime.invalidate = (message?: string) => {
119
- const before = (base.runtime as any).staleMessage;
120
- invalidate(message);
121
- (base.runtime as any).staleMessage = before;
122
- };
114
+ // pi keeps the runtime's stale flag in a closure (`createExtensionRuntime`'s `state`, dist/core/extensions/
115
+ // loader.js), not on the runtime object, so it cannot be read back and restored after `invalidate()`.
116
+ // And `invalidate()` also unsubscribes every event-bus listener the shared extensions made when they
117
+ // loaded, which the next run needs (pi-mcp-adapter's runtime tool calls, say). The shared runtime lives
118
+ // as long as this loaded set, so it is never invalidated; each run's own ExtensionRunner still is.
119
+ base.runtime.invalidate = () => {};
123
120
  return { ...base, extensions: [...base.extensions.filter((e) => !isInsideDir(ownDir, e.resolvedPath) && !isInsideDir(ownDir, e.path)), subagentGuardExtension(deps.log, deps.allowCommands?.() ?? [])] };
124
121
  },
125
122
  });