Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
35704a9
feat(channels): add ChannelIntegrationConfiguration resource + store …
ginccc Apr 18, 2026
53e8224
feat(channels): add ChannelTargetRouter with colon-required trigger m…
ginccc Apr 18, 2026
9f2b330
docs: add conversation cancel & lifecycle control plan
ginccc Apr 18, 2026
a69d5fa
refactor(slack): replace SlackChannelRouter with ChannelTargetRouter
ginccc Apr 18, 2026
5175926
feat(channels): add MCP admin tools + migration helper for channel in…
ginccc Apr 18, 2026
ed684db
docs: update changelog and task list for channel integration work
ginccc Apr 18, 2026
cebdcde
fix(channels): fix 4 bugs found in code review
ginccc Apr 18, 2026
e4e493a
fix(channels): address code review findings #1-12
ginccc Apr 18, 2026
a45bee1
docs(channels): add code review hardening changelog entry
ginccc Apr 18, 2026
39a37a8
fix(channels): harden migration tool β€” N1-N7 from re-review
ginccc Apr 18, 2026
63050b8
docs(channels): add migration tool hardening changelog entry (N1-N7)
ginccc Apr 18, 2026
6abb1f7
test(channels): add 19 tests + polish migration edge cases
ginccc Apr 18, 2026
1925a01
refactor(channels): replace MCP migration with startup migration, dep…
ginccc Apr 18, 2026
1200ebd
docs(channels): add startup migration & deprecation changelog entry
ginccc Apr 18, 2026
aa0d1bf
fix(channels): readAgentβ†’read on IAgentStore, signing secret from res…
ginccc Apr 18, 2026
c861cb0
test(channels): add 31 tests for refresh, public API, secrets, legacy…
ginccc Apr 18, 2026
ded7110
docs(changelog): review hardening and test coverage entry
ginccc Apr 18, 2026
aa759f0
chore(channels): remove unused IResourceStore import
ginccc Apr 18, 2026
4733411
fix(channels): address review bugs β€” legacy posting, duplicate channe…
ginccc Apr 19, 2026
2e3c831
docs(changelog): external review round 4 β€” 6 bugs fixed, 80 tests
ginccc Apr 19, 2026
2121f18
test(channels): comprehensive test coverage for channel integration s…
ginccc Apr 24, 2026
9d44453
chore(merge): resolve merge conflicts from main into feature/channel-…
ginccc Apr 25, 2026
0537232
fix(channels): reject duplicate target names in validation
ginccc Apr 25, 2026
dd9a6fd
fix(channels): address PR review β€” defensive copies, migration retry,…
ginccc Apr 25, 2026
67ab9ba
fix(channels): fix duplicateChannel regression from defensive copying
ginccc Apr 25, 2026
95f2759
fix(ci): harden Postgres integration tests against CI flakiness
ginccc Apr 25, 2026
94d6d0f
fix(migration): inject IMigrationLogStore interface instead of concre…
ginccc Apr 26, 2026
fed27e7
fix(channels): address review findings β€” idempotency, intent keys, he…
ginccc Apr 26, 2026
4fa03f9
Merge remote-tracking branch 'origin/main' into feature/channel-integ…
ginccc Apr 26, 2026
ead310d
Merge remote-tracking branch 'origin/main' into feature/channel-integ…
ginccc May 14, 2026
4c209b2
fix(channels): address code review β€” ThreadLocal removal, vault prefi…
ginccc May 14, 2026
dc7b570
fix(channels): second-pass review β€” log sanitization, defensive copie…
ginccc May 14, 2026
65ec272
docs(changelog): add second-pass review fixes entry
ginccc May 14, 2026
7711817
Merge remote-tracking branch 'origin/main' into feature/channel-integ…
ginccc May 17, 2026
f6ded96
refactor(slack): remove eddi.slack.enabled server toggle β€” config-dri…
ginccc May 17, 2026
50fe538
fix(slack): sanitize attacker-controlled headers in log statements
ginccc May 17, 2026
31ca10a
feat(slack): DM support, test hardening, docs overhaul
ginccc May 18, 2026
bf7a94c
fix(llm): update LlmTaskTest template counts for TEMPLATE_SKIP_PARAMS
ginccc May 18, 2026
86b0694
fix(slack): close table fence before real code block in mrkdwn converter
ginccc May 18, 2026
a01e4f7
chore: merge origin/main into feature/channel-integrations
ginccc May 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 183 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,189 @@ Each entry follows this format:
- **Decision** β€” Key design decisions and their reasoning
- **Files** β€” Links to modified files

## Channel Integration β€” External Review Round 4 (2026-04-19)

**Repo:** EDDI (`feature/channel-integrations`)

### Bugs Fixed (6 findings from external review)
- **#1 β€” Legacy follow-up posting:** `postMessage` fell back to `getIntegration()` which only
checked `integrationMap`, not `legacyMap`. Legacy-only channels silently failed to post responses.
Fixed by adding `getBotToken()` method that checks both maps.
- **#3 β€” Duplicate channelId:** REST validation now rejects create/update if another non-deleted
config already claims the same `channelType:channelId`. Prevents silent overwrites in the router.
- **#4 β€” Reserved triggers:** `"help"` is now rejected as a trigger keyword β€” it would never fire
because the router short-circuits on `help` before trigger matching.
- **#5 β€” NPE guard:** Added null check on `trigger.toLowerCase()` in `resolveFromIntegration` for
data that bypasses REST validation (e.g., raw MongoDB writes, imported ZIPs).
- **#2 β€” Migration credential divergence:** Migration now logs WARN when agents sharing the same
channelId have different botToken/signingSecret values, with affected agentIds listed.
- **#10 β€” Migration target names:** Target names now use the agent's descriptor name (slugified)
instead of raw ObjectId strings, making trigger keywords human-typeable.

### Test Coverage (73 β†’ 80 tests)
- 3 new reserved trigger validation tests
- 4 new `getBotToken()` tests (new-style, legacy fallback, precedence, unknown)

**Files:**
- `ChannelTargetRouter.java` β€” `getBotToken()`, null guard, import order
- `SlackEventHandler.java` β€” use `getBotToken()` instead of `getIntegration()` in `postMessage`
- `RestChannelIntegrationStore.java` β€” reserved triggers, `validateUniqueChannelId()`, `Locale.ROOT`
- `ChannelConnectorMigration.java` β€” descriptor name lookup, slugify, divergence warning
- `RestChannelIntegrationStoreValidationTest.java` β€” 3 reserved trigger tests
- `ChannelTargetRouterRefreshTest.java` β€” 4 getBotToken tests

## Channel Integration β€” Review Hardening & Test Coverage (2026-04-19)

**Repo:** EDDI (`feature/channel-integrations`)

### Critical Bugs Fixed
- **R1 β€” Compilation failure:** `ChannelConnectorMigration` called `readAgent()` on `IAgentStore`, which
only has `read()` (inherited from `IResourceStore`). `readAgent()` is on `IRestAgentStore`. Was masked by
incremental compilation; `mvnw clean compile` failed immediately. Fixed to `agentStore.read()`.
- **R2 β€” Signing secret resolution:** `ChannelTargetRouter.refreshInternal()` collected signing secrets from
the store's cached config (containing vault references like `${eddivault:...}`) instead of the deep-copied
config with resolved secrets. Slack webhook HMAC verification would always fail for vaulted secrets.

### Test Coverage Expansion (42 β†’ 73 tests)
- New `ChannelTargetRouterRefreshTest` (31 tests) covering:
- Public API `resolveTarget()` with mocked stores (new-style + legacy)
- Secret resolution (vault refs, resolver failures, absent keys)
- Legacy fallback (agent routing, group routing, new-style suppression)
- Channel detection (`hasAnyChannels`, `getIntegration`)
- Deep copy safety (store original unchanged after resolution)
- Refresh mechanism (first-call load, interval gate, error resilience)
- `ResolvedTarget` accessor logic (integration vs legacy preference)
- `LegacyTarget.toChannelTarget()` conversion

**Files:**
- `src/main/java/ai/labs/eddi/configs/migration/ChannelConnectorMigration.java` β€” `readAgent` β†’ `read`
- `src/main/java/ai/labs/eddi/integrations/channels/ChannelTargetRouter.java` β€” signing secret from `copy`
- `src/test/java/ai/labs/eddi/integrations/channels/ChannelTargetRouterRefreshTest.java` β€” [NEW]

## Channel Integration β€” Startup Migration & Legacy Deprecation (2026-04-18)

**Repo:** EDDI (`feature/channel-integrations`)

**What changed:** Replaced the MCP-based migration tool with a deterministic startup migration and deprecated legacy channel connectors.

**Key changes:**
- **Removed** `migrate_channel_connectors` MCP tool from `McpAdminTools` β€” migration is now infrastructure, not an admin tool
- **Added** `ChannelConnectorMigration` β€” startup one-shot migration following the established `V6RenameMigration` pattern (flag-based via `migrationlog` collection, idempotent, retry-safe on failure)
- **Wired** into `AgentDeploymentManagement.autoDeployAgents()` after V6 migrations, before agent deployment
- **Deprecated** `ChannelConnector` class and `channels` field in `AgentConfiguration` with `@Deprecated(since="6.1.0", forRemoval=true)`

**Design decisions:**
- Startup migration is cleaner than on-demand MCP tool: runs exactly once, no admin intervention needed, follows existing patterns
- Deprecation rather than removal: old JSON configs in MongoDB can still deserialize; the legacy fallback in `ChannelTargetRouter` remains as a safety net
- Migration is deliberately simple (preview feature with very few users)

**Files:**
- `ChannelConnectorMigration.java` [NEW] β€” startup migration
- `McpAdminTools.java` β€” removed migration tool (-184 lines)
- `AgentDeploymentManagement.java` β€” wired migration into startup
- `AgentConfiguration.java` β€” deprecated channels field + ChannelConnector class

---

## Channel Integration β€” Migration Tool Hardening (2026-04-18)

**Repo:** EDDI (`feature/channel-integrations`)

**What changed:** Re-review of the migration rewrite (fix #2) found 7 new issues (N1-N7). All fixed.

- **N1: Restored per-agent error reporting** β€” regression from rewrite silently swallowed agent read failures.
- **N2: Credential conflict detection** β€” when multiple agents share a channelId with different botToken/signingSecret, migration now skips with `action: "credential_conflict"` and an actionable hint.
- **N3: Target name deduplication** β€” agents with identical names in the same channel get suffixed with short agentId to avoid `BadRequestException` on duplicate triggers.
- **N4: Group key includes channelType** β€” prevents cross-platform collisions (`channelType:channelId`).
- **N5: Deterministic ordering** β€” entries sorted by agentId before constructing targets; `defaultTargetName` is now reproducible across JVM runs.
- **N6: Typed `MigrationEntry` record** β€” replaces `Map<String,Object>` with unsafe casts.
- **N7: `deepCopyConfig` invariant comment** β€” documents that target instances are shared by reference and must not be mutated.

## Channel Integration β€” Code Review Hardening (2026-04-18)

**Repo:** EDDI (`feature/channel-integrations`)

**What changed:** Addressed 12 findings from a thorough code review before merge.

### Critical fixes
- **Deleted dead `SlackChannelRouter`** (#1) β€” was `@ApplicationScoped` but never injected, causing double agent scanning at startup. Removed 615 LOC (class + test).
- **Migration now merges duplicate channelIds** (#2) β€” old tool created one config per (agent, channel) pair; new version groups by platformChannelId and creates a single multi-target config with derived triggers.
- **Deep-copy before secret resolution** (#3) β€” `resolvePlatformSecrets` was mutating the store's instance in-place; added `deepCopyConfig()` so the REST layer always returns vault references.
- **Null/blank trigger guard** (#5) β€” null triggers from loose JSON now return 400 instead of NPE.
- **Removed dead fields** (#6) β€” `newStyleChannelIds` (assigned, never read), `cacheFactory` (constructor-only), unused `ConcurrentHashMap` import.
- **Reject `observeMode=true`** (#12) β€” validation now blocks until the feature is implemented.
- **Stack traces preserved** (#8) β€” all `LOGGER.warnf(msg, e.getMessage())` changed to `LOGGER.warn(msg, e)`.
- **Renamed `channelId` β†’ `resourceId`** (#10) in MCP tool responses to avoid confusion with Slack channelId.
- **Fixed `deployAgent` typo** (#11) β€” 'production' listed twice in 4 environment descriptions.
- **Tempered Javadoc** (#17) β€” now says "currently Slack-only with platform-agnostic model".

### Deferred (architectural follow-ups)
- **#7** Extensible channel type registry (CDI-based) β€” for Teams/Discord fork support
- **#9** Prompt injection hardening in `buildFollowUpInput` β€” truncation + delimiters
- **#13** Replace `ThreadLocal<ResolvedTarget>` with explicit parameter passing
- **#15** Lock thread target only after successful conversation start

## Channel Integration Refactor β€” Decoupled Multi-Target Architecture (2026-04-18)

**Repo:** EDDI (`feature/channel-integrations`)

**What changed:** Refactored the Slack integration from a tightly-coupled, agent-embedded model (`ChannelConnector` inside `AgentConfiguration`) to a standalone, multi-target, multi-platform architecture.

### 1. Standalone Config Resource

Created `ChannelIntegrationConfiguration` β€” a first-class versioned MongoDB document (`eddi://ai.labs.channel/channelstore/channels/{id}`) decoupled from agents. Each config holds:
- `channelType` (slack, teams, discord)
- `platformConfig` (credentials via vault references)
- `targets[]` β€” each with name, type (AGENT/GROUP), targetId, and trigger keywords
- `defaultTargetName` β€” fallback when no trigger matches
- `observeMode` / `ObserveConfig` β€” schema reserved for future passive observation

### 2. ChannelTargetRouter

Platform-agnostic router replacing `SlackChannelRouter`:
- **Colon-required triggers**: `architect: question` routes to the "architect" target
- **Thread target locking**: First message locks the target for the thread (prevents mid-thread switching)
- **New-style wins**: If a `ChannelIntegrationConfiguration` covers a channelId, all legacy `ChannelConnector` entries for that channel are ignored
- **Signing secret aggregation**: Collects from both new and legacy configs for webhook verification

### 3. Slack Adapter Refactor

- `SlackEventHandler` β†’ uses `ChannelTargetRouter` for all routing decisions
- Removed `group:` magic prefix β€” groups now reached via configured triggers
- Added `postHelp()` β€” lists available targets with trigger keywords when message is blank or "help"
- `postMessage()` resolves bot token from `ResolvedTarget` or router fallback
- `RestSlackWebhook` β†’ uses `ChannelTargetRouter.getSigningSecrets("slack")`

### 4. MCP Admin Tools + Migration

Added 6 new MCP tools (admin-only):
- `list_channel_integrations`, `read_channel_integration`, `create_channel_integration`
- `update_channel_integration`, `delete_channel_integration`
- `migrate_channel_connectors` β€” scans legacy `ChannelConnector` entries on deployed agents and converts to standalone `ChannelIntegrationConfiguration` (dry-run by default, non-destructive)

### Design Decisions

- **Colon-required syntax over fuzzy matching**: Deterministic, no ambiguity. `architect: hello` matches; `architect hello` does not.
- **Thread locking over repeated resolution**: Prevents jarring mid-thread target switches in multi-target channels.
- **Schema-now for observe mode**: `observeMode` and `ObserveConfig` are in the model but not wired. Avoids future MongoDB migration when observation is implemented.
- **Migration as MCP tool (not REST endpoint)**: Fits admin tooling pattern, supports dry-run, accessible from Claude/MCP clients.

**Files:**
- `ChannelIntegrationConfiguration.java`, `ChannelTarget.java`, `ObserveConfig.java` β€” [NEW] models
- `IChannelIntegrationStore.java` β€” [NEW] store interface
- `IRestChannelIntegrationStore.java` β€” [NEW] REST interface
- `ChannelIntegrationStore.java` β€” [NEW] DB-agnostic store
- `RestChannelIntegrationStore.java` β€” [NEW] REST implementation with validation
- `ChannelTargetRouter.java` β€” [NEW] platform-agnostic router
- `ChannelTargetRouterTest.java` β€” [NEW] 23 unit tests
- `SlackEventHandler.java` β€” refactored to use ChannelTargetRouter
- `RestSlackWebhook.java` β€” updated credential resolution
- `McpAdminTools.java` β€” 6 new channel integration tools

**In Progress:** Manager UI, file attachment forwarding, observe mode (future PRs).

---

## PR Review Fixes β€” Quota Ordering, Log Injection, Doc Hygiene (2026-04-17)

**Repo:** EDDI (`feature/observability`)
Expand Down
Loading
Loading