Skip to content

feat(assistant): several commands in one call - #3574

Merged
Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:feat/assistant-run-tool
Dec 2, 2026
Merged

Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:feat/assistant-run-tool

Conversation

@Mavrick-F

@Mavrick-F Mavrick-F commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Agents connected over MCP can run several commands in one call, as one undo step. The built-in assistant couldn't, so each command cost it a request and a step.

It is now offered the same run tool. Every line goes through the approval and refusal rules of run_command, checked before any line runs, and a script that needs approval waits whole. MCP's tool list is unchanged apart from its order.

A subagent given only some tools is now refused another one before its approval is asked for. It was refused before too, but only after the user had pressed Allow.

Reach: the built-in assistant on desktop, browser, phone and command line. No command or parameter changes.

Testing

  • The assistant crate's tests, with a new one: a script of edits runs as one undo step, one with a file read waits for approval with none of its lines run, and a subagent without the tool is refused it without asking.
  • An independent review before publishing looked for a way around approvals through run and found none.
  • Full CI on a fork at this commit.

UI evidence

No visible UI change.

Related issue

Part of #3568.

Summary by CodeRabbit

  • New Features
    • The AI Assistant can run multiple related commands together as one undoable step.
    • Commands that require approval wait for confirmation before running; declining prevents the script from executing.
  • Improvements
    • Restricted subagents cannot use tools outside their allowed set, including through multi-command scripts.
    • The MCP server no longer offers the run tool; snapshot remains available as its additional tool.
  • Documentation
    • Updated the assistant guide and MCP tool list to reflect these changes.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The assistant adds a run tool for multi-command scripts, checks subagent tool permissions before approval and execution, and updates MCP tool listings and assistant documentation.

Changes: Assistant run tool

Layer / File(s) Summary
Run tool and permission checks
crates/assistant/src/tools.rs, crates/assistant/src/agent.rs, crates/assistant/src/tests.rs
The assistant defines run for multi-command scripts. The agent checks subagent allowlists before approval and execution. Tests cover one-step undo, declined approval, and a restricted subagent call.

MCP exposure and usage documentation

Layer / File(s) Summary
MCP tool listing and usage notes
crates/assistant/src/mcp.rs, docs/mcp.md, docs/user-guide/assistant.md
The MCP server no longer advertises or registers run; snapshot remains its additional tool. The docs describe the shared tool count and explain that one Ctrl+Z undoes multiple commands run in one step.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Possibly related issues

  • Issue 3568 asks for multiple commands per assistant call. This PR adds the run tool for multi-command scripts, but does not cover the issue’s other requests.

Suggested labels: enhancement

Suggested reviewers: elpidioassinaturas, giswqs

Merge Risk: Minimal · up to 7b521

This adds a run tool that executes several commands as one undo step and refuses disallowed subagent calls before approval. No concrete merge-blocking issue was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(assistant): several commands in one call" matches the main change: the assistant gains a run tool that executes multiple commands in one call as a single undo step. It is concise, sp…
Description check Passed The description follows the template's main sections: Summary, Testing, UI evidence, and Related issue. The Summary explains what changed and why, including the approval rules and the subagent refusal…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "feat(assistant): several commands in one call" matches the main change: the assistant gains a run tool that executes multiple commands in one call as a single undo step. It is concise, specific, and follows a conventional-commit style. The raw summary also covers related changes (subagent allowlist checks, MCP tool list adjustments, docs), but the title reflects the primary feature.

Full details: Description check

Explanation

The description follows the template's main sections: Summary, Testing, UI evidence, and Related issue. The Summary explains what changed and why, including the approval rules and the subagent refusal change. Testing lists the new assistant-crate test, an independent review, and full CI on a fork. UI evidence states 'No visible UI change.' as the template allows. The Related issue section references 'Part of #3568', which fits the template's format. The description is mostly complete. The template's HTML comments were removed, which is acceptable.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit taps a script to run,
Two commands hop as one.
A careful check guards each tool call,
One Ctrl+Z can undo them all.
The bunny bounds beneath the moon.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 86dbc611-8c68-452f-bc4e-66fc7ea61104
Commits

Reviewing files that changed from the base of the PR and between 8d415ca and 7b52124.

Files selected for processing: 6

  • crates/assistant/src/agent.rs
  • crates/assistant/src/mcp.rs
  • crates/assistant/src/tests.rs
  • crates/assistant/src/tools.rs
  • docs/mcp.md
  • docs/user-guide/assistant.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Code review

Reviewed the six changed files against pr-context/AGENTS.md. I did not run cargo test or the wasm build (no shell here), so the new tests and the browser build are unverified. Findings below come from reading the code paths.

Bugs

  • None found. I checked that refused subagent calls are now rejected before any approval prompt (agent.rs:945-949), and that the run script is planned line by line (policy/plan.rs:626). Scripts also refuse script.*, ui.* and notebook.* lines (parameters.rs:61), so run doesn't open a path the run_command guard blocks. Confidence: medium-high.

Security

  • Low confidence. tools::summary (tools.rs:252) puts the raw script text into the transcript, which the desktop and phone display. MCP's audit log redacts scripts with redact_script; the assistant transcript doesn't. Credentials typed into a script (for example a database password) would show up there. run_command params already behave this way, so this extends an existing pattern rather than adding a new one.

Performance

  • None significant. selects_layer re-parses the script, but parsing is capped by MAX_SCRIPT_LINES.

Quality

  • Phone plain-words gap (confidence high that it exists, medium that it matters). crates/ui-touch/src/assistant.rs:301 has no arm for run, so a run step falls through to the default and shows raw text such as run {"script":"layer.addSample…. The PR says the assistant reaches the phone, so this should get an arm such as "run" => tl_raw!("Ran several commands"). This file is outside the PR diff, so I could not anchor an inline comment on it.
  • The new system-prompt sentence (agent.rs:1412-1413) keys on one refusal wording. Other refusals the engine returns, such as "run it on its own" or "split the request", are not covered (confidence low).

AGENTS.md

  • No violations found. No command was added or renamed, so command-surface.txt is unaffected. The PR body covers the surface and undo reach, and the docs were updated. The MCP tool list keeps the same descriptions and annotations, and the docs/mcp.md count of twelve tools (eleven shared, plus snapshot) matches tools::defs().

Prior reviews: none on this PR, so I left no concerns alone.

Change size

Compared with the base branch: the whole PR against main (merge base 2e238c0 to PR head 7b52124).

Files changed Added Modified Removed Renamed Size before Size after Size change
6 0 6 0 0 594.8 KB 597.4 KB +2.6 KB
Path Size before Size after Size change
crates/assistant/src/tests.rs 324.1 KB 326.0 KB +1.9 KB
crates/assistant/src/mcp.rs 32.4 KB 31.3 KB -1.1 KB
crates/assistant/src/tools.rs 99.0 KB 100.1 KB +1.1 KB
crates/assistant/src/agent.rs 71.6 KB 72.3 KB +678 B
docs/user-guide/assistant.md 37.5 KB 37.5 KB +79 B
docs/mcp.md 30.2 KB 30.2 KB -17 B

@Mavrick-F
Mavrick-F added this pull request to the merge queue Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3574/
Web app https://preview.rustgis.app/pr-3574/app/
Commit 7b52124

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

Merged via the queue into opengeos:main with commit 40fb197 Dec 2, 2026
28 checks passed
@Mavrick-F
Mavrick-F deleted the feat/assistant-run-tool branch December 2, 2026 00:45
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