Repository navigation
Port chat to the effect/chat PR snapshot - #189
Merged
Merged
Conversation
Pins every Effect package to the pkg.pr.new snapshot of Effect-TS/effect#10581 at 42cf7c0 and moves Slack and Discord onto effect/chat, @effect/chat-slack and @effect/chat-discord: posting, history, downloads, the Slack webhook and the Discord gateway's dispatch.
- Post the overflow of a reply whose files are refused as text: ChatMarkdown's fallback keeps the overflow file, so the platform refuses it again. - Bound the whole Slack webhook request by 2.5 seconds, body included. - Keep Slack's subtype allow-list in ingress and history, so /me actions start nothing. - Post a Discord reply to a since-deleted message as a plain message, as fail_if_not_exists: false did, instead of mentioning its author.
ChatMarkdownError.remaining is a raw slice of the input: posted on its own, a continuation inside a code fence rendered outside it and lost its indentation.
…ixes Moves every Effect package to the eeccfc1 snapshot of Effect-TS/effect#10581. ChatMarkdown now posts the overflow of a reply whose files are refused as text, in the code fence it was cut in, and @effect/chat-slack's webhook deadline covers reading the body. Janitor's workarounds for both come out; their regression tests stay and run against the library.
The adapter answers a deadline timeout with a plain 503, so the timeout log the removed deadline middleware wrote was gone. A route middleware now logs every 503 from the response status alone, without naming a cause it can't know and without the request's content.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves Janitor's Slack and Discord chat onto
effect/chat,@effect/chat-slackand@effect/chat-discordfrom the Effect-TS/effect#10581 snapshot, so we can dogfood the API before that PR lands.Approved for production (2026-11-13). Tim approved merging this with its snapshot pins and dogfooding it on production: "This is fine for production. We don't need a separate environment." A merge to
maindeploys production through the usual Check → Deploy workflows. The approval covers this PR only. It doesn't cover merging Effect-TS/effect#10581, and the Slack and Discord app settings, scopes and intents stay as they are.Closes EFF-3766
Snapshot provenance
eeccfc1bc8a8cb1d338c2dd85fd41a138047517fof #10581, published by build https://github.com/Effect-TS/effect/actions/runs/43432011317. It adds the fixes for the two defects this dogfood reported (see below) to42cf7c0, which the PR used before.effect/@effect/*catalog entry (except@effect/tsgo, which is versioned separately) ishttps://pkg.pr.new/Effect-TS/effect/<pkg>@eeccfc1….@effect/chat-slackand@effect/chat-discordare new catalog entries used byapps/cluster.pnpm-lock.yaml: all 219pkg.pr.newreferences point ateeccfc1…, no registryeffector@effect/*package is left, and a singleeffect(4.1.4) resolves.blockExoticSubdeps: falselets the existingoverrideshand the URL to subdependencies (e.g.@foldkit/vite-plugin's@effect/platform-node). Restore the default when the catalog returns to registry versions.What moved
Chat/Platform.ts: replies go throughChatMarkdown.post(postMarkdown), with the overflow uploaded asreply.mdand refused files noted in the text. Downloads useChat.download, history usesChat.history.uploadFileand the hand-rolled chunking are gone.SlackChat.layer/layerWebhookreplace the Web API client, the signature verifier and the event decoding. Admission still usesusers.info(viaSlackChat.user) with the one-hour cache. 👍 approvals read the message withchat.fetchMessage.McpServersusesSlackWebApiforconversations.info.MESSAGE_CREATE/MESSAGE_REACTION_ADDtoDiscordChat.dispatch. The ingress is aChatHandler. Threads start withchat.startThread. Posts useDiscordChat.withPostOptionsto ping only named users and the replied-to author.Behaviour kept from before the port
These came up in review (EFF-3766) and now behave as on
main, each with a test that fails without the fix:ChatMarkdowndoes this itself sinceeeccfc1, so Janitor's recovery (recoverRemaining) is gone. The tests stay and now run against the library: overflow on Slack and Discord, a cut inside a closed fence, and an unterminated fence with trailing spaces.@effect/chat-slack's deadline covers that sinceeeccfc1, so Janitor's middleware (answerWithin) is gone. The streaming-body test stays. Every 503 is now logged asSlack webhook answered 503by a route middleware that only reads the response status, with no deadline of its own and nothing from the request. Unlikemain'sSlack webhook failedwitherror: "Timeout", it doesn't name a timeout: the adapter answers a timeout and an unreadable bot user with the same 503. A handler refusal still logsSlack webhook failedwith its error first./meactions. The adapter passesme_messageon as a new message. Janitor's subtype allow-list (none,file_share,thread_broadcast; plusbot_messagein history) is back in ingress and history.fail_if_not_exists: falsedid. The adapter can't send that field, so Janitor retries without the reference when Discord refuses it before anything posted.Behaviour changes from
mainTim saw this table with the production approval above and raised no objection, so these ship as they are. That is acceptance of the table as a whole, not a sign-off item by item. Restoring any of them means bypassing the adapter for the very thing we're dogfooding:
reply.mdreply.mdChatMarkdown's overflow design; no text is lost.janitor_outputmetadataSlackPostOptionshas no metadata field. Nothing in Janitor reads it.allowed_mentionsparse: ["users"]userslist from the<@id>s in the textGaps found in the snapshot (feedback for #10581)
Posted with reproductions on EFF-3691:
eeccfc1:ChatMarkdownoverflow file plus refused files lost the overflow, andSlackChat.layerWebhook's deadline didn't cover reading the body.ChatMarkdownError.remainingdoesn't say which code fence it was cut in. Janitor no longer needs it, but a consumer recovering after another failure would.layerWebhookgives no way to tell a deadline timeout from an unreadable bot user: both are a bare 503, so Janitor logs the status without a cause.fail_if_not_existson Discord.mentionsSelfignores replies to the bot; Janitor keeps that rule withreplyTo.authorId.DiscordChat.layerGatewaycan't resume from external storage, so it doesn't fit a Durable Object.ChatMarkdownpaces writes on theClock, so platform tests needTestClock.Validation
Locally on
fb7f239, the same steps as CI:vp install --frozen-lockfile: up to datevp check: 0 errors (2073 warnings; the baseline was ~2000, the increase is allunstable-api-usagefrom the new imports and tests)vp run @janitor/cluster#graphql:check: exit 0vp test: 157 files, 1029 tests passedDogfooding and rollback
Dogfooding happens on production, as Tim approved: no isolated stage and no local run. After Deploy succeeds, representative Slack and Discord flows are exercised in channels agreed with Tim, and the results are recorded on EFF-3766.
Rollback is
git revertof this PR's merge commit onmain. Check runs on the revert, and Deploy redeploys production from it. The revert restores the registry4.1.3catalog and lockfile. No data migration is needed: the Slack and Discord app settings and scopes, the Discord intents, the secrets, the database, session keys and the gateway Durable Object's storage (shard session and seen ids) keep the format they have onmain. After a rollback, check thatvp install --frozen-lockfileresolves nopkg.pr.newURL.mainkeeps pinning a PR snapshot until #10581 is released. Moving to the release is a separate PR.