instar 1.2.45 → 1.2.46

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "instar",
3
- "version": "1.2.45",
3
+ "version": "1.2.46",
4
4
  "description": "Persistent autonomy infrastructure for AI agents",
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-23T04:13:43.011Z",
5
- "instarVersion": "1.2.45",
4
+ "generatedAt": "2026-05-23T04:15:24.412Z",
5
+ "instarVersion": "1.2.46",
6
6
  "entryCount": 191,
7
7
  "entries": {
8
8
  "hook:session-start": {
@@ -0,0 +1,99 @@
1
+ # Upgrade Guide — vNEXT
2
+
3
+ <!-- bump: patch -->
4
+ <!-- patch = bug fix, no new capability, no breaking change -->
5
+
6
+ ## What Changed
7
+
8
+ **fix(framework): Telegram spawn path now honors the agent's configured framework (codex-cli agents stop spawning Claude sessions).**
9
+
10
+ A follow-on to the framework-spawn-portability fix (v1.2.31). That fix
11
+ made the fresh-spawn path (`spawnInteractiveSession`'s internal
12
+ resolution) read the agent's resolved `config.sessions.framework`. But
13
+ there are TWO paths that pick a framework, and the **Telegram message
14
+ path** was missed.
15
+
16
+ When a Telegram message arrives, `spawnSessionForTopic` resolves the
17
+ framework via `resolveTopicFramework(topicId)`, which returns the
18
+ module-level `_defaultFramework` for any topic without an explicit
19
+ per-topic override (i.e. every fresh topic). `_defaultFramework` was
20
+ initialized in `startServer` as:
21
+
22
+ ```ts
23
+ const framework = frameworkFromEnv() ?? 'claude-code';
24
+ ```
25
+
26
+ — sourced ONLY from the `INSTAR_FRAMEWORK` environment variable. The
27
+ setup wizard sets `enabledFrameworks: ['codex-cli']` in config, NOT the
28
+ env var, so for a codex-cli-only agent that didn't export
29
+ `INSTAR_FRAMEWORK` (the common case), `frameworkFromEnv()` returned
30
+ undefined and `_defaultFramework` fell back to `'claude-code'`. Worse,
31
+ `spawnSessionForTopic` passes its resolved framework as the per-call
32
+ `options.framework` to `spawnInteractiveSession` — and per-call wins
33
+ over `config.framework`. So even though v1.2.31 correctly resolved
34
+ `config.framework` to `codex-cli`, the Telegram path's wrong default
35
+ overrode it and spawned a Claude session on every message.
36
+
37
+ The fix: derive `_defaultFramework` from the agent's resolved runtime
38
+ framework first, falling back to the env var only when that's unset:
39
+
40
+ ```ts
41
+ const framework = config.sessions?.framework ?? frameworkFromEnv() ?? 'claude-code';
42
+ ```
43
+
44
+ `config.sessions.framework` is the single resolved source
45
+ (`resolveConfiguredFramework(sessions.framework, INSTAR_FRAMEWORK,
46
+ enabledFrameworks)` from `Config.load`), so both the fresh-spawn path
47
+ and the Telegram path now agree. A codex-cli-only agent spawns Codex
48
+ sessions whether the session is created directly via the API or
49
+ triggered by a Telegram message.
50
+
51
+ No migration needed — the fix is a server-startup derivation. Deployed
52
+ codex-cli agents get the correct behavior the moment they update and
53
+ restart cleanly. (Note: a clean restart IS required — an agent running
54
+ an older server process keeps the old `_defaultFramework` in memory
55
+ until restarted, even after its files update.)
56
+
57
+ ## Evidence
58
+
59
+ The original failure: a codex-cli-only agent ("codey") with
60
+ `enabledFrameworks: ['codex-cli']` and no `INSTAR_FRAMEWORK` env spawned
61
+ a Claude Code (Opus 4.7) session every time it answered a Telegram
62
+ message — including in brand-new topics. A direct `/sessions/create`
63
+ API spawn correctly produced Codex, which masked the bug (the API path
64
+ doesn't pass the Telegram default).
65
+
66
+ Regression coverage in `tests/unit/framework-spawn-portability.test.ts`
67
+ (2 new assertions):
68
+
69
+ 1. `server.ts` derives `_defaultFramework` from `config.sessions?.framework`
70
+ ahead of the `frameworkFromEnv()` fallback.
71
+ 2. The pre-fix env-only derivation (`const framework = frameworkFromEnv()
72
+ ?? 'claude-code';`) no longer appears in `server.ts`.
73
+
74
+ These join the existing 10 framework-spawn-portability tests (precedence
75
+ of `resolveConfiguredFramework`, the spawn-path source assertions, and
76
+ the `Config.load` wiring) — 12 tests total, all passing. `tsc --noEmit`
77
+ clean, lint clean.
78
+
79
+ Empirical confirmation against a live codex-cli agent (message it, watch
80
+ the spawned session run `codex --model gpt-5.3-codex` instead of
81
+ `claude`) is performed as part of the rollout, per the bug-fix evidence
82
+ bar — no "fixed" claim without reproducing the corrected behavior.
83
+
84
+ ## What to Tell Your User
85
+
86
+ If you set up an agent to run on Codex, it will now correctly run on
87
+ Codex when it answers your messages — not just when a session is
88
+ created some other way. Before this fix, a Codex-only agent could still
89
+ quietly start up on Claude whenever you messaged it, because the
90
+ message-handling path was reading the wrong setting. You don't need to
91
+ do anything beyond letting your agent update and restart; the Codex
92
+ choice you made at setup is now respected on every path.
93
+
94
+ ## Summary of New Capabilities
95
+
96
+ | Capability | How to Use |
97
+ |-----------|-----------|
98
+ | Telegram message path honors configured framework | Automatic — codex-cli agents spawn Codex on incoming messages |
99
+ | Single framework source of truth across both spawn paths | Automatic — derived from your install-time framework choice |
@@ -0,0 +1,106 @@
1
+ # Side-effects review — Telegram default-framework fix (codex agents)
2
+
3
+ **Scope**: Follow-on to framework-spawn-portability (v1.2.31). The
4
+ original fix corrected the fresh-spawn path
5
+ (`spawnInteractiveSession`'s internal framework resolution) but missed
6
+ the Telegram message path (`spawnSessionForTopic` →
7
+ `resolveTopicFramework` → `_defaultFramework`). `_defaultFramework` was
8
+ sourced from `frameworkFromEnv()` only, so a codex-cli-only agent
9
+ without the `INSTAR_FRAMEWORK` env var defaulted to claude-code and
10
+ spawned Claude on every Telegram message — and because the Telegram
11
+ path passes its framework as the per-call `options.framework`
12
+ (highest precedence), it overrode the correct `config.framework`.
13
+ Governed by the existing converged + approved spec
14
+ `specs/dev-infrastructure/framework-spawn-portability.md`.
15
+
16
+ **Files touched**:
17
+ - `src/commands/server.ts` — one line in `startServer`:
18
+ `const framework = frameworkFromEnv() ?? 'claude-code';`
19
+ →
20
+ `const framework = config.sessions?.framework ?? frameworkFromEnv() ?? 'claude-code';`
21
+ plus an explanatory comment. `config.sessions.framework` is the
22
+ resolved runtime framework (`resolveConfiguredFramework` output from
23
+ `Config.load`, line 635), so the Telegram default now matches the
24
+ fresh-spawn path.
25
+ - `tests/unit/framework-spawn-portability.test.ts` — 2 new source-grep
26
+ assertions (derivation reads `config.sessions?.framework`; the
27
+ env-only derivation is gone).
28
+
29
+ **Under-block**: None. The change makes a previously-ignored config
30
+ field authoritative for the Telegram default. There is no path where a
31
+ framework that *should* spawn is now suppressed: per-topic overrides
32
+ (`_topicFrameworksStore` / `_topicFrameworks`) still win over the
33
+ default (they're checked first in `resolveTopicFramework`), and the
34
+ `INSTAR_FRAMEWORK` env still applies as a fallback when
35
+ `config.sessions.framework` is somehow unset.
36
+
37
+ **Over-block**: None. A claude-code agent (config.sessions.framework =
38
+ 'claude-code') still resolves to claude-code. A codex-cli agent now
39
+ correctly resolves to codex-cli instead of silently falling back to
40
+ claude-code. The only behavior change is the bug being fixed.
41
+
42
+ **Level-of-abstraction fit**: The Telegram default now reads the same
43
+ single resolved value (`config.sessions.framework`) that the
44
+ SessionManager's internal resolution reads. One source of truth, both
45
+ spawn paths. `resolveTopicFramework`'s precedence (per-topic store >
46
+ per-topic config map > default) is unchanged — only the *default's*
47
+ source is corrected.
48
+
49
+ **Signal vs authority**: Compliant. `config.sessions.framework`,
50
+ `INSTAR_FRAMEWORK`, and per-topic overrides are all SIGNALS;
51
+ `resolveConfiguredFramework` (in Config.load) is the single AUTHORITY
52
+ that resolves the agent-level framework, and `resolveTopicFramework`
53
+ layers per-topic overrides on top. No new authority introduced.
54
+
55
+ **Interactions**:
56
+ - `resolveTopicFramework` callers (the Telegram spawn path) now get the
57
+ correct default. The per-topic `/route` override path is unaffected
58
+ (it sets `_topicFrameworksStore`, checked before the default).
59
+ - `spawnSessionForTopic` passes `framework` as `options.framework` to
60
+ `spawnInteractiveSession`. With the fix, that value is now correct
61
+ for codex-cli agents, so the per-call override and the internal
62
+ `config.framework` resolution agree (no conflict).
63
+ - `resolvedFramework` (used a few lines later to pick the
64
+ IntelligenceProvider for relationships/shared intelligence) now also
65
+ reflects the configured framework — correct: a codex-cli agent's
66
+ shared intelligence provider should match its framework.
67
+
68
+ **External surfaces**: None. No new API endpoint, no new config field
69
+ (the `INSTAR_FRAMEWORK` env and `enabledFrameworks` config already
70
+ existed), no CLI change.
71
+
72
+ **Migration parity**: No agent-installed file change. The fix is a
73
+ server-startup derivation; deployed codex-cli agents get correct
74
+ behavior on their next update + clean restart. IMPORTANT operational
75
+ note (documented in NEXT.md): an agent running an older server process
76
+ keeps the stale `_defaultFramework` in memory until restarted, even
77
+ after its files update. This is the version-skew pattern — "updated"
78
+ ≠ "running the update". The codey incident that surfaced this bug was
79
+ partly this: the fix-bearing files were present but a long-running
80
+ process still served the old default.
81
+
82
+ **Rollback cost**: Trivial. Revert one line in server.ts + the 2 test
83
+ assertions.
84
+
85
+ **Tests**:
86
+ - 12/12 `framework-spawn-portability.test.ts` (10 existing + 2 new).
87
+ - `tsc --noEmit` clean. `npm run lint` clean.
88
+ - Empirical end-to-end confirmation (live codex-cli agent spawns
89
+ `codex --model gpt-5.3-codex` on a Telegram message, not `claude`)
90
+ is performed during rollout per the bug-fix evidence bar.
91
+
92
+ **Decision-point inventory**:
93
+ 1. Derive `_defaultFramework` from `config.sessions.framework` (vs.
94
+ adding yet another env read or a new config field) — reuses the
95
+ single resolved value the rest of the system already trusts. No new
96
+ knob.
97
+ 2. Keep `frameworkFromEnv()` + `'claude-code'` as fallbacks (vs.
98
+ removing them) — defense-in-depth: if `config.sessions.framework`
99
+ is ever unset (older Config.load, or a hand-edited config), the env
100
+ var and historical default still apply. The fix only re-orders
101
+ precedence to put the resolved config value first.
102
+ 3. Regression test via source-grep (vs. spinning up a full server) —
103
+ `_defaultFramework` is module-private state set inside the large
104
+ `startServer`; a source-grep assertion that the derivation reads
105
+ `config.sessions?.framework` is the proportionate guard, matching
106
+ the existing framework-spawn-portability spawn-path assertions.