Commit Graph
579 Commits
Author SHA1 Message Date
sam 99b0da4e35 chore(beads): add adversarial self-review epic
Epic archie-core-h019 with seven children covering the design decision,
findings contract, reviewer isolation, workflow wiring, calibration, PR and
dashboard surfacing, and the docs promotion. Only the design bead is ready;
the rest are gated behind it per the scope-discipline rule in #533.
2026-08-21 23:03:53 +10:00
sam 502ed568f3 chore(beads): track the issues.jsonl export
d06e3ea ("cleanup of noisey beads files", 2026-08-15) untracked
.beads/issues.jsonl on the rationale that JSONL exports are local
interchange artifacts. That reverses here: the export is now tracked so
issue state is readable and recoverable from a plain git clone, without
standing up a Dolt server.

What has NOT changed is which store is authoritative. Dolt still is, synced
via refs/dolt/data, with GitHub Issues as the external surface. The tracked
file is a mirror, not a source: it is written by bd's auto-export and must
never be hand-edited, because the next export overwrites it.

export.git-add flips to true in the same change, and the two settings only
make sense together. The exporter runs on a 60s interval and on the
pre-commit hook, so a tracked file that is not auto-staged would sit
permanently dirty in git status and block rebases and checkouts until
stashed -- the same friction .beads/interactions.jsonl already causes.
Staging it with the commit that regenerates it is what makes tracking
tolerable.

The cost accepted: most commits now carry issue churn, and parallel branches
can conflict on this file. Resolve such a conflict by taking either side and
re-running `bd export` -- the content is derived, so neither side is more
correct than the other.

Removing the ignore line is what tracks the file. Do not "fix" this with a
!issues.jsonl negation: .beads/.gitignore warns that negations override the
fork protection in .git/info/exclude.
2026-08-21 22:39:27 +10:00
sam f4438843fe docs: let scope discipline permit design where none is settled (#533)
The Scope discipline section used to open by declaring the architecture
documentation "complete and authoritative ... not a draft to extend", and
then banned producing "new architecture documents, migration plans ...
decision records" outright.

That was already false in this tree. docs/architecture/migration-decisions.md
is titled "Active migration inventory" and exists to record "what remains to
be decided before Archie's current implementation can be migrated into the
approved domain-oriented structure". The Architecture section of this same
file points agents at it for "the recorded position and what was agreed next".
docs/prds/ holds an active PRD and docs/archive/prds/ shows PRDs are a normal
artifact here. So the rule asserted the design was finished while the repo
shipped an open decision register, and banned the exact artifact type that
register is made of.

What changed in MEANING: the gate used to be "is this a document" and is now
"is there a settled design for this". Where a settled design exists, nothing
changes -- implement it, and prose instead of a diff is still the failure.
Where none exists (new capability, or an open item in migration-decisions.md)
designing first is now REQUIRED rather than prohibited.

The old ban was a proxy. What it meant to stop was prose substituting for a
diff, and it stopped that by banning the artifact instead of the behaviour.
Proxy rules hold right up until the work is genuinely new -- which is when
this one broke, and when designing first matters most: accreting diffs toward
a new architecture without deciding its shape is how the flat internal/ layout
happened, and CLAUDE.md already says undoing that is measured in weeks.

The anti-sprawl teeth are kept and made checkable rather than categorical: one
page, it decides rather than surveys, it lands in a named home (docs/prds/ or
migration-decisions.md), it is unfinished until a diff follows, and anything a
reader could have learned from the code gets cut. Ownership ledgers,
inventories, current-state traces, review campaigns and planning/refactor
issues stay prohibited -- none of those were ever design.

AGENTS.md is a symlink to this file, so every harness picks this up.
2026-08-21 22:20:48 +10:00
sam 992b17c524 chore(beads): persist interactions log
Append-only audit entries for four issue transitions: the persona
overconfidence fix (archie-core-3jag), the empty label-trigger dispatch fix
(archie-core-...-424), and closing the bws secret-engine plugin task
(archie-core-...-410) as already delivered by the compiled-in engine.

Issue data itself lives in Dolt and was pushed separately (bd dolt push);
this file is the passive export.
2026-08-21 21:59:12 +10:00
sam b5d08d0d93 fix(update): verify an update took effect instead of trusting the report (#530)
A pending update report used to be relayed verbatim. It is entirely
self-reported: scripts/archie-update-watchdog decides "passed" from
`curl -sf $HEALTH_URL/healthz`, which only proves that *a* daemon is
answering, then copies the version the installer *intended*
(ARCHIE_UPDATE_INSTALLED_GATEWAY) into the report. If the new binary
never made it into service, the previous daemon answers the probe just
as happily, so the message read "Update complete: daemon 1.9.8 -> 1.9.0.
Health check passed - archie-core is healthy on the new version" about a
version that was not running. That shipped: /update reported success and
the next task hit the exact bug the update was meant to fix (#468).

Report.Verify now checks the claims against the versions components
report for *themselves* -- archied's compiled-in gatewayVersion, which no
installer can talk it out of -- and partitions every claimed component
into Confirmed, Drift or Unverified.

What changed in MEANING:

- A passed health check used to mean "the new version is running". It
  now means only "something answered"; the version claim is a separate,
  separately-checked assertion.
- "Update complete ... healthy on the new version" used to be the only
  success wording. There are now three outcomes, because collapsing them
  is how the false success happened: confirmed, unconfirmed ("I could
  not confirm which version is actually running"), and contradicted
  ("Update did NOT take effect").
- An unverifiable component is NOT a failing one. Absent, empty,
  "unknown" (the watchdog's own default) and "dev" (an unstamped build)
  all mean "we could not check", never "it is wrong" -- treating them as
  drift would turn healthy updates whose bookkeeping went missing into
  reported failures.

Verification covers the daemon only, deliberately. archied's compiled-in
runtimeVersion records what its own pipeline stamped, not what the agent
container runs, so vouching for the agent would be the same kind of
guess this change exists to remove. The agent is therefore Unverified on
every successful update, and the success message names it as unchecked
rather than letting the confirmed daemon silently vouch for it.

Drift detail is attached per component: one component can sit on the
version the update meant to replace while another is on some third
version, and a single explanatory sentence would state a falsehood about
one of them.

Regression tests were confirmed to fail against the pre-fix code,
reproducing the exact false-success string, and each new guard was
mutation-tested. The drift-ordering test's component count is
load-bearing and documented: Go rotates small maps rather than permuting
them, so 8 components let an unsorted implementation pass ~12% of the
time while 9 fails it outright.

Refs #522, #468
2026-08-21 21:42:48 +10:00
sam 63d044603c fix(daemon): refuse to poll on an empty label-trigger match (#529)
GitHub's issues-list API treats an empty label filter as no filter at
all, so dispatch.trigger = "label"/"either" with cfg.Label unset
silently returned every open issue in the repo. A live incident
(GH#445) queued 124 unrelated issues in one poll cycle after
[dispatch.labels] -- a different field mapping task states to their
own labels -- was configured while the actual trigger-match label was
left blank.

pollIssuesWithConfig's "label" branch now refuses to poll and logs an
error when cfg.Label is empty; pollEitherWithConfig skips only the
label-side poll in that case, still returning assignee matches.
validateDispatch rejects the same misconfiguration at config-load
time. A per-identity gap remains: identities have no Label field of
their own and share the root's, so an identity overriding
dispatch.trigger to "label" isn't caught by validation -- only by
the runtime guard, which is why the runtime guard matters even with
validation in place.

Fixes archie-core-1786637501009-424-5b8332dd / GH#445.
2026-08-20 23:19:53 +10:00
sam 8e8f95381d fix(gateway): stop persona from asserting unverified claims as fact (#528)
The chat agent labelled unchecked figures "Verified details" and
fabricated an entire "Hermes gateway" subsystem with invented file
paths, stating both as confirmed fact until directly challenged.

Reword core rule 1 to separate static tool-capability claims (fixed
by the tool list) from dynamic file/memory/action/result claims,
which now must be verified this turn rather than merely "in this
conversation" -- the looser wording let a stale claim be treated as
still verified. Add rules 8 and 9: never label something
verified/confirmed without a this-turn tool check, and never state a
specific system detail (path, subsystem, count, config value) with
confidence unless just retrieved.

Fixes archie-core-3jag / GH#524.
2026-08-20 23:19:34 +10:00
sam 0496dd8c12 fix: restore provider gate and dashboard token accounting
Restores the provider test gate and durable dashboard token accounting.
2026-08-20 21:16:15 +10:00
sam 68c86ead24 chore(release): archied v1.9.11
deploy / gate (push) Failing after 2m16s
deploy / build-and-push (push) Skipped
2026-08-19 02:08:58 +10:00
sam d4e343b694 fix(mcp): persist npx package cache across daemon restarts
config.docker.toml launches MCP servers with `npx -y <pkg>@<version>`,
and the container has no persistent npm cache, so every daemon restart
re-resolved and re-downloaded the package from the registry -- slow,
and it turns a registry outage or a yanked version into a daemon
outage. It directly amplified the crash loop observed on 2026-07-30,
since each restart repeated the whole download.

configuredMCPProvider now points npx-launched servers (matched by base
name, so an absolute-path npx still qualifies) at NPM_CONFIG_CACHE
under the daemon's own persistent work_dir, plus
NPM_CONFIG_PREFER_OFFLINE=true so a warm cache skips the registry
round trip entirely. Does not cover a package's own separate
downloads (e.g. Playwright/Puppeteer fetching a browser binary via
its postinstall script).

Closes archie-core-1786637490923-43-d4bb914b.

The identical, arguably worse instance in
internal/app/agentworker/mcp_providers.go (every per-task ephemeral
container, not just daemon restarts) needs a persistent Docker volume
that doesn't exist yet, so it's filed separately as
archie-core-qk8m rather than folded into this scoped fix.
2026-08-19 02:08:33 +10:00
sam f1b65c0ef9 chore(beads): persist interactions log 2026-08-19 02:08:26 +10:00
sam d8b4075166 chore(release): archied v1.9.10
deploy / gate (push) Failing after 2m23s
deploy / build-and-push (push) Skipped
2026-08-19 01:49:32 +10:00
sam ddd532b824 feat(update): stream live progress and roll back failed updates automatically
The /update command went silent between "starting" and one final message,
gave no version summary, and required manual intervention on failure.

CommandInstaller now streams the installer script's stdout live instead of
buffering it, and parses a structured result (previous/installed versions,
per-component status) from a sentinel line. Because the reference install
script hands the daemon restart off to a detached systemd unit specifically
so restarting archied.service doesn't kill the process that requested the
update, the outcome is reported in two phases: the synchronous build/install
result comes back through Install() itself, and the post-restart health
check/rollback outcome is written by a new watchdog script and relayed by
whichever archied process boots next, via a small JSON handoff file cleared
once relayed.

Also fixes three defects an adversarial review pass found in the first
draft: the caller's request/handler context was passed straight into the
install child process, so a concurrent /restart or a browser disconnect
could SIGKILL it mid binary-copy; Telegram and the web dashboard each
tracked "install in progress" with their own private flag despite sharing
one Service, allowing two installs to race the same .prev backups; and the
watchdog reported rolled_back:true even when no backup existed to restore,
which would have told an operator to stand down while the daemon was still
broken.

internal/webui gains an unauthenticated /healthz the watchdog polls after
restarting archied.
2026-08-19 01:47:29 +10:00
sam 27f3403d14 chore(release): archied v1.9.9 archie v1.9.9
deploy / gate (push) Failing after 2m16s
deploy / build-and-push (push) Skipped
2026-08-18 09:58:42 +10:00
sam cee3f551d6 fix(telegram): drain live renderer in concurrency test 2026-08-18 09:58:42 +10:00
sam 39cdf196d1 chore(beads): persist interactions log 2026-08-18 09:05:34 +10:00
sam 5da1d5d006 fix(agentworker,daemon): reconcile worktree ownership before push
Agent containers run as root (no USER in the Dockerfile, no
userns-remap), so a commit the agent writes to the bind-mounted
worktree lands owned by UID 0 on the host. The daemon then reads
those same loose objects to push, running as its own non-root host
user, and fails with "openat objects/../..: permission denied".

containerEnv() now passes the daemon's own UID/GID as
WORKTREE_UID/WORKTREE_GID. hybridTrees.Push -- the single point
where a commit's objects are handed back for the actual push --
chowns the worktree to that owner first, via os.Lchown so a
legitimately-tracked-but-dangling symlink doesn't abort a push that
would otherwise have succeeded.

Closes archie-core-1786749700606-6-bf6aa32d.
2026-08-18 09:05:31 +10:00
sam 990a7c499c fix(container): stop a cancelled task's container immediately
Release() always slept the configured GracePeriod and always used
Docker's default ~10s graceful SIGTERM-then-SIGKILL timeout, even
when the release was happening because /stop had just cancelled the
task's context. A cancelled task's container -- and the in-flight
generation/tool calls inside it -- could sit doing nothing for up to
GracePeriod+~10s before actually dying, so /stop reported success
while work visibly continued for tens of seconds to a couple minutes.

releaseDecision(ctx, grace) now skips the grace sleep and requests an
immediate SIGKILL (Timeout: 0) when ctx is already cancelled; a live
ctx (normal completion) keeps the original behaviour byte for byte.

Closes archie-core-1786749700580-5-e3878224.
2026-08-18 09:05:21 +10:00
sam 966dd556d5 chore(beads): persist interactions log 2026-08-18 00:39:09 +10:00
sam bc2ef06a6b chore(beads): persist interactions log 2026-08-18 00:35:48 +10:00
sam 5450231b77 chore(beads): record epic close and engine bead lifecycle 2026-08-18 00:33:58 +10:00
sam 80c0d0ebaf feat(secret): add sops, vault/openbao and age engine plugins
CLI-based, env-configured, cache-less engines resolving SecretRef values
through the existing Yaegi plugin surface. Fresh resolve per call, so
values updated in the backend are picked up without daemon restart —
closing the gap that motivated the remote secret-input epic (#504),
whose value-entry web form duplicated the Bitwarden app for bws.

- examples/secret-engines/: sops (SOPS_FILE), vault (VAULT_ADDR/TOKEN,
  key "path/field" or VAULT_SECRET_PATH prefix), age (AGE_FILE/
  AGE_IDENTITY, key=value lines). //go:build ignore keeps them out of
  the Go toolchain; yaegi treats the tag as a comment and loads them.
- enginehost: host-side Run helper registered as a Yaegi symbol. yaegi's
  interpreted os/exec cannot pass env to child processes, so plugins
  shell out through host code; bounded by a 30s timeout like the bws
  engine.
- secret.LoadDir seeds the interpreter with the host environment: yaegi's
  interpreted os package keeps a private env otherwise, and plugin
  os.Getenv would silently see nothing.
- cmd/archied wires enginehost + unrestricted symbols into the engine
  plugin loader, matching skillscript's interpretation posture.
- tests load the real shipped plugin files with fake CLIs on PATH;
  added CONTEXT.md glossary for the remote secret-input vocabulary.
2026-08-18 00:32:57 +10:00
sam fe2edc07dd chore(release): archied v1.9.8 archie v1.9.8
deploy / gate (push) Failing after 3m22s
deploy / build-and-push (push) Skipped
2026-08-17 00:18:24 +10:00
sam 9946fc464b fix(update): isolate service restart handoff 2026-08-17 00:17:41 +10:00
sam 156f100e37 chore(release): archied v1.9.7 archie v1.9.7
deploy / gate (push) Failing after 2m12s
deploy / build-and-push (push) Skipped
2026-08-17 00:05:23 +10:00
sam 16ec8393fe style: apply gofumpt formatting 2026-08-17 00:02:31 +10:00
sam 58524f24d8 chore(release): archied v1.9.6 archie v1.9.6 2026-08-17 00:00:09 +10:00
sam 2b5c67087b fix(update): stamp install type and bound retry backoff 2026-08-16 23:59:48 +10:00
sam 5080be3450 chore(release): archied v1.9.5 archie v1.9.5
deploy / gate (push) Failing after 2m22s
deploy / build-and-push (push) Skipped
2026-08-16 03:14:59 +10:00
sam ff4af61e2b refactor: extract daemon bootstrap into phased wiring 2026-08-16 03:12:18 +10:00
sam 96263071bc refactor(archied): extract config overlay boot helper and thread ctx 2026-08-16 01:38:11 +10:00
sam 7b2c989615 refactor(builtin): split read executor to lower complexity 2026-08-16 01:37:04 +10:00
sam c12bd72f60 style: remove trailing whitespace 2026-08-16 01:28:25 +10:00
sam c36af46605 fix(tests): check type assertions in overlay and gateway tests 2026-08-16 01:24:31 +10:00
sam b7480e9e3c refactor: flatten nested config and tool fallback logic 2026-08-16 01:20:48 +10:00
sam 7b5292c6b5 fix(tools): flatten write overwrite checks 2026-08-16 01:16:22 +10:00
sam 389498428c fix(email): use context-aware test networking 2026-08-16 01:10:48 +10:00
sam 89af556fa0 test: use t.Context() for helper subprocess 2026-08-16 01:08:47 +10:00
sam 40441c7655 fix(tools): document intentional fallback skips 2026-08-15 23:55:21 +10:00
sam 1da24232af fix(tests): add contexts to HTTP test requests 2026-08-15 23:43:55 +10:00
sam 25699ca154 fix(tools): avoid predeclared max names 2026-08-15 23:41:44 +10:00
sam 6329b336fe fix(indexing): remove unused code search test runner 2026-08-15 23:40:23 +10:00
sam df41aa27fb docs(architecture): document memory engine family 2026-08-15 23:38:34 +10:00
sam 0e53485ea1 chore(release): archied v1.9.4 archie v1.9.4
deploy / gate (push) Failing after 3m27s
deploy / build-and-push (push) Skipped
2026-08-15 23:17:43 +10:00
sam c3f0d87787 fix(telegram): preserve URL boundaries in responses
Keep bare GitHub issue and pull-request links separate from following prose across one-shot sends, live edits, and long-message splitting. Preserve Markdown delimiters and newline boundaries while retaining plain-text fallbacks.
2026-08-15 23:09:28 +10:00
sam f0709829c6 feat(gateway): polish /status command response format
Format /status response with clear heading, visual task status icons, canonical lifecycle ordering, and separated runtime details with graceful fallbacks.
2026-08-15 22:43:41 +10:00
sam 34e36adf36 Merge pull request #525 from samcharles93/ratelimit/evict-stale
Ratelimit/evict stale
2026-08-15 22:32:06 +10:00
sam 2897838e6a feat(ratelimit): add window-based stale-entry eviction
EvictStale sweeps the per-key hit map and removes entries whose hits
have all aged out of the sliding window, so a long-lived limiter
driven on a ticker doesn't accumulate one map entry per identity for
the life of the process. The package doc now states the map is
unbounded until something actually calls EvictStale, rather than
claiming it's bounded by a mechanism nothing yet wires up.
2026-08-15 22:25:07 +10:00
sam 6c9d446742 docs: add Beads tracker guidance to CLAUDE.md 2026-08-15 14:12:08 +10:00
sam 2a6ee4cb45 chore(release): archied v1.9.3 archie v1.9.3
deploy / gate (push) Failing after 2m18s
deploy / build-and-push (push) Skipped
2026-08-15 12:53:52 +10:00