Skip to content

fix(copilot): hold sim_cli commands that perform approval-gated capabilities - #9582

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/sim-cli-approval-gate
Nov 2, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/sim-cli-approval-gate

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The copilot permission gate decided by catalog lookup alone. sim_cli has no catalog entry, so no CLI command was ever held for approval, and the CLI's own confirmation is answered by --yes in model-supplied argv
  • The worker exposes deploy, promote, run, cancel, and MCP deploy/delete only through sim_cli, so the requiresApproval flags on promote_to_live, deploy_as_*, run_workflow, cancel_workflow_run, delete_workspace_mcp_server, and call_integration_tool guarded nothing
  • Added resolveEmbeddedCliCommand to sim/embed: resolves argv with the CLI's real commander tree and parser (stopped at preAction, nothing runs) to the dispatched command's path and the v2 operations it declares. connect/OperationClient already refuse undeclared operations, so this bounds what the call can do
  • cliRequestRequiresApproval holds a CLI call when any declared operation is the capability of an approval-gated catalog tool (activate + rollback, deploy/undeploy, chat publish/unpublish, MCP tool deploy/undeploy, MCP server delete, execute/resume, cancel run, tool execute). Read commands stay ungated. Argv the parser cannot follow is held
  • Both lanes ask the same predicate: the dispatch gate (by execName) and the in-band route (with params)
  • Always-allow is still keyed by the row's display name, but covers a CLI call only when that name matches the command the parser resolves, so a row named for another command (or generic sim_cli) never carries consent across commands

Type of Change

  • Bug fix

Testing

  • New handler tests run the real router + CLI parser through prePersistClientExecutableToolCall: a workflows activate create … --yes frame is stamped awaiting_approval; always-allow on a sibling command or sim_cli does not cover it
  • Router lane rows for activate, rollback (gated) and list (ungated)
  • resolveEmbeddedCliCommand tests: global flags before/between path segments, aliases; help/unknown/usage-error/--dry-run argv resolve to no command and running each through runEmbeddedCli makes zero HTTP calls
  • Reverted each guard and confirmed its test goes red (catalog-only gate, display-name always-allow, missing rollback mapping)
  • handlers.test.ts, router.test.ts, permission.test.ts, embed.test.ts, lint, sim-cli type-check, and the comment-hygiene/file-names/utils/explicit-any/boundaries audits locally; full suite, check:audits and type-check in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 2, 2026 9:21pm UTC

Request Review

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; no actionable issues were found.

Summary

Makes Copilot approval checks follow the command that sim_cli would actually run.

  • Copilot approval follows the capability a CLI command can use.

No actionable issues were found. Review was based on source inspection; tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[sim_cli request] --> B[Validate request]
  B --> C[Resolve command before its action]
  C --> D{Declared operation needs approval?}
  D -->|No| E[Normal execution]
  D -->|Yes| F{Execution lane}
  F -->|In-band| G[Refuse and request checkpoint lane]
  F -->|Checkpoint| H{Saved consent matches command?}
  H -->|Yes| E
  H -->|No| I[Wait for user approval]
  I -->|Allow| E
  I -->|Skip| J[Do not execute]
Loading

Reviews (3) · Last reviewed commit: "fix(copilot): type the sim_cli test fram..." · Reviewed by Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

…ilities

The permission gate decided by catalog lookup alone, and sim_cli has no catalog
entry, so no CLI command was ever held. The worker exposes deploy, promote,
run and cancel only through the CLI, so those catalog approval flags guarded
nothing, and the CLI's own confirmation is answered by --yes in model argv.

Resolve the argv with the CLI's own parser to the command it would run and the
v2 operations it declares, and hold the call when one is the capability of an
approval-gated catalog tool. Both lanes ask the same predicate. Always-allow
covers a CLI call only when its row names the command the parser resolves.
@waleedlatif1
waleedlatif1 force-pushed the fix/sim-cli-approval-gate branch from 04f1a87 to 1f0cab1 Compare November 2, 2026 21:21
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 9 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit fbf5c5e into staging Nov 2, 2026
141 of 143 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/sim-cli-approval-gate branch November 2, 2026 23:25

This branch was previously deployed

1 inactive deployment
Preview — 1f0cab17 Deployed Nov 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant