Archie runs its own agent loop only. Removes Kit resolution and launch,
the harness runner and adapters, the setup terminal and sandbox view,
harness secrets and OAuth capture (table dropped in migration 0075), the
task-tools contract that only Kit containers reached, and the
sandbox-kit-spec dependency. Agent profiles carry image and tools only.
The egress proxy keeps the model-session path; the sandbox relay code
stays for #1867.
Every service connected to PostgreSQL as the database owner, which is a
superuser, so anything that compromised an app process owned the cluster, and
every connection reached the server with an empty application_name, so
pg_stat_activity could not say which service a session belonged to.
Split the DB credential into two login roles and name every pool:
- archie_migrator owns public and its objects and runs goose. Migrations run
on a short-lived pool opened from the new migration_database_url, before the
serving pool opens. It is not a superuser.
- archie_runtime serves requests with SELECT, INSERT, UPDATE, DELETE, sequence
USAGE/SELECT and function EXECUTE only. It has no CREATE privilege, so it
cannot change the schema.
- Every pool sets application_name: archie-state-store, archie-gateway, and a
-migrate / -recovery / -schema / -provision suffix on the transient
administrative connections. Existing one-URL installs keep working: an
absent migration_database_url falls back to database_url and the migration
runs on the serving pool exactly as before.
Provisioning is a new idempotent `archie-state-store provision` subcommand: it
needs an admin URL the services never hold (database owner or superuser),
creates or reconciles both roles, hands every public-schema object to the
migration role, revokes PUBLIC's CREATE on public, sets row-level grants, and
sets the migration role's default privileges so tables future migrations
create are usable without a hand-run grant. It stores SCRAM verifiers, refuses
superuser roles, and verifies the boundary before committing.
install.sh now provisions the bundled path and separates the credentials: the
superuser password the Compose database is created with lives only in a
compose-only postgres.env, while the env file the units load holds the
non-superuser PGPASSWORD. A bundled install that predates the split is
upgraded in place: the roles are created, the superuser password is rotated
out of the env file, and config.toml is moved to the runtime and migration
URLs. External databases keep their operator-managed credential; the
deployments README documents the one-shot provision command.
setup writes both bundled URLs, dev:postgres provisions the dev database, the
e2e stack provisions its throwaway server, and the deployment templates point
at the two roles.
The source repository is private, so the updater and install.sh got 404.
Releases are now published to samcharles93/archie-releases by
task release:publish.
archied update install verifies the release zip, checks every binary
reports the release, pulls the agent image by digest, backs up the
database in-process and stages the binaries before handing off to
archied update watchdog in its own process. The watchdog restarts units
in release order, requires archied healthy for 120s and otherwise rolls
back binaries and image policy, restoring the database only when a
migration ran. Boot recovery resumes the frozen watchdog.
Deletes scripts/archie-update-install, scripts/archie-update-watchdog,
the updater's --from-source and --auto, CommandInstaller,
ScriptInstaller and the update-image and update-topology subcommands.
archie-gateway no longer links the daemon, the web UI or archied. Shared
runtime layering, watches, catalog, NATS discovery and the State Store client
live in servicekit; chat task profiles in chattask. The Gateway waits for the
daemon's NATS endpoint instead of starting a second broker, and chat
approvals go through the task-action client instead of a local service with
no daemon behind it. Version stamping uses buildinfo only.
Replace CLAUDE.md with a short decision-rule constitution; move PRDs,
architecture, development and design docs and repo skills out of the tree;
delete the docs tooling (docsgen, prdlint, docdrift, docsite, contractaudit,
reachaudit) and its gate steps; stop install.sh copying repo skills into
runtime skills.
Architecture, deployment, installer, skill and PRD text now name the Postgres
State Store, the offline recovery commands on database_url, state_dir for host
state, and db_path as the legacy-file locator for archie-state-store import.
Finalised PRDs, CHANGELOG, docs/news and docs/archive are unchanged records.
Two beads, one root: four sites stamped a version and only two of them were CI.
`Taskfile.yml`'s build and `install.sh` derived GATEWAY_VERSION/RUNTIME_VERSION
from `git describe`, so a from-source build claimed a release it was not
running, and the stamp became a function of the commit graph -- the one input a
content-checksum build cache cannot see. An empty commit moved `git describe`
while `task build` reported "up to date" and shipped the previous stamp
(archie-core-pdq2). Both sites now stamp `dev`: a source build says so, and the
version a release carries is written into the artifact CI publishes. That
removes the non-file input rather than caching it, and traceability for a local
build is the checkout it came from.
`deploy.yml` published `:latest` from any push to main, so a release's own
stamping survived only until the next ordinary commit -- minutes, in an active
repo -- and a host deploying :latest reported dev, leaving the update path
unable to tell current from stale (archie-core-i5nb). `:latest` now moves only
from a commit that IS a release; every other build publishes `:edge` (mutable,
newest main) and `sha-<commit>` (immutable). A host that runs releases follows
`:latest`; a host that tracks main follows `:edge`, which RELEASING.md now says.
Verified: `task build` reports `archied dev`; the new workflow test fails
against the old workflow on all five guards and passes after; deploy.yml
parses; install.sh passes `bash -n`.
Gated with `task check` (exit 0) at 8faa0f6a -- the v1.39.0 base, CI-green --
with these five files applied. It is NOT gated at HEAD: HEAD carries an
unrelated red, `TestTaskProtoCarriesEveryDomainField`, because d6f61c2c added
ParkClass and RemediationRounds without the proto mapping. This change neither
causes nor fixes that.
The updater is component-driven: it compares the daemon and agent versions and
acts only when they differ, so a host whose individual binaries disagree looks
healthy. Carina ran a hand-installed archie-messaging 1.35.0 against a 1.30.0
state store and crash-looped on an RPC the older store does not serve, while
the updater reported "no approved component changes; nothing to install".
The reason a comparison was impossible: three of the six host binaries carried
no version at all. archie-ui, archie-messaging and archie-playbooks did not link
internal/app/archied, so the release ldflags never reached them; the gateway and
state store linked the variable but exposed no flag. Only archied could say what
it was.
- internal/buildinfo carries Version, stamped by all three build sites: the
zip, install.sh, and the updater itself.
- Every host binary answers -version ("<name> <version>"). archied's existing
two-line output is unchanged, because something parses it.
- archie-update-install reads each installed binary before it can report
"nothing to install" and refuses, naming every binary that disagrees with the
daemon's version; after an install it verifies the same set against the
release it just installed, so a binary the release did not rebuild is skew
rather than success.
- TestDistZipShipsEveryHostCommand pins stamping across the three build sites
and requires each cmd/ to report, so a seventh command cannot arrive unstamped.
install.sh built and installed five host binaries but wrote only
archied.service, so a fresh install ran one of five services and the updater
refused its own first update for units the installer never created
(archie-core-enow). The runbook stood in as the mechanism, which is the
hand-written step that let a messaging binary and unit drift apart
(archie-core-1c01).
- install.sh writes archie-state-store.service, archie-gateway.service,
archie-ui.service and archie-messaging.service alongside archied.service,
with the contents the runbook used to tell an operator to paste, and starts
all five with the store first.
- deployments/systemd-user-service.md no longer carries the unit contents; it
names the units, explains why each exists, and points at
systemctl --user cat and drop-ins for inspection and overrides.
- The updater's unmanaged-unit refusal now reads as a safety net for a host
that drifted rather than the normal path.
install.sh built five of the six host commands, omitting archie-messaging, and
scripts/archie-update-install's guard only checked that every listed service had
a unit -- never that every host unit was listed. A v1.30.0 updater with the old
list therefore neither backed up nor restarted the messaging service, leaving a
hand-installed binary running under an otherwise updated host (archie-core-1c01,
archie-core-1faq).
- install.sh builds archie-messaging, and its summary names it.
- The updater refuses when a host unit this release ships is not in
GATEWAY_SERVICES, naming it, alongside the existing refusal for a listed
service with no unit.
- TestDistZipShipsEveryHostCommand -- the name deploy.yml:255 already promised --
now pins all four lists to cmd/: the zip's build loop, the zip's copy list,
install.sh's build loop, and the updater's GATEWAY_BINARIES/GATEWAY_SERVICES.
A fresh install still seeds only archied.service; that gap is tracked separately
as archie-core-enow.
Two things fall out of one principle: a test that asserts against a
hand-written file is testing an artifact a human or an agent may legitimately
rewrite at any moment, so only generated output is a valid target.
install.sh generated config.toml two ways -- a full heredoc for the self-host
path and an awk splice of the [forge] block into config.example.toml -- with a
forge_block shell helper feeding both. That is the arrangement
docs/architecture/configuration.md decided against: it "must stop generating
config.toml; archied setup owns it", because the installer hand-rolling TOML
already drifted once (choosing Gitea produced a config naming a token the
installer never wrote). Both generators and forge_block are gone; install.sh
collects its answers as before and passes them to archied setup as parameters,
with secrets passed as REFERENCES to the env keys it just wrote rather than as
values, which would put them on a command line. The installer also now asks for
a cloud model, which archied setup requires and the old path never emitted.
deployment_contract_test.go tested the removed generators by parsing install.sh's
shell text, reconstructing the heredoc and asserting on its content. It broke the
instant install.sh stopped generating config -- "install.sh has no heredoc
declaring the daemon config's [nats] table" -- which is the failure mode in
miniature: the test was coupled to an artifact, not to behaviour. Deleted.
What it actually protected is kept, asserted on the GENERATED config instead:
TestRunSetup_GeneratedConfigSatisfiesDaemonRequirements runs archied setup and
loads what it wrote, requiring services.state.target and bot_user. A test against
generated output fails when generation breaks and passes when a human merely
tidies the template.
Found by an adversarial package sweep (temp tracker: config-1,
repo-root-deployment-1, repo-root-deployment-2).
install.sh produces config.toml two ways, and neither emitted an active
[services.state].target. The self-host branch writes a hand-rolled heredoc with
no [services] section at all, and the non-self-host branch rewrites only the
[forge] block of config.example.toml -- where [services.state] sat commented
out. openStateStoreAdapter requires a target, so a freshly installed archied
aborted at startup with no way to boot from the config the installer had just
written.
Activate [services.state] with a loopback target in both sources, which is the
producer fix: the config the installer emits is the invalid state, so it is
corrected where it is generated rather than defended against at the daemon.
[services.gateway] is activated alongside it for the same reason it is safe to
-- internal/infrastructure/configuration/defaults.go already defaults that
target to 127.0.0.1:8585, so declaring it changes no resolved value and only
makes the emitted config explicit.
Add TestInstallerGeneratedConfigHasServiceTargets, which parses what each
branch actually produces: config.example.toml through the real config loader,
and the install.sh heredoc reconstructed with its shell expansions resolved.
Both assertions are red-first -- with the sources reverted the test fails on
both branches with the boot-fatal message.
Found by an adversarial package sweep (temp tracker: repo-root-deployment-1,
.local/issue-tracker/).
A self-update to 1.23.0 failed its health check and rolled back. The
adapter built and installed ./cmd/archied and nothing else, and the
watchdog restarted archied.service and nothing else, so the new daemon
came up against a State Store, Gateway and UI still on the previous
release. Since 1.23.0 archied cannot boot without a reachable State
Store (openStateStoreAdapter), which on a host that had never run one is
an immediate exit, a failed health check, and a rollback that looks like
a bad release rather than an incomplete deployment.
Install every binary the reference deployment runs, versioned off the
archied tag, and back each up so the rollback restores all of them
together. A binary with no .prev was introduced by the failed release, so
rollback removes it instead of leaving one behind that points at
processes the restored release does not run.
Restart in dependency order: the State Store owns archie.db and every
other process dials it, the Gateway serves the contract archied and the
UI dial, so each comes up before its consumers and stops after them.
archied itself is cycled unconditionally and a failed stop still aborts
the rollback, because a presence probe that guesses wrong must never
skip the stop that keeps a live process off the binary and the database
being restored. The siblings are best-effort, which is safe because the
adapter now refuses the update outright, before touching the host, when
a unit for one of them is missing, naming what to create.
install.sh had the same single-binary assumption, so a fresh install
produced a host that could not start either.
Closes archie-core-hbqk.
-X main.gatewayVersion/main.runtimeVersion targeted package main, but
those vars live in internal/app/archied (cmd/archied is a thin
wrapper). An -X target that doesn't exist is silently ignored by the
linker, so every archied binary this shipped -- task build, install.sh,
Dockerfile.archied, and the carina self-update script -- reported
"dev" instead of its real version. Point every one of those ldflags at
the actual package.
Also, while chasing the carina incident this surfaced:
- restart.go: /restart didn't check for an in-flight /update install.
The install runs as archied's own child process, so a restart killed
it mid-build (observed: "signal: terminated") instead of letting it
finish or fail cleanly. Refuse the restart while updateInProgress.
- update.go / update_report.go: the "no version could be confirmed
running" branch still opened with "Update complete", contradicting
its own next clause. Reworded so an unverified outcome isn't
reported as completion.
Autonomous workflows now always hand a complete task to a scoped archie-agent container. Embedded NATS is the default and external NATS changes only broker placement; legacy agent and containers.enabled inputs decode for migration but cannot select an execution path. The daemon flushes task-event subscriptions before a worker can publish, and runtime updates snapshot and restore the configured worker image.
/update could report success at the correct target version while the
archie-agent container running it never actually changed: the update
mechanism trusted the configured installer's exit code and reported
whatever version number the release claimed, with nothing verifying
the two agreed.
The first piece of the fix: a new internal/installtype package
reports how a binary was built for distribution (Type(), defaulting
to "unknown"), stamped once per release artifact via
"-ldflags -X .../installtype.buildType=<value>" rather than guessed
at runtime by probing the environment -- restic and Tailscale both
treat "which install shape is this" as a build-time decision for the
same reason: a probed signal is guessable, a compiled-in one is not.
releaseupdate.Service.Install now refuses to run the configured
Installer at all when InstallType is unset or installtype.Unknown, so
an unstamped or misconfigured build can no longer silently attempt an
update it has no way to know is even the right kind for how this
instance was deployed. Wired through every real archied build path so
the gate doesn't just exist in principle: Taskfile.yml's build task
(binary), Dockerfile.archied (container), and install.sh (binary) all
now stamp it; cmd/archied/telegram_setup.go wires
Service.InstallType from installtype.Type().
Configuration-page display of install type/version and post-update
verification against the actually-running reference (not just the
installer's reported version) remain open -- this lands the
correctness gate, not the full observability surface.
Refs #522
archied v1.7.0 reloads its configuration on SIGHUP, but neither the unit
written by install.sh nor the one in the systemd runbook declared
ExecReload. 'systemctl --user reload archied' therefore failed, and the
only way to reach the new reload path was to know about
'systemctl --user kill -s HUP'.
The feature shipped with no supported trigger in the documented
deployment shape. Existing installs need the same line added, either by
re-running install.sh or via a drop-in.
Task and event persistence now uses a dedicated SQLite sidecar derived from the configured state prefix, matching the independently persisted conversation store. The configured path now means a state-path prefix rather than a database file so fresh SQLite state never attempts to interpret the previous storage format.
Remove the retired implementation and dependency completely, strengthen SQLite migrations and concurrency behavior, restore backend-neutral coverage, and align configuration, operational guidance, UI labels, and deployment documentation with the new storage and host-daemon topology.
--force was advertised in --help, accepted, and inert (FORCE_BUILD was
set and never read -- go build already rebuilds unconditionally).
Removed the flag and its help line rather than fake an up-to-date
check that go build's own cache already makes unnecessary.
Unknown flags fell through the case statement with no default branch
and silently kept every default, so a typo like --no-systmd installed
the systemd service the user asked to skip. Unknown options now print
a diagnostic naming the bad flag and exit 1, per the (a) option agreed
2026-07-30: this is a hand-run interactive installer where typos
dominate and silent wrong behaviour is the worst outcome.
Linger detection grepped for "Linger=no" and treated any other output
-- including a failed or empty `loginctl show-user` from a missing
logind session, a container, or unset $USER aborting under `set -u`
-- as "already enabled" without observing anything. Detection now
requires a positive "Linger=yes" and falls through to enable-linger
(idempotent) in every other case, and uses $(id -un) instead of $USER.
Refs archie-core-bfw, archie-core-c6o, archie-core-utt
Verified manually: bash -n syntax check; a real invocation of an
unknown flag (exits 1, no side effects, before any build/network
step); the linger branch logic exercised in isolation against stubbed
loginctl output for Linger=yes, Linger=no, empty output, and a failing
command. No shell test harness (bats or similar) exists in this repo
yet, so this is direct verification rather than a committed test.
An unresolvable forge token aborted startup with exit 1, denying the
operator chat, the gateway and every other subsystem over a capability
they may not use -- and under the installed unit (Restart=on-failure,
RestartSec=5s) it crash-looped where the error was never read.
Forge setup moves into resolveForge, shared by the primary forge and
each configured identity, and degrades to NoopForge with a warning.
Malformed config still fails fast in validation. The systemd unit gains
StartLimitIntervalSec/StartLimitBurst as a backstop for other failures.
- Render [forge] from the answers given: the generated-config path
hardcoded the GitHub token key and the Gitea host, so a Gitea install
read a key the installer never wrote and a GitHub install pointed at
gitea.example.com. Both config paths now share one renderer.
- Read tokens with -rs so they stay out of terminal scrollback, and
replace rather than append env keys so a re-run does not leave the
revoked token in the file.
- Exit early on non-Linux instead of failing later in a heredoc.
- Never abort the install because the shipped source tree has local
changes; build what is on disk.