Repository navigation
feat(executioncontroller): add the authorizing Files and Commands proxy - #2899
Merged
Merged
Conversation
blkt
force-pushed
the
feat/2701-authorizing-proxy-c1
branch
from
November 20, 2026 09:47
b8fd414 to
8fd56cc
Compare
blkt
force-pushed
the
feat/2701-authorizing-proxy-c1
branch
from
November 20, 2026 12:43
9350108 to
6829254
Compare
rdimitrov
approved these changes
Nov 20, 2026
rdimitrov
left a comment
Member
There was a problem hiding this comment.
Looks good. Every refusal tagged NOT_FORWARDED happens before the start message or first chunk reaches the executor. A failed NewStream can't have started a command, and errors after Send correctly stay untagged, so they're reported as unknown. Sharing validateRunClaim keeps the proxy and the exec path on the same checks, and dropping the reason from executor responses means only the proxy can claim it.
blkt
enabled auto-merge (squash)
November 20, 2026 13:22
`FileProxy` and `CommandProxy` implement the executor `FileService` and `CommandService` on the provider. Each call authenticates the client through the `Handler`'s security policy, requires a complete `RequestContext`, and asks `Store.ExecutorRoute` to validate the run claim, epoch, grant generation, binding and current client policy with the same checks as `ValidateRunClaim`. The route also refuses a service the session was not admitted for, and returns the executor pin and the template's limits. Nothing is forwarded until it passes. The proxy relays file chunks without assembling them and fails a read or write that exceeds `MaxFileBytes`. `RunCommand` bounds the command length and timeout by the template, forwards cancels, and clips stdout and stderr at `MaxCommandBytes` as they stream, setting `output_truncated` on the result. `ExecutorDialer.Connector` dials the executor for each call and re-resolves the pinned Pod name and UID on every connection, so a replacement Pod at the same address is refused before the handshake and the certificate pin still applies. `RPCLimiter.StreamInterceptor` holds the per-client and global capacity for a stream's lifetime, and the provider now chains it next to the unary interceptor. The provider does not register the proxy services yet; that happens with the transport switch. `fileconformance.Target` gains an optional request context so the suite runs through the proxy. Every refusal the proxy makes before forwarding carries the new `ERROR_REASON_NOT_FORWARDED` executor detail, and `executorclient` reports such a command as not started rather than outcome unknown. The proxy drops that reason from executor responses, so only the proxy can claim it. The reason is additive: older clients keep treating it as unknown. `commandconformance.Harness` gains an optional request context, and both conformance suites run through the proxy over `memexecutor`. Closes: #2701
Wrapped calls in the proxy tests put each argument on its own line, and no `if` statement wraps around an init.
A refused connection surfaces when the proxy creates the upstream `RunCommand` stream, before the start message is sent, so the executor cannot have started the command. Tag that error with `ERROR_REASON_NOT_FORWARDED` so `executorclient` reports the command as not started instead of outcome unknown. Errors from sending the start onwards stay untagged.
…nce suites `commandconformance.Harness.Context` takes an `executorclient.RequestContextFunc`, like `fileconformance.Target`, so both proxy conformance tests pass the same function.
The proxy takes an `ExecutorConnectFunc` instead of the `ExecutorConnector` interface, and drops its unused context. `ExecutorDialer.Connect` implements it on `executionenv.ExecutorServerPort`, replacing the `Connector(port)` wrapper. `Dial` and `Connect` share one resolve-and-dial step.
blkt
force-pushed
the
feat/2701-authorizing-proxy-c1
branch
from
November 20, 2026 13:25
6829254 to
2cc8aa7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the authorizing proxy for the executor
FileServiceandCommandServicetomecatl-execution-provider:FileProxyandCommandProxyininternal/adapter/executioncontrollerauthorize each call with today's checks and forward it to the session's executor.Handler's security policy, requires a completeRequestContextandMayAttestOwner, and asksStore.ExecutorRouteto validate the run claim, epoch, grant generation, binding and current client policy.ValidateRunClaimis split so both paths share those checks from one read of the environment. The same read refuses a lifecycle operation in progress and a service the session was not admitted for (PermissionDenied), and returns the executor pin and the template's limits. Nothing is forwarded until all of it passes.ERROR_REASON_NOT_FORWARDED, andexecutorclientreports such a command as not started instead ofErrOutcomeUnknown. The proxy drops that reason from executor responses, so only the proxy can claim it.MaxFileBytesfails withLIMIT_EXCEEDED; a refused write cancels upstream, so nothing is stored.RunCommandbounds the command length byMaxCommandBytesand the timeout byMaxCommandDuration, forwards cancels, and clips stdout and stderr atMaxCommandBytesas they stream, settingoutput_truncatedon the result.RPCLimiter.StreamInterceptorholds the per-client and global capacity for a stream's lifetime, and the provider now chains it next to the unary interceptor, soRunCommandcounts.ExecutorDialer.Connectordials per call and re-resolves the pinned Pod name and UID on every connection, so a replacement Pod at the same address is refused before the handshake, and the certificate pin still applies.fileconformance.Targetandcommandconformance.Harnessgain an optional request context, and both suites run through the proxy overmemexecutorand the Files gRPC server #2694fileserver.Issue relationship
Closes #2701
The provider does not register the proxy services yet: executor Pods have no server port until the transport switch (#2718), which also carries the demo criterion. No unary buffering is added for mecak8s (optional in the issue);
StartCommandstill uses Pod exec. Withdrawal of in-flight calls and fencing on unknown command outcomes land after the switch, perimplementation.md. The proxy passes theRequestContextto the executor unchanged, asexecutor-protocol.mddescribes.Type of change
Test plan
Baseline checks
task lint,task lint:protoagainstmain)task test:race)go run ./cmd/mecademo): tool call, permission ask and approval, result. The demo does not go through the proxy yet.task check:pr,task generate:data:checkgo vetuntagged and with all custom tags on Linux and darwin (darwin with thee2etag fails onmaintoo, ine2e/harness/local.go)Focused tests:
TestProxyRefusesBeforeForwarding: stale epoch, stale and revoked grant generation, lapsed claim, files or commands not admitted, missing request context, request context without claim or owner, and a replaced executor Pod. Each case checks the gRPC code, theNOT_FORWARDEDdetail, and that nothing was forwarded.TestFileProxyConformanceandTestCommandProxyConformancerun the conformance suites through the proxy.TestCommandProxyClipsOutputMidStream,TestCommandProxyBoundsTheStart,TestFileProxyEnforcesTheTemplateFileLimit,TestRunCommandHoldsPerClientCapacity,TestExecutorConnectorFollowsThePinnedPod,TestExecutorErrorDropsNotForwarded.TestCommandProxyTagsAnUnreachableExecutor: a refused connection to the executor fails when the upstream stream is created, before the start is sent; it is taggedNOT_FORWARDEDandexecutorclientreports the command as not started.TestFailureBeforeStartedIsUnknownUnlessRefusedgains theNOT_FORWARDEDcases; an untaggedPermissionDeniedbeforeStartedstays unknown.Changes
+1,448 −55 across 15 files.
proxy_files.go(+233),proxy.go(+226),proxy_commands.go(+166); the rest isstore_run.go(+42 −12),executor_dial.go(+38),security_limit.go(+32 −6).proxy_test.go(+634),executor_dial_test.go(+31 −20), the two conformance helpers (+19 −4).errors.pb.go(+18 −12) anderrors.proto(+2).Comment ratio on touched files: 0.17 in app code, 0.01 in tests.
internal/adapter/executioncontroller/proxy.go,proxy_files.go,proxy_commands.goFileProxy,CommandProxy,ExecutorRoute,ExecutorConnector,notForwardedinternal/adapter/executioncontroller/store_run.goValidateRunClaimsplit intovalidateRunClaim, which returns the environment it readinternal/adapter/executioncontroller/executor_dial.goExecutorDialer.Connectorinternal/adapter/executioncontroller/security_limit.goRPCLimiter.StreamInterceptorcmd/mecatl-execution-provider/main.gocontracts/proto/mecatl/executor/v1/errors.protoERROR_REASON_NOT_FORWARDEDinternal/executorrpc/executorclient/runner.goNOT_FORWARDEDbeforeStartedas not startedinternal/executorrpc/fileconformance,commandconformanceUser-facing change
None. The proxy services are not registered yet.
API compatibility
ErrorReasongainsERROR_REASON_NOT_FORWARDED = 10. Nothing outside this repo consumesmecatl.executor.v1yet. A client that does not know the value reads it as an unrecognized reason and keeps today's behavior: outcome unknown for commands, a plain error for files. Existing executors never send it. The provider'sExecutionProviderServiceis unchanged, and the new stream interceptor affects nothing until streaming services are registered.fileconformance.Targetandcommandconformance.Harnessgain optional fields; existing callers are unaffected.