Commit Graph
1154 Commits
Author SHA1 Message Date
sam d783bebf37 fix(telegram): address greptile review on tool-result rendering
Four findings from review, all valid:

1. Search detection is now gated on the tool name rather than applied to every
   result. A compiler diagnostic ("file.go:42: message") has the same shape as
   a search hit, so counting it reported a build error as "N matches" and hid
   the diagnostic.

2. Only ripgrep match lines are counted. The hyphen context form
   ("path-N-text") and "--" group separators were being counted as matches, so
   a search with context requested reported the match count plus every
   surrounding context line.

3. The notice parser accepts shell's "showing last N/M lines" form as well as
   the plain "showing N/M lines" one. Shell emits the "last" form, which failed
   integer parsing and was not recognised as metadata -- so a truncated shell
   result quoted the raw truncation notice as its preview, the exact defect this
   change set out to remove. The summary now also states which end was kept
   ("97 lines total; showing last 66" for a tail truncation).

4. The renderer cases are consolidated into one table-driven test per the
   development protocol in AGENTS.md, covering all four defects above plus
   singular/plural, colons in paths, and module-cache noise.
2026-09-17 09:49:49 +00:00
sam 72bc95cc00 fix(telegram): summarise tool results instead of quoting an arbitrary line
Operator report: tool output in the Telegram channel was unreadable during
search-heavy turns -- a wall of fenced blocks each showing one arbitrary
match line ("/path/config.json-322-          }") under a heading that said
only "grep -- done".

The renderer quoted the first non-module-cache line of a result and appended
a line count recomputed from its own truncated sample, which could not agree
with the total the tool had already reported: one search rendered the tool's
"194 more lines" beside our "… 3 more lines". Two different numbers for one
result set read as noise, and the quoted line carried no context at all.

- Describe, don't quote: a search is reported as "N matches", a truncated
  result as "<total> lines total; showing <n>", and every other tool falls
  back to its first informative line. Truncation notices are skipped, since
  they are metadata rather than content.
- Never invent a count: the tool's own reported total is the only
  trustworthy source, parsed from its truncation notice rather than
  recomputed from the visible sample.
- Remove the now-dead compactToolPreview and countNonEmptyOrContentLines.

Also bump go-telegram/bot v1.25.0 -> v1.27.0, which fixes a streaming bug
that lands squarely on this path: rawRequest sent the multipart body through
an io.Pipe, which net/http cannot replay, so sendMessage/editMessageText
failed until the connection was dropped.

Remaining work from the report (collapsing repeated calls into one counted
entry, and a ring of recent activity lines with a capped frame) is tracked
in #837.
2026-09-17 09:36:28 +00:00
sam b250dc47d1 docs(release): document what a release publishes
The zip and its Release were undocumented: RELEASING.md described the
images and the gate, and nothing about dist-zip, the Release asset, or
that a gateway-only release does not rebuild the agent image. Adds that,
plus the consequence that bit this release -- Actions runs the workflow
from the tagged commit, so a deploy.yml fix must be an ancestor of the
tag rather than a commit on top of it.
2026-09-17 07:20:33 +00:00
sam 6dfbc5180d chore(release): archied v1.26.0 archie v1.26.0 2026-09-17 07:17:34 +00:00
sam 5a778065a8 ci(deploy): publish a GitHub Release with the distribution zip
The dist-zip job built the linux/amd64 zip and uploaded it as an Actions
artifact, then stopped. An artifact is reachable only from the run's page,
behind an Actions login, and expires after 90 days -- so every release since
the zip job landed produced a download an operator could not find. The one
Release on this repo (archied/v1.22.0) was created by hand and carries no
asset at all: nothing in CI has ever created one.

Publish the Release from this job and attach the zip:

- Job-level `permissions: contents: write`. The workflow default is
  contents:read, so a publish step would fail without it; scoping it to this
  job keeps the build-and-push jobs read-only.
- The body is this version's changelog section, extracted from the "## [x.y.z]"
  heading to the next "## [" heading rather than pasting the whole file. The
  changelog stays the single source of truth, and the tag/changelog gate in
  `gate` has already proven the section exists.
- Attached to the archied tag, because the zip is named and versioned for
  archied; `--follow-tags` pushes both tags at one commit, so the runtime
  release is the same commit.
- Idempotent: `gh release view` decides between `create` and
  `upload --clobber`, so a retried or superseded deploy run cannot fail on an
  existing Release or duplicate the asset.
- Fails loudly when the section extracts empty, rather than publishing a
  Release with no notes.
2026-09-17 07:17:27 +00:00
sam 8c4a10d6d0 chore(fmt): adopt gofumpt wrapping in contractaudit
task fmt reformatted this file's fmt.Fprintf call; committing it rather than
letting it ride in the release commit, so the release diff stays the changelogs
alone. AGENTS.md: formatter changes are adopted verbatim.
2026-09-17 07:10:03 +00:00
sam 592a6262b5 docs(prds): land the memory engine unification decision
Approved for implementation, dated 2026-09-16, previously untracked.
Settles four open items in docs/architecture/migration-decisions.md#5 and
supersedes the memory-turn-context.md draft.

Section 8's deletion list no longer names config.Memory.SessionTTL: the
council carried that deletion standalone and f25dd1e removed the field,
so listing it here would schedule work already done. Provider and
ProviderConfig are unchanged, both still present.
2026-09-17 00:34:01 +10:00
sam f25dd1e867 refactor(config): delete the two decoded-but-unread policy fields
MemoryConfig.SessionTTL and ToolPolicy.ParallelExecution were decoded by
config loading and read nowhere, so setting either silently did nothing.
Removing them routes both keys into the unknown-key detector, which names
them in a boot warning instead. A live-looking knob wired to nothing is
the worse state, and the sibling memory.provider already earned a loud
load-time rejection for exactly this.

Also drops the config.example.toml line that shipped session_ttl into
every first-run config.toml via configtemplate.go, and the commented-out
dir_test.go assertions that would have re-created both fields under that
file's "make these pass without modifying them" header.
2026-09-17 00:32:02 +10:00
sam 0de7d07519 fix(skills): correct the diagnostics scripts and rebuild the baseline
Three defects made every archie-diagnostics-and-tooling measurement wrong:

- source-metrics.go and config-use-candidates.go walked .worktrees/, the
  live git worktrees nested inside the repo root. Each is a near-complete
  copy of the module, so counts were multiplied by the number of checkout
  worktrees: production_go_files read 1234 against 422 tracked, and 248 of
  421 PACKAGE/HOTSPOT rows were duplicates. Selector counts were inflated
  ~3x, which hid Repo.TestGlob behind a real candidate and buried the rest.
- delivery-snapshot.sh scanned .gitea/workflows, deleted in e539048. Under
  `set -eu` that aborted the run at rc=2 after 10 of 26 rows, silently
  dropping every HYGIENE and MODULE row.
- Its composition-root anchors pointed at cmd/archied/main.go, now a ~30
  line dispatcher, so all five rows reported a misleading 0. Repointed at
  internal/app/archied, where the wiring actually lives.

Both filesystem walkers now skip .worktrees (package-shape.sh reads
`go list` and was already immune), the CI scan covers the surviving GitHub
workflow including docker/build-push-action, and the MODULE find prunes
.worktrees.

Refresh SKILL.md to HEAD d565fb8: the dated snapshot, the delivery and
coverage claims, and notes on why only one candidate status is a signal
and why a composition-root zero is evidence about the anchor.

source-metrics.go now reconciles exactly with git ls-files: 408 + 9
production and 397 test files, plus the tools module's 5 / 2 / 0, against
422 non-test and 398 test tracked files.
2026-09-16 23:37:13 +10:00
sam d565fb8ade refactor(forge): delete the unwired RepliesAfter surface
DELETE: IssueForge.RepliesAfter and its Reply type had no production caller --
the waiting_human status exists and is reachable, but automatic detection of a
human reply never landed, so the intended poller was never built. Neither
implementation paginated either (both read one page of 50), so the method
would have been wrong if wired as-is.

The manual path is untouched: waiting_human remains reachable and an operator
requeues through the existing task-action flow. Removing the interface method
also removes seven test fakes that existed only to satisfy it.

No behavioural test accompanies this: a pure deletion has no assertion to
make fail, and the compiler enforces completeness across every implementation.
2026-09-15 16:54:16 +10:00
sam 0fdf7a2adb docs(architecture): record the NATS scaffolds as deliberate deferrals
servicediscovery/nats and gatewayrpc.StoreClient are implemented and fully
tested, but neither has a production caller and no config surface exposes
either. Both were previously unrecorded, which made them indistinguishable
from oversight. The register now names them: StoreClient under the session
migration that will consume it, service discovery under shared mechanics,
alongside the runtime boundary that pins container addressing by injected NATS
URL instead. Kept rather than deleted because re-deriving tested wire code
later is pure cost.
2026-09-15 16:54:12 +10:00
sam 61f7cb2dd8 docs(architecture): record the embeddings client as deliberately inert
setupEmbeddings constructs a client at boot and holds it on b.embeddings, but
no production code reads that field yet, so a resolved models.embedding role
currently produces a client whose only observable effect is a boot log line.
The document already notes that no curator consumes a Sampler yet; it now says
the same of the embeddings client, so the inert state is stated rather than
implied. Both are prerequisites waiting on #437, not unwired defects.
2026-09-15 16:54:12 +10:00
sam c15d14557c fix(tools): stop testing on the text of other files, and ungate contractaudit
Six tests asserted on the wording and formatting of source and config files
rather than on behaviour: four injected text into fixtures and checked that a
regex noticed, and two asserted on api.jsx's contents. They break on an extra
space, a newline, a rename, or a comment that merely mentions the token -- the
single-fetch check had already false-positived on a comment, and I patched it
with a comment-stripper instead of deleting it. A test that cannot tell "the
code is wrong" from "the file is formatted differently" tests the wrong thing,
and the maintenance cost is permanent.

Deleted: tools/contractaudit/negative_test.go in full, and the source-scanning
"api.jsx holds exactly one fetch call" check with its stripComments helper. The
dashboard suite still asserts the browser mutation contract behaviourally, per
method, by inspecting the request each one makes -- which is where the real
defect was found. 142 UI tests pass; the 45 methods remain fully covered by the
two inventories and the completeness check.

The tool's own decoding is now testable without a file: parseDeclarations takes
an io.Reader, so its rules are exercised with in-memory input, and only the
absent-file branch still touches a path (which is never created).

contractaudit is no longer part of task check. Its surfaces are discovered by
scanning source text, so a rename or reformat elsewhere can change its output
with nothing actually wrong -- it reported 16 live routes as unconsumed once,
when the dashboard's request helper was renamed. A check that can fail for
reasons unrelated to what it measures must not be able to break a build. It now
matches tools/reachaudit: advisory, run by hand, --strict available on request.

Also removes five unused indirect requires from tools/go.mod (go mod tidy).
They were residue from the reflection-based first implementation of the RPC
scan, which was replaced by text scanning without tidying. -mod=readonly cannot
catch a superfluous require, so nothing would ever have found them.

Rewrites docs/prds/contract-conformance-audit.md, which claimed RPC coverage was
derived by reflection over the exported client type -- it never was -- listed
surface sizes of 43/12/52 against real counts of 45/21/49, described three
classification classes where the code has four, invented a five-surface Shape
with files that were never written, and blamed raw fetch calls for a 401 defect
that did not exist. Each false claim is now recorded in an errata section rather
than quietly dropped, and the document states plainly that the audit has found
nothing actionable: the 415 refusals and the duplicated client plumbing were
both found by reading the handler and reproducing the request.

Testing rule added to the document, since this is the second time: assert on the
observable effect, never on the content or formatting of generated or
hand-authored text and config files.
2026-09-15 14:17:53 +10:00
sam 18e8f8f0e6 fix(ui): unbreak binding approve and the two deletes, and centralise the client
Three dashboard mutations were refused 415 on every use. archied's
authorizeTaskMutation runs before the handler body and answers
"Content-Type must be application/json" unless the request declares a JSON
body -- including when there is no body to send, because that requirement is
what makes a simple cross-origin form post inexpressible. bindingApprove,
mappingDelete and bindingDelete sent Accept and X-Archie-CSRF but no
Content-Type, so approving a binding or deleting a mapping or binding never
worked from the dashboard.

Reproduced against the real handler with the browser's exact headers: 415,
where the same request plus Content-Type returns 200 and arms the binding.
The Go tests missed it because doJSONWithHeaders sets Content-Type
unconditionally, even for a nil body, so no test ever exercised the shape the
client actually sends.

Every api.* method now goes through one request() (and one send()), which
sets Content-Type and the CSRF marker on every mutation rather than only
where a payload happens to exist. The module already claimed to be "the
single place that knows how to talk to archied" while 22 call sites built
their own fetch, headers, timeout and error handling inline and chat.jsx
built a 23rd; that claim is now true, and chat.jsx's stream goes through
api.chatStream so only the URL, headers and failure shape are shared while
chat.jsx keeps its abort/timeout and SSE parsing.

Behaviour deliberately preserved: 204 deletes still parse no body, the
install timeout stays 120s, and 401 still classifies as session-expired. One
intentional change -- a 401 message is now the server's own text ("open the
dashboard URL archied logged at startup") rather than a bare "unauthorised",
since errorMessage already prefers the actionable reason and the classification
is derived from the status either way.

ui/test/api-client.test.js asserts the browser mutation contract for every
method, that reads carry no mutation marker, that a 204 resolves without
parsing, that api.jsx holds exactly one fetch call, and that every api method
is classified by the suite so a new one cannot be added uncovered. ui/dist is
rebuilt, being a committed asset.

I had claimed this work was needed to fix a 401 defect. It was not: all 22 raw
call sites passed res.status to ApiError, so classifyActionError already mapped
401 to session-expired, and chat.jsx never classified at all. The missing
Content-Type was the real defect.
2026-09-15 13:49:53 +10:00
sam 22cb0c6de5 fix(tools): stop contractaudit crediting dead paths as live consumers
Renaming the dashboard's request helper from req( to request( broke the
consumer extractor: it matched the call by name, so 16 live routes were
reported unconsumed. The extractor now keys on the call argument instead,
which survives a rename.

The first attempt at that fix was worse than the bug, and is recorded here
because the direction of the error is the whole point. Crediting any quoted
/api/... literal meant a comment, a retired-route array, or a display label
counted as proof a route was reachable -- so deleting every real request
still reported the surface as healthy. A false "unconsumed" is a loud,
fixable failure; a false "consumed" is a silent hole in the gate, which is
worse than having no gate at all.

A path now counts as a consumer only when it is the first argument of a call
in code. That excludes bare constants, dead arrays, object properties, and
commented-out calls, while still accepting any function name. Both halves are
pinned by tests: TestScanFileCreditsAnyCallSignature and
TestScanFileIgnoresNonCallLiterals, plus a surface-level
TestNegativeCommentedOutCallIsStillReported that the vacuous version fails.
Re-injecting either half of the bug fails the suite.

Requiring a call lost no real consumer: internal/webui still reads 49/49.
The remaining limits (path must be the first argument; template
interpolations unseen; routes credited per path rather than per verb) are
declared in docs/contract-declarations.json and the PRD rather than left
implicit.

Also corrects a measurement I had quoted inconsistently: proto/state/v1
declares 45 RPCs, not 43 or 46.
2026-09-15 13:49:47 +10:00
sam 7b3bfe5b2f merge: lane G (tools-builtin-3, tools-mcp-3, infra-misc-2, persistence-5) 2026-09-15 13:40:46 +10:00
sam 302187e7a3 refactor(store): use taskstate status constants in SQL
WIRE: internal/taskstate documents itself as the single source for the
persisted task status strings, but store.go re-declared them as bare SQL
literals. Reference the workflow status constants (aliases of taskstate)
so a rename of a status is a compile-time-visible migration instead of a
silent change in what ClaimNext/RecoverStale/OpenPRs/ClearTerminalTasks
match.
2026-09-15 13:39:15 +10:00
sam 530c8ea090 fix(container): enforce MaxUptime lifetime cap with a timer
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.
2026-09-15 13:33:48 +10:00
sam 7ac7a3df6b fix(mcp): cancel in-flight SSE reconnect on Stop
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.
2026-09-15 13:30:29 +10:00
sam 0020867b3e docs(skill): drop comments that named the deleted skill.Discover
Lane F deleted skill.Discover/skill.DiscoverPlugins/skill.Skill (no
production caller) in 6f4e420, which left three comments in packages it did
not own describing or contrasting behaviour against a symbol that no longer
exists -- a dangling reference is the same drift class as an unreachable
code path, just cheaper to fix.

The behavioural statements are kept; only the dead names go. internal/skill's
Catalog skips a SKILL.md it cannot read, while this curator's store reports
the per-skill failure as an Action, so the test's rationale still holds
without naming the removed function.

Comment-only: no behaviour change, task check exit 0.
2026-09-15 13:17:54 +10:00
sam 28ec1f85aa merge: lane F (skill-2, workflow-engine-2, domain-records-2, forge-3) 2026-09-15 13:15:18 +10:00
sam 2a6b9f9284 refactor(forge): delete dead CreateIssue surface
DELETE: no document in docs/architecture/ or docs/prds/ specifies a
production consumer for forge.IssueForge.CreateIssue. It has no
production caller -- the remaining repo matches are the GitHub
CreateIssueReaction and Gitea CreateIssueComment SDK methods. Removing
the interface method and the GitHub/Gitea/Noop implementations; the
other fakes that still define CreateIssue are test-only and out of lane
ownership, and an interface with one fewer method keeps them satisfying.
RepliesAfter and forge.Reply are untouched (a parallel FLAG record).
2026-09-15 13:13:55 +10:00
sam 41ad0d48ec refactor(binding): delete dead Matcher.Overlaps method
DELETE: no document in docs/architecture/ or docs/prds/ specifies a
consumer for binding.Matcher.Overlaps, and it has no caller or test
caller. The store enforces the overlap invariant with its own SQL
(internal/store/bindings.go InsertBinding/UpdateBinding), which is out
of this lane's ownership and left untouched. The doc comment's
empty-Source rule is already covered by Binding.validateCommon's
"matcher.source is required" check, so nothing needs moving.
2026-09-15 13:12:22 +10:00
sam 39053570c4 fix(builtin): bound read/edit filesystem work by DefaultToolTimeout
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.
2026-09-15 13:12:21 +10:00
sam 27f7053351 refactor(skillbuild): delete dead AugmentRegistry path
DELETE: no document in docs/architecture/ or docs/prds/ names
AugmentRegistry as a consumer. The live per-task registry construction is
skillbuild.BuildRegistry(workDir) at internal/app/agentworker/
task_execution.go; AugmentRegistry was an unwired alternate merge-over-
base path (with collision/override and nil-base semantics) that only
tests exercised. mergeSkillWorkflows remains reachable through
BuildCatalog/BuildRegistry.
2026-09-15 13:10:51 +10:00
sam 6f4e420b3a refactor(skill): delete dead Discover/DiscoverPlugins/Skill path
DELETE: no document in docs/architecture/ or docs/prds/ specifies a
consumer for skill.Discover, skill.DiscoverPlugins, or the skill.Skill
type. Live per-skill loading is reimplemented inline in
internal/domain/workflow/agent.go loadSkillBody via
Catalog/SkillForWorkflow/Parse/LoadPlugins, and daemon startup and webui
use Catalog/CatalogRoots. The parallel fully-tested path had no caller
to keep it honest, so it is removed together with its now-dead tests.
2026-09-15 13:08:43 +10:00
sam 3428425af8 merge: lane B (forge-2 flagged, daemon-1, persistence-2) 2026-09-15 13:04:28 +10:00
sam f8a34d7da2 fix(dev): give dev:gateway the dev overlay so it reaches the dev state store
dev:daemon, dev:dashboard and dev:state-store all pass
`-config-overlay deployments/dev.toml`, which is what sets
[services.state].target = 127.0.0.1:9090. dev:gateway did not, so under
`task dev` the gateway dialled whatever the developer's installed
~/.config/archie/config.toml named, or failed to start in a fresh checkout,
while the other three processes used the dev store the task summary itself
describes.

No automated test accompanies this: asserting it would mean reading
Taskfile.yml's text, which is the source-coupling class the tracker already
files as test-coupling-6/-7. The change is a config value, verified by
inspection of the four dev processes.
2026-09-15 13:04:11 +10:00
sam 760c2f868a fix(daemon): forward configured MCP servers to task agents
WIRE: taskrun.Request.MCPServers is documented as the channel for MCP server
definitions the agent should construct, and the archie-agent worker consumes
it (task_execution.go startMCPProviders). The daemon's request constructor
dropped the field in a refactor, so configured MCP servers never reached a
task container. Restore it from d.configFor(task).Tools.MCPServers.
2026-09-15 13:01:53 +10:00
sam b0caecbbb1 merge: lane C (tools-core-7, tools-core-6) 2026-09-15 13:01:26 +10:00
sam cd401d195c merge: lane A (gate-subsystem-2, gate-subsystem-1, infra-misc-3) 2026-09-15 12:59:30 +10:00
sam fb945fec41 fix(taskactions): resolve max_retries from the task's owning identity
WIRE, not delete: per-repo max_retries is a configured field with a real
consumer (the retry gate), and it works for the legacy single-identity
[[repos]] list. In a multi-identity deployment repositories live under
[[identities.repos]] and there is no global [[repos]] at all, so the resolver
never saw the override and a parked task was killed at the global cap rather
than the configured one.

MaxRetries now consults the identity named on the task before the legacy list,
then falls back to the global cap. Identity name is the only thing that says
which repository list owns a persisted row.

Red-then-green: TestMaxRetriesResolvesFromTheOwningIdentity gained the
multi-identity cases; "identity repo override wins over the global cap" failed
with `MaxRetries = 3, want 7`. Two neighbouring cases keep the fix honest:
another identity's override must not leak, and the legacy path must still
resolve. Mutation-verified by deleting only the identity lookup, keeping the
extracted helper and the API intact.
2026-09-15 12:59:06 +10:00
sam fe66f40b2b refactor(tools/mcp): delete unreachable MCP adaptation path
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.
2026-09-15 12:58:10 +10:00
sam aed1ed85dd refactor(daemon): remove unreachable SQLite poll/drain path
DELETE: NATS startup is mandatory (config.NATSConfig documents "there is no
broker-off execution mode"), so Daemon.Tasks is never nil in production and
pollSQLite/drainSQLite are unreachable. Remove them and their d.Tasks==nil
call sites, and correct the Tasks field comment.
2026-09-15 12:57:54 +10:00
sam d3bfef4a6b refactor(gateway): share sensitive-key markers with webhookguard
Resolves infra-misc-3.

WIRE: webhookguard.SensitiveKeyMarkers is now the single exported marker
list, and gateway.sensitiveParameterKey consumes it instead of inlining an
identical copy. webhookguard/redact.go documented that the two lists must
match "exactly so the two redaction paths agree"; that agreement is now
structural (one slice, two consumers) rather than a comment nothing
enforces. A new test asserts both consumers observe the same set, so a
future edit cannot silently desynchronise chat-transcript redaction from
webhook-capture redaction.
2026-09-15 12:55:52 +10:00
sam 8fdddb0463 merge: lane E (tools-media-1, transport-nats-2, release-1) 2026-09-15 12:55:07 +10:00
sam d2f9c31f0c fix(tools/provider/mcp): preserve MCP binary tool results for delivery
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.
2026-09-15 12:54:07 +10:00
sam 681824ccd0 merge: lane D (curator-1, staterpc-2) 2026-09-15 12:53:32 +10:00
sam 9745ab9661 fix(releaseupdate): don't treat empty available as deferred
Service.Check matched deferred[component.ID] == component.Available, and a
never-deferred recipient's absent entry is the empty string -- equal to an
empty Available emitted for a component with no update. Guard on a real
(non-empty) available version before applying the deferral, so an
up-to-date recipient is not told their update is deferred. No WIRE/DELETE
decision applies: this is a correctness fix on a live consumer, not
unreachable code.
2026-09-15 12:53:25 +10:00
sam ddeb654f43 fix(scheduling): record a completed run so a recurring job stops re-firing every tick
WIRE, not delete: cronstore.Store.MarkRun is the documented run-completion
step ("once the ticker has dispatched a job, the runner ... calls MarkRun to
keep next_run fresh") and the scheduling engine is now started at boot, but
nothing in production called it. Due returns every job whose NextRun is at or
before now, so with NextRun frozen in the past a job with a 1h interval was
handed to the runner on every tick.

The delivery Router is the single Runner the engine is given and, per this
package's own doc, the only place that knows a job store exists, so it is the
producer-side site. RouterStore (SpecLookup + RunRecorder) widens only what
the Router takes; the per-kind runners keep the narrow SpecLookup, and
NewRouter's signature is unchanged, so no call site moved.

Only a successful run records, matching the store's own contract that an
interval or cron schedule fires "after the last successful run". A one-shot
schedule reports ErrScheduleUnsupported -- it has no recurring next run by
definition -- which is swallowed rather than returned, because propagating it
would make the engine emit KindJobError for a job that actually succeeded.

Red-then-green: TestRouterAdvancesTheScheduleAfterASuccessfulRun asserts
LastRun is set and NextRun moved past now, and failed on both counts before
the change. TestRouterToleratesAOnceScheduleWithoutANextRun pins the
sentinel half. Mutation-verified by replacing only the record call with
`return nil`, keeping the API intact.
2026-09-15 12:53:02 +10:00
sam daeb1f61f8 fix(gate): validate finding level and share the blocking threshold
Resolves gate-subsystem-2 and gate-subsystem-1.

WIRE: gate.Finding.Level is now a typed gate.Level restricted to
LevelError/LevelWarn, and Finding.Validate rejects any other value so a
mis-typed or empty level fails the gate closed instead of silently
downgrading an intended blocker to a pass -- mirroring the fail-closed
standard ReviewFinding.Validate already sets in
internal/domain/workflow/review_findings.go.

WIRE: StageYaegiGate now delegates the blocking decision to
gate.Finding.Blocking instead of re-implementing the raw "error" literal,
so the script-facing gate.Blocking helper (exposed by gateextract to
interpreted .archie/gate.go scripts) and the rule the daemon actually
enforces share one source of truth and cannot drift.
2026-09-15 12:52:00 +10:00
sam a85ba42870 fix(servicediscovery/nats): validate config after defaults
Root-cause fix: Connect validated the raw config before withDefaults, so
the Heartbeat<TTL guard was skipped whenever Heartbeat was unset and a
custom TTL below DefaultHeartbeat passed as a silently expiring registry.
Apply defaults first so the documented invariant is enforced. No
WIRE/DELETE decision applies: this is a producer-ordering bug, not
unreachable code.
2026-09-15 12:51:17 +10:00
sam 42adee2f87 fix(staterpc): preserve marshal_error marker in eventDataJSON
WIRE: docs/prds/state-store-contract.md §11 requires the remote wire and the
local adapter to behave identically. The local adapter (internal/store/events.go)
records a {"marshal_error":%q} marker when json.Marshal of event Data fails,
while eventDataJSON silently returned "" on the same failure, emptying the
event's Data on the wire. Carry the same marker so an unmarshalable Data
value survives the hop with the local adapter's fidelity.
2026-09-15 12:50:57 +10:00
sam 77d1e62f7d fix(memory): install the threat scanner the composition root never wired
WIRE, not delete: docs/architecture/configuration.md's behavioural-literals
inventory lists the "Memory safety scanner -- compiled prompt-injection and
sensitive-data patterns with fixed warn/block consequences" as current
behaviour, and internal/memory.Manager.HandleToolCall already refuses a write
whose content scans as ThreatBlock. The consumer existed; the producer never
called SetScanner, so Manager.ScanContent short-circuited to ThreatNone and
the gate was a permanent no-op.

setupMemory now installs memory.DefaultScanner. Consequences stay at the
documented defaults -- scanReject is false, so a prompt-injection match is
downgraded to a warn and logged rather than refusing the operator's write.

Red-then-green: TestSetupMemoryInstallsAThreatScanner asserts the composed
manager actually scans, not that a field was assigned; it failed with
"ScanContent = ThreatNone for a prompt-injection payload" before the change.
Mutation-verified by removing only the SetScanner call (API intact) and
watching the same assertion fail.
2026-09-15 12:49:13 +10:00
sam 82d7bb301d test(telegram): pin upload-ceiling agreement with send_file
Choice: cross-package test (pin). Both ceiling pairs are live producers
and currently agree, so the WIRE/DELETE rule does not apply. Deriving one
shared definition would either require a new package outside this lane's
ownership or bind the channel-free sendfile tool to the telegram package;
the cross-package test pins the documented 'the two must agree' contract
at the duplicate itself.
2026-09-15 12:48:51 +10:00
sam 7fd393492d fix(curator): populate PassInput.Since with the prior pass time
WIRE: docs/prds/session-memory-curator.md specifies that each pass finds
"sessions with activity since the last pass", and its effectiveSince rule
treats a zero Since as "the runtime declining to name a horizon" (24h
fallback for the first pass). The runtime is the only production constructor
of PassInput and already carries lastPass, so it must name the horizon at the
producer by setting Since to the prior pass time. Previously Since was never
set, so the session curator fell back to now-24h on every pass and re-read
the same window each chat turn.
2026-09-15 12:48:38 +10:00
sam e84aded3fb refactor(state): delete the dead IncrementRetryCount RPC (breaking change, accepted)
IncrementRetryCount had zero production callers -- only tests and the
staterpc plumbing referenced it. taskactions.Service.applyRetry already
uses the atomic RetryTask exclusively, which increments retry_count and
requeues in one transaction.

Unlike ListCaptures/ListUndispatchedCaptures (kept as declared-unconsumed
compatibility surfaces because a rolling deploy could have an old
client/server pairing mid-flight), this repo has one production consumer
(see AGENTS.md's solo-project note), so the breaking removal is accepted
outright rather than deprecated-and-kept. Deleted the Go method, the
storecontract interface entry, the staterpc server/client methods, and the
RPC/messages from state.proto, regenerating the .pb.go/_grpc.pb.go pair.

Test fixtures that used IncrementRetryCount as a setup helper now drive
retry_count through the real path instead: queries_test.go bumps it via
direct SQL (same package, no contract to route through), and
api_tasks_actions_test.go now loops RetryTask+Transition, which exercises
production code instead of a deleted one.
2026-09-15 11:24:57 +10:00
sam ac38c442d5 feat(channels): wire ConfigSchema/ValidateConfig into a startup validation loop
Every chat gateway (Telegram, email, webhook) implemented channels.Channel's
ConfigSchema/ValidateConfig contract but nothing ever called it, so a
misconfigured gateway would only fail once it tried to start rather than at
boot. setupEmailGateway/setupWebhookGateway now call ValidateConfig before
registering a start function and return false (fatal boot error, matching
setupTelegramGateway's existing convention) on failure; telegram_setup.go
does the same for the already-constructed *telegram.Gateway.

Fixed telegram.Gateway.ValidateConfig/ConfigSchema along the way: it only
recognised token_env, but chat.telegram.token (a secret reference) is an
equally valid, already-precedent-ordered credential source per
resolveTelegramToken. Wiring the old validator unmodified would have
rejected every Token-only deployment. Also corrected ConfigSchema's stale
allowed_chat_ids property name to the real allowed_user_ids toml key.
2026-09-15 11:22:23 +10:00
sam 6d5a1d7ff7 Merge branch 'crew/cluster3' into crew-integration 2026-09-15 10:33:15 +10:00
sam edb6373715 Merge branch 'crew/cluster2' into crew-integration 2026-09-15 10:33:15 +10:00