Commit Graph
1404 Commits
Author SHA1 Message Date
sam b5b58c370a fix(statestore): read a kind the store does not hold as its seed, and stop validate touching the daemon's log
Four defects from the re-run contract review, all in the recovery path.

A store missing a control-plane kind was refused while a store with no
resources table at all was accepted -- two stances inside validateStore for
states the daemon cannot tell apart. The State Store seeds every kind from
its own config before it serves (RunStateStore -> ImportConfig), so a kind
the file does not hold yet is one archied reads the seed for: an upgrade that
adds a kind, and a validate before the State Store has started again, exited
1 with "read provider-settings: resource not found" for a store the daemon
boots on fine. StoredRuntimeConfig now reads a missing kind as the seed the
State Store would write for it (Definition.seededValue, shared with
ImportConfig so the two cannot drift), and the missing-table branch is the
same stance taken to its extreme.

defaultConfigPath() derived the daemon's config with os.UserConfigDir, which
disagrees with archied's configHome on darwin and rejects a relative
XDG_CONFIG_HOME outright -- leaving validate with an empty path and no
verdict, on a host where archied boots from relative-dir/archie/config.toml.
It is now the daemon's own rule, exported as archied.DefaultConfigPath and
used by the daemon's own -config default too, with a test pinning the
equality.

-h exited 2, the code documented as "the command line was wrong", while the
serve path in the same binary exits 0 and main.go advertises -h for these
subcommands. ErrHelp now returns 0.

validate resolved the boot config through loadConfig -> setupLogging, which
created cfg.Log.File's directory, opened the log, and wrote a line stamped
component="daemon" -- a diagnostic editing the deployment it inspects, and
rotating a log the daemon is writing. boot.stderrLog keeps setupLogging on
the stderr logger for the recovery path: no feed, no task-log registry, no
durable copy.

Tests: TestRecoveryValidateRunsTheGateBootRuns now asserts the unseeded and
the missing-kind stores are accepted (both exited 1 before), while the
bogus-policy case still refuses; TestRecoveryHelpExitsZero,
TestRecoveryValidateLeavesTheDaemonLogAlone and
TestRecoveryDefaultConfigFollowsTheDaemonsConfigHome are new. Each was run
red first, and the seed fallback and stderrLog were mutation-checked.
2026-09-21 22:04:42 +10:00
sam 8d015db7c1 fix(statestore): make validate run boot's gate, and stop backup replacing the database
Two P1 findings from review, both about a claim outrunning the code.

validate answered a different question from boot's. Boot refuses on
configuration.Validate over the file config with every stored resource
layered onto it (internal/app/archied/control_plane.go:27), which is a
stricter check than the write path's per-resource Decode: validateScheduling
never inspects dispatch.trigger and explicitly permits "0s", while boot
rejects an unknown trigger and a non-positive poll interval. A store holding
such a value printed "is a valid store ... N stored resources validate" and
exited 0 while archied exited 1 on it -- a false green pushing an operator
toward the blunt restore instead of the surgical rollback.

validate now runs both layers and reports both, in boot's order:
store.ValidateFile, then the write path's ValidateStored, then the config
gate. The layering itself is now one implementation: controlplane's
runtimeConfigFrom takes a resourceReader, which the gRPC client and a new
Server.StoredRuntimeConfig (reading its own store) both provide, so the
offline check cannot drift from the daemon's. validate takes -config /
-config-overlay (default: the path the serve subcommand uses), because the
question is about the stored values layered onto that document.

backup had no guard against -out naming the database. It renames its
snapshot over the target, so `backup -db F -out F` replaced a database a
serving State Store may still have open and orphaned the WAL of the file it
just unlinked -- the state Restore refuses up front and maintenance.go's own
comment calls unrecoverable. backup now refuses with the same message
Restore uses, which is what makes its exemption from the ownership lock
sound.

Claims corrected where they ran ahead of the code: ValidateStored now says it
is the write path's check and not boot's, the Restore comment no longer
promises "never a mixture" for the sidecars it removes first, the usage text
advertises validate's -config, and the architecture table drops "must be
stopped" for validate (nothing enforces it; read-only opens skip the lock by
design) and states which two layers validate reports.

Tests: TestRecoveryValidateRunsTheGateBootRuns fails on the pre-fix code
("validate accepted a stored policy the daemon refuses to boot with") and
covers a store the State Store never seeded; TestRecoveryBackupRefuses-
TheDatabaseAsItsOwnSnapshot fails on the pre-fix code ("backup over the
database itself succeeded"). The validate-accept test now seeds the store
through ImportConfig and asserts the reported count is non-zero, and the
stored-resource case uses a value both gates refuse instead of one only the
write path does.
2026-09-21 22:04:42 +10:00
sam 014868eda8 feat(statestore): offline backup, restore, validate and rollback
archie-state-store gains the offline recovery commands
docs/prds/runtime-control-plane.md ("Bootstrap, migration, and recovery")
asks for. They work on the task database file directly -- <db_path>-tasks.sqlite,
not db_path -- and need neither archied nor the Web UI, which matters because
the failure they exist for is the one that stops archied starting:

  backup   -db F -out F     consistent snapshot (VACUUM INTO), verified as a
                            usable store before it is published; safe against
                            a serving store
  restore  -db F -from F    replace the database with a snapshot, dropping the
                            replaced file's -wal/-shm
  validate -db F            readable, not corrupt, schema no newer than this
                            binary, every stored resource decoding under the
                            definition that owns it
  rollback -db F -kind K    replay an earlier revision of a stored resource
           [-revision N]    through the ordinary replace, recorded as a new
                            revision

No rollback RPC is added and none is needed: a revision carries its own value,
so restoring one is the same replace the dashboard and the channels already
use, by hand, with the store stopped.

"The State Store is stopped" is checked rather than assumed. The serving
process now takes an exclusive flock on <db>.lock for its whole life
(store.AcquireOwnership), and restore/rollback refuse with
`task database is owned by another process` while it holds it. backup is the
deliberate exception: the update installer runs inside the process it is
replacing and cannot stop the State Store.

scripts/archie-update-install takes its pre-flight snapshot through
`go run ./cmd/archie-state-store backup` from the release being installed
instead of its own sqlite3 shell, so the installer and an operator run one
implementation. The watchdog's refusal semantics are unchanged: an update that
cannot back up still must not start.

Docs: safe-change-and-recovery.md's "Recovery: not yet built" now describes
what exists.
2026-09-21 22:04:41 +10:00
sam 0b399955fc fix(workflow): make gate.diff-rules fail closed on a change it never read
Follow-up to the gate.diff-rules step (archie-core-8szi). The step's contract
said it diffed the worktree; Trees.Diff reports the merge base against HEAD, so
only committed work was visible and a definition placing the step before the
committing step ran every rule against an empty diff and returned nil --
'load and check nothing', indistinguishable in the run's events from a pass.
2026-09-21 20:44:54 +10:00
sam 66ea2937a9 fix(workflow): make gate.diff-rules fail closed on a change it never read
The step's contract said it diffs "the worktree". It does not: Trees.Diff
reports the merge base against HEAD, so only committed work is visible.
A stored definition that placed gate.diff-rules before the step that
commits therefore ran every rule against an empty diff, found nothing and
returned nil, letting the run proceed -- the "load and check nothing"
failure the same file's settings validation exists to prevent, and
indistinguishable in the run's events from a change that passed.

The rules now read the committed change, and a run that read no committed
change while the worktree still holds uncommitted work fails on the spot,
naming the step it must follow. The count of added lines read is logged on
every run, so "checked nothing" is visible rather than silent.

Telling those two apart needs a fact Trees does not carry, so it arrives as
the same shape of optional capability changeStatsReader is: an unexported
interface in the domain, implemented where git is actually read
(worktree.Manager.HasUncommittedChanges, which excludes ignored files the
way CommitAll's own status check does) and forwarded by hybridTrees, the
Trees every production run uses. A Trees implementation that cannot answer
is refused rather than assumed clean: for a gate, silence about the change
is a failure, not a pass.

The four remaining review findings are recorded, not fixed, in
archie-core-ze7y (the escalated .archie/stages/*.go decision, P1, which now
blocks archie-core-8szi), archie-core-4kbg (discoverability),
archie-core-s1jz (hunk-header and threshold hardening) and archie-core-vof9
(retry keeps the pinned definition, so a rule cannot be unblocked by
editing it).
2026-09-21 20:43:48 +10:00
sam eb4d5c2017 feat(workflow): register gate.diff-rules as the .archie/gate.go replacement
Part of archie-core-8szi. Restores the deleted .archie/gate.go Check() behaviour
as a registered, declarative workflow step type: RE2 rules matched against the
committed diff, per-rule level (error parks with findings in Detail, warn logs),
file:line preserved, registered through the workflowsteps provider set. The
.archie/stages equivalent (an argv-running step) is deliberately not landed and
is held for the maintainer's trust-boundary decision.
2026-09-21 20:35:22 +10:00
sam e3748895a7 feat(workflow): register gate.diff-rules as the .archie/gate.go replacement
steps.go's StageYaegiGate tells the operator to migrate the deleted
.archie/gate.go hook to a registered YAML workflow step, and
BuiltinStepRegistry() exposed only the six shipped workflows' own stages,
so there was nothing to migrate to. What that hook did, from 3944f544
which deleted it: it read the worktree's repository-authored Go,
exporting Check(GateContext{Diff, ChangedFiles, Dir, BaseRef, Repo})
[]Finding, where each Finding carried a level ("error" blocked the run,
"warn" was advisory) and an optional file and line, and it inspected the
committed diff.

gate.diff-rules is that behaviour as a typed step: operator-written rules
in a stored definition -- per-rule level, RE2 pattern, optional path and
exclude_path scope, message -- matched against the ADDED lines of the
diff against the base branch, reported with their new-file line numbers.
An error-level finding parks the run with the findings in the park
reason; a warn-level finding is logged and nothing else. Unlike the hook
it replaces, no code is read out of the repository being worked on, and
the rules are versioned and audited with the definition they live in.

The settings are validated at the factory, which runs where a definition
is validated and again where it is compiled: a missing level, pattern or
message, an unknown level or settings key, and an expression that is not
a RE2 all refuse the definition rather than load and check nothing.

It arrives through the extension point archie-core-fwmp landed: a
repo-hooks provider in internal/infrastructure/workflowsteps, so both
roots that resolve a step type (the State Store's validating side and the
daemon's workflow-definitions client) register it at once.

Deliberately not landed: a step type for .archie/stages/*.go, whose
faithful equivalent is running a configured command. That would make the
stored workflow-definitions resource a command-execution surface on the
agent host, which is a maintainer's trust decision, not this lane's; it
is escalated, so steps.go's repo-stages error stays as it is.
2026-09-21 20:33:47 +10:00
sam 6354cda6b1 feat(archied): check a live settings replacement before switching to it
Resolves archie-core-nwa0. The live apply path builds and probes a replacement
before promoting it and retains the previous component when the probe fails,
reporting the outcome through the apply-status surface instead of a hard-coded
nil.
2026-09-21 20:33:41 +10:00
sam e8558f6c36 fix(archied): probe what the live settings update would actually run
Review of d7f3d0da found the build-and-probe step shape-only: the check it
added re-ran workflow.ExecutionSettings.Validate, which the store runs before
writing the document and controlplane.Client runs again on the way out, so no
producer could trip it. That review was right; this corrects it.

- The probe is now this process's own runnability check on the candidate it
  would switch to: configuration.Validate over the configuration snapshot the
  new limits would be published as, the same gate runtimeConfig applies before
  publishing a layered config and the readiness probe applies to the published
  one. The duplicated schema check is gone.
- The refusal the daemon really meets arrives as a watch error, because the
  client decodes every document before the apply path sees it. That branch
  logged and returned without writing an apply-status record, so the settings
  page showed a live resource as healthy while nothing was being applied. It
  now reports the refusal, against the version the reporter last applied.
  Whether the stream is re-established afterwards stays archie-core-yrmr.
- `Closes archie-core-nwa0` in d7f3d0da is withdrawn: the item stays open. For
  a limits-only kind no producer can make the owned check fail today, so the
  refusal path is exercised by test, not by traffic; the live kind whose
  candidate check has content is personas (archie-core-nw7t). Both callers are
  covered by tests now, through the client seam, instead of by calling the
  apply function directly.
- The comments no longer claim behaviour the code lacks: the boot abort is the
  fail-closed direction of a rule whose branch boot cannot reach, and the
  carried-forward version is the reporter's property, not this call's.

Out of scope and recorded instead: the live apply still publishes with
cfgHolder.Set rather than publishConfig, leaving the dashboard's config
snapshot stale after a live change (archie-core-75cc). workflow-definitions
gets no check because nothing swaps a running definition: the daemon reads the
collection per task pin (daemon.go:1479, pinWorkflowFromCollection) and the
only other reader is the dashboard's stream, so there is no live replacement to
probe.
2026-09-21 20:32:04 +10:00
sam 83974b6847 feat(archied): check a live settings replacement before switching to it
docs/prds/runtime-control-plane.md ("API") requires a live change to start
and check the new component before switching to it, keeping the old one
running when the check fails. The live workflow-execution-settings apply
stored whatever arrived on the watch, republished the configuration snapshot
new tasks are built from, and reported success unconditionally.

Stage the update as a candidate first: validate the limits and build the
snapshot they produce without touching anything running, then switch both in
only if the check passes. A refused update leaves the running limits and the
snapshot in place and reports the failure through the apply-status surface,
which keeps the version that is still live and carries the error. Boot
propagates the same rejection, so a process is never started on limits it
cannot run.

personas is the other live-watched kind and gets no check or report here;
filed as archie-core-nw7t rather than half-wired.

Closes archie-core-nwa0.
2026-09-21 20:32:04 +10:00
sam bf2cb79dc1 feat(workflow): plugin-registered step vocabulary resolved identically on both sides
Resolves archie-core-fwmp. The workflow step vocabulary is owned by an
injected workflow.Manager (internal/domain/workflow), assembled from a single
compiled-in provider set (internal/infrastructure/workflowsteps) and registered
at each composition root, following ARCHITECTURE.md#plugin-engine-rule-strict
invariant 2 and the memory family's house pattern. Replaces the five hardcoded
BuiltinStepRegistry() call sites.
2026-09-21 20:29:36 +10:00
sam cfe393e9ea refactor(archied): fold the daemon's state surfaces into one boot step
Run's added openDaemonWorkflowDefinitions guard pushed it to gocyclo 21
(.golangci.yml's budget is 20). openDaemonStateSurfaces owns the pair --
adapter, then the definitions client on its transport -- so Run keeps one
branch for the whole sequence and no suppression is added.

step_vocabulary_test.go's pin moves with the sequence: it still asserts
adapter before client, client before buildDaemon, and now also that Run
opens neither half directly, so the ordering has exactly one call site.

Behaviour is unchanged; the gateway root still calls openStateStoreAdapter
alone and resolves no step vocabulary.
2026-09-21 20:29:20 +10:00
sam 1b4289ed0c fix(archied): register the step vocabulary only where a root resolves it
Review pass on the step-vocabulary shape. The gateway root shared
openStateStoreAdapter with the daemon, so it registered a step vocabulary and
built a workflow-definitions client it never read: the same dead vocabulary the
previous commit removed from internal/app/archiemessaging, reintroduced through
the shared adapter, and able to fail the gateway's boot the day a provider set
can fail to load. The vocabulary and the client now belong to the daemon root
alone (openDaemonWorkflowDefinitions, called by Run before buildDaemon captures
it), which is what Client's "a process that never reads or writes a workflow
definition needs no provider set and cannot be failed by one" already claimed.

The root guard was weaker than its own comment: it asserted that a root calls
stepVocabulary(), not that the manager returned is the one handed to
NewServer/NewWorkflowDefinitionsClient, so a root could call it and inject an
empty manager and keep every test green. The pin now asserts the data flow (both
halves mutation-checked), plus Run's ordering -- after openStateStoreAdapter,
before buildDaemon.

Three root guards asserted exact equality with workflow.BuiltinStepRegistry(),
which contradicted the extension path they guard: adding a provider to
workflowsteps.Providers() -- the documented way a step type arrives -- failed
all three, and the expectation could not be satisfied by editing it. They now
assert what their doc says (every shipped stage present) plus provenance (every
name resolved is declared by the shared provider set), and the workflowsteps
guard derives its expectation from Providers() so both sides move together.

New guard on the defect class the bead exists for: TestNoProductionSiteReaches-
ForTheBuiltinStepRegistry scans the module and fails if any non-test file outside
the domain declaration and the shipped provider names BuiltinStepRegistry, which
the agreement test cannot see for a sixth resolution site added later.

Claim-vs-code corrections: openStateStoreAdapter "reads and replaces" -> the
daemon only reads, and ReplaceWorkflowDefinitions has no production caller yet;
workflowsteps' package/Providers docs no longer claim every Archie binary
registers the set (archie-gateway, archie-messaging, archie-playbooks and
archie-ui do not); the shipped-provider test no longer says production does not
call BuiltinStepRegistry, which is false -- production calls it only there.
2026-09-21 20:22:44 +10:00
sam c0ec3f6b8e fix(workflow): pin the roots, drop the dead vocabulary, guard the nil manager
Third review pass on the step-vocabulary shape, one fix per finding.

P1, roots unpinned. The agreement test built its own manager and injected it, so
it pinned the resolution sites and not the roots that decide the provider set; a
root regressed to workflow.NewManager() (no shipped stages) left go test green.
archied now resolves through one unit, stepVocabulary (step_vocabulary.go), and
agentworker's productionWorkerDependencies is exercised directly:
internal/app/agentworker/step_vocabulary_test.go and
internal/app/archied/step_vocabulary_test.go assert each root's manager resolves
the shared provider set's shipped stages and accepts a provider registered
through it. RunStateStore and openStateStoreAdapter own a SQLite file and a gRPC
dial, so their calls are pinned by source position, the way
composition_order_test.go pins the memory-engine ordering.

P2-B, dead vocabulary. archie-messaging registered a step vocabulary it never
resolved (its only control-plane call is RuntimeChatConfig) and could fail
startup on it before the State Store target guard. The workflow-definitions
surface is now its own type, controlplane.WorkflowDefinitionsClient, so the
vocabulary is a constructor dependency of the one surface that resolves step
types and of nothing else. The messaging root no longer imports workflowsteps.

P2-C, nil manager. A nil *workflow.Manager dereferenced on every resolution path.
stepRegistry and CompilePinnedWorkflow now refuse with an error naming the wiring
mistake; TestNilStepVocabularyFailsClosedAtEveryResolutionSite pins the refusal.

Claim-vs-code corrections: agreement is stated as within one build (vocabulary.go,
stepRegistry, openStateStoreControlPlane, openStateStoreAdapter); the Yaegi claim
now says no bridge to StepFactory has been built and cites
internal/secret/secretextract; the provider set names its three roots;
Manager.Register's ordering is documented as a constraint with its consequence,
and the shape rule no longer claims to reserve shipped stage names; the
shipped-stage test compares against the builtin factory's own stage.
2026-09-21 20:00:37 +10:00
sam ab204fe586 test(workflowsteps): pin that the provider forwards the shipped factories
Self-review of the fwmp shape: the provider enumerates BuiltinStepRegistry and
forwards each factory, so no shipped behaviour changed -- but the one guard the
refactor moved off the production path lost its coverage. "A shipped stage
accepts no settings" was asserted only in
internal/domain/workflow/definition_test.go through BuiltinStepRegistry, which
production no longer calls; TestShippedVocabularyCoversEveryShippedStage
compares names only, so a provider that rebuilt the factories instead of
forwarding them would keep every name, lose the guard, and stay green.

The new test drives every shipped definition through the registered vocabulary
and asserts each step compiles to the shipped stage (not a rebuild named after
the step type) and that settings are still refused.
2026-09-21 19:46:05 +10:00
sam 56f7295a3c feat(workflow): own the step vocabulary in a family manager registered at each composition root
archie-core-fwmp. Every call site hardcoded workflow.BuiltinStepRegistry(), so
the step vocabulary a workflow definition may name was closed to the six shipped
workflows and archie-agent could compile only what the control plane happened to
validate against the same literal.

internal/domain/workflow.Manager is the family owner (ARCHITECTURE.md#plugin-
engine-rule-strict invariant 2): a constructed, injected value with no
package-level registry and no init()-time registration. Register validates at
the producer and atomically -- nil or unnamed provider, malformed provider or
step-type identifier, a step type with no factory, a duplicate claim, a provider
declaring one type twice, and a contribution shadowing a shipped stage are each
refused, and a refused contribution applies nothing. Registry() hands back a
copy, so the closed set is a property of the manager rather than a convention.

internal/infrastructure/workflowsteps is the one package both composition roots
import: it holds the compiled-in provider set and builds the manager. archied
registers it in RunStateStore (the validating side) and in openStateStoreAdapter
(the daemon's client), archie-agent in productionWorkerDependencies (the
executing side), and archie-messaging at its own root, each before the first
resolution.

The five hardcoded sites now resolve the injected manager instead: the State
Store's workflow-definitions validate closure and encodeWorkflowDefinitions, the
control-plane client's read and write paths, and CompilePinnedWorkflow's shipped
-definition and pinned compiles (one resolution per package).

step_vocabulary_agreement_test.go registers a provider through the production
Manager and drives all three sides with it; breaking any one of the six
resolution points back to the builtin registry fails that side's assertion.
2026-09-21 19:42:24 +10:00
sam 37e6df8c1e docs(architecture): a new command is not a reason for a new binary 2026-09-21 17:18:58 +10:00
sam db7478dbdc feat(webui): show which process is running which settings version
The settings page now reads apply status beside each resource: every known
process with the version it applied, its error if it rejected the edit, and
whether it is still reporting at all. It re-reads after each save, so the page
reflects what the processes did with an edit rather than what was stored.

The server derives liveness only, because it knows whether a record went stale
but not which version the page is showing. The client compares against the
resource it is rendering, which is what turns a live record on an older
version into a pending restart.

A process that stopped re-stamping and one that never reported are separate
rows with separate wording, and neither is an error: the setting may be fine
and the process simply absent, which an operator acts on differently. A failed
apply-status read leaves the previous rows rather than taking the settings
page down with it.

state-store-contract.md gains the pair in its inventory and its count moves
from 45 to 47, with the note that this read is a list rather than the
config-snapshot pair's found=false singleton.

Closes archie-core-pskb.
2026-09-21 15:57:46 +10:00
sam be4e29c91b feat(controlplane): report which settings version each process is running
Every process that layers database-owned settings now publishes the version it
applied, and re-stamps it every 30 seconds so the report time doubles as a
liveness signal. A record older than 90 seconds belongs to a process that has
stopped, which is the only way this surface can tell a live process from one
that applied a version and then died.

RuntimeConfig returned the merged config and discarded the versions it read,
so no caller could report what it had applied. It now returns them, and
archied and archie-gateway report each kind through boot.runtimeConfig at boot
and on SIGHUP. A validation failure reports every kind with the error, because
the layering is all-or-nothing, and leaves the recorded version alone so a
rejected edit does not erase the fact that an older one is live. The daemon
also reports workflow execution settings as the watch applies them, and
archie-messaging reports channel settings at startup.

Reporting is best-effort by construction: the configuration a report describes
has already been applied, so a failed write is logged and never returned. That
keeps it off the reload's error path, where it would have raised a banner
saying a reload failed when its config took effect.

applystatus.New refuses a process name Processes() does not list. The reader
renders known names, so an invented one would be invisible rather than wrong,
which is the same thing the page means by a process that never started.

Relates to archie-core-pskb.
2026-09-21 15:49:54 +10:00
sam f38e1a30c8 feat(statestore): carry control-plane apply status on the store contract
Adds PutApplyStatus/ListApplyStatus so each process can report which version
of a control-plane resource it is running, and the UI can read it back.
docs/prds/control-plane-apply-status.md is the approved design.

It goes on the State Store contract rather than the control plane, whose
service is for editing a resource: a status report is not an edit. The
config-snapshot pair is the precedent, and the deny-by-default arm of
authorizesTaskScopedCall already refuses both new RPCs to a task grant, which
TestOnlyAdminReportsApplyStatus pins.

The row is keyed on (process, kind) and replaced in place, because a process
re-stamps on an interval and nothing reads a history of re-stamps. An error
leaves applied_version alone, so a rejected edit never erases the fact that an
older version is live. The read is a list and an empty one is not an error,
unlike the config snapshot's found=false singleton.

Contract PRD inventory and RPC count follow in the same series.

Relates to archie-core-pskb.
2026-09-21 15:44:31 +10:00
sam 285474a552 docs(prds): leave apply-status liveness open instead of deciding it
RULES.md says not to turn a requested outcome into extra product features and
to keep inferences open until the maintainer or repository evidence settles
them. The first draft broke that: a reviewer found that a record replaced in
place lets a process that applied a version and then died keep reading as
current, and I answered it by adding a periodic re-stamp, a recurring write in
three processes that neither the tracking issue nor runtime-control-plane.md
asks for.

The hazard is real, so it stays in the document as an open question with three
options and a recommendation, for Sam to settle. The re-stamp and the instance
identity come out of the design.

Also the sentence pass RULES.md requires before approval, which had not been
done: the staleness rule was stated in three sections, and rationale stood
where a requirement belongs.

Relates to archie-core-pskb.
2026-09-21 15:33:14 +10:00
sam 2bfb75763d docs(prds): decide where control-plane apply status is reported
runtime-control-plane.md requires each process to report the version it is
using or why it failed, and does not say where that report goes. It cannot be
a control-plane operation: that service is the surface for editing a resource,
and a status report is not an edit. It goes on the State Store contract,
following the config snapshot pair, whose administrative RPCs a task-scoped
grant already cannot reach.

Draft, pending approval. Reviewed by three independent lenses first, per
docs/prds/RULES.md. The operator lens opposed the first draft on two counts
now fixed: a record replaced in place with no re-stamp would let a process
that applied a version and then died keep asserting health, inverting the
choice status-health-surface.md made deliberately; and the dominant failure,
an unreachable State Store, can never report itself, because every apply point
is reached only after the store has answered. The draft now carries instance
identity and a re-stamp interval, says plainly which failures are reportable
at all, and gives the three kinds of absence distinct renderings.

The boundary lens required the surface be reconciled against ConfigView's
reload status rather than duplicating it; apply status covers resource kinds
and ReloadStatus stays the file document's only report. The contract lens
established that task-grant denial needs no new rule, that the read is a list
rather than a found=false singleton, and that the contract's RPC count moves
from 45 to 47 in two places.

Relates to archie-core-pskb.
2026-09-21 14:55:04 +10:00
sam bda9a9cc8e 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.
2026-09-21 14:41:50 +10:00
sam 5367731216 docs(architecture): purge the deleted runtime config overlay
2311529d deleted the overlay but not its documentation of record, leaving
docs/architecture/ asserting a subsystem that no longer exists.

safe-change-and-recovery.md was the dangerous one. It listed three ways back
from a bad runtime setting, all of them gone, so its recovery section was a
dead end. The replacement records the posture honestly: the control plane
fails closed, a stored value that will not validate stops the daemon starting,
and there is no escape hatch until archie-core-6zw0 lands.

configuration.md's ledger rows for the overlay store and the two dashboard
write routes become one row for the control-plane command. migration-decisions
marks the config-write descope superseded rather than deleting it, per
docs/prds/RULES.md.

Also removes leftovers the gate could not catch: a dashboard banner bound to
ReloadStatus.overlay_unavailable, a field the server stopped sending, and a
delivery-snapshot scan pointed at ApplyOverlayValues in a composition root that
no longer calls it.

The reload trace behind this found archie-core-ju85: SIGHUP republishes the
file document alone, reverting every database-owned setting until restart.
Recorded in the ledger as current behaviour.
2026-09-21 12:30:24 +10:00
sam f768b4912b docs: qualify the red step and require verifying handed-over input
Red-green stays the default, but a test that cannot fail for an interesting
reason is noise in the gate rather than evidence. Tests that restate an
assignment or a constant were being written to satisfy the protocol literally.

An empty handed-over export cost a whole autonomous run this session: the tree
was reconstructed from instead, on a 131-file change with no context. An
unreadable input is a blocking fact, not a gap to fill by inference.
2026-09-21 11:30:48 +10:00
sam 7729cefc31 docs(skills): record two gate traps and the service-target default
task check's proto:check and ui:check verify committed artifacts rather than
the build, so both fail on correct but unstaged work and both read as a broken
generator. Cost this session twice.

A registered service client always resolves to a non-empty target, so
Services.Get(name).Target != "" proves nothing: a guard meaning "only dial when
configured" dials always, and a test that sets no target reaches for a real
process on the developer's machine.

Also corrects the config skill's input-path table, which still described the
dashboard runtime overlay deleted in 2311529d. The rest of that stale surface
is archie-core-b7dn.
2026-09-21 11:02:38 +10:00
sam 8cd3071641 docs(prds): define three PRD statuses and approve the control plane
PRD headers carry 26 distinct status strings across docs/prds/. Draft,
Approved and Finalised are the only three, and a finalised PRD is superseded
rather than edited.

runtime-control-plane.md still read "Draft -- not approved" after it was
approved to proceed.
2026-09-21 10:43:08 +10:00
sam 44f8e19f0d feat(controlplane): expose resource history so edits can be reviewed and rolled back
resource_history has carried a row per change since the control plane landed
(value, version, actor, source, request ID, both versions, timestamp), but
nothing could read it. The audit trail existed and was invisible, and the PRD's
"shows failed changes and can correct or roll them back" had nothing to stand
on.

Restoring is deliberately not a command of its own. A revision carries the
value it held, so putting one back is an ordinary replace against the version
currently stored: the restore lands in the same history as every other edit,
under the same optimistic concurrency, instead of rewriting the past.

The revision value crosses the HTTP boundary as raw JSON rather than the base64
a proto bytes field renders as, because the dashboard sends it straight back as
the replace payload.

ResourceStore is exported from the controlplane package and the State Store
composition asserts against it, replacing the inline anonymous interface that
had started to drift from the real requirement.
2026-09-21 09:11:17 +10:00
sam 2311529def refactor(config): delete the runtime config overlay
The control plane replaces this, rather than extending it
(docs/prds/runtime-control-plane.md, "First implementation"). Until now both
paths existed: overlay kept dashboard edits in its own SQLite file beside
archie.db and layered them over the file config at boot and on every reload,
which is the duplicate configuration authority the PRD set out to remove.

Gone with it: the --no-config-overlay flag and ARCHIE_SKIP_CONFIG_OVERLAY
recovery hatch, which existed because a bad overlay row could brick the boot;
ReloadStatus.OverlayUnavailable; and the reload controller's overlay source.
The -config-overlay file overlay is a different thing and stays.

The dashboard's three write seams went too. UpdateConfig, ResetConfig and
UpdateRepoField were assigned only in internal/webui's own tests, so in
production they answered 503 and ConfigView.Editable was permanently false
(archie-core-j28m). Removing Editable would otherwise have flipped the SPA's
controls on, since configEditable read a missing field as true, so the config
pages become what they already were in practice: a read of what each process
is running with. Configuration is written through the control plane.

apply.go survives this deliberately; archie-core-xrux carries the question of
whether its map merge is still guarding the file overlay path.
2026-09-21 08:57:55 +10:00
sam d8dd9ac6d6 fix(webui): attribute dashboard writes to an identity, not a literal
internal/webui hardcoded the control-plane actor as "operator:web", so every
audit row a dashboard edit wrote to resource_history named a constant rather
than an identity the repository can resolve. The identity API next door already
had the answer: the dashboard authenticates with one shared token and carries
no per-user session, so the actor is the System identity.

Both dashboard paths now derive attribution from one webAudit helper, which
also stops swallowing the request ID error that would otherwise write an empty
idempotency key.

Messaging said the same thing but only checked the sender string was non-empty
before passing it through as the actor. Its set and replace paths now resolve
the sender to an identity and record its ID, on the same resolver the identity
subcommand uses, so a sender that does not resolve cannot change settings.
2026-09-21 08:49:21 +10:00
sam 3944f544e8 feat(controlplane): runtime administration over the State Store's gRPC server
The Web UI and messaging channels now read and write Archie's runtime
settings through one versioned, audited control-plane API hosted on the
State Store's existing gRPC server: catalog, query, command, watch. Each
feature owns its resource, validation and commands; storage only writes
versions and audit records.

Workflows move with it. Definitions become portable YAML compiled through
a closed, typed step registry and stored as a control-plane resource, so
the yaegi interpretation paths (internal/gate, wfeval, wfextract,
gateeval, gateextract, skillbuild) are deleted rather than carried.

The UI process reads definitions as data: the JSON projection lives in
internal/domain/workflow/task so a dashboard decodes the stored
collection without linking the workflow engine, which cmd/archie-ui's
deletion gate forbids. Shipped definitions ride the catalog descriptor
rather than a bespoke REST route, keeping the API to its four operations.

archie-messaging gains -state-store-target/-state-store-token and reads
channel settings from the database, failing closed when the State Store
is unreachable: the database is authoritative for those settings.
2026-09-21 08:17:42 +10:00
sam 28e2c01018 fix(webui): bind the capture pane to the list it sits beside
The pane was capped against the viewport, which let it grow taller than the
box it lives in on a short list -- and a sticky element taller than its
container is a sticky element that cannot stick. It is now capped by the
list's own measured height and by the room the window has, whichever is
smaller: both are sizes the pane does not influence, so filling the cap
cannot feed back into it. Stacked, where there is no sibling to be bound by,
the panel caps itself at 62vh the way the task log does, so one large
payload is a scrolling payload rather than a ten-thousand-pixel page.
2026-09-21 01:22:22 +10:00
sam ddb9c88f4f fix(webui): read a capture beside the list, not over it
The capture detail was the app's only sheet: it covered the list it was
opened from, had to be dismissed between rows, and held no address. It is
now a pane that sits with the list -- sticky and internally scrolling on the
wide layout, stacked under the list below 1100px, where selecting scrolls it
into view. The selection rides in the URL (?capture=N) with replace, so a
capture survives a reload and can be linked, and a page opened without a
selection shows the newest event rather than an empty box.
2026-09-21 01:17:04 +10:00
sam 7f1da81d52 feat(tools): a capture-intake sender for exercising the Events surfaces
Posts to /webhooks/capture/{source} with a realistic GitHub, Sentry, form or
large payload (or an exact body), reads the capture back so a silent drop is
visible immediately, and names the intake's rate and size limits when it
hits them. Wired as task webhook:send.
2026-09-21 01:10:30 +10:00
sam 34ede03b4d fix(webui): stuck log reads surface as errors, not eternal loading
A keyed read whose request never settles pinned the panel's loading line
forever; after a quiet minute the read is declared broken so the retry
button appears, and the started-dedupe is released so it can run again.
Also drops the download button from the log's empty state -- a log with
nothing recorded has nothing to download -- and the leftover imports from
the empty-state cuts.
2026-09-21 01:05:37 +10:00
sam 52d92fed04 fix(webui): let the empty state say no capture once 2026-09-21 01:01:17 +10:00
sam e5856bb970 chore(webui): rebuild dist 2026-09-21 00:56:30 +10:00
sam 24f1d429a6 fix(webui): stop empty states re-deriving their own titles
A title that states the fact does not need a description that derives it:
the log, panels, lifecycle lists, dashboard cards, stages, skills and
captures empty states now say the fact once, and keep only the
descriptions that carry an action, a cause, or a distinct reading.
2026-09-21 00:56:24 +10:00
sam 5037281e8b fix(webui): drop the log filter labels and the empty-stage explainer
The selects' first options already say All levels / All stages, so the
uppercase captions restated them; the screen-reader names stay. The
no-stage-names notice restated the filter's obvious emptiness and is gone.
2026-09-21 00:51:29 +10:00
sam a5eba184c2 fix(webui): use appearance page width 2026-09-21 00:46:50 +10:00
sam 538c04fbc4 fix(webui): four-column appearance grid on wide screens 2026-09-21 00:46:28 +10:00
sam fffa6bc528 feat(webui): refine system navigation and appearance 2026-09-21 00:45:02 +10:00
sam 569d01c151 fix(webui): settle the run page head around the attempt pager
The head strip breaks into a full-width control row -- Back, Refresh, and
Start a new run on the left, the forge coordinates pushed to the far edge
-- and the meta row pairs the lifecycle badge with the attempt pager, which
rides in from TaskMetaBar's slot. TaskMetaBar narrows to the served status
badge; the forge links move out of it into the control row where the other
navigation lives.
2026-09-21 00:43:41 +10:00
sam ebae92e9b2 fix(webui): hide the attempt pager for zero or one attempt
A one-page pager is the old text fact wearing extra chrome. The URL still
names the attempt and the panels show it.
2026-09-21 00:27:19 +10:00
sam d7e74d0c59 feat(webui): make attempts a pager above the tabs
The attempt selector becomes an icon-ended pager from the registry
pagination primitive: chevrons walk run history, numbers land on an
attempt, and the active page is the attempt on screen. It sits top-right
above the tab card, and the meta line loses the attempt text fact since
the control now carries it.
2026-09-21 00:25:54 +10:00
sam 3163c0d9cd fix(webui): strip the task detail page to one head strip and honest states
The page stacked five chrome strips before its content and every state
wrote an essay. The head is now one strip -- title, workflow, actions, a
single meta line -- the retry explainer is gone (the confirm dialog already
carries the commit-discard consequence), and empty states say the fact in
the title without a paragraph re-deriving it.
2026-09-21 00:10:19 +10:00
sam e32ca50843 fix(webui): deepen the primary violet and give links their own tint
The bright violet passed the contrast ratio on paper and failed in the
hand: black-on-purple vibrated at button and FAB sizes. The primary surface
is now deep enough for white labels, and link text on the canvas uses a
dedicated lighter tint, since one violet cannot be both a dark-enough
surface and a light-enough text colour. Also drops an empty-state
description that restated its title.
2026-09-21 00:10:10 +10:00
sam b35b6c0049 feat(webui): add a command palette, live tasks, and a11y fixes
Ctrl/Cmd+K opens a palette over the capability-gated nav entries; the tasks
board refreshes from the shared event stream; config tooltips are
keyboard-reachable; live activity announces politely; and missing event
timestamps render an em-dash instead of a fabricated now.
2026-09-20 23:38:57 +10:00
sam 49af6c75bc fix(webui): make task actions and dangerous approvals deliberate
Task rows render one primary control with the rest in an overflow menu
instead of every catalog action at once; dangerous-action approvals and the
daemon-restarting install confirm by name; the Needs-you tile reads the
served attention statuses instead of a hardcoded pair; and dangerous.go
stops calling the 24-hour approval permanent.
2026-09-20 23:38:57 +10:00
sam a38f92b17b fix(webui): cut redundant tails and restating descriptions from copy
Empty states and card descriptions no longer explain the consequence the
main clause already implies, page descriptions match between the router and
the chat page-index tool, and the Appearance cards lose descriptions that
restated their controls.
2026-09-20 23:38:57 +10:00