Skip to content

feat(contracts): define the executor Files and Commands services - #2764

Merged
blkt merged 2 commits into
mainfrom
feat/executor-services-2689
Nov 12, 2026
Merged

blkt merged 2 commits into
mainfrom
feat/executor-services-2689

Conversation

@blkt

@blkt blkt commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Adds the mecatl.executor.v1 package with FileService and CommandService, the shared contract that the in-memory implementation (#2691), the executor servers (#2694, #2695), the provider proxy (#2701) and the mecak8s client (#2710) build against.

What changes

  • contracts/proto/mecatl/executor/v1/{files,commands,errors,context}.proto, generated into contracts/gen/go/mecatl/executor/v1 (executorv1) by task generate. The generated code imports only protobuf and gRPC, so Move the contract and adapters into standalone modules #2716 is a move plus a go.mod.
  • FileService has one RPC per Workspace and WorkspaceNamespace operation, plus ResolveAuthorityPath for AuthorityResourceResolver. ReadFile covers both Read and ReadVersion.
  • Versions travel as a FileVersion message, so an absent version, which never matches, is distinct from a valid empty token. CreateFile is create-only; rename and copy refuse an existing destination.
  • CommandService.RunCommand is a bidirectional stream: the caller sends start and an optional in-band cancel; the server sends started, ordered stdout and stderr chunks, and one terminal result (succeeded, failed, cancelled, timed out, or outcome unknown). Cancelling in-band rather than closing the call lets the caller still receive the result needed for fencing. A failure before started ran nothing; a failure after it without a result has an unknown outcome.
  • Failures carry an ErrorDetail reason beside the canonical status code, since one code can mean two things (for example FAILED_PRECONDITION for directory-not-empty and version mismatch).
  • Every request carries a RequestContext, a wire-identical copy of the execution/v1 message, so the package imports no other mecatl package. The trusted service authorizes each call with it; executors ignore it.
  • task lint:proto runs buf lint and, once the base ref has the package, buf breaking on contracts/proto/mecatl/executor only; CI runs it in the sdk-integration job. The rest of the tree has existing STANDARD lint violations, so the gate is scoped. Because it does not cover execution/v1, Switch file and command operations to the executor server #2718's removal of the old RPCs needs no exemption.
  • ExecutionProviderService, its messages and engine/ are unchanged. StartCommand keeps working until Switch file and command operations to the executor server #2718 switches mecak8s to CommandService.

API compatibility

Closes #2689

@blkt
blkt force-pushed the feat/executor-services-2689 branch 2 times, most recently from 92e1a87 to a0587fe Compare November 11, 2026 15:58
@blkt
blkt marked this pull request as ready for review November 11, 2026 16:03
@blkt

blkt commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Please note that 3554 lines in this PR are generated, and the real change amounts to 333.

@blkt blkt self-assigned this Nov 11, 2026

@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. The protos line up with the Workspace/WorkspaceNamespace ports: absent vs empty FileVersion, create-only CreateFile, rename/copy refusing an existing destination. RequestContext is wire-identical to execution/v1, and the RunCommand lifecycle is clear. The scoped buf breaking guard is safe on main and in shallow clones.

The last CI run was cancelled, so it needs a re-run before merge.

Worth settling before the dependent PRs build on this (non-blocking here):

  • Unary whole-file transfer. ReadFile/CreateFile/ReplaceFile can carry up to 5 MiB, above gRPC's 4 MiB default. Either document the raised limit as a requirement for both ends, or move to chunked streaming now, before #2691/#2694/#2695/#2701/#2710 depend on the unary shape.
  • No terminal_receipt equivalent. The provider store uses CommandStatusResponse.terminal_receipt to treat a durable command as finished. A received result event can stand in for it, but #2718 should do that deliberately. A line in the protocol draft would help.

Add the mecatl.executor.v1 package, generated into
contracts/gen/go/mecatl/executor/v1 with only protobuf and gRPC imports so
it can become a standalone module by a move plus a go.mod.

FileService has one RPC per Workspace and WorkspaceNamespace operation,
plus ResolveAuthorityPath. Versions travel as a FileVersion message so an
absent version, which never matches, is distinct from a valid empty token.
CommandService.RunCommand is a bidirectional stream: start and an optional
in-band cancel go in; started, stdout, stderr, and one terminal result come
out. The result can be succeeded, failed, cancelled, timed out, or outcome
unknown. Every request carries a RequestContext, a wire-identical copy of
the execution/v1 message so the package stays standalone; executors ignore
it.
Failures carry an ErrorDetail reason beside the canonical status code.

Add task lint:proto (buf lint, and buf breaking once the base ref has the
package) and run it in CI.

Closes #2689
@blkt
blkt force-pushed the feat/executor-services-2689 branch from a0587fe to 1b71c82 Compare November 12, 2026 11:26
A result whose outcome is known replaces Pod exec's terminal_receipt, so the trusted service treats it as the end of the command.
@blkt
blkt merged commit 020b3a3 into main Nov 12, 2026
56 of 58 checks passed
@blkt
blkt deleted the feat/executor-services-2689 branch November 12, 2026 13:18
@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.

Define the Files and Commands gRPC services

2 participants