Repository navigation
Enforce per-plan code mode gating (saved-tool caps + inline Team+) - #1447
Merged
Merged
Conversation
Numbers live in the backend (src/license/code-mode-quotas.ts), mirroring file-search-quotas, so existing licence keys need no reissue; an Enterprise contract can override the cap via features.maxCodeTools. - Saved code tools capped per plan on Cloud AND self-hosted: Community 3, Starter 5, Team/Business 20, Enterprise unlimited (unknown/no plan = Community). Enforced in LicenseGuardService.checkCanCreateCodeTool. - Inline code (code_execute / code_propose_tool) is Team and above, enforced in the MCP endpoint's resolveInlineCode via canUseInlineCode, on top of the per-server codeMode and the inlineCode role capability.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #1446. Enforces the code-mode plan gating that was scaffolded but not applied. No schema change; off by default everywhere.
What
src/license/code-mode-quotas.ts(new, mirrorsfile-search-quotas.ts):codeToolCapForPlan(Community 3 / Starter 5 / Team 20 / Business 20 / Enterprise unlimited; unknown/no plan → Community;features.maxCodeToolsoverrides) andinlineCodeAllowedForPlan(Team+). Numbers live in the backend so existing licence keys need no reissue.LicenseGuardService.checkCanCreateCodeTool: now caps on Cloud AND self-hosted (was Cloud-trial only), by plan. Cloud still requires an active licence first; self-hosted self-guards.LicenseGuardService.canUseInlineCode+DynamicMcpTools.inlineCodeAllowedForOrgpass-through, called from the MCP endpoint'sresolveInlineCode: inlinecode_execute/code_propose_toolis exposed only on Team+ plans, on top of the per-servercodeModeand theinlineCoderole capability.Scope
Writes /
runAs: definer/ shared-endpoint exposure stay Enterprise/admin as before. Per-tier audit retention and Cloud monthly run quotas are out of scope (operational / separate). Pricing-page numbers (owned by the website) are unchanged and match this map.Testing (worktree, after
npm ci+prisma generate)packages/backend:tsc --noEmitclean;eslintclean on changed files;jest— newcode-mode-gating.spec.ts(quotas + guard: self-hosted/Cloud caps, override, inline Team+) with license/connectors/mcp-server suites, 388 pass.generate-llms-txt.mjs --checkclean after a Governance note.Independent of #1444/#1445 (the three bug fixes); touches different files. Reviewed every line.