Skip to content

Enforce per-plan code mode gating (saved-tool caps + inline Team+) - #1447

Merged
helpcodeai merged 3 commits into
mainfrom
helpcodeai/code-mode-plan-gating
Nov 2, 2026
Merged

helpcodeai merged 3 commits into
mainfrom
helpcodeai/code-mode-plan-gating

Conversation

@helpcodeai

Copy link
Copy Markdown
Contributor

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, mirrors file-search-quotas.ts): codeToolCapForPlan (Community 3 / Starter 5 / Team 20 / Business 20 / Enterprise unlimited; unknown/no plan → Community; features.maxCodeTools overrides) and inlineCodeAllowedForPlan (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.inlineCodeAllowedForOrg pass-through, called from the MCP endpoint's resolveInlineCode: inline code_execute / code_propose_tool is exposed only on Team+ plans, on top of the per-server codeMode and the inlineCode role 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 --noEmit clean; eslint clean on changed files; jest — new code-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 --check clean after a Governance note.

Independent of #1444/#1445 (the three bug fixes); touches different files. Reviewed every line.

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.
@helpcodeai
helpcodeai merged commit c9af6bf into main Nov 2, 2026
14 checks passed
@helpcodeai
helpcodeai deleted the helpcodeai/code-mode-plan-gating branch November 2, 2026 12:00
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code mode: enforce per-plan gating (saved-tool caps + inline Team+)

1 participant