WIP: feat/agent-desired-state #260

Draft
johnride wants to merge 2 commits from feat/agent-desired-state into master

2 Commits

Author SHA1 Message Date
51b39505bb docs(adr): reframe desired-state ADR as proposal and explore alternatives
Some checks failed
Run Check Script / check (pull_request) Failing after 37s
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.
2026-04-10 07:13:38 -04:00
9cd1713788 feat(agent): desired-state convergence happy path
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).
2026-04-10 07:08:53 -04:00