instar 1.3.57 → 1.3.59
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/dist/commands/server.d.ts.map +1 -1
- package/dist/commands/server.js +28 -1
- package/dist/commands/server.js.map +1 -1
- package/dist/config/ConfigDefaults.d.ts.map +1 -1
- package/dist/config/ConfigDefaults.js +8 -0
- package/dist/config/ConfigDefaults.js.map +1 -1
- package/dist/core/MessagingToneGate.d.ts +20 -0
- package/dist/core/MessagingToneGate.d.ts.map +1 -1
- package/dist/core/MessagingToneGate.js +12 -1
- package/dist/core/MessagingToneGate.js.map +1 -1
- package/dist/core/TopicIntentArcCheck.d.ts +15 -0
- package/dist/core/TopicIntentArcCheck.d.ts.map +1 -1
- package/dist/core/TopicIntentArcCheck.js +41 -0
- package/dist/core/TopicIntentArcCheck.js.map +1 -1
- package/dist/core/types.d.ts +10 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/monitoring/SessionReplyExtractor.d.ts +31 -0
- package/dist/monitoring/SessionReplyExtractor.d.ts.map +1 -0
- package/dist/monitoring/SessionReplyExtractor.js +115 -0
- package/dist/monitoring/SessionReplyExtractor.js.map +1 -0
- package/dist/server/AgentServer.d.ts +15 -0
- package/dist/server/AgentServer.d.ts.map +1 -1
- package/dist/server/AgentServer.js +90 -4
- package/dist/server/AgentServer.js.map +1 -1
- package/dist/server/routes.d.ts +5 -0
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +26 -0
- package/dist/server/routes.js.map +1 -1
- package/dist/server/topicIntentRoutes.d.ts +10 -4
- package/dist/server/topicIntentRoutes.d.ts.map +1 -1
- package/dist/server/topicIntentRoutes.js +3 -1
- package/dist/server/topicIntentRoutes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +47 -47
- package/upgrades/1.3.58.md +47 -0
- package/upgrades/1.3.59.md +71 -0
- package/upgrades/side-effects/mentor-cycle-smoothness.md +48 -0
- package/upgrades/side-effects/topic-intent-arccheck-wiring.md +101 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Side-Effects Review — mentor cycle smoothness (capture + busy-gate)
|
|
2
|
+
|
|
3
|
+
**Spec:** `docs/specs/MENTOR-LIVE-READINESS-SPEC.md` §Recipient side. The two
|
|
4
|
+
fast-follows from the live round-trip: reply-capture reliability + the
|
|
5
|
+
remote-mentee safe-window.
|
|
6
|
+
|
|
7
|
+
**Change:** new `src/monitoring/SessionReplyExtractor.ts` (pure extractors) +
|
|
8
|
+
`src/server/AgentServer.ts` (`extractMenteeReplyFromTranscript` helper, wired
|
|
9
|
+
into the mentee handler as transcript-first/tmux-fallback; `isMenteeBusy`
|
|
10
|
+
gates on OutstandingPromptTracker) + unit tests.
|
|
11
|
+
|
|
12
|
+
## What changed
|
|
13
|
+
1. `extractCodexFinalMessage` / `extractClaudeFinalMessage` — pure, tolerant
|
|
14
|
+
parsers returning the final assistant prose (null when absent).
|
|
15
|
+
2. `extractMenteeReplyFromTranscript(session, spawnTs)` — codex: newest rollout
|
|
16
|
+
written ≥ spawn → task_complete.last_agent_message; claude: the
|
|
17
|
+
`<claudeSessionId>.jsonl` under ~/.claude/projects → last assistant text.
|
|
18
|
+
3. Mentee handler: after the bounded-wait, prefer the transcript reply; keep
|
|
19
|
+
the existing capture-while-alive tmux read as the only fallback.
|
|
20
|
+
4. `isMenteeBusy`: `!getOrCreateMentorOutstanding().canSendTo(menteeAgent).ok`
|
|
21
|
+
instead of Echo's local session count.
|
|
22
|
+
|
|
23
|
+
## The seven questions
|
|
24
|
+
1. **Over-block.** isMenteeBusy now blocks LESS (only when a real prompt is
|
|
25
|
+
outstanding) — it was over-blocking before (always busy). Correct direction;
|
|
26
|
+
the anti-ping-pong invariant is preserved (one outstanding prompt per mentee).
|
|
27
|
+
2. **Under-block.** The outstanding-prompt gate still prevents concurrent
|
|
28
|
+
prompts to the same mentee. Transcript reading is read-only (no new writes).
|
|
29
|
+
3. **Level-of-abstraction fit.** Extractors are pure + isolated; the helper
|
|
30
|
+
reuses findRecentRolloutFiles (existing). isMenteeBusy reuses the existing
|
|
31
|
+
tracker. No new infrastructure.
|
|
32
|
+
4. **Signal vs authority.** Extractors are pure signal; the handler decides.
|
|
33
|
+
isMenteeBusy is a gate input to the existing safe-window decision.
|
|
34
|
+
5. **Interactions.** Reads ~/.codex/sessions + ~/.claude/projects (read-only).
|
|
35
|
+
Reuses OutstandingPromptTracker (shared with deliverToMentee — consistent
|
|
36
|
+
semantics). No new shared mutable state.
|
|
37
|
+
6. **External surfaces.** None new. mentor-replies.jsonl now carries clean
|
|
38
|
+
prose instead of stream JSON (content-quality change, same schema).
|
|
39
|
+
7. **Rollback cost.** Trivial — revert restores tmux-only capture + the local
|
|
40
|
+
session-count busy check.
|
|
41
|
+
|
|
42
|
+
## Testing
|
|
43
|
+
10 new unit tests (SessionReplyExtractor) green; mentor-runner + mentor/mentee/
|
|
44
|
+
inbox suites green; tsc clean. Live tick-driven round-trip with clean-prose
|
|
45
|
+
capture verified post-release (the autonomous run's completion criterion).
|
|
46
|
+
|
|
47
|
+
## Migration parity
|
|
48
|
+
No config keys, no state schema change. Pure code. No PostUpdateMigrator change.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Side-effects review — topic-intent ArcCheck wiring (Layer 3)
|
|
2
|
+
|
|
3
|
+
Spec: `docs/specs/topic-intent-arccheck-wiring.md` (approved by justin 2026-05-28).
|
|
4
|
+
|
|
5
|
+
## What this change does
|
|
6
|
+
|
|
7
|
+
Wires the topic-intent ArcCheck (Layer 3) classifier, which existed but was
|
|
8
|
+
never connected. Two dead spots are closed:
|
|
9
|
+
|
|
10
|
+
1. `createTopicIntentRoutes` was constructed with no classifier, so the
|
|
11
|
+
`/topic-intent/:topicId/arccheck` route always returned a degrade-open
|
|
12
|
+
`{fire:false}` verdict.
|
|
13
|
+
2. No production caller invoked ArcCheck on the outbound path, so the agent
|
|
14
|
+
never got a signal when a draft contradicted a tracked ref.
|
|
15
|
+
|
|
16
|
+
Live evidence the gap was real: `arccheck_fired = 0` on every topic, including
|
|
17
|
+
topic 13481 (258 turns, 81 refs). The founding drift ("we need a second
|
|
18
|
+
machine" while a SETTLED ref said the mac-mini was already configured) is the
|
|
19
|
+
exact `contradicts-settled` verdict ArcCheck was designed to emit.
|
|
20
|
+
|
|
21
|
+
## Files changed (in-scope) and their blast radius
|
|
22
|
+
|
|
23
|
+
- `src/core/TopicIntentArcCheck.ts` — ADD `createArcCheckClassifyFn(intelligence, onDegrade)`.
|
|
24
|
+
Pure addition mirroring `createLlmExtractFn`. Degrade-safe: returns an empty
|
|
25
|
+
classification (→ `{fire:false}`) on no-intelligence or throw, so it can
|
|
26
|
+
never fire a false signal. Subscription transport (`model: 'fast'`,
|
|
27
|
+
attribution `TopicIntentArcCheck`). No existing export changed.
|
|
28
|
+
|
|
29
|
+
- `src/server/topicIntentRoutes.ts` — route now accepts an `arcCheck` ArcCheck
|
|
30
|
+
instance directly; KEEPS the legacy `arcCheckClassify` param (constructs a
|
|
31
|
+
per-route instance from it) so all pre-existing callers/tests keep working
|
|
32
|
+
unchanged. Backward-compatible; no behaviour change when neither is passed
|
|
33
|
+
(still degrade-open).
|
|
34
|
+
|
|
35
|
+
- `src/server/AgentServer.ts` — ADD optional `topicIntentArcCheck` to
|
|
36
|
+
`AgentServerOptions` + `RouteContext`; forward it into
|
|
37
|
+
`createTopicIntentRoutes`. Additive; null/undefined preserves prior behaviour.
|
|
38
|
+
|
|
39
|
+
- `src/server/routes.ts` — `checkOutboundMessage` now collects an ArcCheck
|
|
40
|
+
signal in-process (when `options.topicId` and `ctx.topicIntentArcCheck` are
|
|
41
|
+
both present) under a 200ms hard timeout via `Promise.race`. On timeout or
|
|
42
|
+
throw the signal is simply omitted — identical fail-skip shape to the
|
|
43
|
+
existing dedup detector. ArcCheck is SIGNAL-ONLY: it populates
|
|
44
|
+
`signals.arcCheck`; the MessagingToneGate retains all block authority. No
|
|
45
|
+
new block path. Delivery is never slowed (concurrent-eligible + bounded).
|
|
46
|
+
|
|
47
|
+
- `src/core/MessagingToneGate.ts` — ADD `arcCheck` field to `ToneReviewSignals`
|
|
48
|
+
+ render it in `renderSignals`. Only renders when `fire === true`. The gate
|
|
49
|
+
may fold the rewrite hint into its review; it does NOT gain a new block rule.
|
|
50
|
+
|
|
51
|
+
- `src/config/ConfigDefaults.ts` + `src/core/types.ts` — ADD
|
|
52
|
+
`topicIntent.arccheck.enabled` (default `true`). Migration parity: existing
|
|
53
|
+
agents pick it up via the canonical `applyDefaults` path in
|
|
54
|
+
`PostUpdateMigrator.migrateConfig` (existence-checked, idempotent). Kill
|
|
55
|
+
switch: `false` leaves the route mounted but the classifier dark and skips
|
|
56
|
+
the in-process call.
|
|
57
|
+
|
|
58
|
+
- `src/commands/server.ts` — construct ONE `ArcCheck` instance (gated on
|
|
59
|
+
`sharedIntelligence && topicIntent.arccheck.enabled`), reusing the same
|
|
60
|
+
queued-intelligence transport as the capture loop, declared at outer scope
|
|
61
|
+
so it reaches the `AgentServer` constructor. Sets
|
|
62
|
+
`globalThis.__instarTopicIntentArcCheckWired` for the wiring-integrity test.
|
|
63
|
+
|
|
64
|
+
## Failure modes considered
|
|
65
|
+
|
|
66
|
+
- **Outbound latency regression** — bounded by the 200ms `Promise.race`
|
|
67
|
+
timeout; ArcCheck runs concurrent-eligible with other signal collection and
|
|
68
|
+
is wrapped in try/catch. Worst case: the signal is absent and the gate
|
|
69
|
+
behaves exactly as today.
|
|
70
|
+
- **False block** — impossible by construction: ArcCheck is signal-only; the
|
|
71
|
+
tone gate has no new block rule keyed on `signals.arcCheck`.
|
|
72
|
+
- **Cost** — second always-on per-turn LLM path (capture being the first).
|
|
73
|
+
Bounded by the shared `LlmQueue` background lane + daily cap; degrades to a
|
|
74
|
+
no-op on cap breach.
|
|
75
|
+
- **Prompt injection** — `buildArcCheckPrompt` renders refs in a structured
|
|
76
|
+
block; the classifier is conservative-by-prompt and parse-tolerant
|
|
77
|
+
(`parseArcCheckResponse` returns empty arrays on malformed output).
|
|
78
|
+
|
|
79
|
+
## Migration parity
|
|
80
|
+
|
|
81
|
+
Server-side only. One new config default via the canonical defaults path. No
|
|
82
|
+
hook/template/skill/settings change. No `PostUpdateMigrator` surgery beyond the
|
|
83
|
+
config default.
|
|
84
|
+
|
|
85
|
+
## Rollback
|
|
86
|
+
|
|
87
|
+
Flip `topicIntent.arccheck.enabled = false` (classifier construction is gated;
|
|
88
|
+
in-process call is skipped). Code rollback: remove the AgentServer wire, the
|
|
89
|
+
classifier creator, and the `signals.arcCheck` channel — everything else
|
|
90
|
+
reverts to inert, as today.
|
|
91
|
+
|
|
92
|
+
## Tests
|
|
93
|
+
|
|
94
|
+
- Unit: `createArcCheckClassifyFn` degrade paths + transport attribution
|
|
95
|
+
(tests/unit/TopicIntent-arccheck.test.ts, +4).
|
|
96
|
+
- Unit: MessagingToneGate renders/omits the ArcCheck signal
|
|
97
|
+
(tests/unit/MessagingToneGate.test.ts, +2).
|
|
98
|
+
- E2E: mac-mini-drift regression pin + wiring-integrity source guards
|
|
99
|
+
(tests/e2e/topic-intent-arccheck-lifecycle.test.ts, new, 5 tests).
|
|
100
|
+
- All 7 pre-existing topic-intent test files remain green after the
|
|
101
|
+
backward-compatible route reshape.
|