Repository navigation
docs(self-host): say CRON_SECRET is needed self-hosted too once Chat is on - #1852
Conversation
…is on With CHAT_AGENTIC on, each Chat model step holds and charges the AI budget through the server's /api/internal/chat/budget, which the web app calls with CRON_SECRET, self-hosted included: without the same value on both sides Chat can't answer. The self-host env page and both .env.example files said "cloud only — not needed for self-hosted". Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
gkhngyk
left a comment
There was a problem hiding this comment.
Approving. Checked against main: with CHAT_AGENTIC on, web/src/lib/chat/budget.ts refuses the step when CRON_SECRET is unset, and server/src/routes/internal-chat-budget.js returns 401 when the server's copy is missing or different. Both sides fail closed, and the run stops before any model call, so the new wording ("set it on both sides, the same value, or Chat can't answer") is accurate. None of the open Chat PRs add another place that reads it. Merges clean on main.
Optional nits, fine as follow-ups:
- "self-host with Chat" understates it a little. The MCP tools that reach the server (brief generation, site audits, Improve, publishing) also need
CRON_SECRETon a self-hosted install, and the brief call throws without it. The web.env.examplelist right under the new header already names the MCP layer. Something like "cloud; self-hosted: Chat and the MCP tools" would match the code. CHAT_AGENTIC/CHAT_AGENTIC_ORGShave no rows indocs/self-host/env-variables.mdx, but the newCRON_SECRETrows point toCHAT_AGENTIC. Both are only described in the two.env.examplefiles. Rows for web and server (same values on both, empty orgs list = every organization) would make the page complete.- The docs page doesn't say how to make the value; the
.env.examplefiles do (openssl rand -hex 32). One short clause in the row would help people who only read the docs.
gkhngyk
left a comment
There was a problem hiding this comment.
Merging in order with the other approved PRs. This head merges current main; its tree is what main will be after this squash, checked with the full server and web suites, tsc, lint, format and next build.
Summary
With
CHAT_AGENTICon, every Chat model step asks the server's internal budget endpoint (/api/internal/chat/budget/*) to reserve and charge AI usage. That call carriesCRON_SECRETas a bearer token, andserver/src/routes/internal-chat-budget.jsrefuses it when the secret is missing or different. So a self-hosted install with Chat on needsCRON_SECRETon both sides; without it every run stops with "Chat couldn't check your AI usage". The docs and both.env.examplefiles still said "cloud only — not needed for self-hosted".Docs only:
docs/self-host/env-variables.mdx: the web and serverCRON_SECRETrows now say "cloud; self-host with Chat", and explain the budget call and the need for the same value.web/.env.example,server/.env.example: the section headers say "cloud, and self-hosted with Chat on"; the endpoint lists include Chat's budget.Found while previewing Chat locally (a dev setup without
CRON_SECRETcouldn't run a Chat step).Related issue
None.
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
Read the three files. To see the behaviour: run web and server with
CHAT_AGENTIC=trueand noCRON_SECRET, send a Chat message, and the run stops with "Chat couldn't check your AI usage just now". Set the sameCRON_SECRETinweb/.env.localandserver/.env, restart both, and the budget calls answer.Checklist
yarn lintpasses (no code changed)yarn typecheckpasses (no code changed)yarn format:checkpasses (no code changed)🤖 Generated with Claude Code