Route Hub agent exec through the runtime dispatcher#120
Route Hub agent exec through the runtime dispatcher#120mfreeman451 wants to merge 6 commits intoGoogleCloudPlatform:mainfrom
Conversation
2a58dd4 to
0460670
Compare
PR #120 Review: Route Hub agent exec through the runtime dispatcherExecutive SummaryThis PR wires the existing runtime broker Critical Issues1. Timeout parameter accepted but never propagated to the runtime brokerSeverity: Medium The Hub handler accepts // runtimebroker/handlers.go:1286
output, err := rt.Exec(ctx, id, req.Command) // no timeout passedThe timeout is serialized on the wire but has no effect. A caller specifying Impact: Commands that hang will block until the HTTP client times out, not the requested duration. This is a silent contract violation. Suggested Fix: This is pre-existing in the runtime broker and not introduced by this PR, but the PR is now exposing this path to Hub clients. Consider documenting this limitation or, ideally, wiring a 2. Hardcoded
|
|
I was actually hitting this the other day as well - may patch this up to get merged |
- Propagate exit code from runtime broker response through the full
dispatch chain instead of hardcoding 0 in the hub handler.
- Wire context.WithTimeout in the broker's execCommand handler so the
timeout parameter is actually enforced.
- Use requireRuntimeBrokerAssigned helper for consistency.
- Add validation for negative timeout values.
- Use typed struct for exec JSON response instead of map[string]interface{}.
- Fix trailing newline in agent_actions.go.
|
rebased commits locally and pushed |
Summary
/api/v1/agents/{id}/execworksValidation
go test ./pkg/hub -run '^TestHandleAgentExec_DispatchesToRuntimeBroker$|^TestHTTPAgentDispatcher_DispatchAgentMessage$|^TestHTTPAgentDispatcher_DispatchAgentStart_WithGroveProviderPath$|^TestHTTPAgentDispatcher_DispatchAgentMessage_UsesSlugNotName$'Context
This fixes the Hub-side 404 seen from
scion lookagainst hosted agents: the client already called the Hub exec endpoint, but the server never handled theexecaction.