Commit Graph
592 Commits
Author SHA1 Message Date
sam 311f5f71f9 fix(gateway): stop ClaimTurn's insert-race branch losing its own retry read
Found while investigating an `ineffassign` finding, not a stylistic report:
the branch handling "another connection inserted the same turn between our
read and insert" was discarding its own result.

`result, err := tx.ExecContext(ctx, ...)` for the INSERT sits inside
`if errors.Is(err, sql.ErrNoRows) { ... }`, a new block scope, with `result`
new to that scope -- so Go's `:=` declares a fresh, block-scoped `err`
shadowing the function's own `err` for the rest of the block, including the
retry read a few lines later (`err = tx.QueryRowContext(...).Scan(...)`).
That assignment landed in the shadow, which goes out of scope at the block's
closing brace. The `if err != nil` check afterward was therefore still
looking at the *original* err -- sql.ErrNoRows from the very first read --
regardless of whether the retry read succeeded. The loser of a genuine
insert race would always return `sessionstore: read turn: %w` wrapping
`sql.ErrNoRows`, contradicting the branch's own comment: "apply the normal
claim state machine instead of surfacing a uniqueness error."

Fix: the insert-path errors are now insertErr, not err, so the retry read's
plain assignment reaches the outer err the later check actually inspects.
Confirmed via careful trace of Go's block-scoping rules that this closes the
gap for the affected!=1 (loser) path without touching the affected==1
(winner) path, which returns from its own separately-scoped err before ever
reaching this one.

Commit the honest limitation along with the fix: a genuine two-connection
concurrent regression test could not be made to hit the exact branch. A
temporary, reverted-before-commit diagnostic (real concurrent race,
artificially widened with a sleep) showed the losing connection instead
fails its own INSERT outright with SQLITE_BUSY_SNAPSHOT under WAL mode with
this driver, before ON CONFLICT DO NOTHING can ever report 0 rows affected
-- meaning the specific branch this bug lived in may be effectively
unreachable via this driver/journal-mode combination today. The shipped
test verifies the weaker, still real property that matters operationally:
many genuinely concurrent same-turn-ID claims across separate connections
never produce the bug's error signature ("sessionstore: read turn:"),
distinct from unrelated SQLITE_BUSY/SQLITE_BUSY_SNAPSHOT lock contention,
which is retried rather than treated as a failure. The fix stands
regardless of provable live reachability -- the shadowing was unambiguous
and wrong on its own terms.

Adversarially reviewed by a fresh subagent, which independently reverted
just the fix (keeping the test) and confirmed empirically -- 20 runs, plus
1000 trials with a debug probe on the affected!=1 branch -- that the branch
is never reached under this driver, corroborating the test's own stated
limitation rather than contradicting it. gocognit/nestif findings on
ClaimTurn are pre-existing on the prior committed baseline, unchanged by
this fix (only variable names moved).
2026-08-22 02:03:27 +10:00
sam a0d569da09 fix: address simple findings from a repo-wide golangci-lint sweep
Six mechanical fixes from `golangci-lint run ./...` (30 findings total, 23
deliberately left -- see the next commit's message for the one that grew
into something bigger, and the following note for the rest):

- apply.go: %v -> %w for the wrapped yaml error, matching the identical
  double-%w pattern already used in decode.go/discovery.go/loader.go in the
  same package (errorlint).
- contract_test.go: filepath.Join("provider.go") with a single argument is a
  no-op join; replaced with the literal (gocritic).
- inprocess_test.go, yaegi_test.go: two goroutines whose whole purpose is
  timing (does Execute return promptly on cancellation / does Run block
  forever), where the call's result is irrelevant -- explicitly discarded
  with `_, _ =` and a comment saying why, rather than silently ignored
  (errcheck).
- find_test.go: an unchecked os.MkdirAll now matches the file's own
  createTestFile helper, which already checks and t.Fatals on the same
  operation (errcheck).

Not touched, and why: 18 cyclop/gocognit/gocyclo/funlen/nestif findings
require extracting helpers to reduce complexity -- the exact shape of two
regressions already recorded in CLAUDE.md's Lint-driven changes section
(one from --fix silently dropping a predicate, one from a nestif extraction
that doubled data), so a blind sweep across 9 unfamiliar files was declined
rather than risk a third. 2 godox findings (storage.go, worktree.go) mark
real missing work; deleting the comment would hide debt, not fix it. 3
recvcheck findings (Duration, TaskEnvelope, Provenance) each mix a
mandatory-pointer-receiver method (UnmarshalText/UnmarshalJSON's interface
contract, or genuine mutation) with correctly-value-receiver read-only
methods -- forcing consistency would either break interface conformance or
force pointer receivers onto call sites where the value isn't addressable.

Adversarially reviewed by a fresh subagent: all six confirmed
behavior-neutral or behavior-improving, all touched packages pass -race,
golangci-lint confirms exactly 23 issues remain (not more, not fewer), and
none are new.
2026-08-22 02:03:11 +10:00
sam 9dc009d267 chore(beads): record 7d5u.3 merge to main (9b62c89, PR #534) 2026-08-22 01:36:14 +10:00
sam 9b62c89773 Merge pull request #534 from samcharles93/feat/webhookguard-shared-mechanics
feat(webhookguard): event-source decisions + shared webhook mechanics
2026-08-22 01:34:48 +10:00
sam 7c1d34ac85 feat(webhookguard): shared HMAC, rate-limit, and redaction mechanics
archie-core-7d5u.3 -- storage-agnostic building blocks for vetting inbound
webhook-shaped requests, extracted rather than duplicated:

- VerifyHMAC: behavior-preserving extraction of internal/channels/webhook's
  private validateHMAC. internal/channels/webhook now calls it instead of
  keeping its own copy; all 10 of that package's existing tests still pass
  unmodified, and the one now-redundant unit test was removed with a
  comment pointing to where its coverage relocated.
- RateLimiter: per-source token bucket. Source IDs come from a registered,
  operator-controlled set, not unbounded attacker input, so the bucket map
  is not itself bounded -- documented explicitly rather than left implicit.
- RedactPayload: key-name-based redaction, matching gateway/stream.go's
  sensitiveParameterKey marker list. Deliberately does NOT reuse that
  function's actual behavior: it replaces every string value regardless of
  key, correct for a bounded chat summary and wrong here -- a captured
  payload exists to be inspected for field mapping (t2db.3), so only values
  under a sensitive-looking key are touched.

Narrowed from 7d5u.3's original scope, which bundled capture storage and an
approval state machine into this package. Both moved to the beads that own
that state (t2db.1's capture store depends on 7d5u.2's still-open NATS
storage decision; t2db.4's binding is the only consumer of approval state
today) rather than building shared abstractions ahead of a second real
consumer.

Adversarially reviewed by a fresh subagent with zero surviving findings:
token-bucket math hand-traced on two scenarios and race-clean under -race,
the redaction/gateway-stream.go behavioral divergence verified by reading
both functions side by side, both the redaction and rate-limit guards
mutation-tested by disabling each and confirming the suite catches it.

task check exit 0, golangci-lint 0 issues, gofumpt clean.
2026-08-22 01:28:58 +10:00
sam 75a9838d8b docs(prds): decide event sources and reaction delivery
archie-core-7d5u.1 -- closes with the decision recorded. Investigated three
mechanisms already in the tree rather than designing from scratch:

- No out-of-process extension boundary exists or is needed; in-process typed
  families throughout, and plugins-and-extensions.md does not need amending.
- Reaction delivery reuses internal/eventbus's Publisher/Consumer contract,
  but NOT the existing nats.Client unmodified: it hardcodes
  jetstream.WorkQueuePolicy (client.go:65), the competing-consumer policy
  correct for ARCHIE_TASKS and wrong for fan-out reactions -- two reactions on
  overlapping subjects would hit the exact silent-starvation trap CLAUDE.md
  already documents. Retention needs to become a Config field; reactions get
  a second stream.
- Reactions in these two epics are producer-only (curator's WakeOnPrimaryInput
  for cheap wake, or the existing pollNATS->publishTask shape for real work).
  No veto/mutate-in-flight capability is being built here.
- No single generic Source interface. workintake.TaskEnvelope already is
  forge intake's typed contract and needs no new type -- its IdempotencyKey is
  keyed on owner/repo/number, not delivery source, so a webhook-sourced
  envelope dedups against a poll-discovered one for free. What's genuinely
  shared is a small cross-cutting package for HMAC/rate-limit/capture/approval
  mechanics, owned by neither domain.

Retitled and rescoped archie-core-7d5u.3 to match: it was still asking for
'one registry for every kind of inbound caller,' which this decision
explicitly rejects. Removed a false blocking dependency of t2db.1 on 7d5u.4
(GitHub-specific receiver) -- they are siblings sharing the new cross-cutting
package, not a chain -- and linked them instead.
2026-08-22 01:01:52 +10:00
sam d046ad6859 docs(prds): decide webhook intake security ahead of the code it constrains
archie-core-t2db.5 -- decides the five non-negotiables its description named
before capture (t2db.1) or the intake family (7d5u.3) exist to build against
it: per-source HMAC auth reusing internal/channels/webhook's existing scheme,
a draft/pending_approval/armed binding state machine modeled on telegram's
dangerous-command approval flow, per-source rate limiting (precedent:
pairing.MaxPendingPerPlatform) that rejects rather than silently drops,
blast-radius bounding via the same gate/diff-cap/sandbox every task already
gets rather than a new relaxation, and 7-day retention with best-effort
redaction reusing gateway/stream.go's sensitiveParameterKey heuristic.

The bead stays open: its code-level acceptance criteria constrain beads that
haven't landed yet and cannot be satisfied by a document alone.
2026-08-22 00:54:00 +10:00
sam e8b053b95a chore(beads): correct NATS-optional mistake in event-sources epic
Two prior updates to archie-core-7d5u/.1/.2 characterized 'no external NATS
configured' as a permanent no-NATS fallback and framed reaction delivery as
a choice between NATS and a second in-process bus. Sam corrected both: the
intended second deployment shape was always NATS EMBEDDED, not NATS-optional.
Verified github.com/nats-io/nats-server/v2 is already a direct dependency and
already used to run a real embedded server in this codebase's own tests
(internal/infrastructure/agenttransport/nats/transport_test.go and others) --
it was simply never wired into production daemon startup. 7d5u.2 retitled and
rescoped accordingly.
2026-08-22 00:28:46 +10:00
sam 2c3bfb767e chore(beads): drop dead global-database references from metadata
global_dolt_database/global_project_id pointed at beads_global on the shared
Dolt server, which no longer backs this project after the move to embedded
mode. They were inert rather than harmful: `bd --global` is gated on
shared-server mode, so it fails identically with or without these keys, and
beads_global held zero issues. Removing them leaves metadata.json matching
tau, crew and nell-engine, which have always run embedded and never had them.

Restoring `bd --global` would mean running the shared server again, not
restoring these keys.
2026-08-22 00:07:20 +10:00
sam dfc33b99cd chore(beads): switch to embedded Dolt
dolt_mode in .beads/metadata.json is what selects the storage engine --
'embedded' runs in-process out of .beads/embeddeddolt with no server, 'server'
runs a project-local sql-server out of .beads/dolt. The dolt.shared-server key
in config.yaml only chooses between a shared and a project-local server; it
does not reach embedded mode, which is why the earlier switch landed on
server mode instead.

Data moved from .beads/dolt/archie_core to .beads/embeddeddolt/archie_core;
508 issues intact and the Dolt remote push verified from the new location.
Both paths were already gitignored.
2026-08-21 23:59:55 +10:00
sam 175b8560dd chore(beads): recover from v1.2.1 schema skew; move to a project-local Dolt
The accidental, untested beads v1.2.1 release migrated the schema from v53 to
v65 while the supported v1.2.2 binary expects v53, so bd refused to run. All
three databases on the shared server were affected, not just this one --
archie_core, ai_sdk and beads_global were each at v65.

Recovery per docs/RECOVERY-1.2.1.md (beads v1.2.2): rolled the schema cursor
back to v53 in each database and re-tracked the events table to restore
audit-event versioning. Issue data was not touched; 508 issues before and
after. Data the 1.2.1 release wrote into 1.2.x-only structures (work-lease
state, events-journal rows, provenance, storage_class markers) remains in the
database and is simply unused by the 1.1 line.

shared-server flips to false, so this project now runs its own Dolt server out
of .beads/dolt instead of sharing /home/sam/.beads/shared-server with ai_sdk
and beads_global. Note bd 1.2.2 has no "embeddeddolt" mode -- that layout
belongs to the older embedded builds; project-local server is the equivalent
today, and .beads/dolt is already gitignored.

Hooks were reinstalled: the installed set was still 1.2.1.

The rest of the config diff is bd reflowing the YAML indentation on write.
2026-08-21 23:54:42 +10:00
sam 1f581de428 chore(beads): add no-code playbooks epic; correct plugin-doc misquote
Epic archie-core-t2db: capture unrecognised inbound events, inspect real
payloads, map fields by example, bind matcher+mapping to an agentic workflow
at runtime. Security is P0 within the epic -- the intake surface is public and
its output is an agent with tool access.

Also corrects archie-core-7d5u and 7d5u.1, which misquoted
plugins-and-extensions.md as banning 'untyped hooks'. The rule is scoped to
Workflow semantics and does not block an event system.
2026-08-21 23:46:14 +10:00
sam f0bd5ccefd chore(beads): add event sources and typed reactions epic
Epic archie-core-7d5u with six children: the gating design decision, reaction
delivery, the typed intake family, a GitHub forge webhook receiver behind a
feature flag, idempotency/poll parity, and the docs reconciliation. Linked to
the existing WebhookAdapter beads so intake work is not duplicated.

Only the design bead is ready; the rest are gated behind it.
2026-08-21 23:27:31 +10:00
sam 4f838a6cd1 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 879c0ff74d chore(beads): track the issues.jsonl export
ceee96b ("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 ec28bc6ce0 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 d271cc5ef6 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 2873cbba82 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 e19ff3a1de 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 7a40cc8636 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 8792c17538 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 6c1dbb90af chore(release): archied v1.9.11 2026-08-19 02:08:58 +10:00
sam c32319968c 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 fac8a0f3f2 chore(beads): persist interactions log 2026-08-19 02:08:26 +10:00
sam d0d06e0632 chore(release): archied v1.9.10 2026-08-19 01:49:32 +10:00
sam 7c409aadb5 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 a24f6fa8b0 chore(release): archied v1.9.9 archie v1.9.9 2026-08-18 09:58:42 +10:00
sam 39101dba33 fix(telegram): drain live renderer in concurrency test 2026-08-18 09:58:42 +10:00
sam ceec27dc9d chore(beads): persist interactions log 2026-08-18 09:05:34 +10:00
sam eca391b9e8 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 0b5c808400 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 79a92fd63d chore(beads): persist interactions log 2026-08-18 00:39:09 +10:00
sam 7f7fb2425e chore(beads): persist interactions log 2026-08-18 00:35:48 +10:00
sam a8335ab674 chore(beads): record epic close and engine bead lifecycle 2026-08-18 00:33:58 +10:00
sam a5a878c2d0 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 cea030261d chore(release): archied v1.9.8 archie v1.9.8 2026-08-17 00:18:24 +10:00
sam 401913fffa fix(update): isolate service restart handoff 2026-08-17 00:17:41 +10:00
sam 9abc976330 chore(release): archied v1.9.7 archie v1.9.7 2026-08-17 00:05:23 +10:00
sam 8239e8e935 style: apply gofumpt formatting 2026-08-17 00:02:31 +10:00
sam 1bb1d48ea0 chore(release): archied v1.9.6 archie v1.9.6 2026-08-17 00:00:09 +10:00
sam 62adab69af fix(update): stamp install type and bound retry backoff 2026-08-16 23:59:48 +10:00
sam 14f28fbc02 chore(release): archied v1.9.5 archie v1.9.5 2026-08-16 03:14:59 +10:00
sam edf38eb3e4 refactor: extract daemon bootstrap into phased wiring 2026-08-16 03:12:18 +10:00
sam a47ca4ec78 refactor(archied): extract config overlay boot helper and thread ctx 2026-08-16 01:38:11 +10:00
sam 4374bfd57c refactor(builtin): split read executor to lower complexity 2026-08-16 01:37:04 +10:00
sam 81a8b9b5e1 style: remove trailing whitespace 2026-08-16 01:28:25 +10:00
sam 2c6a4f9adc fix(tests): check type assertions in overlay and gateway tests 2026-08-16 01:24:31 +10:00
sam 63cff4fe53 refactor: flatten nested config and tool fallback logic 2026-08-16 01:20:48 +10:00
sam 79a4db5362 fix(tools): flatten write overwrite checks 2026-08-16 01:16:22 +10:00
sam fa826fb486 fix(email): use context-aware test networking 2026-08-16 01:10:48 +10:00