paseo-follow-up 1.4.0-beta.28 → 1.4.0-beta.29

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
@@ -2,6 +2,10 @@
2
2
 
3
3
  What changed in each version of Follow-up, newest first. Follow-up shows these in "What's new" after an update, and in full from Home's last line.
4
4
 
5
+ ## 1.4.0-beta.29 (2026-11-10)
6
+
7
+ - Small fixes and improvements.
8
+
5
9
  ## 1.4.0-beta.28 (2026-11-10)
6
10
 
7
11
  - "What's this about?" is now the Summary: one short sentence under the workspace's name saying what it's for. Rewrite it from the panel's Spec, agent and recovery section.
package/README.md CHANGED
@@ -221,7 +221,7 @@ This replaces the separate **Wait** plugin (`paseo-wait`). While that plugin is
221
221
  Install the beta:
222
222
 
223
223
  ```sh
224
- paseo plugin update follow-through --version 1.4.0-beta.28
224
+ paseo plugin update follow-through --version 1.4.0-beta.29
225
225
  # or, for a fresh install:
226
226
  paseo plugin install npm:paseo-follow-up@beta
227
227
  ```
package/index.server.ts CHANGED
@@ -65,6 +65,7 @@ import { labelsFor, providerName, resolveRole, roleSummary, type AgentSettingsVi
65
65
  import type { LoadSignals } from "./shared/agent-load";
66
66
  import { OnboardingStore, ReadinessChecks, nativeAgentCount } from "./server/onboarding";
67
67
  import { execFile } from "node:child_process";
68
+ import { compactHeap } from "./server/memory";
68
69
  import { VersionsStore, demoOverride, describeSelf, readPackage, type SelfInstall } from "./server/release-notes";
69
70
  import { releaseNotesViewSchema, type ReleaseNote, type ReleaseNotesView } from "./shared/changelog";
70
71
  import { BRIEF_KIND, BRIEF_VERSION, prState, validateNeedsYou, type Brief, type NeedsYouRecord } from "./shared/brief";
@@ -330,10 +331,13 @@ export default function contribute(server: PluginServerContext) {
330
331
  }
331
332
  return withSessionMcp({ ...request, env: { ...request.env, FOLLOW_THROUGH_TOOLS: "stdio", FOLLOW_THROUGH_PROVIDER: request.provider } }, directory, clientEntry(), paseoHome, recovery, process.env, brief, root, overseer, providers) as R;
332
333
  };
334
+ let compacted = false;
333
335
  const loop = async () => {
334
336
  await ready;
335
337
  if (stopped || loadError) return;
336
338
  await engine.tick();
339
+ // Startup is done once the first tick is: release what it grew (see server/memory.ts).
340
+ if (!compacted) { compacted = true; compactHeap(); }
337
341
  if (!stopped) timer = setTimeout(() => void loop(), 15_000);
338
342
  };
339
343
  void loop();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "1.4.0-beta.28",
4
+ "version": "1.4.0-beta.29",
5
5
  "description": "Follow every workspace PR stack in Paseo, answer agent questions, batch repairs for the main agent, and see what needs you.",
6
6
  "type": "module",
7
7
  "files": [
package/server/engine.ts CHANGED
@@ -116,8 +116,7 @@ export class Engine {
116
116
  if (this.stopped) return;
117
117
  const runtime = await this.gateway.observe(original).catch((): Runtime => ({ busy: false, reason: "Agent state unavailable; refresh will retry", archived: false }));
118
118
  const pruned: Batch[] = [];
119
- await this.store.mutate(state => {
120
- const w = findWorkspace(state, original.id);
119
+ await this.store.mutateWorkspace(original.id, w => {
121
120
  w.runtimeBusy = runtime.busy; w.runtimeReason = runtime.reason;
122
121
  w.backgroundBusy = runtime.backgroundBusy ?? false;
123
122
  if (runtime.gone && w.goneAgent?.agentId !== w.mainAgentId) w.goneAgent = { agentId: w.mainAgentId, at: new Date(this.now()).toISOString(), reason: runtime.gone };
@@ -0,0 +1,20 @@
1
+ import { setFlagsFromString } from "node:v8";
2
+ import { runInNewContext } from "node:vm";
3
+
4
+ /**
5
+ * One full, compacting garbage collection, for the worker once its startup work is done (load, migrations, the first
6
+ * engine tick). That work grows V8's young generation and touches pages V8 then keeps pooled, so without it the worker
7
+ * idled at its startup peak: 216-239 MB in the 120-workspace scale check against 152-184 MB with it (1.4.0-beta.23).
8
+ * Paseo starts plugin processes itself, so there's no --expose-gc: the flag is set for one fresh context only, which
9
+ * leaves no `gc` global behind. Returns false where the runtime refuses; the worker carries on either way.
10
+ */
11
+ export function compactHeap(): boolean {
12
+ try {
13
+ setFlagsFromString("--expose-gc");
14
+ const gc = runInNewContext("gc") as unknown;
15
+ setFlagsFromString("--no-expose-gc");
16
+ if (typeof gc !== "function") return false;
17
+ gc();
18
+ return true;
19
+ } catch { return false; }
20
+ }
package/server/store.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { mkdir, open, readFile, rename, unlink } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { randomUUID } from "node:crypto";
4
- import { stateSchema, type State } from "../shared/model";
4
+ import { stateSchema, type State, type Workspace } from "../shared/model";
5
5
 
6
6
  /**
7
7
  * Follow-up's saved state. 1.3.0-beta.4: the state lives in memory once loaded, and writes to state.json are
@@ -42,14 +42,38 @@ export class Store {
42
42
  /** A private, mutable copy of the saved state (the old per-call read). */
43
43
  async read(): Promise<State> { return structuredClone(await this.load()); }
44
44
  async mutate<T>(work: (state: State) => T | Promise<T>): Promise<T> {
45
- const next = this.tail.then(async () => {
46
- const draft = structuredClone(await this.load());
45
+ return this.apply(async current => {
46
+ const draft = structuredClone(current);
47
47
  const value = await work(draft);
48
- // Write-through keeps the old contract: a failed write leaves the saved state as it was. The draft may hold
49
- // objects owned by callers (observations), so only the validated copy the write returns is frozen.
50
- if (this.writeMs <= 0) this.state = await this.write(draft);
51
- else { this.state = draft; this.schedule(); }
52
- await this.onChanged(this.state).catch(() => undefined);
48
+ return { value, next: sameJson(draft, current) ? null : draft };
49
+ });
50
+ }
51
+ /**
52
+ * A mutation of one workspace: only that workspace is copied, and nothing is written, re-validated or derived when
53
+ * it comes back unchanged. The engine observes every active workspace on each tick, and copying the whole state for
54
+ * each (then re-parsing it at the next write) was most of the idle worker's garbage (1.4.0-beta.23 scale check).
55
+ */
56
+ async mutateWorkspace<T>(id: string, work: (workspace: Workspace) => T | Promise<T>): Promise<T> {
57
+ return this.apply(async current => {
58
+ const index = current.workspaces.findIndex(w => w.id === id);
59
+ if (index < 0) throw new Error("Workspace tracking is initializing; try again shortly.");
60
+ const before = current.workspaces[index];
61
+ const draft = structuredClone(before);
62
+ const value = await work(draft);
63
+ return { value, next: sameJson(draft, before) ? null : { ...current, workspaces: current.workspaces.with(index, draft) } };
64
+ });
65
+ }
66
+ /** Runs a mutation in order. A null `next` means nothing changed: the state, the pending write and derived files stay as they are. */
67
+ private apply<T>(work: (current: State) => Promise<{ value: T; next: State | null }>): Promise<T> {
68
+ const next = this.tail.then(async () => {
69
+ const { value, next } = await work(await this.load());
70
+ if (next) {
71
+ // Write-through keeps the old contract: a failed write leaves the saved state as it was. The draft may hold
72
+ // objects owned by callers (observations), so only the validated copy the write returns is frozen.
73
+ if (this.writeMs <= 0) this.state = await this.write(next);
74
+ else { this.state = next; this.schedule(); }
75
+ await this.onChanged(this.state).catch(() => undefined);
76
+ }
53
77
  return structuredClone(value);
54
78
  });
55
79
  this.tail = next.catch(() => undefined);
@@ -114,6 +138,26 @@ export class Store {
114
138
  }
115
139
  }
116
140
 
141
+ /**
142
+ * Whether two values would save the same: JSON-equal, ignoring key order and undefined properties (the schema
143
+ * normalizes both). Anything else (a Date, a Map) counts as different, so a real change is never skipped.
144
+ */
145
+ export function sameJson(a: unknown, b: unknown): boolean {
146
+ if (a === b) return true;
147
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) return false;
148
+ if (Array.isArray(a)) {
149
+ if (!Array.isArray(b) || a.length !== b.length) return false;
150
+ for (let i = 0; i < a.length; i++) if (!sameJson(a[i], b[i])) return false;
151
+ return true;
152
+ }
153
+ if (Array.isArray(b) || Object.getPrototypeOf(a) !== Object.prototype || Object.getPrototypeOf(b) !== Object.prototype) return false;
154
+ const x = a as Record<string, unknown>, y = b as Record<string, unknown>;
155
+ let keys = 0;
156
+ for (const key in x) { if (x[key] === undefined) continue; keys++; if (!Object.hasOwn(y, key) || !sameJson(x[key], y[key])) return false; }
157
+ for (const key in y) if (y[key] !== undefined) keys--;
158
+ return keys === 0;
159
+ }
160
+
117
161
  function deepFreeze<T>(value: T): T {
118
162
  if (value && typeof value === "object" && !Object.isFrozen(value)) {
119
163
  Object.freeze(value);