Skip to content

feat(executor): enable each executor service by its own flag - #2859

Merged
blkt merged 1 commit into
mainfrom
feat/2696-service-flags
Nov 18, 2026
Merged

blkt merged 1 commit into
mainfrom
feat/2696-service-flags

Conversation

@blkt

@blkt blkt commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Summary

mecatl-executor serve registers only the services enabled by -files and -commands, both off by default, and refuses to start when neither is set. Without -commands the server skips EnableCommandExecution, the command supervisor, and the orphan reaper, so a file-only executor has no code path that starts a process, as the executor protocol design requires.

Issue relationship

Closes #2696

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe):

Test plan

Baseline checks

  • Linting (task lint)
  • Fast offline test suite (task test), covered by task test:race
  • Pre-review race suite (task test:race)
  • Offline demo (go run ./cmd/mecademo): tool call, permission ask and approval, result
  • Markdown changed: docs generation/link checks (task docs), no Markdown changed
  • User docs/user-facing behavior changed: site build (task site:build), not applicable
  • Guarded engine API affected: compatibility check (task api:check), nothing under engine/ changed
  • Intentional engine API change: task api:update + engine/CHANGELOG.md, not applicable

task check:pr also passes. The new tests pass on darwin with -race and on Linux (golang:1.27.3, uid 1000).

  • TestServeRejectsNoEnabledService: serve -listen X with no service flag is a startup error. The check runs before the Linux check, so it runs on every OS.
  • TestServeWithoutCommandsLeavesCommandServiceUnimplemented: a files-only newExecutorServer over bufconn serves StatFile and answers RunCommand with Unimplemented. Forcing the Commands branch on makes it fail on both darwin and Linux.

Changes

File Change
cmd/mecatl-executor/serve.go -files and -commands flags, no-service error, newExecutorServer registers only enabled services, Commands setup moved into newCommandServer
cmd/mecatl-executor/serve_test.go Tests above; the -max-file-bytes test now passes -files
cmd/mecatl-executor/main.go Package doc names the flags

User-facing change

None. Nothing in the repo runs mecatl-executor serve yet; the Pod-exec mode the controller uses is unchanged.

Special notes for reviewers

  • Both flags default to off, so whoever wires serve into the Pod spec (Switch file and command operations to the executor server #2718) must pass the admitted services explicitly.
  • There is no Commands-only test: building the Commands service needs Linux and sets the process subreaper, so it is not exercised in the unit tests.
  • -max-file-bytes is still validated when Files is disabled.

`mecatl-executor serve` now registers only the services named by
`-files` and `-commands`, both off by default, and refuses to start
when neither is set. With `-commands` unset the server skips
`EnableCommandExecution`, the command supervisor, and the orphan
reaper, so a file-only executor has no code path that starts a
process and a `CommandService` call returns `Unimplemented`.

Server construction moves into `newExecutorServer` so the file-only
shape is tested over bufconn on every OS.
@blkt blkt self-assigned this Nov 18, 2026
@blkt
blkt enabled auto-merge (squash) November 18, 2026 11:19

@rdimitrov rdimitrov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. With -commands off, EnableCommandExecution, the supervisor and the orphan reaper are all skipped, so a files-only executor really has no path that starts a process. Defaulting both flags to off and refusing to start with neither enabled is the right fail-closed choice, and nothing in the repo runs serve yet. The Unimplemented test pins the important property.

@blkt
blkt merged commit 2c0ecb3 into main Nov 18, 2026
47 checks passed
@blkt
blkt deleted the feat/2696-service-flags branch November 18, 2026 11:38
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Nov 18, 2026
2 tasks
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.

Per-service enable flags

2 participants