fix(archied): re-apply database-owned settings on SIGHUP reload
The reload callback re-resolved the file document and republished it as the running config. Every setting the control plane owns lives only in the database, so a reload reverted providers, model roles, repository policies, channel settings, scheduling policy, tool and plugin settings, container policies and workflow execution budgets to their file values until the process restarted, and logged "config reloaded" while doing it. Boot's layering is now one call, boot.runtimeConfig, and the reload makes the same call over the document it just resolved. Execution budgets arrive on a watch rather than in a resource query, so boot records the last settings it applied and the reload re-applies them from there. apply gains an error return, which the controller records exactly like a bad file: a control plane that cannot answer fails the reload and leaves the running config alone, because it already holds the values the file does not. The query is bounded at 10s so a State Store that stops answering surfaces as a failed reload rather than a SIGHUP that never returns. The callback also read the old config from b.d.Cfg, the same Holder as b.cfgHolder; reading it from the Holder boot owns drops the daemon from this path and makes it testable. Closes archie-core-ju85.
This commit is contained in:
7 files changed
+297
-63
No files matched your search
@@ -244,7 +244,7 @@ The application currently changes behavioural values through unrelated paths:
|
||||
| Active provider selection | `chatModelManager.SetActiveProvider` changes provider selection. | A conversation/session command changing runtime state, with the same distinction from provider-instance configuration. |
|
||||
| Persona selection | `PersonaRegistry.SetActive` mutates an in-memory per-session choice. | Agent-system session state. Persistence and audit requirements are owned by that domain, not the configuration loader. |
|
||||
| File and environment overlays | Applied while loading `internal/config`; defaults are filled by mutation in `finalize`. | Configuration-infrastructure input processing that produces separately typed candidates. Defaults and derivations remain visible in provenance. |
|
||||
| SIGHUP config reload (2026-08) | Re-resolves the file config, validates, then atomically republishes through `config.Holder`. A failed reload keeps the running config and records `last_error`/`last_error_at` in `/api/config`. It does not re-read the control plane, so database-owned settings revert to their file values until restart (`archie-core-ju85`). | Candidate promotion with last-known-good retention: the running snapshot is untouched on failure. Reload must re-apply the database layer. A bounded observation period and actor audit are not yet implemented. |
|
||||
| SIGHUP config reload (2026-08) | Re-resolves the file config, re-applies the database layer over it, validates, then atomically republishes through `config.Holder`. A failed reload, whether the file or the control plane caused it, keeps the running config and records `last_error`/`last_error_at` in `/api/config`. | Candidate promotion with last-known-good retention: the running snapshot is untouched on failure. A bounded observation period and actor audit are not yet implemented. |
|
||||
| Control-plane resource command (2026-09) | `ControlPlaneService.Command` validates a whole resource document against its owning feature, then writes it with an audit record (actor, source, request ID, expected version) under optimistic concurrency. Hosted on the State Store's gRPC server; the Web UI and messaging channels are its only clients. See `docs/prds/runtime-control-plane.md`. | Met for validate-stage-promote, actor audit and versioned history. Per-field health observation and validate-before-switch on live apply are not yet implemented. |
|
||||
|
||||
Any further mutation seam discovered during migration MUST be added here before
|
||||
@@ -307,11 +307,13 @@ deliberately. A reload that changes any non-allowlisted field logs
|
||||
|
||||
### SIGHUP reload
|
||||
|
||||
SIGHUP re-resolves the file config, validates, and atomically republishes
|
||||
through the shared Holder. A failed reload keeps the running config and records
|
||||
`last_error`/`last_error_at` in `/api/config` so the stale state is visible
|
||||
where the operator is looking. The three poll tickers re-read `PollInterval` per iteration and reset on change,
|
||||
so a reloaded interval genuinely takes effect.
|
||||
SIGHUP re-resolves the file config, re-applies the database layer over it
|
||||
(`boot.runtimeConfig`, the same call boot makes), validates, and atomically
|
||||
republishes through the shared Holder. A failed reload keeps the running config
|
||||
and records `last_error`/`last_error_at` in `/api/config` so the stale state is
|
||||
visible where the operator is looking. The three poll tickers re-read
|
||||
`PollInterval` per iteration and reset on change, so a reloaded interval
|
||||
genuinely takes effect.
|
||||
|
||||
### Settings writes go through the control plane
|
||||
|
||||
@@ -327,9 +329,13 @@ Two properties matter to anyone changing this area:
|
||||
layers database resources over it at boot (`boot.loadRuntimeConfig`). Values
|
||||
the daemon needs before it can reach the State Store — the database path,
|
||||
listen addresses, credentials — stay file-only by design.
|
||||
- **Reload does not re-read them.** SIGHUP republishes the file document alone,
|
||||
which reverts database-owned settings until restart. Tracked as
|
||||
`archie-core-ju85`; see the ledger above.
|
||||
- **Reload re-reads them.** SIGHUP resolves the file document and then runs the
|
||||
same `boot.runtimeConfig` layering boot does, so a reload cannot revert a
|
||||
database-owned setting to its file value. A control plane that cannot answer
|
||||
fails the reload rather than publishing the file's values over the running
|
||||
ones. Workflow execution budgets arrive on a watch rather than in a resource
|
||||
query, so boot records the last published settings and the reload re-applies
|
||||
them from there.
|
||||
|
||||
## Completion criteria
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ posture is the opposite: **the daemon fails closed.**
|
||||
| --- | --- | --- |
|
||||
| State Store unreachable | `boot.loadRuntimeConfig` returns the dial error and `archied` exits non-zero | stderr: `runtime settings unavailable` |
|
||||
| A stored resource fails validation | Same: `validate database settings` wraps the error and the daemon exits | Same |
|
||||
| SIGHUP reload with a bad file | Running config is kept; the reload records `last_error` / `last_error_at` | `/api/config` → `reload.last_error` → dashboard banner |
|
||||
| SIGHUP reload with a bad file, or a control plane that cannot be read | Running config is kept; the reload records `last_error` / `last_error_at`. The reload re-applies the database layer, so it never publishes file values over the running database-owned ones | `/api/config` → `reload.last_error` → dashboard banner |
|
||||
|
||||
Failing closed is deliberate for settings the database owns: falling back to the
|
||||
file values would restore the second source of truth the control plane exists to
|
||||
|
||||
Reference in new issue
Block a user