Skip to content

(CODUX-225) Complete the Discord connector - #3069

Merged
numnx merged 3 commits into
feature/CODUX-225-chat-connector-completeness-and-verificationfrom
task/feature-codux-22-t02-codex-1f9c0cde-mrjtgd0y
Jul 13, 2026
Merged

(CODUX-225) Complete the Discord connector#3069
numnx merged 3 commits into
feature/CODUX-225-chat-connector-completeness-and-verificationfrom
task/feature-codux-22-t02-codex-1f9c0cde-mrjtgd0y

Conversation

@numnx

@numnx numnx commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

🧩 Task: Complete the Discord connector

Automated task PR opened by Code UX for T02.

📋 Summary

Sprint: Sprint 225 · Chat connector completeness and verification · Task: T02

Complete and verify all six chat connectors through provider-specific profiles, correct authentication and session behavior, encrypted durable state, atomic routing and retries, REST/MCP/dashboard management, official-documentation evidence, deterministic contract coverage, and credential-gated checks limited to provider-controlled endpoints, with Discord prioritized.

🤖 Model & Provider

Provider Codex CLI
Model gpt-5.6-sol

⏱️ Timing

Started 2026-07-13 22:51:00 UTC
Finished 2026-07-13 23:10:30 UTC
Duration 19m 29s

📊 Token Usage

Metric Value
Input tokens 192,440
Cached input tokens 7,266,304
Output tokens 43,170
Total tokens 7,501,914
Invocations 1
Tool calls 46
Active time 18m 33s

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

✅ QA Review

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

📝 Full Task Prompt
## Objective
Complete the Discord profile with provider-native HTTP interaction authentication, stateful Gateway message delivery, REST replies, credential verification, deterministic failure handling, and backward-compatible custom gateway support.

## Scope
- `src/domain/chat-connectors/providers/discord.ts`
- Create `src/services/chat-providers/discord-gateway-session.ts`
- Create `tests/backend/domain/chat-connectors/discord.test.ts` and `tests/backend/services/discord-gateway-session.test.ts`
- `docs/settings/chat-connectors/discord.md`
- `docs-web/architecture/chat-connectors/discord.md`
- Official references: [Gateway](https://docs.discord.com/developers/events/gateway), [Gateway events](https://docs.discord.com/developers/events/gateway-events), [Interactions](https://docs.discord.com/developers/interactions/overview), [Messages](https://docs.discord.com/developers/resources/message), and [Rate limits](https://docs.discord.com/developers/topics/rate-limits)

## Implementation Requirements
1. Add an `official_api` setup using application ID, public key, intents, and a write-only bot token while retaining the existing `webhook` gateway contract for stored connections.
2. Verify HTTP interactions with `X-Signature-Ed25519` and `X-Signature-Timestamp` over the exact raw body, reject malformed or stale requests, and return the required PONG response for type-1 validation requests.
3. Normalize supported interaction payloads and Gateway `MESSAGE_CREATE` events into stable channel, sender, message, and thread identities; ignore the connector bot's own messages and explain the privileged `MESSAGE_CONTENT` intent requirement.
4. Implement Gateway identify/resume, sequence tracking, heartbeat jitter and acknowledgements, missed-ACK reconnects, resumable session state, bounded exponential reconnect backoff, cancellation, and clean shutdown through the shared session-store interface from T01.
5. Send replies only to `https://discord.com/api/v10`, disable automatic mentions with `allowed_mentions.parse: []`, use a stable delivery nonce with `enforce_nonce` where supported, preserve reply references, parse returned snowflake IDs, and honor Discord rate-limit headers without retry storms.
6. Implement read-only credential verification through Discord's current-user endpoint and classify invalid auth, missing intents/permissions, 429 responses, timeouts, and ambiguous network outcomes without exposing tokens.
7. Cover valid and invalid Ed25519 signatures, PING, message normalization, bot-loop suppression, heartbeat/reconnect/resume, rate limiting, cancellation, legacy gateway behavior, and redaction with deterministic fixtures and mocked transports.

## Constraints
- Unit tests must never connect to Discord; the credential-gated live suite is owned by T13.
- Never permit a configured URL to replace the provider-controlled Discord API origin in `official_api` mode.
- Do not persist bot tokens, interaction tokens, or authorization headers in Gateway state or delivery metadata.
- Do not modify other provider modules or shared generated docs-web artifacts.

## Verification
- Run `pnpm run test:backend -- tests/backend/domain/chat-connectors/discord.test.ts tests/backend/services/discord-gateway-session.test.ts`.
- Run `pnpm run lint`.
- Confirm simulated disconnects resume when possible, fall back to identify when required, and stop reconnecting after cancellation or shutdown.
🌿 Branch Info

Base: feature/CODUX-225-chat-connector-completeness-and-verification
Head: task/feature-codux-22-t02-codex-1f9c0cde-mrjtgd0y


🤖 Generated by Code UX

@numnx
numnx merged commit 1b3afb6 into feature/CODUX-225-chat-connector-completeness-and-verification Jul 13, 2026
20 checks passed
@numnx
numnx deleted the task/feature-codux-22-t02-codex-1f9c0cde-mrjtgd0y branch July 13, 2026 23:54
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