Repository navigation
[M1.2c3] Maintain authenticated agent streams and enforce revocation - #34
Merged
Merged
Conversation
3 of 4 tasks
samuelmbabhazi
force-pushed
the
feat/m1.2c2-agent-enrollment
branch
from
November 5, 2026 13:37
d5bce5e to
f342eb2
Compare
samuelmbabhazi
force-pushed
the
feat/m1.2c3-gateway-stream
branch
from
November 5, 2026 13:37
4d2ceb8 to
02ea7c9
Compare
samuelmbabhazi
force-pushed
the
feat/m1.2c2-agent-enrollment
branch
from
November 5, 2026 14:27
f342eb2 to
ac31d21
Compare
samuelmbabhazi
changed the base branch from
feat/m1.2c2-agent-enrollment
to
main
November 5, 2026 14:28
samuelmbabhazi
force-pushed
the
feat/m1.2c3-gateway-stream
branch
from
November 5, 2026 14:29
02ea7c9 to
8257f06
Compare
samuelmbabhazi
added a commit
that referenced
this pull request
Nov 5, 2026
Implements the connection runner portion of M1.2c4, split from daemon wiring and the cross-language integration test to keep review focused. Depends on #34 and targets its branch. The runner sends Hello, validates the returned node/epoch and heartbeat interval, and owns the receive goroutine through cancellation. Control-plane interruptions reconnect with bounded exponential backoff and jitter. Certificates rotate at two thirds of validity and are persisted atomically before reconnecting. Explicit authentication/epoch rejection and renewal persistence failure halt connection attempts without silently re-enrolling. Dead connections use TLS/gRPC keepalive; remote error text is excluded from logs. Validation: Go race tests over real TLS/gRPC cover reconnect, heartbeats, renewal persistence, authentication error propagation, shutdown and backoff bounds; golangci-lint passes. Existing TypeScript and protobuf checks are unchanged. This runner dispatches no actions and grants no leases; unsupported frames fail explicitly pending their planned handlers. - [x] M1.2c4a behavior and tests - [x] No new dependency, shell invocation or secret exposure - [x] Plan, specification and threat model updated - [ ] CI and maintainer review Daemon integration and the NestJS-to-Go restart/revocation test remain M1.2c4b. No merge requested.
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.
Implements M1.2c3: authenticated agents can keep a bidirectional Connect stream open. Depends on #33 and targets its branch.
The first frame must identify the authenticated node and current epoch. The gateway replies with Welcome and a five-second heartbeat interval. Duplicate streams replace the previous connection; idle peers time out after 15 seconds. Certificate registration, revocation, expiry and node removal are checked at every frame and once per second during silence. Database failures close the stream with sanitized errors. Stream deadlines are separate from unary deadlines; message sizes remain bounded to 64 KiB.
Validation: TypeScript lint/typecheck and unit tests; 22 PostgreSQL/TLS integration tests, including forged identities, stale epochs, live revocation without another request and duplicate connections. Fake-timer tests cover idle expiry and timer cleanup. An asynchronous socket-rejection regression found during testing was fixed by observing pending reads immediately.
Scope: this is transport only. Durable leases, action dispatch and state reports remain in their planned milestones. No lease is granted by Welcome yet; unsupported frames fail explicitly. ExecStream remains authenticated and Unimplemented until session authorization exists. No persistent state changes or unaudited database writes are introduced.
The Go daemon's connection loop and real cross-language restart test follow in M1.2c4. No merge requested.