ImagePull was called with empty options, so a private registry answered 401
on every pull regardless of containers.pull_policy. docker login did not help
either: it writes ~/.docker/config.json, which only the CLI reads.
Add containers.registry_auth, a SecretRef reusing the credential shape the
rest of the file uses, whose resolved value is a Docker registry.AuthConfig
JSON document. archied resolves it at boot and the pool base64url-encodes it
into the X-Registry-Auth header ImagePullOptions carries.
A missing or unresolvable credential degrades to the anonymous pull that
existed before the field (with a warning), so a deployment with no private
registry is unaffected; a half-named reference is refused by
configuration.Validate. The field is file-owned and json:"-", so the
container-runtime-policies layering has to preserve it explicitly, the way it
preserves Profiles.
agent-context@1 was listed as supported, but a Kit's contributed guidance
never reached the agent. At container create archie now writes the
workload's profile file (CLAUDE.md, AGENTS.md, ...) beside the workspace
with a Kits index: a staged body is pointed at where the image holds it,
an inline one gets its own file the index points at. The profile never
inlines a Kit's text. The files are written as root, so a run can read
but not change them, and are rewritten on every create.
The workspace moves to /archie/workspace so the profile sits in a real
parent directory rather than /, which some CLIs stop short of when they
look upward for instruction files.
Part of archie-core-egkf.6.
StartKit calls InstallDone after the install hooks, before files and
startup hooks, so the caller moves the egress session to its runtime
policy exactly where the Kit spec ends the install phase.
StartKit creates the Kit container with archie's worker as its root
entrypoint and credentials, the Kit's volumes keyed by execution, then
runs install hooks as their users, writes the Kit's files as the harness
user, and runs startup hooks. A failing hook removes the container and
reports the hook's output. The Docker test proves on a real container
that the harness user cannot read the worker's environment, and fails if
the worker shares the harness uid.
Workflow definitions declare inputs, repository (none, optional or
required; default required) and profile. A binding assigns each input
from a mapped parameter or a constant and may take its repository from a
parameter, which must name a configured repo; both are checked when the
binding is saved and again at dispatch. Inputs travel as structured task
data (tasks.inputs, the task brief, and a JSON block in the agent's
mission), never as body text.
A task with no repository runs in a per-task scratch workspace with no
clone and no publication grant. The agent.run step runs one mission
without a repository and finishes the task in the new completed status.
Agent profiles live under [containers.profiles.<name>]: an image and an
allowlist over the tools archie adds (MCP, scripts, plugins).
[containers].image is the default profile; an unconfigured profile parks
the task. The workflow is now pinned before the container starts so the
profile can choose its image.
Also stop two archied tests writing embedded NATS state into the package
directory, refuse an empty state_dir for embedded NATS, and drop the NATS
store files an earlier lane commit tracked.
* feat(gateway): give /status a real daemon-health surface
Phase 2 of archie-core-wp9s. Phase 1 split the commands apart (health vs
work) but left /status with one aggregate queue line and a static runtime
block; it could not answer the questions an operator actually asks when
something feels wrong. /status now reports, between the queue line and the
runtime block:
- Broker: the live state of this process's own NATS connection
(eventbus/nats.Client.Connected), not a fresh dial -- a probe would
report the probe's reachability, not the daemon's.
- Containers: the pool's own active counter against the configured cap
(Pool.Active/Cap), not a Docker listing, which would include containers
this pool does not own. A zero cap means unlimited, so it is not shown
as a ratio.
- Channels: the channel manager's real lifecycle state, including a
failed adapter's reason (the documented decision: read the existing
manager rather than re-deriving health per adapter).
- Chat model: last-known outcome of every chat-model call this process
made, recorded once in sendChatTurn (the single choke point) and read
back by /status. The second documented decision: never a live probe,
so /status stays instant and reports what happened -- or says plainly
that nothing has been attempted yet.
- Last poll: when the most recent poll pass began, stamped on both poll
paths (Run's single-identity loop and runIdentities' per-identity
goroutines). A pass that hangs leaves the stamp stale, which is the
signal; stamping completion would leave a wedged poller looking
healthy.
Truthful or absent: a section this process has no source for is omitted
rather than rendered as a zero. The standalone Gateway owns no poll loop,
pool or channel manager, so its /status reports broker and chat-model
health only; aggregating across processes would need a new daemon RPC and
is deliberately not built. Version stays out (/version owns it).
/status and /tasks descriptions now describe what each command actually
does on both published surfaces (Telegram menu/help and the shared
specs), pinned by a test that also fails if the two surfaces drift.
Sources are read through functions, not captured values: occupancy and
channel state move, and the daemon is built after the gateways, so a
source captured at construction would freeze /status on boot state.
Left in place deliberately: the Runtime (provider/model) block, which
Phase 1 flagged and which duplicates /model and /whoami. Removing it is a
product call on a command Sam uses daily, not a mechanical follow-up.
* docs(prds): record the two open /status health decisions as settled
Both were flagged in PR #892 as needing the maintainer's call; both are now
answered, and the PRD is the place a follow-up would look:
- The Runtime (provider/model) block stays. It is the one line in /status the
ticket's own rule says should not be there, but /status is read daily to see
the active model at a glance, so the duplication is deliberate. Recorded as a
settled product decision so it is not removed later as an oversight.
- Health stays per-process. Pooling the daemon's and the Gateway's chat-model
outcomes would need a new daemon<->gateway health RPC for one status line, and
a per-process line is true where an aggregate would be a claim about a process
the answering one cannot see.
/agents' published description is still left to archie-core-mxls, unchanged.
The reaper's deferred forgetTeardown could delete a container's teardown
entry between the reaper's own claim and Release's later claim check.
teardownLocked then recreated a fresh, unclosed entry, letting Release
believe it still owned teardown and re-run ContainerStop/ContainerRemove.
Release is now the sole owner of deleting the entry, since it always
runs for every acquired container.
Timer.Stop cannot unwind a max-uptime callback that has already begun, so
cancelling still let the reaper and Release both stop and remove the same
container, which is the duplicate teardown and the misleading 'No such
container' warnings this was meant to remove.
Teardown is now claimed once per container: whichever of the two gets there
first talks to Docker and the loser skips to its own bookkeeping. Release
still claims after the grace period, so MaxUptime keeps biting during it.
Also table-drives the event pump priming cases, per the repo's test directive.
The reaper was cancelled at the top of Release, before the grace-period
sleep, which let a container outlive MaxUptime by GracePeriod. MaxUptime is
documented as a cap from creation enforced regardless of task state, and a
grace period is task state, so the cancel belongs after the sleep.
Also asserts the disarmed reaper directly rather than only inferring it from
the absence of later Docker calls.
The timer stayed armed after Release removed the container, so an hour later
it stopped and removed an ID Docker had already forgotten and logged two
warnings that read like a failed teardown.
WIRE: Config.MaxUptime and Acquire documented a hard container lifetime cap
(PRD section 4), but the code only wrapped ContainerCreate/ContainerStart in
a MaxUptime deadline that was cancelled when Acquire returned, so no running
container was ever killed. Wire the documented cap with a per-container
timer that stops and removes the container once the cap elapses.
Autonomous workflows now have exactly one production boundary: a task-scoped archie-agent receives a full-task core-NATS request and runs the worker-local stage loop. The legacy [agent] section remains decode-only for migration; it no longer selects runtime behavior.
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.
WriteTaskJSON wrote task.json to the worktree root -- the same worktree
the agent commits from. CommitAll stages with go-git's All option, and
go-git's Add does not honour .gitignore or .git/info/exclude, so the
brief was swept into the agent's commit and pushed onto every task
branch. That is how a task.json for issue #57 ended up committed in
the repo root.
This is the identical failure the prepared sentinel hit; worktree.go
already documents the fix. Nothing under .git can ever be tracked, so
put the brief there rather than papering over it with an exclude.
/stop cancelled the chat turn but could not touch a task the daemon was
executing, and /cancel refused outright:
case statusRunning:
return fmt.Errorf("task is actively running; cannot cancel
until it reaches a waiting state")
So the one case worth interrupting was the one case neither command
would touch.
The daemon now holds a cancel function for every executing task,
registered in process() -- the single point every dispatch path reaches
-- so a task is stoppable for its whole life, including the slow clone,
worktree prepare and image pull that is exactly when someone realises
they asked for the wrong thing.
- /cancel <id> interrupts the work first, then records the terminal
state. That order matters: writing the state while the task still runs
invites it to write its own afterwards and win. A task the store calls
running that nothing is executing (crashed daemon) still gets its state
recorded, which is what unsticks it.
- bare /stop now stops the reply, the queue behind it, and every running
task for the identity, reporting which of those it actually did.
Nobody reaching for the brake should have to look up a task ID first.
- StopRunning deliberately writes no terminal state: a stopped task
unwinds to parked, which is resumable. Forcing rejected would discard
work worth keeping.
- Without a runtime wired, cancelling a running task is still refused --
recording it as cancelled while it carries on would be a lie.
Container teardown detaches from the task context. Release runs on the
way out, and the main reason a task is on its way out is cancellation --
at which point the graceful ContainerStop failed instantly and the
container was left to the forced remove. Cleanup gets its own deadline.
process() gained two statements and crossed the funlen limit, so the
container setup block is extracted rather than suppressed.
- bodyclose: add deferred resp.Body.Close() in storage_test.go Docker test handler
- contextcheck: thread context through email handleSMTP/processMessage; replace
context.Background() with context.WithoutCancel(ctx) in telegram, webhook, webui
shutdown paths and container pool cleanup; add ctx parameter to Pool.Release
- containedctx: replace ctx context.Context struct field with stopCh chan struct{}
in StdioTransport and SSETransport; thread lifecycle context through goroutine
chains instead of storing it in structs
- fatcontext: lift context deadline derivation out of PrefetchContext loop
golangci-lint run --fix plus the formatters: errorlint, gocritic,
sloglint, usestdlibvars, usetesting, gci, gofumpt, goimports.
160 issues -> 130.
One autofix was wrong and had to be reverted by hand. gocritic rewrote
ctx, cancel = context.WithTimeout(ctx, m.prefetchTimeout)
to `:=` inside an if-block in internal/memory/manager.go. That does not
compile, which is the good outcome — had it compiled, the shadowed ctx
would have scoped the timeout to the if-block and the prefetch deadline
would silently never have applied. Restored the assignment and commented
why it must not be a declaration.
Worth recording: --fix is not a safe no-op. It broke the build on a
24-file change, and the failure mode it was one compiler error away from
was a silent behaviour change.
archied's container-mode agent tasks were all failing with "nats: no
responders available for request" in production. Root cause: pool.go's
selfNetwork() auto-detects the daemon's own Docker network by looking up
a container named after os.Hostname(), then joins spawned agent
containers to that same network so they can resolve "nats" by name.
On carina this detection was silently failing (wrong/stale hostname vs.
actual container ID) and returning "", so every per-task agent container
landed on the default bridge network instead — unable to resolve "nats",
never subscribing, hence "no responders" on every request.
selfNetwork() swallowed every failure silently (only logged on success),
so this had no diagnostic trail.
Fix: added Containers.Network config field (containers.network in
config.toml) so deployments can name the network explicitly instead of
relying on fragile self-detection; selfNetwork() remains as a fallback
but now logs a warning on every failure path so this doesn't silently
recur. Wired through container.Config and cmd/archied/main.go.
- daemon.go: real bug — maybeRetryParked resolved fg := d.forgeFor(task)
(matching markDead's pattern) but called d.Forge.SetStateLabel instead
of fg.SetStateLabel, silently using the wrong forge client for
multi-identity/multi-forge task routing. Fixed to use fg throughout.
- telegram.go: updateThreadID existed but was never called anywhere;
wired it into updateLoggingMiddleware so debug logs include thread_id.
- Two SA9003 empty-branch tests (nell adapter_test.go, tools
toolentry_test.go) were dead assertions with no body; implemented the
actual check instead of deleting them.
- memory manager_test.go: mockProvider.lastConfigSchema/lastBackupPaths
were declared but never recorded; wired GetConfigSchema/BackupPaths to
populate them and strengthened the aggregation tests to assert on
per-provider content, not just counts.
- Removed genuinely dead gateway messageevent_test.go helpers (intPtr/
i64Ptr, marked //go:fix inline, already fully superseded by the new()
builtin used throughout the file).
- Remaining errcheck findings (defer Close/Flush/Write, os.Setenv, etc.
in test files) fixed with the existing `_ = ` convention already used
elsewhere in the codebase.
go build ./..., go test ./... (all packages ok), and
golangci-lint run ./... all clean.
Checkpoint commit covering concurrent work across several archie-core-abg
epics to avoid losing in-progress state:
- Memory manager (18.7-18.16): background sync pipeline, prefetch with
timeout, memory-write notification, threat scanning, shutdown drain
with abandoned-write tracking, frozen snapshot pattern. Wired
ScanContent and NotifyMemoryToolWrite into HandleToolCall so scanning
and notification actually apply to writes, not just exist as unused
primitives.
- Fixed a literal unresolved merge-conflict that had been committed to
internal/memory/scrubber/scrubber.go.
- Tool provider/registry, MCP client/transport (stdio, HTTP, SSE),
multimodal results, disclosure.
- Pairing device auth store, rate limiting.
- Gateway compression, session store, tasks.
- Various workflow, plugin host, and agentexec updates.
19 files touched. All fixes are in code — no lint configuration
weakened:
- Added unchecked error handling in defer cleanup paths
- Removed dead variables and unused functions
- Added missing imports (io in gitea.go)
- Simplified conditions (TrimSuffix, De Morgan, slices.Contains)
Also fixes JetStream TempDir teardown race (archie-core-340):
t.Cleanup(srv.Shutdown) now registers after t.TempDir() so
server shutdown (including JetStream files) completes before
temp dir removal. Added srv.WaitForShutdown() for deterministic
cleanup ordering.
Closes: archie-core-756, archie-core-340
Fix go vet/test failures by adding LinkBranch methods to stubForge, prCapturingForge, testForge, and fakeForge. Update test data from 'sam/archie' to 'acme/widget' and state label defaults from 'archie:*' to 'agent:*'. Add Taskfile.yml for project build automation. Implement container self-network detection so spawned agents join the daemon's Docker network.
Daemon previously processed one task at a time. Add bounded concurrent
dispatch for SQLite and NATS agent modes, reusing [containers].max_concurrency
(0 = unlimited). Same-repository tasks stay FIFO-serialized to avoid worktree
conflicts; different repositories now run concurrently.
Unblocks archie-core-l1q (NATS transport) and archie-core-g1l
(per-repo allow_concurrent override).
Fixes (4 items):
S4 — Add TypeScript, Deno, Bun cache ecosystems to
cacheVolumesByEcosystem. TypeScript shares node+pnpm volumes;
Deno and Bun get dedicated cache volumes.
R4 — Share single Docker client between container.Pool and
storage.DockerBackend. NewPool now accepts an optional
DockerClient in Config; if nil, creates its own. Pool
tracks ownership (ownCli) and only closes its own client.
S2 — Wire Storage.Teardown() call in daemon.process() after
workflow.Run(). Docker backend is a no-op; this closes the
interface contract for future backends.
R5 — Emit observability event on AugmentRegistry failure.
Previously only logged a warning; now emits a
'registry_augment_failed' event with error detail.
Promoted log level to Error.
Documentation (4 items):
D1 — Document PluginRegistry as reserved for future daemon
extension points (forge resolvers, storage backends, etc.)
S1 — Fix /data/ layout comment to reflect actual task.json path
(/data/worktree/task.json, not /data/task.json)
S3 — Add TODO(PRD §3) for session.jsonl, memory.jsonl, plugins/
volume — these need agent-side implementation first
N6 — Document that VolumeInspectOptions{} requires moby v25+
(go.mod pins compatible version)
N7 — Document that _Plugin.IValue is required by Yaegi interface
bridging; warn that go generate strips nil-guards
Test: TestCacheMountsForTypeScript verifies typescript ecosystem
returns node+pnpm volumes sorted by destination.
Verification: single client.New(client.FromEnv) in main.go;
all 21 storage tests pass; full suite green.
Introduces the storage.Backend interface for pluggable container mount
management. The Docker implementation (DockerBackend) is the MVP —
no NFS/SMB/S3, just Docker volumes + bind mounts.
/data/ volume layout:
/data/worktree/ — bind mount of host worktree (always)
/data/repo/ — per-repo Docker volume (when persistent_storage = true)
/data/cache/go/ — shared GOMODCACHE volume
/data/cache/node/— shared npm cache volume
/data/cache/pnpm/— shared pnpm store volume
/data/cache/pip/ — shared pip cache volume
/data/cache/cargo/— shared Rust cargo cache volume
/data/task.json — boot-time brief (existing WriteTaskJSON)
Changes:
- internal/storage/: Backend interface, DockerBackend, Mount types,
ecosystem-to-cache-volume mapping, ConvertMounts helper
- container.Pool.Acquire: now accepts []storage.Mount instead of
hardcoding a single bind mount — mount list comes from the storage
backend
- daemon.process(): calls d.Storage.Setup() to build the mount list,
passes Ecosystem + PersistentStorage from repo config
- config.Repo.PersistentStorage: when true, a named Docker volume
(archie-repo-<owner>-<repo>) is mounted at /data/repo and survives
task completion
- main.go: creates DockerBackend when containers are enabled
21 tests: interface contract, ecosystem cache mounts (go/node/
python/rust/custom), worktree bind mount ordering, persistent
storage on/off/empty-owner guard, mount list sort+dedup, adversarial
(nonexistent worktree, empty ecosystem, unknown ecosystem).
Why: daemon-managed cache volumes mean warm GOMODCACHE/npm cache
across tasks. Per-repo persistent volumes preserve expensive build
artifacts. The interface leaves room for future backends without
rewiring container orchestration.
GracePeriod now enforced in Release(): if > 0, container stays alive
for the configured duration after task completion before being killed,
per PRD section 1.
WriteTaskJSON now called from daemon.process() before container
Acquire, writing the task payload to <workspace>/task.json per
PRD section 3 /data/ layout.
PluginSpecs populated from TaskContext.SkillPlugins into the
Request sent to the agent. PluginSpec type added to protocol.go.
pluginSpecs() converts skill.Plugin → agentexec.PluginSpec for
transport. PRD section 5 Layer 1.
Gap 8 (frontmatter plugins key): add Plugins []string to
Metadata.Archie struct. Parses the plugins list from SKILL.md
YAML frontmatter per PRD section 5.
Gap 2 (grace period): add GracePeriod field to container.Config,
distinct from MaxUptime. MaxUptime = total container lifetime cap.
GracePeriod = idle time after task completion before kill.
Documented per PRD sections 1 and 4.
Gap 6 (task.json): add TaskPayload struct and WriteTaskJSON
function to internal/container. Daemon writes the task payload
to <workspace>/task.json before container start, matching the
PRD section 3 /data/task.json boot brief.
Gap 2 (MaxUptime): container created with context deadline when
MaxUptime > 0 — Docker kills the container on expiry.
Gap 6 (/data/ volume): mount worktree at /data/worktree instead of
/workspace, matching PRD section 3 volume layout.
Gap 4 (per-task subjects): change SubjectForAgentRequest from per-stage
(archie.agent.<id>.<stage>) to per-task (archie.agent.<id>.request).
Stage name is carried in the AgentRequestMessage payload. PRD section 2.