The index built google/codesearch over the chat workspace on every daemon
start, for the process lifetime, through a child-process helper and a
SQLite metadata DB -- and grep consulted it only for searches confined to
the workspace root, which the analysed sessions showed was a small
fraction of searches. The compute was continuous; the benefit was not.
Removes internal/indexing, the workspace-codesearch helper subcommand,
the [indexing] config section, and the GrepIndex accelerator seam from
the grep tool, which returns to its direct walk. google/codesearch
leaves go.mod with it.
A tool call rendered as a label line plus a ```text fence. Telegram draws a
fenced block as a full code widget (language header bar, copy button, panel),
and the block parser inserts a spacer paragraph before every block, so one
call cost four rendered elements. Three calls filled the screen to show three
word counts.
Every toolPreview path already summarises to a single line, so the fence was
never wrapping more than one. Drop it and put the preview on the header line.
Tool lines now join with a hard break rather than a bare newline: a soft
break would space-join them into one run-on paragraph, and a blank line would
put the spacer back. Three calls are now three consecutive blocks.
Two hardcoded values go with it. The status word is printed only when the
outcome is not success, since every line otherwise read "done" and
distinguished nothing. The icon is no longer a literal in the renderer: each
builtin declares its own on tools.Tool (not on Schema, which is the model's
contract), the provider carries it into ToolEntry, and the turn snapshots the
registry's icons alongside its tool set. A tool that declares none renders
without one rather than borrowing a generic wrench.
Carries a dependency upgrade (go.mod, go.sum, tools/go.mod, tools/go.sum).
MCPServer gains ParallelToolCalls (default false). The client's
per-server callMu is now nil for a server that opted in, so CallTool
stops serializing that server's calls and the caller's own concurrency
decides; every other server keeps exactly one tools/call in flight.
The flag is threaded from config through the provider constructor -
the only place MCPServer configs become Client instances - into
NewClient, in both the daemon and the agent worker.
* feat(workflow): post line-anchored review comments with suggested fixes
Bead archie-core-q9au (docs/prds/inline-review.md). A review's findings reached
the operator only as a flat list in the PR body, so the author had to map every
finding back to its line by hand and apply mechanical fixes by hand. Now the
line-anchored findings are also posted as inline review comments, carrying a
one-click suggestion when the reviewer could state the fix.
Domain (internal/domain/workflow):
- ReviewFinding gains Suggestion; Validate rejects one on anything but a
confirmed finding, so the agent's record_finding call is refused with
something it can act on. Validate splits into validateAnchor /
validateClassification / validateDisposition, which also brings it back under
the cyclop limit the gate enforces.
- StagePostReviewComments runs after StageOpenPR in the implement workflow. It
posts only line-anchored findings (Line > 0); a whole-file finding has no line
to attach to and stays in the body list, which remains the complete record.
It is best-effort: the PR is open and the body already lists every finding, so
a failed comment is logged, never a park -- the same reasoning as OpenPR's
existing best-effort LinkBranch call.
- The suggestion fence is gated on Verdict == confirmed where the fence is
written, because it is a one-click apply: a wrong suggestion breaks the code
and the author has to notice.
Forge (internal/forge): ReviewCommentWriter + GitHub/Gitea implementations,
type-asserted like PullRequestReader so a forge that cannot is skipped rather
than faked (NoopForge is pinned as not satisfying it). GitHub loops one
CreateComment per comment and joins the failures, so one refused anchor cannot
drop the rest; Gitea carries them on a single COMMENT-state review.
Two deliberate departures from the PRD's sketch, both recorded in it:
- The interface is batch (CreateReviewComments), not one call per comment:
Gitea's only inline shape is one submitted review, and the set then crosses
NATS once instead of once per finding.
- The head SHA is resolved inside each forge implementation rather than by the
caller. The stage runs in archie-agent, which holds no forge credentials and
has no PullRequestReader; the daemon-side forgerpc handler is the only place
that does.
Transport (internal/forgerpc): workflow.Forger gains the method, so the agent
reaches the daemon over the new create_review_comments subject; the server
type-asserts the writer and answers an incapable forge with an error the stage
logs. This is the one proxied method whose absence on an image skew does not
park a task.
The reviewer prompt and record_finding schema ask for a suggestion on a
confirmed, mechanically fixable defect only.
Regenerating the wfextract symbol table -- the documented way a new exported
workflow symbol reaches interpreted stage plugins -- also picked up symbols that
were missing from the committed table (the Status* and Source* constants,
ReviewCheck, Store, Task, and the _Store wrapper). Nil-guards were re-applied to
every wrapper afterwards, as that file's header requires.
Evidence: task check exit 0 (incl. 229 UI tests). Three mutations of the new
stage logic each fail a test that names the behaviour -- dropping the
confirmed-only gate, dropping the Line > 0 filter, and letting a posting failure
escape -- so the tests discriminate rather than passing vacuously.
* fix(build): drop the Dockerfile pin assertion
The guard fetched golangci-lint's go.mod at image build time to fail the build
when GOLANGCI_LINT_VERSION and GOFUMPT_VERSION disagreed. It only ever tripped
on self-inflicted pin drift, but it added a network fetch and a new failure
mode to the release build, which is not where that belongs.
The pins stay correct (golangci-lint 2.13.2, whose vendored gofumpt v0.11.0
equals GOFUMPT_VERSION) and the comment above them still states the invariant,
so the reasoning survives without the build-time machinery. The pin change
itself reaches the agent image through the normal release path: CI rebuilds
and pushes archie-agent on an archie/vX.Y.Z release, and a gateway-only
release deliberately does not.
* feat(workflow): add the remediate workflow for PR review remediation
Implements step 5 of docs/prds/pr-review-remediation.md: a remediate
workflow that resumes the task's existing worktree onto its PR branch
(worktree.Manager.Resume, not Prepare's refresh), runs a builder agent
against the review's actionable comments, commits and pushes to the
same branch, and replies via the forge's ReplyToReview. Task.RetryCount
doubles as the remediation round counter, capped by the repo's
max_retries; the round-cap stage parks the task and posts one comment
when it's hit.
Task gains a ReviewPayload field (JSON-encoded review unit) with full
store/proto/staterpc plumbing. workflow.Forger gains Comment and
ReplyToReview, proxied to archie-agent via a new forgerpc RPC. Resume
and its Dir lookup are added as an unexported optional Trees capability
rather than widening the exported interface, which is already at
golangci-lint's interfacebloat cap and is projected into wfextract's
Yaegi symbol table for repository-authored stage plugins.
The daemon-side reaction consumer that dispatches into this workflow
(subscribing ARCHIE_REACTIONS, grouping comments by review, enforcing
per-task serialization) is tracked separately in archie-core-8li9.4.
* feat(messaging): extract standalone messaging service binary and process composition
* feat(messaging): adapt channel frontends to consume Gateway ChatContract
* feat(messaging): remove in-process channels and Router from daemon bootstrap
Telegram, email and webhook now run only in the Messaging Service, which
reaches this process through the Gateway's ChatContract. The daemon builds
no channel and no gateway.Router, so the wiring that existed only to serve
them goes with it: setupGateways, setupEmailGateway, setupWebhookGateway,
setupTelegramGateway, buildTelegramRouter, makeTelegramReload and the
release-announcement path helper.
The seams those paths owned move to where they can still be honoured:
- Channel ValidateConfig runs in archiemessaging.compose, which now returns
an error, so a configured-but-invalid front-end fails the service rather
than being dropped silently.
- The inbound rate limiter moves to the Gateway process, which owns the only
Router and therefore the only place a per-sender budget applies to every
channel's turns.
- The daemon's gateway readiness probe becomes a ContractProbe against the
Gateway. It cannot observe a channel lifecycle it no longer runs, and a
channel-count probe would have reported every daemon degraded.
- telegramSetup is now chatSetup (in chat_setup.go), trimmed to the fields a
chat turn runner actually reads.
Telegram operator features that were wired only in the daemon (/update,
release announcements, version reporting, SIGHUP reload) are not yet wired
in the Messaging Service: archie-core-8cda.6.6. Channel lifecycle reporting:
archie-core-8cda.6.8. The Gateway process builds no worktree manager, so
review_pr is unadvertised on every channel: archie-core-8cda.6.7.
* feat(messaging): re-wire the Telegram operator surface in the Messaging Service
setupTelegramGateway satisfied eight telegram.Gateway seams from the daemon's
own process. Each is resolved by where the fact it needs is owned, not by
where it used to be built; the decision table is in
docs/architecture/migration-decisions.md.
Wired here: /update (built from this service's own [chat.telegram] check and
install commands), the update-report relay (same sha256(bot_user)[:8] path the
daemon wrote, so a pending report is found rather than written afresh),
show_tool_calls, and /restart's config reload, which re-resolves the token and
allowlist from this service's own file and refuses a reload that resolves to
an empty token.
/version is sourced from the Gateway: ChatSnapshot gains a Version field
carrying the Gateway's rendered build block, read per call and bounded by the
dependency timeout. cmd/archie-messaging deliberately takes no version
ldflags, so it cannot report a partial upgrade as a matched one.
RunningVersions and ReleaseAnnouncements stay nil. Both need a component's
real running version, and the only versions this process can obtain are a
different binary's stamps -- reporting them would manufacture exactly the
false success the update check exists to catch, and the announcer without
parseable versions is a no-op that reads as configured. archie-core-8cda.6.9
carries the contract that unblocks them. Dangerous stays nil: no composition
has ever supplied a command authority.
Enrich is dropped from the update service: componentInstallTypeEnricher read
[nats], which this service must not decode, so the check command's own
reported install type stands.
* fix(workflow): guard inline review comments against head drift
Two findings from the review of q9au.
A comment's line numbers describe exactly one revision of the branch, but the
forge resolved the pull request's head at posting time -- after the review had
already read the worktree. A push in that window (a collaborator, a retry) meant
the findings were anchored to whatever now occupied those lines, mislabelling
instead of failing. The revision the review measured now travels with the
comment set: OpenPR records it from the same worktree read it already performs
(TaskContext.ReviewedHeadSHA), StagePostReviewComments threads it through
Forger to forgerpc, and the forge refuses the whole set once the head it reads
has moved off it -- which the best-effort stage logs, the PR body remaining the
record. An unmeasured revision posts unverified rather than dropping every
finding, so a worktree that cannot report one degrades instead of regressing.
Suggestion was documented single-line only, because GitHub applies a suggestion
fence up to its first line and a multi-line replacement would silently corrupt
the file. Only the verdict was validated, so a multi-line suggestion reached the
renderer and posted as that truncated fence. Validate now rejects an embedded
newline, which makes record_finding refuse it with feedback the model can act on
instead of the reviewer discovering the corruption later.
* chore(plugin): delete the unwired capability-host health surface
plugin.Host.Health, plugin.Host.Manifests, ModuleStatus and their private
safeHealth helper were implemented, exhaustively tested, and called from nowhere
but their own tests. AGENTS.md forbids speculative surfaces, and no settled
design places plugin module status anywhere that exists:
- docs/prds/status-health-surface.md Phase 2 is self-described as "a proposed
resolution, awaiting Sam's sign-off -- not yet implemented", and does not
mention plugin status even in that unapproved list.
- The readiness subsystem enumerates exactly five probes -- state_db, config,
disk, model, gateway (internal/app/archied/readiness.go) -- with no plugin
probe.
- docs/architecture/plugins-and-extensions.md names no operator-visible plugin
status surface.
- The only bead naming it is closed.
plugin.Host itself stays: it is the daemon's live capability host, constructed
and Start/Stop-ed from internal/app/archied. Only the unconsumed observability
methods go.
host_contract_test.go encoded the defect -- it asserted plugin.Host *defines*
"Health" and "Manifests" -- so those two names are removed from its list, which
is now exactly the shipped lifecycle: Register, Start, Stop. The three tests
covering the deleted surface are removed with it.
The Yaegi symbol table (internal/plugin/pluginextract) was regenerated rather
than hand-edited, so ModuleStatus leaves the reflected type set with it.
Reachability evidence: Host.Health and Host.Manifests appear only in their own
tests; plugin.Host is otherwise reached from bootstrap.go and gateway.go for
Register/Start/Stop. Note that "task reachability" does NOT flag these -- the
address-taken constructor is a known blind spot of the whole-program RTA.
* chore(plugin): delete the dead Module.Health chain wired to nothing
Extends the capability-host observability deletion: plugin.Module.Health
was a required interface method with real implementations in
tools/provider/mcp and tools/provider/builtin, aggregated by
tools/provider.Registry.Health via a provider-package-local safeHealth,
and backed by per-module LifecycleState bookkeeping in plugin.Host
(registeredModule.state, setModuleState). None of it had a caller before
this change -- Host.Health was the only thing that would ever have read
a registered module's Health(), and Host.Health was already deleted as
unreachable. registeredModule.state was write-only: nothing ever read it.
Deleted:
- plugin.Module.Health, plugin.Health/HealthStatus (+ consts),
plugin.LifecycleState (+ consts), legacyModule.Health,
registeredModule.state, Host.setModuleState and its call sites.
- tools/provider.Registry.Health, tools/provider.safeHealth.
- tools/provider/mcp.Provider.Health, tools/provider/builtin.Provider.Health.
- Tests exclusively covering the above, and fakes' now-unnecessary Health
methods (plugin/host_test.go, pluginextract/reachability_test.go,
tools/provider/{provider,optional}_test.go, tools/provider/mcp/provider_test.go,
app/agentworker/mcp_providers_test.go).
internal/plugin/pluginextract's generated file was regenerated via
`go generate ./internal/plugin/...` and the yaegi wrapper nil-guards
(dropped by fresh generation, as documented in reachability_test.go)
were reapplied by hand to WManifest/WStart/WStop/WName/WVersion,
following this repo's established post-regen pattern.
Deletes internal/memory (Manager, builtin.Provider, memory_edit tool) now
that slices 2-4 built the CRUD engine family and its per-turn read/write
seams. Also deletes internal/infrastructure/memory/builtin/provider.go (the
memory_edit adapter over the old package -- its markdown store already
relocated in slice 2), internal/tools/provider/memory (the old tool
registration, redundant with slice 4's memory_create/update/delete/list),
config.Memory.{Provider,ProviderConfig} and the validateMemory rejection
that existed only to complain about Provider, and webui.MemoryStatus/
MemoryProviderHandle plus its dashboard page -- never wired in production
(s.Memory was always nil), confirmed by /api/capabilities always reporting
"memory": false.
Rewrites ARCHITECTURE.md's "Memory engine family" section to describe the
current engine (internal/domain/memory contract, internal/infrastructure/
memory builtin engine + its builtin/ markdown store, the per-turn read seam
in gateway/turn_memory.go, the per-turn write tools in
gateway/turn_memory_tool.go) instead of the deleted Manager. Fixes two
docs/architecture/configuration.md rows that described the deleted
manager's literals and SaveConfig mechanism.
internal/tools/builtin.RegisterBuiltins has always accepted a GrepIndex and
nothing ever passed one, so every grep ran the direct walk no matter what
[indexing] was set to. internal/indexing was fully implemented and tested
with zero production callers, and internal/config decoded IndexingConfig into
nothing. Two halves of one defect.
The composition root now builds an indexing.Manager and hands it to the
workspace tool provider, which forwards it to RegisterBuiltins. deadcode
confirms the result rather than the commit message asserting it: unreachable
functions drop from 88 to 73, and all 15 internal/indexing entries are gone.
Failure degrades rather than propagates. A manager that cannot build logs a
warning and grep keeps its direct walk, which is exactly what it did before
this was wired. An accelerator must never stop the daemon starting.
The context is detached with WithoutCancel rather than replaced with
Background: the index build's lifetime is the process, while the gateway
path's boot context is cancelled once startup returns, so inheriting
cancellation would kill the build mid-flight. Background would have satisfied
the linter too, but would silently drop the caller's context values, so
registerTools now takes the context its callers already had.
internal/agentexec's RegisterBuiltins call is deliberately left alone. It
registers builtins only to harvest their names for a plugin tool-name
collision check and never executes them, so there is no grep there to
accelerate.
WIRE: the SSE transport's Stop contract already says it closes the
connection and waits for background readers, but the reconnect loop issued
its HTTP GET with the Start context, which Stop could not cancel, so Stop
blocked on readerWg.Wait() against an unreachable endpoint. Wire a
per-lifecycle cancel (mirroring the stdio transport's stopCh plus guarded
commit) so Stop interrupts the in-flight reconnect request.
WIRE: read and edit each declared a DefaultToolTimeout deadline and then
discarded it, so the documented contract (Tools that exceed this are
cancelled) was a no-op on the live tool-executor path. Wire the deadline
through runWithContext, the same helper write already uses, so a hung
filesystem cannot block the tool executor.
DELETE: mcp.Client.RegisterTools and its handlerFor/writeMultimodalResult
chain, plus the WithMediaDir and WithParallelToolCalls options, had no
production caller -- the live adaptation path is provider/mcp.Provider,
which now owns binary media persistence itself. A repo-wide search finds
no remaining reference outside the composition contract test that asserts
RegisterTools must not appear, so the two paths can no longer diverge.
WIRE: the live provider/mcp adaptation path is the only production MCP
consumer and its handlerFor detected image/audio/resource-blob blocks but
returned an empty MultimodalResult, so telegram_setup's multimodalMediaRefs
(which reads only result.URLs) had nothing to deliver. Decode each media
block into the provider's media root and populate Files, SubdirHint and
URLs with local-path refs the channel uploads.
RegisterPluginTool/SetPluginToolExecutor/UnregisterPluginTools and the
PluginToolDef/PluginToolExecutor types have no production caller.
Plugin/MCP tool registration flows through agentexec.pluginToolSet and
internal/tools.Registry, not this staging registry (tools-builtin-2,
duplicate of tools-core-8).
Registry.Discover, DefaultRegistry and the go/ast extraction helpers
have no production caller; static source discovery has no PRD and no
consumer. Production registration goes through bootstrap.go's
toolReg.Register and the provider Registry's RegisterBatch (tools-core-3).
DispatchSequential, DispatchConcurrent, ClassifyEntry and their
supporting types (dispatch.go) have zero non-test callers; the live
tool path is agentexec/toolset.go's BuildToolSetFrom. Removes the
dead engine and its tests, and updates the PRD status table that
referenced it (tools-core-1).
checkRecursiveDelete compared the raw segment name, `seg.Name != "rm"`, while
every sibling rule in the same table resolves the command through baseName --
checkMkfs, checkBlockDeviceWrite, checkKillAll, checkSystemPower,
checkSelfTermination and checkDaemonLaunch all call baseName(seg.Name), and
baseName's own doc says its purpose is that /sbin/reboot and reboot are judged
the same. The test suite already pinned that convention for /sbin/poweroff.
Because tokenise yields the raw first word, `/bin/rm -rf /` produced
seg.Name == "/bin/rm", the rule declined, no other rule matched, and Hardline
returned nil. Since provider/builtin calls command.Hardline on the shell tool's
command field before every execution, an absolute path defeated the
recursive-root-delete gate entirely. `/bin/rm -rf /etc` (any critical path, not
just the root) was equally reachable; an overlay probe confirmed both, and
confirmed the sibling /sbin/poweroff case was already correct.
Resolve through baseName, matching the rest of the rule table, and add table
cases for absolute-path rm plus an allow case for an ordinary absolute-path
recursive delete so the normalisation cannot over-block.
Found by an adversarial package sweep (temp tracker: tools-command-1,
.local/issue-tracker/).
Compose the base registry with per-turn extras into a turn-local registry and
let ContextPressureGate decide full-vs-bridge disclosure per chat turn. The
three bridge tools (tool_search, tool_describe, tool_call) are now wired into
the chat toolset and only disclosed under context pressure, keeping the LLM's
schema footprint small while preserving full arsenal access on demand.
Per-turn extras are identity-bound per channel and cannot live in the
process-wide registry (agentexec.BuildToolSetFrom invariant), so the bridge is
composed turn-locally rather than registered globally. Thread the model's
context window through TurnModel.Prepare (TurnPrepareContext) so the gate
activates with a real window.
Refs #167
- mcp client_test: assert both initialize handshake calls happened and
notifications/initialized has an empty ID, not their exact order
- telegram model_test: assert the resolved model has an openrouter/
prefix instead of scanning button text for the string; replace the
single-hardcoded-count pagination test with cases covering 0/1/8/9/100
models so pageBounds and nav-row logic are actually exercised
- webui api_chat_test: assert the actionable file path is present in the
streamed error instead of matching generic wording
- tomlwrite.go: split Apply into collectPending + an applier struct
(indexTables/resolveTable/matchActiveKeys/uncommentKeys/
appendMissingKeys/render). gocognit 82 -> under threshold.
- find.go: split findWalkVisitor's closure into findSkipEntry/
findMatchesFilters. gocognit 46 -> under threshold. This clears the
last complexity finding from archie-core-agui's original 31.
- richblocks.go: go fix modernization (strings.SplitSeq).
Behavior-preserving.
Extracts focused helpers out of applyEdits, grepFallback/grepDirFallback,
serveReadContent, handleChatStream, TDD, runFindGoFallback,
makeGrepExecutor and makeShellExecutor to bring them under the
project's cyclop/gocognit/funlen thresholds. Behavior-preserving.
Partial pass on archie-core-agui: richblocks.go (gocognit),
gateway.go dispatchLocal (gocyclo), and a couple of remaining
gocognit/nestif findings are left for a follow-up.
Follow-up to the cmd/archied -> internal/app/archied wiring extraction:
the architecture test that greps main.go for required wiring strings
still pointed at the old cmd/archied path.
Follow-up to e5e0316, which claimed non-delivery is never silent and that
oversized files fail visibly. Both claims had gaps.
chatStreamSink.Media skipped any attachment with an empty URL, exactly as
liveReply.Media used to. The tool registry is shared between the Telegram
and dashboard chat setups, so send_file is offered on the dashboard too:
the model announced a sent file, the sink dropped the event, and nothing
reached the transcript. The dashboard cannot upload at all, so the fix is
to REPORT the file as undeliverable and name where it is on the host,
rather than to stay quiet. The skip was right while media meant a hosted
URL; it stopped being right when a host path could arrive here.
send_file applied one 50MB ceiling to every type while the sender enforces
10MB for photos, so an 11-50MB image passed the early check, was reported
sent, and was rejected by a layer the model cannot see. The early check is
now per-type and mirrors the sender's limits.
MediaType called every image/* an image, but a photo endpoint rejects
image/svg+xml and image/tiff outright. Photo-safe formats are now an
explicit set, so an svg goes as a document and arrives, which is what the
"unrecognised means document" reasoning intended all along.
Also tests the readability probe's own error path (mode 0000), which was
the one case it exists for and the one case not covered; verified it fails
with the probe removed.
Remaining review findings are filed, not fixed: fallback lines appended
after the live reply finalizes are dropped by a stopped renderer
(archie-core-atv2), confinement is symlink-blind and re-opens after
checking (archie-core-jkmu), and concurrent uploads are uncapped
(archie-core-3svc).
The agent could produce a file -- a transcript, a log dump, a screenshot --
and had no way to hand it over. Asked to send one it offered a "download"
link; nothing arrived and it had no signal that anything had failed. The
defect was not that it lied: success and silent non-delivery were
indistinguishable to it.
Three places made a local file undeliverable, and each is fixed here:
- liveReply.Media skipped any attachment with an empty URL, so a local
file was dropped before it ever reached a sender.
- telegramMediaSender built every attachment as models.InputFileString,
which tells Telegram to FETCH the string as a URL. A host path is not
fetchable, so the send did nothing while reporting success. It now
chooses by what the attachment carries: URL -> fetch, Path -> upload
via models.InputFileUpload over an open file.
- Nothing let the agent ask for a send at all. New send_file tool
(internal/tools/sendfile) validates the file and returns a
MultimodalResult naming it; the turn's channel delivers it.
Meaning changes, called out because the names did not:
- MediaAttachment gains Path, the alternative to URL. Exactly one is
meaningful for an outbound send.
- tools.MultimodalResult.URLs used to mean remote-hosted media only; it
now means media this result wants delivered, which may be local. JSON
name unchanged so existing producers keep working.
- errNoURL is now errNoSource: having neither source, not having no URL,
is what makes an attachment undeliverable.
Failures are visible at every layer, which is the actual fix. send_file
errors on an absent, irregular, unreadable, oversized or confinement-
refused path, so the model sees it and can report it. The sender checks
Telegram's ceilings (10 MB photos, 50 MB otherwise) before the request and
reports the real size rather than leaving a 400 nobody reads. A delivery
that still fails now appends "could not send <name>" to the reply instead
of an empty link, which read as a delivered file.
Exposing a public URL for local files was explicitly rejected: it trades a
missing feature for a hosting and access-control problem.
send_file resolves paths through builtin.ResolveReadable -- the read tool's
own policy, exported rather than reimplemented -- so sending cannot reach
what reading cannot, whatever [chat] unrestricted_filesystem is set to.
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.
Render completed ToolCallEvents as Telegram-safe streaming blocks
with compact name/status and a short cleaned preview. Summarize
file contents and listings instead of dumping source or quoted
JSON. Collapse repeated legacy turn-budget failures.
Remove max_tokens turn gating and the 200000 turn_budget_chars
default so absent or commented config cannot restore an aggregate
cap. Keep per-result max_result_chars and spill.
Confine find/grep discovery to the active workspace/worktree.
Refs #604
internal/tools/minimax wraps MiniMax's v2/video_generation (submit)
and v2/query/video_generation/{id} (poll) endpoints. Generation is
asynchronous on MiniMax's side but archie's tool subsystem has no
async-tool flow control (ToolEntry.IsAsync carries no flow control
today), so GenerateAndWait blocks the calling goroutine -- a tool
call, not the model's own generating goroutine -- submitting and
polling until the job reaches a terminal status or MaxWait elapses.
The poll loop tracks elapsed time purely from its injected Sleep
calls rather than a real time.Now() deadline, so a test that fakes
Sleep as an instant counter also makes the loop terminate instantly
instead of spinning in real wall-clock time.
Text-to-video only for now; image-to-video (image_url content items)
is a schema-and-routing change this can grow into. The tool returns a
tools.MultimodalResult carrying the video as a URLs entry -- the
shared envelope the gateway wiring downstream turns into a delivered
attachment.
MultimodalResult only modeled local bytes written under SubdirHint
(Files). A tool whose media lives at a remote, already-hosted URL --
a generation API's result, for example -- had nowhere to put it.
MediaRef{Type, URL} and the new URLs field give it one, reusing the
existing envelope rather than forking a second convention for the
same concept.
Ephemeral task containers re-resolve and re-download npx-launched MCP
server packages from the npm registry on every task, since each task
gets a fresh container with no persistent cache -- a worse amplifier
of a registry outage than the daemon-restart case d4bb914b already
fixed.
Extract the daemon's npm-cache env logic into mcp.NpmCacheEnv, shared
by both the daemon's own long-lived npx MCP servers and archie-agent's
per-task ones. Mount a new archie-cache-mcp-npm Docker volume at
/data/cache/mcp-npm on every task container regardless of ecosystem
(MCP servers are daemon-wide config, not tied to the task repo's
language), and point npx-launched per-task stdio transports at it.
Closes archie-core-qk8m.
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.
Adds a human-consent gate for tools marked RequiresApproval, exposes
session management as LLM-invokable chat tools, and gives the operator
/delete to retire conversations permanently.
**Tool-approval gate (internal/tools, internal/agentexec)**
- ApprovalRequester contract lives in internal/tools (not gateway) so
agentexec can import it without pulling in the chat-adapter stack.
- ToolSetOptions.Approval wires the approver through to toolExecute.
- BuildToolSetFrom omits RequiresApproval tools when no approver is
configured; dispatch paths (invokeTool, tool_call bridge) refuse
them too, so the invariant holds at every indirection.
- The gate fails closed: only Approved/PermanentlyApproved pass;
an unknown decision value from a faulty approver does not execute.
- Tool-level timeout (2 min) returns a plain error, not a context
cancellation, so the model can report "approval timed out" instead
of the turn aborting.
- BuildApprovalDescription callback lets a tool surface the specific
resource being acted on ("Delete session \"abc123\"") rather than
showing a static tool description.
**Session tools (internal/gateware/session_tools.go)**
- session_list (idempotent), session_resume (mutating), session_title
(mutating), session_delete (mutating + RequiresApproval).
- Scoped to the current platform + channel: GetByChannel replaces
List() so a model in chat A cannot list or manipulate chat B.
- session_title validates the session belongs to this channel before
writing; session_resume/session_delete resolve refs against the
channel-scoped list.
- Shared limit helper extracted to tools.ListLimit.
**Telegram approval adapter (internal/channels/telegram/approval.go)**
- telegramApprover implements ApprovalRequester via the three-button
inline keyboard (Approve/Permanent/Deny). 2-min token expiry.
- Own map + mutex + "approval:" callback prefix — separate from the
dangerous-command system.
- Permanent approval uses exact-match (not prefix) lookup keyed by
action + resource description, so permanently approving "delete
session abc123" only covers that one session, not every call to
session_delete for 24h.
**Session lifecycle**
- /delete <session-id>: removes a session and its history. Refuses
prefixes shorter than 4 chars even when unique. Exact ID wins over
an ambiguous prefix. sessionTracker.forget sweeps every channel+
thread pointing at the deleted session.
- Extracted resolveSessionRef and shortSessionID for /resume and
/delete to share.
**Wiring**
- submitTurn builds the approver onto ctx before the LLM turn.
- chatGenerateOptions reads approver from ctx, passes it through
ToolSetOptions.
- SessionTools built per turn on the current message, combined with
taskTools into a single toolset.
- Reword docs and comments to drop vague "legacy" qualifiers where they no longer describe deprecation status
- Remove unused code: RecentEvents, MessageEvent.ToLegacy, index setState, stderr redaction tool, telegramOnlyCommands
- Delete or comment out tests covering removed or superseded behavior
The WalkDir callback swallows every per-entry error and returns nil,
so the only error that can escape is ctx.Err() from the cancellation
select. The old guard compared that error against itself and never
fired, so a timeout or /stop fell through to whatever partial matches
had accumulated, or "no matches found" when it had none -- telling the
model a search found nothing when it never finished.
Refs archie-core-ts9
provider.Registry.Start was atomic for every provider: one failure
unregistered every other provider including the builtins, returned an
error up through the capability host, and exited archied. Under
Restart=on-failure that is a crash loop. Observed on carina 2026-07-30 --
mcp.desktop-commander could not start because the runtime image was
missing unzip, and the daemon restarted continuously, losing chat, the
gateway and every builtin tool over one third-party npm package.
Atomicity is right for a provider archied requires. It is wrong for an
external MCP server pulled from a registry at runtime, which is exactly
the category allowed to be absent -- the same reasoning already applied
to the forge, and to containers.
RegisterOptional marks a provider the daemon can run without. Its
failure to start, discover or index stops only itself and excludes it;
Register keeps today's rollback. Required/optional is a deployment fact
rather than a property of the code, so the registrar states it instead
of the engine declaring it in its own manifest -- which also keeps
plugin.Manifest metadata-only, per the plugin engine rule.
A skipped provider's dependents cannot run either: an optional dependent
is skipped with the reason, a required one is a hard failure, since it
declared it cannot work without something now absent.
Degradation is reported, not silent -- Health goes degraded naming each
provider and cause, Skipped() exposes the set, and the daemon logs one
error line per exclusion. Silence is how this went unnoticed until the
crash loop. A provider that half-started before failing is still
stopped, so no child process is left behind.
The regression test drives the real capability host, the path main.go
calls: with desktop-commander registered as required it fails with the
verbatim carina error, and as optional the daemon starts with its
builtins intact.
Closes archie-core-ky6
The rg package carried three platform binaries (14MB) inside the Go
binary and extracted the matching one to a temp file on every single
run, so a long-lived daemon left a trail of copies behind and paid the
write on each grep. Nothing depended on ripgrep's own output format.
grep now uses the Go implementation unconditionally.
The nestif extraction in 712388d pulled --provider handling out of
parseModelRest into a helper that took modelParts by pointer and
appended every surviving field to it. The caller's own loop appended
the same fields again, so every model name was doubled: /model gpt-5.6
asked the router for "gpt-5.6 gpt-5.6" and SetActiveModel rejected it
as unknown. The index loop becoming a range loop also stopped the
space-separated "--provider openai" value being consumed with its flag,
so it landed in the name too. Direct model switching over Telegram was
broken for everything but --refresh and provider-only switches.
splitProviderFlag is now the sole accumulator and returns the surviving
fields, so the shared-slice shape that allowed the double append cannot
recur (archie-core-0d6).
Found while auditing the remaining hunks of 6108fc5 (archie-core-ifi):
the naked return in the same function could not be regression-tested
until the function produced correct values. That audit is complete and
the other seven hunks are behaviour-neutral. Notably shell.go's
errorlint rewrite is not a repeat of the grep failure - it had no
companion exit-code condition to drop, and the ctx.Err() timeout check
already runs first - and find.go's errors.Is rewrite is safe because
errors.Is(err, nil) is false for any non-nil err.
Tests cover the return order of parseModelRest (two strings and three
bools, so a transposed pair compiles silently), the field count of the
model name, and shell's exit-code branch, which had no coverage at all.
The find fallback's habit of reporting a cancelled walk as "no matches
found" is filed as archie-core-ts9.
An errorlint autofix rewrote the ExitError check to match any exit
code, so a search that never ran (bad pattern, unreadable path) was
reported as "no matches found". Keep errors.As, restore the exit-code
check, and add a regression test.