Skip to content

docs(self-host): say CRON_SECRET is needed self-hosted too once Chat is on - #1852

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:docs/self-host-cron-secret
Oct 30, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:docs/self-host-cron-secret

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

With CHAT_AGENTIC on, every Chat model step asks the server's internal budget endpoint (/api/internal/chat/budget/*) to reserve and charge AI usage. That call carries CRON_SECRET as a bearer token, and server/src/routes/internal-chat-budget.js refuses it when the secret is missing or different. So a self-hosted install with Chat on needs CRON_SECRET on both sides; without it every run stops with "Chat couldn't check your AI usage". The docs and both .env.example files still said "cloud only — not needed for self-hosted".

Docs only:

  • docs/self-host/env-variables.mdx: the web and server CRON_SECRET rows 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_SECRET couldn't run a Chat step).

Related issue

None.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

Read the three files. To see the behaviour: run web and server with CHAT_AGENTIC=true and no CRON_SECRET, send a Chat message, and the run stops with "Chat couldn't check your AI usage just now". Set the same CRON_SECRET in web/.env.local and server/.env, restart both, and the budget calls answer.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes (no code changed)
  • yarn typecheck passes (no code changed)
  • yarn format:check passes (no code changed)
  • Changes are focused — one concern per PR

🤖 Generated with Claude Code

…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]>
@mintlify

mintlify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 2351881.

Approve preview

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_SECRET on a self-hosted install, and the brief call throws without it. The web .env.example list 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_ORGS have no rows in docs/self-host/env-variables.mdx, but the new CRON_SECRET rows point to CHAT_AGENTIC. Both are only described in the two .env.example files. 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.example files do (openssl rand -hex 32). One short clause in the row would help people who only read the docs.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gkhngyk
gkhngyk merged commit 457e889 into ansvisor:main Oct 30, 2026
5 of 6 checks passed
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.

2 participants