Skip to content

Implement authenticated chat ingress (codex) - #2517

Merged
numnx merged 2 commits into
feature/CODUX-162-integrate-chat-connectionsfrom
task/feature-codux-162-integrate-chat-connections-t04-codex-mra9o1a6
Jul 7, 2026
Merged

Implement authenticated chat ingress (codex)#2517
numnx merged 2 commits into
feature/CODUX-162-integrate-chat-connectionsfrom
task/feature-codux-162-integrate-chat-connections-t04-codex-mra9o1a6

Conversation

@numnx

@numnx numnx commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

🧩 Task: Implement authenticated chat ingress

Automated task PR opened by Code UX for T04.

📋 Summary

Sprint: Sprint 162 · Integrate Chat Connections · Task: T04

Integrate configurable external chat providers under Settings -> Providers so WhatsApp, iMessage, Telegram, Slack, Microsoft Teams, and Discord can be securely connected to project-manager chat flows, managed through dashboard and MCP APIs, linked flexibly across projects/channels, and routed through the existing chat reply runtime with external-channel-safe replies that suppress dashboard-only rich widgets.

📝 Full Task Prompt
## Objective
Implement authenticated inbound chat-provider ingress that verifies provider bridge requests, deduplicates external messages, resolves channel bindings to projects, and posts external user instructions into existing conversation threads.

## Scope
- Create `src/services/chat-provider-ingress-service.ts`
- Create `src/services/chat-provider-security.ts`
- Create `src/server/chat-provider-ingress-routes.ts`
- Edit `src/server/dashboard-server.ts`
- Edit `src/server/dashboard-route-registration.ts`
- Edit `src/app/dependency-factory/dashboard-factory.ts`
- Edit `src/app/lifecycle/dashboard-lifecycle-service.ts`
- Add `tests/backend/services/chat-provider-ingress-service.test.ts`
- Add `tests/backend/server/chat-provider-ingress-routes.test.ts`
- Consumes repository and route wiring from T01 and T02

## Implementation Requirements
1. Add inbound endpoints for OpenClaw/webhook/native bridge POST payloads, including `POST /api/chat-providers/ingress/:providerConnectionId` and a provider-kind-compatible payload parser for WhatsApp, iMessage, Telegram, Slack, Microsoft Teams, and Discord fields.
2. Verify each inbound request with the configured bridge secret: bearer token for OpenClaw/native bridges, HMAC signature for webhook mode when configured, timestamp freshness, replay prevention, and per-provider connection enablement.
3. Normalize inbound payloads into one internal message shape containing provider connection id, provider kind, external channel id/name, external sender id/name, text body, external message id, timestamp, and raw metadata with secrets stripped.
4. Use repository idempotency checks before posting messages; duplicates must return the existing delivery/conversation result without creating another conversation message.
5. Resolve enabled channel bindings by provider connection and channel id; if multiple projects match, apply configured routing hints or project selector prefixes first, otherwise record a disambiguation-needed delivery state and return a clear response that does not guess a project.
6. Post routed inbound text through `ChatThreadRuntimeService.postMessage` with metadata marking `source: "chat_provider"`, provider kind, external channel id, external sender, inbound delivery id, and `suppressRichWidgets: true`.
7. Add structured, redacted logs with correlation ids for accepted, rejected, duplicate, ambiguous, and failed ingress attempts.

## Constraints
- Do not implement outbound provider replies or widget stripping in this task.
- Do not accept unauthenticated inbound requests except in explicit test-only paths.
- Do not silently route ambiguous shared channels to the wrong project.
- Do not log raw secrets, bearer tokens, signatures, or full raw provider payloads containing credentials.

## Verification
- Run `pnpm exec vitest run tests/backend/services/chat-provider-ingress-service.test.ts tests/backend/server/chat-provider-ingress-routes.test.ts`.
- Run `pnpm run lint`.
- Success means authenticated inbound messages are normalized, deduplicated, safely routed to project conversation threads, and ambiguous channels are handled without guessing.

✅ QA Review

⏳ QA review runs after this PR is opened. Check the task card in the dashboard for the outcome once it lands.

🤖 Model & Provider

Provider Codex CLI
Model gpt-5.5

⏱️ Timing

Started 2026-07-07 06:27:11 UTC
Finished 2026-07-07 06:40:30 UTC
Duration 13m 19s

📊 Token Usage

Metric Value
Input tokens 145,884
Cached input tokens 5,960,064
Output tokens 30,397
Total tokens 6,136,345
Invocations 1
Tool calls 82
Active time 12m 40s

Included usage estimate (subscription/local login): $4.62

🌿 Branch Info

Base: feature/CODUX-162-integrate-chat-connections
Head: task/feature-codux-162-integrate-chat-connections-t04-codex-mra9o1a6


🤖 Generated by Code UX

@numnx
numnx merged commit f51c64b into feature/CODUX-162-integrate-chat-connections Jul 7, 2026
6 checks passed
@numnx
numnx deleted the task/feature-codux-162-integrate-chat-connections-t04-codex-mra9o1a6 branch July 7, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant