Repository navigation
Add agent-proposed code tools (code_propose_tool) - #1370
Merged
Merged
Conversation
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.
Summary
Lets an agent propose a saved code tool that a workspace admin then reviews and approves, closing the loop from PR #1366 where only an admin could hand-author a code tool. Builds on the
KgSkillSuggestion.kindhook that PR added. Tracks #1369.code_propose_tool(new per-server MCP tool): gated exactly like inline code (codeMode = 'inline'+ theinlineCoderole capability + a configured runner). It does not run code and does not create a tool — it records an inertKgSkillSuggestionwithkind = 'code',source = 'agent', alwaysinvoker+ read-only, and only over the proposer's own visible connectors. An agent can never raise its own authority.assertValidCodeTool+ plan cap, admin's own auth); writes /definerare added only by editing the tool afterwards, where Enterprise/admin gating applies again.apply()refuses a code proposal on purpose.kind = 'code'is excluded invisibleWhere, the single query behind every skill-delivery path.kg_skill_suggestions.payloadcolumn (metadata-only in Postgres). Off by default; no-op for existing installs.Cloud vs self-hosted
Identical behaviour in both. The proposal tool only appears when a server opted into
inlineand the caller's role carries the capability (the Cloud shared/mcpendpoint never exposes it, like all code mode). No new cross-tenant surface: proposals reference only the proposer's connectors and are created through the same org-scoped tool path.Testing (worktree,
packages/backendunless noted)npx tsc --noEmit -p tsconfig.json— backend: clean; frontend (packages/frontend): clean.npm run lint— backend: 0 errors (11 pre-existing warnings in unrelated files); touched files clean.npx jest src/knowledge-graph src/mcp-server src/roles— 801 passed, 2 skipped (live runner), 1 suite skipped.npx jest src/knowledge-graph/kg-skill.service.spec.ts— 39 passed (new: proposal stored invoker/read-only with payload; empty name/code/connectors rejected;apply()refuses a code proposal;kind = 'code'excluded from active-skills query).prisma migrate deploy, success) andprisma migrate diffDB→schema reports "No difference detected."docs/code-mode.md) andllmsregenerated (node scripts/generate-llms-txt.mjs --checkclean).Notes
No
ee/changes. Follows the off-by-default, fail-safe pattern of PR #1366. The schema change was discussed first in #1369 per AGENTS.md.