Skip to content

feat(agent): allow variable tool permission modes - #7538

Merged
j15z merged 3 commits into
stagingfrom
codex/agent-tool-permission-mode
Sep 15, 2026
Merged

j15z merged 3 commits into
stagingfrom
codex/agent-tool-permission-mode

Conversation

@j15z

@j15z j15z commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Let an agent tool's Permission Mode be a fixed selector value or a variable such as <start.toolMode>. The expression is resolved before tool filtering, and anything other than auto, force, or none is rejected before provider or tool work starts.

  • Stores the fixed usageControl and the usageControlExpression separately, with a selector/variable toggle in the expanded tool controls.
  • API and Copilot edits select the mode from the field they send. A tool that carries both values keeps its current mode, and each tool keeps its mode when an edit reorders the tools list.
  • Preserves the expression through workflow search, import/export, and sanitization, and adds it to the v2 OpenAPI spec and generated CLI types.
  • Moves Permission Mode from the tool header into the expanded tool. Clicking a tool header now expands it (custom and MCP tools included), a pencil button opens the custom tool editor, and a tool set to None is greyed out.

Companion: simstudioai/mothership#488

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

  • Unit and engine tests cover fixed and variable resolution, invalid values, secret tracking, mode selection and unchanged round trips through API edits, modes following reordered tools, import/export, search, and sanitization.
  • type-check, lint, check:api-validation, check:openapi, check:cli-api, and check:cli-docs pass, and CI passes.
  • Manual Chrome and CLI testing covered selector and variable modes end to end.

Reviewers: applyAgentToolUsageControlModesAfterEdits in lib/workflows/editing/engine.ts runs after the tool canonical-mode reindex, so a mode chosen through an API edit lands on its tool's final position.

Checklist

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

Screenshots/Videos

Before:
Screenshot 2026-09-14 at 6 21 31 PM
Screenshot 2026-09-14 at 6 19 51 PM

After:
Screenshot 2026-09-14 at 6 19 31 PM
Screenshot 2026-09-14 at 6 19 22 PM

@vercel

vercel Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Ready Ready Preview Sep 14, 2026 6:24pm UTC

Request Review

@j15z

j15z commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

@j15z

j15z commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

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

@greptile-apps

greptile-apps Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable new defects or outstanding previous findings remain.

Summary

  • Resolves and validates the active permission mode before tool discovery, transformation, or provider work.
  • Adds editor controls and canonical-mode handling for fixed and variable representations.
  • Preserves expressions through API contracts, editing, sanitization, import/export, and workflow search.
  • Updates generated OpenAPI and CLI artifacts and adds focused regression coverage.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Stored Agent tool] --> B{Canonical permission mode}
  B -->|Selector| C[Use fixed usageControl]
  B -->|Variable| D[Resolve usageControlExpression]
  D --> E{Auto, Force, or None?}
  E -->|No| F[Reject before tool or provider work]
  E -->|Yes| G[Apply resolved mode]
  C --> G
  G --> H{Mode is None?}
  H -->|Yes| I[Exclude tool]
  H -->|No| J[Transform and send tool to provider]
Loading

Reviews (12) · Last reviewed commit: "docs(agent): document the tool Permissio..."

Comment thread apps/sim/lib/workflows/tool-input/usage-control.server.ts Outdated
@j15z
j15z force-pushed the codex/agent-tool-permission-mode branch from 11c3d58 to 818dca4 Compare September 6, 2026 00:21
@j15z
j15z changed the base branch from codex/canonical-tool-mode-base to staging September 6, 2026 00:22
@j15z
j15z force-pushed the codex/agent-tool-permission-mode branch from 818dca4 to 41af1d3 Compare September 7, 2026 19:00
@j15z
j15z force-pushed the codex/agent-tool-permission-mode branch from 41af1d3 to 661f655 Compare September 9, 2026 20:30
@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

✅ Cross-repo companion check

All declared companion PRs are merged into staging.

@j15z

j15z commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

@j15z

j15z commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

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

Comment thread apps/realtime/src/database/operations.ts Outdated
Comment thread apps/realtime/src/database/workflow-authoring.ts Outdated
@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

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

@j15z
j15z force-pushed the codex/agent-tool-permission-mode branch from d433d88 to 68451c9 Compare September 10, 2026 00:04
@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

@j15z

j15z commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

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

@j15z
j15z force-pushed the codex/fix-api-tool-canonical-remapping branch from 3c840ed to ea8a65c Compare September 12, 2026 20:27
@j15z
j15z force-pushed the codex/agent-tool-permission-mode branch from 296302f to 78ae7ef Compare September 12, 2026 20:27
@j15z
j15z force-pushed the codex/fix-api-tool-canonical-remapping branch from ea8a65c to 30eea7f Compare September 12, 2026 23:04
@j15z
j15z force-pushed the codex/agent-tool-permission-mode branch from 78ae7ef to c09d0d5 Compare September 12, 2026 23:04
@j15z
j15z force-pushed the codex/fix-api-tool-canonical-remapping branch from 30eea7f to b2a8afd Compare September 12, 2026 23:29
@j15z
j15z force-pushed the codex/agent-tool-permission-mode branch from c09d0d5 to 43481a7 Compare September 12, 2026 23:29
@j15z
j15z force-pushed the codex/agent-tool-permission-mode branch from 43481a7 to ed511a8 Compare September 13, 2026 00:34
@j15z
j15z changed the base branch from codex/fix-api-tool-canonical-remapping to staging September 13, 2026 00:34
@j15z
j15z marked this pull request as ready for review September 14, 2026 17:58
Comment thread apps/sim/lib/workflows/editing/builders.ts Outdated
@j15z
j15z force-pushed the codex/agent-tool-permission-mode branch from ed511a8 to 4e43b51 Compare September 14, 2026 18:16
@j15z

j15z commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

j15z and others added 3 commits September 14, 2026 11:22
Apply each agent tool's Permission Mode after the edit batch reindexes tool
canonical modes, so a mode chosen for a tool's final position is not moved
again as if it were keyed by the original tool list.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@j15z
j15z force-pushed the codex/agent-tool-permission-mode branch from 4e43b51 to b17a4ac Compare September 14, 2026 18:22
@j15z

j15z commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

This branch was successfully deployed

1 active deployment
Preview — b17a4ac8 Deployed Sep 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant