Commit Graph
2710 Commits
Author SHA1 Message Date
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
sam 20bff1a367 feat(agentexec,workflow): surface tool calls on the task timeline
archie-core-467 wired tool-call visibility into the interactive chat
gateway, but a workflow task's own transcript never showed what its
tools actually did -- only stage/agent-finish events existed, so
there was no way to confirm an agent's summary matched what it really
ran.

Adds a ToolCallReporter, invoked once per completed call from
toolExecute (the single choke point every tool call passes through
before reaching a model), reported via a new ToolSetOptions.OnToolCall
hook. Runner.Run grows a report parameter to carry it in: InProcessRunner
wires it through, since it executes in the same process as its tools;
SubprocessRunner and NATSRunner accept and ignore it, since their tool
calls happen in a different process with nothing here to observe them.

The workflow engine turns each report into a tool_call event on the
task's own Bus (agent.go, implement.go), riding the same NATS
event-forwarding archie-core-518 already built to get container
events onto the daemon's timeline.

Scoped to the central tool registry (read/write/edit/grep/shell/...)
built via BuildToolSet; capture tools (structured finish output) and
run_go_script build their ToolSet entries directly and are not yet
covered.
2026-08-15 12:53:41 +10:00
sam a237a35532 fix(agentworker): back off before refetching a nak'd stage message
On a stage-handle failure, the main loop logged the error, called
Nak (which requests redelivery), and looped straight back into
FetchStage with no delay -- unlike the fetch-error branch three lines
above, which already backs off for a second. A deterministic failure
(a broken gate, a malformed request) therefore refetched and failed
again immediately, flooding the log with one "handle failed" line per
loop iteration instead of per genuine retry -- hundreds of identical
lines within the same second in production.

Adds the same time.Second backoff after Nak.
2026-08-15 12:53:31 +10:00
sam 95ca1cad6d fix(logging): resolve error attrs to their message string, not {}
SystemLogHandler and FeedHandler both json.Marshal Entry.Fields
directly rather than through slog's own JSON handler, so a logged
`error` value went straight into a map[string]any as the raw
interface. encoding/json has no Error()-aware special case, and the
concrete type behind almost every Go error (errors.errorString,
fmt.wrapError, ...) holds only unexported fields, so it marshalled to
`{}` and silently discarded the message everywhere it was logged --
including on every container/system-log line shipped to the daemon
and shown in the webui, which is where this was actually noticed: a
flood of `"err":{}}` with no way to see what had actually failed.

attrValue now resolves an error attr to its .Error() string before it
reaches the map. It also guards against the classic Go footgun where
a non-nil error interface wraps a nil concrete pointer (var e *T; var
err error = e) -- a naive err != nil check would call Error() on a
nil receiver and crash the one thing that must never crash: logging
itself.
2026-08-15 12:53:24 +10:00
sam 824c53b297 fix(webui): scroll selected command into view on keyboard navigation
Arrow-key navigation in the chat composer's command menu updated
aria-selected but never scrolled the option into the visible area, so
selecting past the viewport with the keyboard left the highlighted
item hidden. Mouse scrolling already worked since it doesn't rely on
selection state.
2026-08-15 12:05:52 +10:00
sam 3570f600d4 chore(release): archied v1.9.2 archie v1.9.2
deploy / gate (push) Failing after 3m24s
deploy / build-and-push (push) Skipped
2026-08-15 11:22:35 +10:00
sam 05944b6fd3 fix(worktree): force checkout so retry recovers from a dirty worktree
refresh checked out the task branch without Force before hard-resetting
to base. A prior attempt's leftover uncommitted changes -- a killed
container, or a stage that edits files before ever reaching a commit --
made go-git's default MergeReset checkout refuse to reconcile them, even
with HEAD already on the correct branch and the target commit unmoved.
The fallback then made it worse: any checkout failure was assumed to
mean the branch didn't exist yet, so it retried with Create: true, which
failed with a much more confusing error since the branch did exist --
"a branch named ... already exists" -- masking the real cause and
parking the retry with the same unhelpful message every time.

Reproduced directly against a live deployment's actual broken worktree
(modified tracked file, untracked file, branch already checked out) and
confirmed retry then succeeds and correctly restores to base.

Force is safe unconditionally here: refresh hard-resets to base a few
lines later regardless of what checkout leaves behind.

Closes #523
2026-08-15 11:22:22 +10:00
sam d83f5a9be3 chore(release): archied v1.9.1 archie v1.9.1
deploy / gate (push) Failing after 3m30s
deploy / build-and-push (push) Skipped
2026-08-15 10:35:18 +10:00
sam 369b13b688 feat(releaseupdate): stamp install type at build time, fail closed on unknown
/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
2026-08-15 10:34:46 +10:00
sam d958923033 fix(webui): filter turn_completed noise from the Live Activity SSE feed
turn_completed fires on every chat turn so input-driven curators can
wake on it, but it carries no task correlation (TaskID always 0,
Detail a raw session ID) -- on the dashboard's "Live activity" panel
this drowned real task-lifecycle events: 27 of the last 30 rows in a
live sample were content-free turn_completed noise.

Excluded at the SSE boundary (sseVisible), not at publish, so
curators reading the Bus directly are unaffected. since still
advances past a filtered event exactly as it would for a sent one --
EventsSince only ever returns events with id > since, so leaving
since behind a filtered event would make the next catchUp refetch it
forever.

Closes #521
2026-08-15 10:34:33 +10:00
sam d9a9b17153 fix(agentworker): forward workflow events across the NATS worker boundary
A workflow run through the container/NATS path never wired
workflow.TaskContext.Bus, so every tc.Emit call (stage_start,
stage_finish, outcome, parked) was a silent no-op. archied's own
in-process path sets Bus and always worked; anything dispatched to an
archie-agent worker did not, which meant the dashboard's per-task
timeline showed "No events yet" for every task regardless of status
or stage -- confirmed live across a Working task and two differently
parked tasks.

Bridges the gap the same way system logs already cross this boundary:
ForwardTaskEvents relays a per-task in-process *events.Bus to a new
NATS subject (SubjectForEvents), and a new daemon-side subscriber
(subscribeAgentEvents) republishes decoded events on the daemon's own
Bus, landing them in the same persist-and-broadcast pipeline an
in-process workflow already used.

Closes #518
2026-08-15 10:34:25 +10:00
sam 0d1d418f60 chore(release): archied v1.9.0 archie v1.9.0
deploy / gate (push) Failing after 2m30s
deploy / build-and-push (push) Skipped
2026-08-15 02:25:10 +10:00
sam 8c7052b20b refactor(webui): decompose handleSSE to cut cognitive complexity
handleSSE mixed connection registration, backlog catch-up, and live
broadcast relay into one function with three nested closures --
gocognit flagged it at 52 against a limit of 30. Extracted each
concern into its own top-level piece: sseSince (resume-point
resolution), registerSSEConn (subscribe/unsubscribe), and a new
sseStream type carrying the per-connection state (send, catchUp,
sendPage, drain) that the closures used to capture implicitly.

Behavior is unchanged -- catchUp/sendPage's page-boundary and
target-reached logic is the same control flow the original closure
had, just named and independently testable. handleSSE itself is now
a straight-line sequence of calls.

Added direct unit tests against sendPage/catchUp for the boundary
cases a full HTTP round-trip test doesn't exercise: a target reached
mid-page vs. at a page boundary, a target of zero (drain everything),
a write failure stopping the page immediately, and backlog spanning
more than one EventsSince fetch.
2026-08-15 02:24:43 +10:00
sam 9a01af3811 fix(telegram): use NewRequestWithContext to satisfy noctx
Pre-existing lint finding, unrelated to any behavior change.
2026-08-15 02:19:57 +10:00
sam afd00be00e fix(telegram): guarantee no message is stranded on gateway stop/restart
A daemon shutdown or /restart cancels turnCtx without any guarantee
that the goroutine owning a liveReply ever runs again to notice and
clean up after itself -- a full process exit gives it no chance at
all. Gateway now tracks every liveReply mid-turn in a registry and
Stop drains it, marking each as interrupted so nothing is left ending
in the "typing" cursor forever.

finalize and abandon now run their bodies inside a per-reply
sync.Once (the terminal field): a turn finishing naturally and a
concurrent Stop draining the same reply were reaching it from two
goroutines at once, both sending their own edit for the same message
with the outcome decided nondeterministically by which HTTP response
Telegram processed last -- including a complete real answer getting
silently overwritten by the restart marker. Only one side's body now
ever runs; the other blocks on the winner and then does nothing.

The drain itself is bounded (liveDrainTimeout, default 5s): a single
stalled Telegram API call must not hang gateway, and therefore
daemon, shutdown indefinitely. Entries still in flight past the
deadline keep running in the background rather than blocking Stop.

A liveReply created in the narrow window between Stop claiming the
registry and its own registration call is abandoned immediately
instead of being registered into (and lost from) a registry nothing
will drain again.

Regression tests cover the mutual-exclusion race directly (20
iterations of finalize and abandonRestarted racing on the same
reply, asserting exactly one outcome ever wins), the bounded drain
against a deliberately hung API call, and the post-stop registration
gap.
2026-08-15 02:19:53 +10:00
sam a60dea926f fix(config,webui): make show_tool_calls one cross-channel setting
show_tool_calls gated Telegram's tool-activity narration only; the
web dashboard's SSE chat stream narrated every completed tool call
unconditionally with no way to turn it off, leaking tool names and
parameter shapes to anyone with dashboard access even when an
operator had already opted out for Telegram.

Moved ShowToolCalls from TelegramConfig to ChatConfig so it is one
setting for every channel, and wired the webui stream to it:
chatStreamSink now carries a showToolCalls flag (snapshotted once per
turn, mirroring how Telegram's liveReply snapshots it) and ToolCall
no-ops when it's off.

BREAKING: an existing [chat.telegram] show_tool_calls = true in
config.toml now parses as an unrecognized key under [chat.telegram]
and is silently ignored (TOML decoding is non-strict) rather than
erroring -- move it to the top-level [chat] table.
2026-08-15 01:57:06 +10:00
sam 15556a8a1c docs(agent): correct markSafe's doc comment to its actual existence check
The comment claimed a mount was checked before touching the
operator's global gitconfig; the code only ever checked os.Stat
(existence + directory-ness). A directory that merely exists at the
mount path -- a stale leftover, never actually bind-mounted this run
-- already satisfied the guard and got added to safe.directory,
exactly what the comment said it prevented. A real mount check would
need platform-specific mountinfo parsing for an inert failure mode
(the entry does nothing unless a git repo later exists at that exact
path), so this corrects the contract to match the code and pins it
with a test instead of changing behavior.
2026-08-15 01:48:39 +10:00
sam 023d0a0165 docs(telegram): note the live-edit timestamp trade-off on liveReply
The finished reply is delivered by editing the message created at the
first streamed frame, and editMessageText does not change a
message's date, so a long tool-using turn's answer keeps its
turn-start timestamp and can sort before conversation that produced
it. Delete-and-resend would fix the ordering but reintroduce the
flicker/reorder streaming exists to avoid, so this documents the
accepted trade-off rather than changing behavior.
2026-08-15 01:48:33 +10:00
sam c2e8638d24 fix(webui): style tool-call failure from a structured field, not a string prefix
chatStreamEvent gained a Failed bool, set from ToolCallEvent.Err !=
"" -- the field the rest of the codebase already treats as
authoritative -- rather than the browser sniffing summary.startsWith
"failed:" on rendered text. A successful tool whose own output starts
with that literal string (a grep hit, a log line read back) was being
styled as a failed step.
2026-08-15 01:48:29 +10:00
sam 707af1dde5 chore(release): archied v1.8.0
deploy / gate (push) Failing after 3m34s
deploy / build-and-push (push) Skipped
2026-08-15 01:44:00 +10:00