From 117cc5027498e50844b17c26fb7fed8186f5e6fd Mon Sep 17 00:00:00 2001 From: Michael Zhou Date: Fri, 4 Dec 2026 00:27:35 +0800 Subject: [PATCH] Correct the env example and deployment docs that contradict the code .env.example carried Slack token placeholders that satisfy requireEnv and fail later at the Slack API, labeled DISCORD_TOKEN as the discord-mcp token and DISCORD_BOT_TOKEN as the discord-bot token (the bot reads DISCORD_TOKEN; DISCORD_BOT_TOKEN is the worker Discord adapter's legacy fallback), and omitted POSTMARK_API_KEY/POSTMARK_FROM_EMAIL (required by the EMAIL ticket adapter), TEAM_MEMBER_IDS, ON_CALL_MEMBERS, SYNC_ECHO_WINDOW_MS and SMTP_SECURE. docs/deployment.md claimed every HEALTH_PORT consumer has a different fallback (teams-bot and the worker share 3003) and omitted DISCORD_BOT_TOKEN from the Discord env list. Refs #156 Co-Authored-By: Claude Code --- .env.example | 19 ++++++++++++++----- docs/deployment.md | 4 ++-- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 030a0700..7b72d844 100644 --- a/.env.example +++ b/.env.example @@ -48,8 +48,8 @@ AI_SENTIMENT_MODEL= # Default gpt-5.6-luna (Claude Haiku for anthropic SHADOW_MODE=false # ─── Discord Bot ───────────────────────────────────────────────────────────── -DISCORD_TOKEN="" # Bot token used by discord-mcp -DISCORD_BOT_TOKEN="" # Bot token used by the discord-bot app +DISCORD_TOKEN="" # Bot token used by the discord-bot app and the worker's Discord adapter +DISCORD_BOT_TOKEN="" # Legacy fallback for DISCORD_TOKEN (worker Discord adapter) DISCORD_CLIENT_ID="" DISCORD_CLIENT_SECRET="" # OAuth client secret (dashboard Discord login) DISCORD_MCP_TOKEN="" # Shared secret guarding the discord-mcp server @@ -65,10 +65,11 @@ DISCORD_CHANNEL_AGUI_SUPPORT= # AG-UI support channel DISCORD_CHANNEL_AGUI_BUILDING= # AG-UI building channel # ─── Slack Bot ─────────────────────────────────────────────────────────────── -SLACK_BOT_TOKEN=xoxb-... -SLACK_APP_TOKEN=xapp-... +SLACK_BOT_TOKEN="" +SLACK_APP_TOKEN="" SLACK_SIGNING_SECRET= SLACK_SOCKET_MODE=true +TEAM_MEMBER_IDS= # Optional: comma-separated Slack user IDs treated as team members # ─── Slack Ticket Mirror ───────────────────────────────────────────────────── # Mirrors tickets into one Slack channel: the ticket opens a thread, community @@ -136,19 +137,24 @@ GITHUB_ALLOWED_REPOS="CopilotKit/CopilotKit" LINEAR_API_KEY= LINEAR_WEBHOOK_SECRET= LINEAR_TEAM_ID= +# SYNC_ECHO_WINDOW_MS=60000 # Optional: sync echo/conflict window in ms (default 60000) # ─── HubSpot CRM ───────────────────────────────────────────────────────────── HUBSPOT_API_KEY= # ─── Email (Postmark - managed) ────────────────────────────────────────────── -# POSTMARK_SERVER_TOKEN="" # Postmark server API token +# POSTMARK_SERVER_TOKEN="" # Postmark server API token (outbound email sender) # POSTMARK_WEBHOOK_TOKEN="" # Webhook auth token (required in production) +# EMAIL platform adapter (worker replies to email tickets): +POSTMARK_API_KEY= # Postmark API key +POSTMARK_FROM_EMAIL= # From address for email ticket replies # ─── Email (SMTP - self-hosted alternative) ────────────────────────────────── # SMTP_HOST="" # SMTP_PORT=587 # SMTP_USER="" # SMTP_PASS="" +# SMTP_SECURE= # Set true for implicit TLS; default is STARTTLS # ─── Monitoring ────────────────────────────────────────────────────────────── SENTRY_DSN="" @@ -182,6 +188,9 @@ HEALTH_PORT=3005 # Health check port — read by FIVE services (wor # healthcheck timeout, or a slow check is killed as an # unexplained deploy failure instead of logging a reason. +# ON_CALL_MEMBERS= # Optional: comma-separated team member IDs for the on-call rotation + # (read by the web dispatch API and the worker's dispatch engine) + # ─── Railway ───────────────────────────────────────────────────────────────── # Railway auto-deploys from GitHub; no deploy hook needed. # RAILWAY_TOKEN is only needed for CLI-based deploys (e.g. `railway up`). diff --git a/docs/deployment.md b/docs/deployment.md index fef121a3..e5ac3f3a 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -66,7 +66,7 @@ every branch a service deploys from. Ports are the code's defaults (`process.env.PORT`/`HEALTH_PORT` fallback) — Railway may assign different values via its own `PORT` env var per service. -**Five** services read the same `HEALTH_PORT` variable, each with a different fallback: +**Five** services read the same `HEALTH_PORT` variable. Each falls back to its own default when the variable is unset — note that teams-bot and the worker share 3003: | Service | Fallback in code | Pinned by its Dockerfile | | --------------------- | ---------------- | ------------------------ | @@ -99,7 +99,7 @@ Copy `.env.example` and fill in all values. Key groups: - **Auth**: `NEXTAUTH_URL`, `NEXTAUTH_SECRET`, `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET` - **AI**: `OPENAI_API_KEY` on the worker and web service, plus `PATHFINDER_URL` - **Optional AI rollback**: `AI_RESPONSE_PROVIDER=anthropic` and `ANTHROPIC_API_KEY`; clear any explicit OpenAI model overrides -- **Discord**: `DISCORD_TOKEN`, `DISCORD_CLIENT_ID`, `GUILD_ID`, `MONITORED_CHANNEL_IDS` +- **Discord**: `DISCORD_TOKEN`, `DISCORD_BOT_TOKEN` (optional legacy fallback), `DISCORD_CLIENT_ID`, `GUILD_ID`, `MONITORED_CHANNEL_IDS` - **GitHub App**: `GITHUB_APP_ID`, `GITHUB_PRIVATE_KEY`, `GITHUB_INSTALLATION_ID`, `GITHUB_WEBHOOK_SECRET`, `GITHUB_TEAM_LOGINS` (optional) - **Slack**: `SLACK_BOT_TOKEN`, `SLACK_APP_TOKEN`, `SLACK_SIGNING_SECRET`, `MONITORED_CHANNEL_IDS`, `TEAM_MEMBER_IDS` (optional) - **Slack ticket mirror**: `SLACK_MIRROR_MODE` (`off` | `shadow` | `live`, default `off`), `SLACK_MIRROR_CHANNEL_ID` (channel ID, not name). **Set both on `outpost-worker` AND on every service that creates tickets** (`outpost-discord-bot`, `outpost-github-app`): the handler runs in the worker, but the producers gate on the same config via `readSlackMirrorConfig()` inside `InboundHandler`, so vars present only on the worker mean no job is ever enqueued and the mirror is silently dead. `live` also needs `SLACK_BOT_TOKEN` with `chat:write` **on the worker**. Without it the mirror does NOT simply log once and carry on: each mirror job dead-letters, one per ticket and one per reply, and that content is gone rather than retried once the token appears. Set the token before setting `live`, or leave the mode `off`. `shadow` needs no token. Any mode is inert while `SLACK_MIRROR_CHANNEL_ID` is unset. Invite the bot to the channel or posts fail `not_in_channel`, which the handler treats as permanent and does not retry. Which tickets get mirrored is decided by `isMirrorableSource()` in `packages/outpost/shared/src/platforms/slack-mirror-config.ts` (today: Discord + GitHub issues and discussions; Slack-sourced tickets are excluded because they already live in Slack). **Scope in v1: ticket-opens from Discord and GitHub, AI replies on both, and community follow-ups from Discord only.** A follow-up comment on a GitHub issue or discussion does NOT reach the mirror: `apps/github-app/src/webhooks/issue-comment.ts` appends its `Message` row directly rather than through `InboundHandler`, so it never enqueues a mirror job, and GitHub Discussions have no comment webhook at all. Nothing logs the omission, so a Slack thread that stops after the AI reply means "no Discord follow-ups", not "the reporter went quiet" — check the GitHub thread itself before concluding anything from the mirror. `SLACK_MIRROR_MODE` is intentionally independent of `SHADOW_MODE`: that flag protects community surfaces, while the mirror targets an internal channel — see the shadow-mode section for the documented exception. Keep `SLACK_MIRROR_CHANNEL_ID` out of the Slack bot's `MONITORED_CHANNEL_IDS`: the bot drops `bot_id` events today, so its own mirror posts do not become tickets, but monitoring the mirror channel would duplicate ticket context into the inbound path and leave the loop one filter change away.