instar 1.3.445 → 1.3.446
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 +57 -20
- package/dist/commands/server.js.map +1 -1
- package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
- package/dist/core/PostUpdateMigrator.js +14 -4
- package/dist/core/PostUpdateMigrator.js.map +1 -1
- package/dist/core/SessionManager.d.ts +1 -0
- package/dist/core/SessionManager.d.ts.map +1 -1
- package/dist/core/SessionManager.js +8 -0
- package/dist/core/SessionManager.js.map +1 -1
- package/dist/messaging/slack/SlackAdapter.d.ts +54 -2
- package/dist/messaging/slack/SlackAdapter.d.ts.map +1 -1
- package/dist/messaging/slack/SlackAdapter.js +88 -6
- package/dist/messaging/slack/SlackAdapter.js.map +1 -1
- package/dist/messaging/slack/types.d.ts +29 -0
- package/dist/messaging/slack/types.d.ts.map +1 -1
- package/dist/messaging/slack/types.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +9 -2
- package/dist/server/routes.js.map +1 -1
- package/package.json +1 -1
- package/src/data/builtin-manifest.json +65 -65
- package/src/templates/scripts/slack-reply.sh +26 -1
- package/upgrades/1.3.446.md +24 -0
- package/upgrades/side-effects/slack-thread-session.md +48 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Side-Effects Review — Slack thread→session mapping
|
|
2
|
+
|
|
3
|
+
**Version / slug:** `slack-thread-session`
|
|
4
|
+
**Date:** 2026-06-09
|
|
5
|
+
**Author:** Instar Agent (echo)
|
|
6
|
+
**Second-pass reviewer:** not required — deterministic session ROUTING (no LLM, no block/allow gate); covered by my own review + 84 tests. (Touches session-spawn lifecycle, so the routing-correctness + regression risks are reviewed in §5.)
|
|
7
|
+
|
|
8
|
+
## Summary of the change
|
|
9
|
+
|
|
10
|
+
Phase 2, piece 3. Makes a Slack **thread a continuous conversation = its own agent session** (mirroring the Telegram topic→session model, which keys on topic). Implemented as a **routing-key abstraction**: `resolveRoutingKey(channelId, threadTs, ownTs)` returns `channelId` by default and `channelId:thread_ts` only when the channel is opted in AND the message is a reply *inside* a thread. The channel registry + 24h resume map are keyed on this routing key; raw `channelId` + `thread_ts` are retained for all Slack API calls + replies. **Opt-in, default OFF** (`SlackConfig.threadSessions`) — with no config, every routing key equals the channel id, so behavior is byte-for-byte today's (one channel = one session). 13 files; mirrors the existing channel→session machinery rather than a parallel path.
|
|
11
|
+
|
|
12
|
+
## Decision-point inventory
|
|
13
|
+
|
|
14
|
+
- Session-routing key (`server.ts` onMessage + recovery) — **modify (additive)** — registry lookup / resume / register now key on `resolveRoutingKey(...)`; default `=== channelId` (no change).
|
|
15
|
+
- `SessionManager.spawnInteractiveSession` — **add** — optional `slackThreadTs` → `INSTAR_SLACK_THREAD_TS` env (propagated through resume-failed fallback).
|
|
16
|
+
- `slack-reply.sh` — **modify (back-compat)** — optional 2nd positional `thread_ts` (regex-gated so a normal message word is never mistaken for a thread id) + a feature marker for migration-parity refresh.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 1. Over-block / 2. Under-block
|
|
21
|
+
|
|
22
|
+
N/A — this is session routing, not a block/allow gate. No message is blocked or allowed by it; it only decides WHICH session a message lands in.
|
|
23
|
+
|
|
24
|
+
## 3. Level-of-abstraction fit
|
|
25
|
+
|
|
26
|
+
Correct. It reuses the existing channel→session registry + resume-map machinery, swapping the key from `channelId` to a `resolveRoutingKey` that defaults to `channelId`. No parallel routing path; mirrors Telegram topic→session.
|
|
27
|
+
|
|
28
|
+
## 4. Signal vs authority compliance
|
|
29
|
+
|
|
30
|
+
N/A in the gate sense — no new authority, no brittle decision. The routing key is a pure deterministic function of `(channelId, threadTs, ownTs, config)`. No LLM, no fail-open surface.
|
|
31
|
+
|
|
32
|
+
## 5. Interactions (the real risks for a routing change)
|
|
33
|
+
|
|
34
|
+
- **Cross-talk / key collision (the #1 risk):** prevented. Two distinct threads → distinct `thread_ts` → distinct keys (`C:ts1` ≠ `C:ts2`) → distinct sessions; the same thread → the same key → resume. `parseRoutingKey` splits on the FIRST `:` and Slack channel ids never contain `:` (always `C…`/`D…`/`G…`), so the round-trip is unambiguous. A thread ROOT (`thread_ts === ts`, no replies yet) routes to the channel session — avoids a degenerate per-root session. Covered by the `two-threads-distinct` / `same-thread-same-key` / `thread-root` tests.
|
|
35
|
+
- **No regression (default OFF):** with no `threadSessions` config, `isThreadRoutingEnabled` is false → routing key always `=== channelId` → existing single-session installs are byte-for-byte unchanged. No migration needed for the routing itself.
|
|
36
|
+
- **API/reply correctness:** the raw `channelId` + `thread_ts` are always recovered (via `parseRoutingKey`) for Slack API calls + replies + history + system-channel checks, so a routing key is never mistaken for a channel id when talking to Slack. `sendToChannel`/`isSystemChannel` are routing-key-tolerant for standby/PresenceProxy paths.
|
|
37
|
+
- **Recovery path:** the context-exhaustion recovery resolves the key back to the raw channel for history/reply while registering/resuming on the key — consistent with the live path.
|
|
38
|
+
- **Stall tracking** stays channel-keyed (coarser, not broken) for thread sessions — a deliberate scope boundary, not a regression.
|
|
39
|
+
|
|
40
|
+
## 6. External surfaces
|
|
41
|
+
|
|
42
|
+
- **Other agents / install base:** none — dark/opt-in (default off → today's behavior).
|
|
43
|
+
- **External systems (Slack):** no NEW Slack Web API calls; the same send/history calls, now resolving the raw channel from the routing key.
|
|
44
|
+
- **Migration parity:** the `slack-reply.sh` template change (optional `thread_ts` arg) ships with a `PostUpdateMigrator` feature-marker refresh so existing agents' deployed reply scripts pick it up on update (and the arg is regex-gated → fully backward compatible for callers that don't pass a thread id).
|
|
45
|
+
|
|
46
|
+
## 7. Rollback cost
|
|
47
|
+
|
|
48
|
+
Low / additive. Revert + patch; default (channel-keyed) behavior is unchanged on every install. No data migration (the resume map keys are forward-compatible: old channel-keyed entries still resolve since routingKey===channelId when thread routing is off). The slack-reply.sh marker refresh is idempotent.
|