A desktop coding agent with free access to frontier models.
TypeScript
feat: project config code stays off
Samrat Talukdar33a696819a59
diff --git a/apps/app/src/app/lib/omnirush-server.ts b/apps/app/src/app/lib/omnirush-server.tsindex 2aeacfbf..23ef8912 100644--- a/apps/app/src/app/lib/omnirush-server.ts+++ b/apps/app/src/app/lib/omnirush-server.ts@@ -687,6 +687,10 @@ export type OmniRushMcpPolicyView = {supported: OmniRushMcpPreset[];decisions: OmniRushMcpDecision[];reportAt: number | null;+ /** What of the project's own config the engine left out (plugins, language server and formatter commands). */+ ignored?: Array<{ kind: "plugin" | "lsp" | "formatter"; name: string; source: string | null }>;+ /** One line about it, or null. */+ ignoredNotice?: string | null;};export type OmniRushMcpAppResource = {diff --git a/apps/app/src/lib/capability-call.ts b/apps/app/src/lib/capability-call.tsindex 0f10ad1a..c41a0b09 100644--- a/apps/app/src/lib/capability-call.ts+++ b/apps/app/src/lib/capability-call.ts@@ -139,6 +139,19 @@ function verbPhrase(action: string, tense: "present" | "past"): string {// engine names their tools `<id>_<tool>`; those calls read "Used <title>: <tool>".const mcpServerTitles = new Map<string, string>()+const projectCodeNoticesShown = new Set<string>()++/**+ * The notice about a project's own config the engine left out (its plugins,+ * language server and formatter commands): once per project and app run.+ */+export function projectCodeNotice(workspaceId: string, text: string | null | undefined): { id: string; text: string } | null {+ const line = text?.trim()+ if (!line || projectCodeNoticesShown.has(`${workspaceId}\0${line}`)) return null+ projectCodeNoticesShown.add(`${workspaceId}\0${line}`)+ return { id: `project-code-ignored:${workspaceId}`, text: line }+}+/** Remember the titles of supported MCP servers (from GET /workspace/:id/mcp). */export function registerMcpServerTitles(entries: ReadonlyArray<{ id?: string | null; title?: string | null }>): void {for (const entry of entries) {diff --git a/apps/app/src/react-app/domains/session/surface/session-surface.tsx b/apps/app/src/react-app/domains/session/surface/session-surface.tsxindex 597891b8..6c676cc9 100644--- a/apps/app/src/react-app/domains/session/surface/session-surface.tsx+++ b/apps/app/src/react-app/domains/session/surface/session-surface.tsx@@ -146,7 +146,7 @@ import {type ChatMcpReconnectScope,} from "./mcp-chat-reconnect";import { OpenTargetProvider, type OpenTargetOptions } from "@/lib/target-provider";-import { registerMcpServerTitles } from "@/lib/capability-call";+import { projectCodeNotice, registerMcpServerTitles } from "@/lib/capability-call";import type { ThreadStatus } from "@/lib/messages";import {EnvironmentVariableProvider,@@ -2849,7 +2849,11 @@ export function SessionSurface(props: SessionSurfaceProps) {useEffect(() => {let current = true;void props.client.listMcp(props.workspaceId).then((response) => {- if (current && response.mcpPolicy) registerMcpServerTitles([...response.mcpPolicy.supported, ...response.mcpPolicy.decisions]);+ if (!current || !response.mcpPolicy) return;+ registerMcpServerTitles([...response.mcpPolicy.supported, ...response.mcpPolicy.decisions]);+ // Once per project and app run: what of the project's own config did not load.+ const notice = projectCodeNotice(props.workspaceId, response.mcpPolicy.ignoredNotice);+ if (notice) toast.info(notice.text, { id: notice.id });}).catch(() => undefined);return () => { current = false; };}, [props.client, props.workspaceId]);diff --git a/apps/app/src/react-app/domains/settings/pages/mcp-supported-panel.tsx b/apps/app/src/react-app/domains/settings/pages/mcp-supported-panel.tsxindex 436d5a86..3ae1a8d3 100644--- a/apps/app/src/react-app/domains/settings/pages/mcp-supported-panel.tsx+++ b/apps/app/src/react-app/domains/settings/pages/mcp-supported-panel.tsx@@ -25,6 +25,7 @@ export const MCP_BLOCKED_HINTS: Record<string, string> = {unknown_command: "Start it with npx or uvx.",outside_project: "Point it at a folder or file inside the project.",version: "Leave the version out to use the supported one.",+ runner_missing: "Install Node.js (for npx) or uv (for uvx), then restart the app.",};export type McpServerState =@@ -90,11 +91,18 @@ export function McpSupportedPanel(props: {const [addError, setAddError] = useState<{ id: string; message: string } | null>(null);const decisionFor = (name: string) => props.policy.decisions.find((decision) => decision.name === name) ?? null;+ const ignoredNotice = props.policy.ignoredNotice?.trim() ? (+ <p data-testid="mcp-project-code-ignored" className="text-xs text-dls-secondary">{props.policy.ignoredNotice.trim()}</p>+ ) : null;+if (!props.policy.enabled) {return (- <p data-testid="mcp-policy-off" className="mb-5 text-sm text-dls-secondary">- {props.policy.message?.trim() || "MCP servers are turned off for this account."}- </p>+ <div className="mb-5 flex flex-col gap-2">+ <p data-testid="mcp-policy-off" className="text-sm text-dls-secondary">+ {props.policy.message?.trim() || "MCP servers are turned off for this account."}+ </p>+ {ignoredNotice}+ </div>);}@@ -111,6 +119,7 @@ export function McpSupportedPanel(props: {return (<div data-testid="mcp-supported-panel" className="mb-6 flex flex-col gap-5">+ {ignoredNotice}{props.policy.engineV2 ? (<p data-testid="mcp-engine-v2-note" className="text-sm text-dls-secondary">{MCP_ENGINE_V2_NOTE}</p>) : null}diff --git a/apps/app/tests/mcp-supported-panel.test.tsx b/apps/app/tests/mcp-supported-panel.test.tsxindex 1d4aa527..2546685e 100644--- a/apps/app/tests/mcp-supported-panel.test.tsx+++ b/apps/app/tests/mcp-supported-panel.test.tsx@@ -2,6 +2,7 @@ import { describe, expect, test } from "bun:test";import { renderToStaticMarkup } from "react-dom/server";import type { OmniRushMcpPolicyView, OmniRushMcpPreset } from "../src/app/lib/omnirush-server";+import { projectCodeNotice } from "../src/lib/capability-call";import type { McpServerEntry } from "../src/app/types";import {MCP_BLOCKED_HINTS,@@ -110,6 +111,22 @@ describe("Settings > MCP: supported servers", () => {expect(html).not.toContain("`");});+ test("what the project's own config could not load is said once, in the panel and as a notice", () => {+ const line = "Not loaded from this project's config: plugins evil.ts.";+ expect(render({ policy: policy({ ignoredNotice: line }) })).toContain(line);+ expect(render({ policy: policy({ enabled: false, ignoredNotice: line }) })).toContain(line);+ expect(render()).not.toContain("mcp-project-code-ignored");+ expect(projectCodeNotice("ws_1", line)).toEqual({ id: "project-code-ignored:ws_1", text: line });+ expect(projectCodeNotice("ws_1", line)).toBeNull();+ expect(projectCodeNotice("ws_2", line)).not.toBeNull();+ expect(projectCodeNotice("ws_3", null)).toBeNull();+ });++ test("a missing runner says how to fix it", () => {+ expect(mcpServerState(server("x"), { name: "x", status: "blocked", code: "runner_missing", reason: "npx or uvx was not found on this computer outside the project folder, so the server does not start." }))+ .toMatchObject({ hint: "Install Node.js (for npx) or uv (for uvx), then restart the app." });+ });+test("helpers", () => {expect(presetCommandLine({ command: ["uvx", "mcp-server-git", "--repository", "my repo"] })).toBe("uvx mcp-server-git --repository 'my repo'");expect(presetConfigured(filesystem, [], [{ name: "files", status: "allowed", code: "allowed", id: "filesystem" }])).toBe(true);diff --git a/apps/server/src/server.ts b/apps/server/src/server.tsindex 03038000..ca482c52 100644--- a/apps/server/src/server.ts+++ b/apps/server/src/server.ts@@ -187,7 +187,7 @@ import { buildOmniRushRuntimeConfigObject, omnirushGatewayConfigured, omnirushRuimport { assertMcpAllowed, mcpAllowed, mcpDisabledMessage, mcpPolicyForConfig, refuseAccountLinkedMcp } from "./mcp-policy.js";import { currentMcpPolicy, rememberMcpPolicy, watchMcpPolicy, workspaceMcpReport, writeWorkspaceMcp } from "./mcp-allow/state.js";import { isOmniRushUiMcpRegistryEntry } from "./omnirush-ui-mcp-command.js";-import type { McpAllowEntry } from "./mcp-allow/mcp-allow.mjs";+import { describeIgnored, type McpAllowEntry } from "./mcp-allow/mcp-allow.mjs";import { omnirushModelWantsReasoningSummary, readOmniRushModelCatalog } from "./omnirush-model-catalog.js";import {SUBAGENT_MODEL_FALLBACK_TRACE,@@ -5142,6 +5142,9 @@ function createRoutes(supported: enabled && policy ? policy.allow.map(mcpPreset) : [],decisions,reportAt: report?.at ?? null,+ // What of the project's own config the engine left out (plugins, language server and formatter commands).+ ignored: report?.ignored ?? [],+ ignoredNotice: describeIgnored(report?.ignored),},});});diff --git a/docs/skills-and-mcp.md b/docs/skills-and-mcp.mdindex 5a519848..9e1afc6b 100644--- a/docs/skills-and-mcp.md+++ b/docs/skills-and-mcp.md@@ -105,6 +105,8 @@ To remove a server added in the app, choose Remove (`DELETE /workspace/:id/mcp/:- The server gives the engine `OMNIRUSH_MCP_POLICY_FILE`, `OMNIRUSH_MCP_REPORT_DIR` and `OMNIRUSH_MCP_WORKSPACE_DIR`. The engine plugin `omnirush-mcp-policy` (always loaded, last in the plugin list) adds the project's app-added servers to its config, then replaces `mcp` with the allowed servers only, keyed by id, pinned, paths checked, and run through the sandbox shell when the project's sandbox is on. It writes a report per project (`<server state>/mcp/reports/`) with one decision per entry; `GET /workspace/:id/mcp` returns it.- Nothing is pushed into a running engine: an added server starts when the project's engine instance reloads. The engine's own routes that would add a server at runtime or run its OAuth flow are refused; listing and connect/disconnect pass.- Playwright opens pages on this machine only (localhost); other pages are refused before the tool runs.+- `npx` and `uvx` are run from their full path on `PATH`, never from a folder inside the project; when neither is found outside the project the server is blocked (`runner_missing`).+- The engine runs with `OMNIRUSH_PROJECT_CODE=0`: a project's own config (its `opencode.json` and `.opencode` folders) brings no plugins and no language server or formatter commands, since those would run code just by opening the project. What was left out is in the report and shown once as a notice and in Settings > MCP. The app's own plugins and language servers come from its runtime config and still load; `OMNIRUSH_PROJECT_CODE=1` in the app's own environment turns this off.- MCP tools reach the model as `<id>_<tool>` and are asked about like other tools (no allow rules are added for them).- The preview engine (v2) cannot apply the list: MCP stays off there (its servers are removed before each request, and a prompt in a project with MCP servers is refused with a message).- Uploads: a session in a project with at least one server on gets `environment.mcp_servers: [{id, package, version, runtime, sandbox}]`; other sessions upload exactly as before.