Repository navigation
[M1.4a2] Durable agent action queue with at-least-once delivery - #148
Merged
Merged
Conversation
Signed-off-by: Samuel Mbabhazi <[email protected]>
Signed-off-by: Samuel Mbabhazi <[email protected]>
…tream Signed-off-by: Samuel Mbabhazi <[email protected]>
Signed-off-by: Samuel Mbabhazi <[email protected]>
Signed-off-by: Samuel Mbabhazi <[email protected]>
samuelmbabhazi
added a commit
that referenced
this pull request
Nov 5, 2026
…ctors (#166) ## 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 (#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. --------- Signed-off-by: Samuel Mbabhazi <[email protected]>
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.
Closes #134 (with #147).
What changed
M1.4a2: the control-plane side of action dispatch.
agent_actionstable.assertTenantDatabaseRolenow covers 11 tables.EnvelopeService: scopeorganization:<id>, purpose bound to the action id.AgentActionsservice:enqueuevalidates the kind against the proto catalog, the key grammar and a deadline within 24 h, and requires a node that has not been removed. It stamps the node's lease epoch, is idempotent per key (including a concurrent insert) and auditsfleet.action.queued.deliverablefirst expires overdue actions (audited asfleet.action.expired), then returns the node's unfinished actions not yet sent on this stream asActionRequests.recordapplies an agentActionUpdateonly to that node's own non-terminal action. Terminal states never change again, and each terminal state is audited asfleet.action.<state>with the node as actor. The step and error are bounded, and the result is stored as JSON.NodeStream. After Hello, each poll (at most every second) sends unfinished actions once per stream, and the stream acceptsactionUpdateframes. A new stream redelivers everything unfinished; the agent journal ([M1.4a1] Agent action dispatch with journaled, validated execution #147) replays known keys.How it was tested
gateway.integration.spec.ts:succeeded;Security considerations