Skip to content

feat: Simplify user consent flow for computer-use#28266

Open
dlavrenuek wants to merge 1 commit intomasterfrom
NODE-4795-simplify-computer-use-hitl
Open

feat: Simplify user consent flow for computer-use#28266
dlavrenuek wants to merge 1 commit intomasterfrom
NODE-4795-simplify-computer-use-hitl

Conversation

@dlavrenuek
Copy link
Copy Markdown
Contributor

Summary

Simplifies the decisions in HITL for Computer Use.

  • Removes Always allow and Always deny options which store the decision permanently between sessions for given resource.
  • Allow for session choice is changed to Allow {toolGroup} for session and sets the tool group to allow for the current session
  • Default "allow" choice is changed from Allow for session to Allow (once), Allow for session was moved to the dropdown

Related Linear tickets, Github issues, and Community forum posts

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with Backport to Beta, Backport to Stable, or Backport to v1 (if the PR is an urgent fix that needs to be backported)

@dlavrenuek dlavrenuek requested a review from elsmr April 9, 2026 15:57
@dlavrenuek dlavrenuek self-assigned this Apr 9, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 11 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/@n8n/computer-use/src/confirm-resource-cli.ts">

<violation number="1" location="packages/@n8n/computer-use/src/confirm-resource-cli.ts:28">
P2: According to linked Linear issue NODE-4795, the CLI prompt must remove the permanent “Always allow” and “Always deny” options. These choices are still presented, so the UI doesn’t match the simplified consent flow.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant User as User (UI/CLI)
    participant UI as n8n Frontend
    participant GC as GatewayClient
    participant GS as GatewaySession
    participant Tool as Computer Use Tool

    Note over User,Tool: Tool Execution Request

    GC->>GS: check(toolGroup, resource)
    GS-->>GC: PermissionMode: "ask"

    alt NEW: Instance Mode (Web UI)
        GC-->>UI: NEW: Error(GATEWAY_CONFIRMATION_REQUIRED)
        Note right of UI: Includes ToolGroup & limited options:<br/>denyOnce, allowOnce, allowForSession
        UI->>User: Display Simplified Prompt
        User-->>UI: Selects "Allow {toolGroup} for session"
        UI->>GC: NEW: dispatchToolCall(..., _confirmation: "allowForSession")
    else CHANGED: Client Mode (CLI)
        GC->>User: CHANGED: Prompt for confirmation
        Note right of User: Choices include toolGroup in "Allow for session" label
        User-->>GC: "allowForSession"
    end

    Note over GC,GS: Permission Elevation Flow

    alt Decision is "allowForSession"
        GC->>GS: CHANGED: setPermissions({ [toolGroup]: 'allow' })
        Note over GS: Permission is now elevated for the ENTIRE tool group<br/>for this session (previously resource-specific)
    else Decision is "allowOnce"
        Note over GC: Proceed without updating session state
    end

    GC->>Tool: execute()
    Tool-->>GC: Result
    GC-->>UI: Tool Result

    opt Session End
        GC->>GC: disconnect()
        Note over GC,GS: CHANGED: Session-specific rules are no longer<br/>manually cleared as they are part of session state
    end
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

@n8n-assistant n8n-assistant bot added the n8n team Authored by the n8n team label Apr 9, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../instanceAi/components/GatewayResourceDecision.vue 0.00% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 9, 2026

Bundle Report

Changes will decrease total bundle size by 479 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
editor-ui-esm 45.47MB -479 bytes (-0.0%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: editor-ui-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/worker-*.js 3.14MB 3.16MB 17560.39% ⚠️
assets/worker-*.js -3.14MB 17.9kB -99.43%
assets/core-*.js -112 bytes 613.91kB -0.02%
assets/InstanceAiView-*.js -367 bytes 288.57kB -0.13%

Files in assets/InstanceAiView-*.js:

  • ./src/features/ai/instanceAi/components/InstanceAiConfirmationPanel.vue → Total Size: 402 bytes

  • ./src/features/ai/instanceAi/components/GatewayResourceDecision.vue → Total Size: 386 bytes

@dlavrenuek dlavrenuek enabled auto-merge April 10, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

n8n team Authored by the n8n team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant