Fix /login: restore /api/bots/ingest + link endpoints for standalone bots - #8
Merged
Merged
Conversation
The 0013 dashboard-connect rewrite removed the endpoints the discord/
telegram/slack.grayoffice bot repos depend on, so /login just hangs.
- migrations/0014: bot_link_codes + bot_links (now carrying org_id)
- workers/bot-compat.ts: /api/bots/ingest + /api/bots/link/{start,status,revoke},
mounted before the /:platform/:orgId webhook router
- app/routes/link.tsx: enter-the-code page at /link
- ingest resolves the linked user+org and runs the same handleInbound /
runFinanceAgentText path as the webhooks; idempotency via bot_processed_events
Additive — no change to bots.ts / bot-router.ts behaviour.
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.
Problem
/loginin the Discord bot (and Slack/Telegram) defers "thinking…" and never replies. The0013dashboard-connect rewrite deleted/api/bots/ingestand/api/bots/link/*— every endpoint the standalone bot repos (discord/telegram/slack.grayoffice) call. Deployedgrayoffice.appreturns 404 for all of them.Fix (additive — no behaviour change to
bots.ts/bot-router.ts)migrations/0014_bot_link_compat.sql—bot_link_codes+bot_links(the latter now carriesorg_id).workers/bot-compat.ts—/api/bots/ingest+/api/bots/link/{start,status,revoke}, mounted on/api/botsbefore the/:platform/:orgIdwebhook router (different segment counts, no collision)./ingestresolves the linked user + org frombot_linksand runs the samehandleInbound→runFinanceAgentTextpath the webhooks use (real agent + tools when linked; Workers-AI fallback when not).bot_processed_eventsledger.app/routes/link.tsx— the enter-your-code page at/link(signed-in; writesbot_linksfor the user's first org).app/routes.ts,workers/app.ts.To go live
The bot repos need
GRAYOFFICE_URLpointed at the deployment andBOT_INGEST_TOKENmatching.Note
This keeps the standalone-bot model working alongside the dashboard-connect one. Longer term they should converge (see #7).
🤖 Generated with Claude Code