Skip to content

[M3.4c4b] Planner steps as agent actions, with agent compatibility vectors - #166

Merged
samuelmbabhazi merged 3 commits into
mainfrom
feat/m3.4c4b-agent-steps
Nov 5, 2026
Merged

samuelmbabhazi merged 3 commits into
mainfrom
feat/m3.4c4b-agent-steps

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

What changed

M3.4c4b: planner steps become typed agent actions, and the agent checks that it accepts them.

  • agentAction(step, secrets) (deployments/infrastructure/agent-steps.ts) maps each pipeline step to its proto action: EnsureNetwork, PullImage, RunReleaseTask, CreateContainer, StartContainer, HealthCheck, UpsertRoute (container upstreams, ADR 0017, automatic HTTPS), RemoveRoute and StopContainer, with durations converted exactly.
    • Container specs: name, pinned image, argv, env, an exposed TCP port (never published on the host), CPU and memory, labels, network, and restart policy (always, or never for release tasks).
    • Secrets: the decrypted values are injected here, at enqueue time, as SecretEnv{name, version, value}. An unset secret is refused with 409 secrets_missing. They travel only inside the action payload, which the queue encrypts per organization ([M1.4a2] Durable agent action queue with at-least-once delivery #148), over mTLS.
  • Compatibility vectors. agent-steps.vectors.spec-helpers.ts runs the planner over a full deployment: release task, health check, domains, and a previous release on another node. A vitest file snapshot writes every action it sends to agent/internal/actions/testdata/control-plane-actions.txt.
    • The new Go test TestControlPlaneActionsPassAgentValidation decodes each vector and plans it with the agent's own handlers. All 9 action kinds pass, so the planner and the agent validators cannot drift apart silently.
  • Docs. SPEC section on the planner; PLAN: c4b is done.

How it was tested

  • agent-steps.spec.ts:
    • the container spec, including secrets as bytes with their version;
    • refusal of an unset secret;
    • every other step, after a wire round trip;
    • durations (120.5 s), the release task spec and the health probe;
    • container upstreams;
    • the vector snapshot.
  • Go: the compatibility test, go test -race and golangci-lint.
  • API tests: 274 pass. The local gate passes.

Security considerations

  • Secret values appear only in the encrypted queue payload and on the mTLS stream: not in logs, audit, the planner or the vectors, which use a fixture value.
  • The agent still validates everything. The vectors only prove that what we send is accepted.

agentAction maps each pipeline step to its typed proto action. Container
specs carry env, exposed port, resources, labels, network and restart
policy, and secret values are injected here, at enqueue time, refusing
any unset secret.

Signed-off-by: Samuel Mbabhazi <[email protected]>
Golden vectors written by the API tests hold every action a full
deployment sends; the agent plans each with its own handlers, so the
planner and the agent validators cannot drift apart.

Signed-off-by: Samuel Mbabhazi <[email protected]>
@samuelmbabhazi
samuelmbabhazi merged commit 80788c5 into main Nov 5, 2026
1 of 10 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m3.4c4b-agent-steps branch November 5, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant