Skip to content

feat(minimald): rip out arbitrary session exec - #709

Merged
twitchyliquid64 merged 1 commit into
mainfrom
tom/release2
Jul 10, 2026
Merged

feat(minimald): rip out arbitrary session exec#709
twitchyliquid64 merged 1 commit into
mainfrom
tom/release2

Conversation

@twitchyliquid64

@twitchyliquid64 twitchyliquid64 commented Jul 10, 2026

Copy link
Copy Markdown
Member
  • New, mostly-internal task type echo so we can tests tasks without needing the graph machinery
  • Rip out arbitrary exec of commands
  • Fix tests that were using that
  • Unit tests for task exec over minimald

Summary by CodeRabbit

  • New Features
    • Added task-based echo actions with argument interpolation and newline-terminated stdout.
    • Echo tasks execute as synthetic in-process outputs, skipping package graph/sandbox setup.
    • Public helper added to interpolate task action strings, reused across task invocation reporting.
  • Bug Fixes
    • Remote execution now only accepts min run <task> requests; other exec forms are rejected.
  • Tests
    • Added/updated unit and end-to-end coverage for echo parsing, execution, and request restrictions.
  • Documentation
    • Updated session E2E harness notes to reflect removal of arbitrary in-session command execution coverage.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cdf725e9-7896-418c-b3df-bd5fa0b1b5d9

📥 Commits

Reviewing files that changed from the base of the PR and between 1f51305 and 699f326.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • crates/mctx/src/env.rs
  • crates/mctx/src/lib.rs
  • crates/mfile/src/tasks.rs
  • crates/minimald/src/exec.rs
  • crates/minvmd/Cargo.toml
  • crates/minvmd/tests/minimald_session_e2e.rs
  • scripts/session-e2e.sh
✅ Files skipped from review due to trivial changes (1)
  • crates/minvmd/Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (5)
  • crates/mctx/src/lib.rs
  • crates/mctx/src/env.rs
  • crates/mfile/src/tasks.rs
  • crates/minvmd/tests/minimald_session_e2e.rs
  • crates/minimald/src/exec.rs

📝 Walkthrough

Walkthrough

Adds an echo task action with shared interpolation, executes echo tasks without sandbox creation, restricts SSH exec routing to min run <task>, and updates session end-to-end tests to upload and execute task definitions.

Changes

Echo task execution

Layer / File(s) Summary
Task contract and interpolation
crates/mfile/src/tasks.rs, crates/mctx/src/env.rs, crates/mctx/src/lib.rs
Adds TaskAction::Echo, interpolation support, echo detection, and the public interpolate_task_strings helper.
Minimald echo process path
crates/minimald/src/exec.rs
Routes min run tasks through TaskProcess, adds EchoProcess, and rejects non-task exec requests.
Session upload and end-to-end validation
crates/minvmd/Cargo.toml, crates/minvmd/tests/minimald_session_e2e.rs, scripts/session-e2e.sh, crates/minimald/src/exec.rs
Uploads task definitions over SFTP and validates echo output, exit status, command rejection, and updated shell-harness behavior.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SSHClient
  participant handle_exec
  participant TaskExec
  participant task_producer
  participant EchoProcess
  SSHClient->>handle_exec: request min run task
  handle_exec->>TaskExec: create task execution
  TaskExec->>task_producer: produce task process
  task_producer->>EchoProcess: interpolate echo task
  EchoProcess-->>TaskExec: stdout and exit status
  TaskExec-->>SSHClient: bridged execution result
Loading

Possibly related PRs

Suggested reviewers: evanspearman, norrietaylor

Poem

I’m a rabbit with an echo to send,
Through Nickel paths that neatly bend.
No sandbox cage, just bytes that flow,
A task says “hop!” and out they go.
SFTP brings the tune to town—
Zero exit, no errors down.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly captures the main change of removing arbitrary session exec from minimald.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/minimald/src/exec.rs`:
- Around line 810-817: Update the `argv.strip_prefix("min run ")` handling to
separate the task name from trailing arguments, using the first whitespace
delimiter so `task` contains only the name; alternatively, explicitly reject and
report extra arguments. Ensure lookup and subsequent execution use the parsed
task name, preserving the existing rejection path for malformed requests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e12b0310-dc10-41db-8e2e-b56fcbd3d341

📥 Commits

Reviewing files that changed from the base of the PR and between 20a9859 and 1f51305.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • crates/mctx/src/env.rs
  • crates/mctx/src/lib.rs
  • crates/mfile/src/tasks.rs
  • crates/minimald/src/exec.rs
  • crates/minvmd/Cargo.toml
  • crates/minvmd/tests/minimald_session_e2e.rs

Comment on lines +810 to +817
let task = match argv.strip_prefix("min run ") {
None => {
tracing::warn!(%session_id, "execution request rejected: expected `min run <task name>`");
session.channel_failure(id)?;
return Ok(());
}
Some(t) => t,
}.to_string();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map relevant files and inspect the specific areas mentioned in the review comment.
git ls-files crates/minimald/src/exec.rs crates/minimald/src | sed -n '1,120p'

echo '--- outline exec.rs ---'
ast-grep outline crates/minimald/src/exec.rs --view expanded || true

echo '--- relevant lines around handle_exec ---'
sed -n '780,860p' crates/minimald/src/exec.rs

echo '--- search for split_once(" ") / run handler ---'
rg -n 'split_once\(" "\)|min run|TaskExec|task\(' crates/minimald/src -g'*.rs' -A4 -B4

echo '--- relevant surrounding lines in any matching file(s) ---'
# If rg found a run handler elsewhere, inspect the surrounding lines in that file by name.
fd -a 'exec.rs|*.rs' crates/minimald/src | sed -n '1,120p'

Repository: gominimal/minimal

Length of output: 1994


Split task name from trailing args in min runstrip_prefix("min run ") currently treats the whole remainder as task, so min run mytask --flag looks up "mytask --flag" instead of "mytask". Split on the first space or reject extra args explicitly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/minimald/src/exec.rs` around lines 810 - 817, Update the
`argv.strip_prefix("min run ")` handling to separate the task name from trailing
arguments, using the first whitespace delimiter so `task` contains only the
name; alternatively, explicitly reject and report extra arguments. Ensure lookup
and subsequent execution use the parsed task name, preserving the existing
rejection path for malformed requests.

@twitchyliquid64
twitchyliquid64 merged commit 3324a84 into main Jul 10, 2026
20 checks passed
@twitchyliquid64
twitchyliquid64 deleted the tom/release2 branch July 10, 2026 19:08
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.

2 participants