WIP: feat/agent-desired-state #260

Draft
johnride wants to merge 2 commits from feat/agent-desired-state into master
Owner
No description provided.
johnride added 2 commits 2026-04-10 15:21:16 +00:00
Adds a proof-of-concept desired-state convergence mechanism for
harmony_agent: the central platform writes a DesiredStateConfig
to NATS KV at desired-state.<agent-id>; the agent watches the key,
executes the command via sh -c, and writes the result to
actual-state.<agent-id>.

- New module: harmony_agent/src/desired_state.rs (~150 lines)
- New types: DeploymentConfig::DesiredState, DesiredStateConfig,
  ActualState, ExecutionStatus
- ADR: docs/adr/021-agent-desired-state-convergence.md

This is an initial happy path for review. The architecture
needs further evaluation against the mini-kubelet vision before
hardening (security, sandboxing, signing, resource limits).
docs(adr): reframe desired-state ADR as proposal and explore alternatives
Some checks failed
Run Check Script / check (pull_request) Failing after 37s
51b39505bb
Re-frame ADR-021 from an accepted shell-executor decision into an
explicit problem statement plus one candidate proposal (Alternative A),
with an Open Questions section capturing the concerns raised during
review: wrong abstraction level, no idempotency, no resource model, no
typed status, incoherence with the Score-Topology-Interpret pattern,
and weak security posture.

Add ADR-022 enumerating four alternatives:
- A: shell command executor (current scaffold)
- B: mini-kubelet with typed resource manifests and reconcilers
- C: embedded Score interpreter on the agent
- D: hybrid — typed manifests now, Scores later

Recommends Alternative D: ship typed AgentManifest/AgentStatus with a
small fixed reconciler set for the IoT MVP, keeping an explicit
migration seam to the Score-based end state once Scores become
uniformly wire-serializable.

Also documents what specifically is wrong with the happy-path shell
executor in harmony_agent/src/desired_state.rs and clarifies that the
NATS KV watch + typed CAS write skeleton is reusable, while the
execute_command shell-out should be gated behind an audited ShellJob
variant or deleted once real reconcilers land.
Some checks failed
Run Check Script / check (pull_request) Failing after 37s
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/agent-desired-state:feat/agent-desired-state
git checkout feat/agent-desired-state
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NationTech/harmony#260
No description provided.