Repository navigation
feat(nova-desktop): add inference meter package and enhance folder management - #384
yashdev9274 wants to merge 1 commit into
Conversation
…nagement - Introduced the @super/inference-meter package to the workspace for improved inference tracking. - Updated folder management logic to persist grants across service restarts and handle symlink scenarios. - Enhanced folder grant tests to ensure robustness in various scenarios, including service restarts and permission revocations. - Implemented a new DesktopShell component for better UI structure and user experience in the Nova Desktop application. - Added comprehensive styles for the desktop explorer interface to improve usability and aesthetics. - Updated package.json and bun.lock to reflect new dependencies and workspace configurations.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedToo many files! This PR contains 192 files, which is 92 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This organization's CodeRabbit subscription is cancelled. Resubscribe in Billing to continue reviews beyond the free-tier limit.
|
Confidence Score: 0/5
[High impact] The PR changes how Nova runs provider agents, exposes tools, and tracks inference across its web, desktop, and CLI surfaces. Do not merge until the server access, approval, billing, data-loss, and provider lifecycle issues are fixed. Findings
|
| const started = await entry.rpc.request("thread/start", { | ||
| cwd: process.cwd(), | ||
| model: input.model, | ||
| sandbox: "read-only", | ||
| approvalPolicy: "on-request", |
There was a problem hiding this comment.
The new codex-agent path runs native tools in the web server’s directory and inherits its environment. A signed-in user can ask the agent to read application files instead of going through Nova’s workspace checks. If that checkout contains private configuration, those files are exposed too. Read-only access prevents writes, not reads of server files. Run these agents in an isolated workspace with an explicit environment allowlist.
How this was verified: Web turns reach spawnAppServer, which inherits process.env and starts threads at process.cwd() without a per-user filesystem boundary.
| const meteredFetch = createInferenceFetch({ | ||
| userId, | ||
| provider, | ||
| model: resolvedModel, | ||
| signal, | ||
| maxOutputTokens: getModelMaxTokens, |
There was a problem hiding this comment.
Cloud billing uses wrong account
managedTransportPair receives the dashboard user ID, but createInferenceFetch looks up subscriptions and credits in the terminal database. ensureHarnessToken links accounts by email and creates a separate terminal ID. When those IDs differ, managed inference cannot find the user’s subscription, and creating one against the dashboard ID fails. Resolve the terminal identity before metering and recording usage.
| const hash = stableHash({ name: request.method, args }) | ||
| const idempotencyKey = `agentreq:${input.sessionId}:${String(request.id)}` | ||
| const expiresAt = new Date(Date.now() + INTERACTION_TTL_MS) | ||
|
|
||
| return prisma.$transaction(async (tx) => { | ||
| const existing = await tx.toolInvocation.findUnique({ where: { idempotencyKey } }) | ||
| const invocation = existing ?? await tx.toolInvocation.create({ |
There was a problem hiding this comment.
Old approvals authorize new actions
createInteraction keys decisions by session and request ID, without the run or current arguments. The Composio caller also reuses its key for identical arguments across turns. An earlier approved row is returned unchanged, and pollDecision accepts it immediately. A later mutation can therefore run without another approval card. Bind approvals to one action in one run, and consume each approval once.
How this was verified: Repeated Composio calls reuse the stored interaction, whose approved status is accepted without checking the new run or claiming execution.
| server.registerTool("nova_workspace_apply_patch", { | ||
| description: "Apply a previously proposed patch after the user approved it. Pass the previewId returned by nova_workspace_propose_patch.", | ||
| inputSchema: { previewId: z.string().min(1).max(200) }, | ||
| }, async ({ previewId }: { previewId: string }) => { | ||
| const result = await desktopWorkspaces.applyPatch(deps.sessionId, previewId) | ||
| return { content: [{ type: "text", text: JSON.stringify(result).slice(0, MAX_READ_CHARS) }] } |
There was a problem hiding this comment.
Desktop previews bypass approval
The agent can obtain a preview and immediately call nova_workspace_apply_patch, nova_workspace_publish, or nova_workspace_revert. The downstream checks establish ownership, expiry, and unchanged content, but not user approval. These tools are also offered during read-only turns. Require a recorded user decision and enforce the current turn’s mode before executing them.
How this was verified: The gateway exposes both preview and execution tools, while desktopWorkspaces executes solely from the stored preview and its session checks.
| case "tools/call": { | ||
| const name = typeof params?.name === "string" ? params.name : "" | ||
| const tool = TOOLS[name] | ||
| if (!tool) return rpcError(id, -32602, `Unknown tool: ${name}`) | ||
| const args = (params?.arguments ?? {}) as Record<string, unknown> | ||
| try { | ||
| const output = await tool.handler(args, ctx) |
There was a problem hiding this comment.
Web gateway ignores read-only mode
tools/list exposes every gateway tool, and tools/call runs handlers without checking the turn’s mode. A plan turn can therefore navigate or type into an existing agent-controlled browser, although the existing turn path requires agent mode for those actions. Prompt text does not enforce that restriction. Scope the grant and each call to the current run’s allowed tools.
How this was verified: Gateway dispatch calls handlers directly, whereas the existing browser path explicitly rejects calls outside agent mode.
| const promptPromise = rpc(entry, "session/prompt", { | ||
| sessionId: entry.acpSessionId, | ||
| prompt: [{ type: "text", text: input.content }], | ||
| }).then((result) => ({ ok: true as const, result })) |
There was a problem hiding this comment.
Gemini ignores the selected model
The picker offers gemini-2.5-pro and gemini-2.5-flash, but createAcpSessionManager never reads input.model. Session creation, loading, and prompting all omit it, so both choices use the CLI’s default model. Apply the selected model before prompting, including when an existing session changes models.
| async adoptThread(uuid: string, native: string, owner: string): Promise<boolean> { | ||
| if (this.threads.has(uuid)) return true | ||
| try { | ||
| await this.rpc.request("thread/resume", { threadId: native }) | ||
| this.threads.set(uuid, { native, owner }) |
There was a problem hiding this comment.
Resumed threads lose gateway access
A new desktop process receives a fresh gateway URL, but adoptThread resumes the native thread with only its ID. The fresh URL is supplied only by thread/start, which a successful resume skips. Since closing revoked the previous token, the resumed thread has either a dead URL or no gateway tools. Refresh the MCP configuration on resume. The web Codex resume path has the same omission for expiring grants.
| aside[aria-label="Workspace panel"] | ||
| div:has(> div > input[placeholder="Search files"]) { |
There was a problem hiding this comment.
The new rules require an input whose placeholder is exactly Search files, but FilesPane renders Search files. and changes the nesting around it. The explorer therefore receives none of these search, tree, or selected-row styles. Use a stable class or data attribute for the pane and match its new child structure.
| export const ALL_MODELS: NovaModelEntry[] = [ | ||
| ...CLAUDE_AGENT_MODELS, | ||
| ...GEMINI_AGENT_MODELS, | ||
| ...OPENCODE_AGENT_MODELS, | ||
| ...DROID_AGENT_MODELS, | ||
| ...CURSOR_AGENT_MODELS, | ||
| ...DEVIN_AGENT_MODELS, |
There was a problem hiding this comment.
Catalog audit rejects agent aliases
Adding agent provider IDs to ALL_MODELS makes integration-registry.test.ts fail its exact comparison with INTEGRATION_IDS, which contains only base provider IDs. The new isIntegrationId guard runs after that comparison and cannot fix it. Update the audit to map agent choices to their registered provider, or register the aliases consistently.
| const doneReason = await Promise.race([ | ||
| turnDone, | ||
| new Promise<string>((resolve) => { | ||
| const check = () => (entry.dead ? resolve("interrupted") : setTimeout(check, 100)) | ||
| check() | ||
| }), |
There was a problem hiding this comment.
Droid leaves polling timers running
The process-death branch of Promise.race schedules another timer every 100 ms until the process exits. Completing turnDone does not cancel that branch, so each successful turn leaves another polling chain running for the rest of the process lifetime. Use the existing entry.exited promise, or clear the polling timer when either branch settles.
Description
Describe the problem, the change, and its effect on users or contributors. For non-trivial changes, link the issue or discussion where the approach was agreed.
Related issue: #
Type of change
How Has This Been Tested?
List the commands you ran and their results, including focused tests. Explain any checks you could not run and why. For UI changes, add before/after screenshots; include a recording for motion or interaction changes.
Checklist: