instar 1.3.157 → 1.3.159

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.
@@ -9,6 +9,7 @@ import type { Session, JobState, ActivityEvent } from './types.js';
9
9
  export declare class StateManager {
10
10
  private stateDir;
11
11
  private _readOnly;
12
+ private _sessionPoolActive;
12
13
  private _machineId;
13
14
  constructor(stateDir: string);
14
15
  /**
@@ -26,7 +27,23 @@ export declare class StateManager {
26
27
  * Used on standby machines to prevent accidental state forks.
27
28
  */
28
29
  setReadOnly(readOnly: boolean): void;
29
- /** Guard that throws if in read-only mode. */
30
+ /**
31
+ * Whether the active-active session pool is enabled for this machine. When true, a
32
+ * read-only standby is still permitted to write the PER-SESSION state of sessions it
33
+ * legitimately OWNS (the pool's CAS ownership guarantees a single owner per session,
34
+ * so a per-session file write can't fork shared cluster state). Shared-cluster writes
35
+ * (set/delete/saveJobState/appendEvent) stay blocked on a standby regardless.
36
+ * Default false → a pure one-awake standby remains fully read-only (unchanged).
37
+ */
38
+ setSessionPoolActive(active: boolean): void;
39
+ /**
40
+ * Guard that throws in read-only mode. `sessionScoped` marks a write that targets a
41
+ * single owned session's own file (state/sessions/<id>.json) — permitted on a
42
+ * read-only standby ONLY when the session pool is active (bug #9: a moved session's
43
+ * owner-side resume must persist on the standby that now owns it; the pool path that
44
+ * triggers it only fires for CAS-confirmed owned sessions). Shared-state writes pass
45
+ * no opts and stay blocked.
46
+ */
30
47
  private guardWrite;
31
48
  /** Validate a key/ID contains only safe characters to prevent path traversal. */
32
49
  private validateKey;
@@ -1 +1 @@
1
- {"version":3,"file":"StateManager.d.ts","sourceRoot":"","sources":["../../src/core/StateManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAyCnE,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAA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AAO,EAAE;QACnB,KAAK,CAAC,EAAE,IAAI,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,aAAa,EAAE;IA0CnB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAoB7B,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IASnC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAa5B;;;OAGG;IACH,OAAO,CAAC,WAAW;CAapB"}
@@ -44,6 +44,7 @@ function describeReadError(err, filePath) {
44
44
  export class StateManager {
45
45
  stateDir;
46
46
  _readOnly = false;
47
+ _sessionPoolActive = false;
47
48
  _machineId = null;
48
49
  constructor(stateDir) {
49
50
  this.stateDir = stateDir;
@@ -71,11 +72,31 @@ export class StateManager {
71
72
  setReadOnly(readOnly) {
72
73
  this._readOnly = readOnly;
73
74
  }
74
- /** Guard that throws if in read-only mode. */
75
- guardWrite(operation) {
76
- if (this._readOnly) {
77
- throw new Error(`StateManager is read-only (this machine is on standby). Blocked: ${operation}`);
78
- }
75
+ /**
76
+ * Whether the active-active session pool is enabled for this machine. When true, a
77
+ * read-only standby is still permitted to write the PER-SESSION state of sessions it
78
+ * legitimately OWNS (the pool's CAS ownership guarantees a single owner per session,
79
+ * so a per-session file write can't fork shared cluster state). Shared-cluster writes
80
+ * (set/delete/saveJobState/appendEvent) stay blocked on a standby regardless.
81
+ * Default false → a pure one-awake standby remains fully read-only (unchanged).
82
+ */
83
+ setSessionPoolActive(active) {
84
+ this._sessionPoolActive = active;
85
+ }
86
+ /**
87
+ * Guard that throws in read-only mode. `sessionScoped` marks a write that targets a
88
+ * single owned session's own file (state/sessions/<id>.json) — permitted on a
89
+ * read-only standby ONLY when the session pool is active (bug #9: a moved session's
90
+ * owner-side resume must persist on the standby that now owns it; the pool path that
91
+ * triggers it only fires for CAS-confirmed owned sessions). Shared-state writes pass
92
+ * no opts and stay blocked.
93
+ */
94
+ guardWrite(operation, opts) {
95
+ if (!this._readOnly)
96
+ return;
97
+ if (opts?.sessionScoped && this._sessionPoolActive)
98
+ return;
99
+ throw new Error(`StateManager is read-only (this machine is on standby). Blocked: ${operation}`);
79
100
  }
80
101
  /** Validate a key/ID contains only safe characters to prevent path traversal. */
81
102
  validateKey(key, label = 'key') {
@@ -106,7 +127,7 @@ export class StateManager {
106
127
  }
107
128
  }
108
129
  saveSession(session) {
109
- this.guardWrite('saveSession');
130
+ this.guardWrite('saveSession', { sessionScoped: true });
110
131
  this.validateKey(session.id, 'sessionId');
111
132
  const filePath = path.join(this.stateDir, 'state', 'sessions', `${session.id}.json`);
112
133
  this.atomicWrite(filePath, JSON.stringify(session, null, 2));
@@ -140,7 +161,7 @@ export class StateManager {
140
161
  return sessions;
141
162
  }
142
163
  removeSession(sessionId) {
143
- this.guardWrite('removeSession');
164
+ this.guardWrite('removeSession', { sessionScoped: true });
144
165
  this.validateKey(sessionId, 'sessionId');
145
166
  const filePath = path.join(this.stateDir, 'state', 'sessions', `${sessionId}.json`);
146
167
  if (!fs.existsSync(filePath))
@@ -1 +1 @@
1
- {"version":3,"file":"StateManager.js","sourceRoot":"","sources":["../../src/core/StateManager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;;;;;;GASG;AACH,SAAS,iBAAiB,CAAC,GAAY,EAAE,QAAgB;IAIvD,MAAM,IAAI,GAAI,GAAyC,EAAE,IAAI,CAAC;IAC9D,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,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AC,CAAC;QAClE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,KAAK,CAAC;QAC3C,IAAI,CAAC;YACH,cAAc,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,8BAA8B,EAAE,CAAC,CAAC;YACvF,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;;OAGG;IACK,WAAW,CAAC,QAAgB,EAAE,IAAY;QAChD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACnC,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,QAAQ,GAAG,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACxF,IAAI,CAAC;YACH,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAChC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,gCAAgC;YAChC,IAAI,CAAC;gBAAC,cAAc,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,8BAA8B,EAAE,CAAC,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;YACrH,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "1.3.157",
3
+ "version": "1.3.159",
4
4
  "description": "Coherence infrastructure for self-evolving AI agents — on the Claude Code or Codex subscription you already have.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "./builtin-manifest.schema.json",
3
3
  "schemaVersion": 1,
4
- "generatedAt": "2026-05-31T09:52:37.332Z",
5
- "instarVersion": "1.3.157",
4
+ "generatedAt": "2026-05-31T10:20:07.892Z",
5
+ "instarVersion": "1.3.159",
6
6
  "entryCount": 193,
7
7
  "entries": {
8
8
  "hook:session-start": {
@@ -0,0 +1,22 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- assembled-by: assemble-next-md -->
4
+ <!-- bump: patch -->
5
+
6
+ ## What Changed
7
+
8
+ **The publish workflow now survives the publish-vs-merge git race.** Publishes are already serialized against each other (workflow concurrency group), but a concurrent PR merge — a separate workflow — can still move `main` between a publish's fetch and its final `git push`, which rejected the push and failed the release run (leaving npm briefly ahead of the committed version on main). The "Commit version bump & tag" step now retries that push: on a rejection it fetches and rebases the release commit onto the updated main and pushes again (up to five attempts). Because a concurrent merge never bumps npm, the version the run already resolved stays valid, so the rebase needs no version re-resolution. The version tag is now created on the final, landed commit. If a rebase ever hits a real conflict the run aborts loudly rather than force-pushing.
9
+
10
+ ## What to Tell Your User
11
+
12
+ Nothing user-facing — this is release-pipeline robustness. When two changes hit the main branch at the same moment, a release that would previously have failed its final push now quietly rebases and completes, so versions on the registry and in the repository stay in step.
13
+
14
+ ## Summary of New Capabilities
15
+
16
+ - The publish workflow's commit-and-push step retries with a fetch + rebase on a rejected push, then pushes the version tag on the commit that actually landed.
17
+ - The common path (push succeeds on the first try) is unchanged; the retry only runs on a rejected push, so a successful publish behaves exactly as before.
18
+
19
+ ## Evidence
20
+
21
+ - `js-yaml` parse of `.github/workflows/publish.yml` succeeds; the commit step contains the rebase-retry loop and tags after the branch push.
22
+ - Pairs with the per-PR release-note fragment system (this very note is a fragment): fragments removed the PR-level NEXT.md collisions, this removes the publish-level git-push collision.
@@ -0,0 +1,49 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- assembled-by: assemble-next-md -->
4
+ <!-- bump: patch -->
5
+
6
+ ## What to Tell Your User
7
+
8
+ If you run your agent across more than one machine and move a conversation to another
9
+ one, that machine can now actually record and run the moved conversation instead of
10
+ refusing to save it. Your backup machine still can't touch shared cluster state, so
11
+ the safety against split state is unchanged. This only matters when the multi-machine
12
+ session pool is turned on; single-machine agents are unaffected. Nothing to configure.
13
+
14
+ ## Summary of New Capabilities
15
+
16
+ - `StateManager.setSessionPoolActive(active)` + a `sessionScoped` write option: a
17
+ read-only standby permits per-session writes (`saveSession`/`removeSession`) only
18
+ when the session pool is active; shared writes (`set`/`delete`/`saveJobState`/
19
+ `appendEvent`) stay blocked.
20
+ - The server marks a pool-participant machine session-pool-active where it wires the
21
+ session router; a non-pool agent stays fully read-only (default off).
22
+
23
+ ## Evidence
24
+
25
+ - Found live on 2026-05-31: after the previous release made the move forward
26
+ correctly, the mini received the conversation and tried to start it but logged
27
+ "StateManager is read-only (this machine is on standby). Blocked: saveSession", so
28
+ the owner-side resume aborted.
29
+ - Unit, `tests/unit/state-manager-readonly.test.ts`: a read-only standby with the
30
+ pool active allows saveSession/removeSession and the file persists; still blocks
31
+ set/delete/saveJobState/appendEvent; with the pool inactive it blocks saveSession
32
+ too (one-awake unchanged); a normal machine writes everything.
33
+ - 104 StateManager-family + coordinator + wiring tests pass; tsc --noEmit clean.
34
+ - Spec, `docs/specs/standby-pool-session-writes.md` plus the .eli16.md sibling.
35
+ - Side-effects, `upgrades/side-effects/standby-pool-session-writes.md`.
36
+
37
+ ## What Changed — a backup machine can now keep a conversation that was moved to it
38
+
39
+ Another step in making the multi-machine "move this conversation to my other machine"
40
+ feature work. To stay safe, a backup machine runs in read-only mode so it can never
41
+ fork the shared cluster state. But when you move a single conversation to that
42
+ machine, it has to record that it now owns and is running that conversation — and the
43
+ read-only rule was blocking that save, so the moved conversation never started.
44
+
45
+ This release splits writes into two kinds. Shared cluster state stays fully blocked on
46
+ a backup, exactly as before. But a single conversation's own state — for a
47
+ conversation the machine legitimately owns through the pool — is now allowed when the
48
+ conversation-pool feature is on. That is safe because the system already guarantees a
49
+ single owner per conversation, so there is nothing for that write to conflict with.
@@ -0,0 +1,27 @@
1
+ # Side-effects review — publish-vs-merge push retry
2
+
3
+ Seven-dimension review for the `.github/workflows/publish.yml` "Commit version bump & tag" change (retry-with-rebase on a rejected push).
4
+
5
+ ## 1. Security
6
+ No new secrets, tokens, or permissions. Uses the same `RELEASE_TOKEN`/checkout already in the job. `git rebase`/`git fetch` operate only on `main`. No force-push (a conflict aborts loudly instead).
7
+
8
+ ## 2. Blast radius (release pipeline — highest concern)
9
+ This is the one workflow nothing else can tolerate breaking. Mitigation: the change is **downside-bounded** — the common path is `git push origin main` exactly as before; the retry loop only executes when that push is *rejected*. A bug in the retry can therefore only affect the already-failing case (which previously failed outright), never a successful publish. YAML validated via `js-yaml`.
10
+
11
+ ## 3. Correctness
12
+ Concurrent merges are not releases (they never bump npm), so the version this run resolved remains valid after rebasing onto them — no version re-resolution needed. The version tag is created after the successful branch push, so it always points at the commit that actually landed. Newly-arrived release-note fragments from the concurrent merge survive the rebase (this run's commit only deleted the fragments it assembled) and ride to the next publish — consistent with the fragment system.
13
+
14
+ ## 4. Rollback
15
+ Revert the one workflow step (or the commit). No state migration, no persisted data. Reverting restores the prior single-push behavior exactly.
16
+
17
+ ## 5. Observability
18
+ On a rejected push the step logs the attempt + reason; on an unrecoverable conflict it emits a GitHub `::error::` and exits non-zero (visible failed run) rather than silently proceeding.
19
+
20
+ ## 6. Multi-machine / concurrency
21
+ This IS the concurrency fix. Publishes are serialized by the workflow `concurrency` group; this closes the remaining publish-vs-merge gap. Retry cap of 5 bounds the loop.
22
+
23
+ ## 7. Backward compatibility
24
+ Pure workflow change; no API, config, schema, or agent-installed-file change. Existing releases behave identically on the common (no-race) path.
25
+
26
+ ## Second-pass review
27
+ Release-pipeline change — a human reviewer sign-off on the workflow diff is appropriate before relying on it under heavy churn. The downside-bounded property (common path unchanged) makes shipping low-risk in the interim.
@@ -0,0 +1,100 @@
1
+ # Side-Effects Review — Standby persists pool-owned sessions (bug #9)
2
+
3
+ **Version / slug:** `standby-pool-session-writes`
4
+ **Date:** `2026-05-31`
5
+ **Author:** `echo`
6
+ **Second-pass reviewer:** `not required`
7
+
8
+ ## Summary of the change
9
+
10
+ `StateManager` gains a `_sessionPoolActive` flag (`setSessionPoolActive`) and a
11
+ `sessionScoped` option on the private `guardWrite`. A read-only standby now permits
12
+ `saveSession`/`removeSession` (per-session file writes) ONLY when the session pool is
13
+ active; all shared-cluster writes (`set`/`delete`/`saveJobState`/`appendEvent`) stay
14
+ blocked. `server.ts` sets `setSessionPoolActive(true)` where the SessionRouter is
15
+ wired. Closes bug #9 (the standby's owner-side resume was blocked at `saveSession`).
16
+
17
+ ## Decision-point inventory
18
+
19
+ - **guardWrite** — read-only? no → allow. read-only + sessionScoped + poolActive →
20
+ allow. else → throw. All three paths unit-tested.
21
+ - **saveSession / removeSession** — tagged `sessionScoped: true`. All other guarded
22
+ writes unchanged (no opts → shared → blocked when read-only).
23
+ - **server wiring** — `setSessionPoolActive(true)` only in the SessionRouter-wired
24
+ (pool-participant) block; default false elsewhere.
25
+
26
+ ## 1. Over-block
27
+
28
+ **What legitimate inputs does this reject?** Nothing new is rejected. It RELAXES one
29
+ case: a read-only standby may now persist per-session state when the pool is on.
30
+ Shared writes are still rejected on a standby exactly as before. A non-pool agent is
31
+ unchanged (flag defaults false).
32
+
33
+ ## 2. Under-block
34
+
35
+ **What does this still miss?** It does not address bug #7 (the standby has no
36
+ Telegram token → a moved session is mute). It scopes the exception to `saveSession`/
37
+ `removeSession`; if the owner-side resume later needs another per-session write, that
38
+ write would need the same tag (the next live re-test will surface it — same cascade
39
+ method). It does not add a pool-ownership re-check inside StateManager (the upstream
40
+ owner-side-resume path already gates on stage!=dark + CAS ownership; StateManager
41
+ trusts that, scoped to per-session files which cannot fork shared state).
42
+
43
+ ## 3. Level-of-abstraction fit
44
+
45
+ **Right layer?** Yes. The guard lives in `StateManager.guardWrite` (the single write
46
+ chokepoint). The per-session vs shared distinction is expressed at each write's call
47
+ site via one boolean. The pool-participant signal is set once where the pool is
48
+ wired. No duplicated policy.
49
+
50
+ ## 4. Signal vs authority compliance
51
+
52
+ **Required reference:** [docs/signal-vs-authority.md](../../docs/signal-vs-authority.md)
53
+
54
+ This IS a safety-authority guard (read-only standby prevents state forks). The change
55
+ NARROWS the guard's scope for a provably-safe case (per-session owned files under
56
+ single-owner CAS), never widening it for shared state. It blocks nothing new and
57
+ adds no user-facing gate.
58
+
59
+ ## 5. Interactions
60
+
61
+ The read-only flag is toggled dynamically by `MultiMachineCoordinator`
62
+ (`setReadOnly(!holdsLease)`); `_sessionPoolActive` is orthogonal (set once at pool
63
+ wiring). Together: a non-holder standby with the pool on may write owned sessions but
64
+ not shared state. The owner-side resume (`server.ts` onAccepted) is the consumer —
65
+ its `saveSession` now succeeds on the standby. Idempotent. No interaction with the
66
+ lease/registry shared-state path (still guarded).
67
+
68
+ ## 6. External surfaces
69
+
70
+ None. No HTTP routes, config, or notifications. The visible effect is the absence of
71
+ the `owner-side resume failed … Blocked: saveSession` warning on a pool standby.
72
+
73
+ ## 7. Rollback cost
74
+
75
+ Low. Revert restores the unconditional read-only block on saveSession (re-introducing
76
+ bug #9). No schema, no persisted state, no migration. The `_sessionPoolActive` flag is
77
+ in-memory only.
78
+
79
+ ## Conclusion
80
+
81
+ Minimal, scoped relaxation of a safety guard for a provably-fork-safe case
82
+ (per-session owned writes under single-owner CAS), both sides + the one-awake-default
83
+ unit-tested, no shared-state exposure, no external surface, cheap revert. Lets a moved
84
+ session actually persist on the machine that now owns it.
85
+
86
+ ## Second-pass review (if required)
87
+
88
+ Not required — narrowly-scoped guard relaxation, every decision branch + the
89
+ one-awake default tested, no shared-state write enabled, reversible, pool-gated. The
90
+ live two-machine re-test is the Tier-3 gate that follows.
91
+
92
+ ## Evidence pointers
93
+
94
+ - `tests/unit/state-manager-readonly.test.ts` — read-only+pool-active allows
95
+ saveSession/removeSession + persists; still blocks shared writes; read-only+pool-
96
+ inactive blocks saveSession; normal machine writes all. Existing block tests green.
97
+ - 104 StateManager-family + coordinator + wiring tests green; `tsc --noEmit` clean.
98
+ - Found live on the mini: `owner-side resume failed for topic 8882: StateManager is
99
+ read-only (this machine is on standby). Blocked: saveSession`.
100
+ - Spec: `docs/specs/standby-pool-session-writes.md` (+ `.eli16.md`).