Commit Graph
1140 Commits
Author SHA1 Message Date
sam dacec700a6 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 51b0902926 merge: lane G (tools-builtin-3, tools-mcp-3, infra-misc-2, persistence-5) 2026-09-15 13:40:46 +10:00
sam 242d8322d5 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 7c5b81fd53 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 a0dd21273b 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 f4e32ee6d4 docs(skill): drop comments that named the deleted skill.Discover
Lane F deleted skill.Discover/skill.DiscoverPlugins/skill.Skill (no
production caller) in 952bf4d, 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 280b744d8c merge: lane F (skill-2, workflow-engine-2, domain-records-2, forge-3) 2026-09-15 13:15:18 +10:00
sam a406c36f27 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 1177012a3a 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 bf7eb16bc4 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 0548a944b1 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 952bf4d5d6 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 ab2793e87f merge: lane B (forge-2 flagged, daemon-1, persistence-2) 2026-09-15 13:04:28 +10:00
sam fe48ffdd97 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 2b84ec2989 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 d0395cebd5 merge: lane C (tools-core-7, tools-core-6) 2026-09-15 13:01:26 +10:00
sam b5230941ec merge: lane A (gate-subsystem-2, gate-subsystem-1, infra-misc-3) 2026-09-15 12:59:30 +10:00
sam fbcfd68cd1 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 8ea45e836b 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 16d331a16e 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 0e0611a6b3 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 8b06d4192c merge: lane E (tools-media-1, transport-nats-2, release-1) 2026-09-15 12:55:07 +10:00
sam c9a5ae4aeb 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 cd775f8705 merge: lane D (curator-1, staterpc-2) 2026-09-15 12:53:32 +10:00
sam 72d80f1dfc 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 bb780e63b4 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 e93ad6353b 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 0a73394c23 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 4268a25d30 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 3300ac0a31 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 0c5ea7b2a0 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 8bef9605f3 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 b0050ff20a 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 7c68e1d436 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 04d690322a Merge branch 'crew/cluster3' into crew-integration 2026-09-15 10:33:15 +10:00
sam d7ba77e1e9 Merge branch 'crew/cluster2' into crew-integration 2026-09-15 10:33:15 +10:00
sam 49da68fb25 Merge branch 'crew/cluster1' into crew-integration 2026-09-15 10:33:15 +10:00
sam abb23247c5 refactor(tools): delete unused plugin-tool registration API from builtin.Registry
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).
2026-09-15 10:25:59 +10:00
sam 5c8f2f400a refactor(tools): delete unreachable AST-based tool discovery
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).
2026-09-15 10:23:17 +10:00
sam 6951125415 feat(channels): wire chat.webhook route config through to the gateway
internal/channels/webhook's RouteConfig implements and tests HMAC
signature validation, payload template extraction, and reply delivery,
but setupWebhookGateway built []webhook.RouteConfig{{Path: "/webhook"}}
literally -- no config field could reach Secret/Template/DeliverTo, so
the gateway accepted any unsigned POST despite its package doc claiming
signature validation.

Adds config.ChatConfig.Webhook (WebhookRoute: path, secret as the
existing SecretRef pattern, template, deliver_to) and webhookRoutes(),
the pure translation into []webhook.RouteConfig that
setupWebhookGateway now calls. A secret ref that fails to resolve logs
and falls back to no validation rather than refusing to start, since
signature validation stays opt-in (an empty secret is documented,
valid config) unlike the mandatory forge webhook secret.
2026-09-15 10:22:54 +10:00
sam 778d33f89c refactor(tools): delete unreachable dispatch/gating engine
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).
2026-09-15 10:19:39 +10:00
sam ba3d8cba21 refactor(archied): delete the daemon's unused webui.Server and UI adapters
b.web and its three adapters (skillCatalogAdapter, memoryUIAdapter,
curatorsUIAdapter) were constructed at boot but the daemon never calls
Handler() on the server and no route reads any of these fields -- the
dashboard is served by the separate archie-ui process (compose.go),
which deliberately leaves the same surfaces nil, and the daemon's
config snapshot goes through the standalone webui.BuildConfigView, not
a Server method. Removed the field, its four assignment sites, and the
three adapter files; test boot literals that carried a leftover
`web: &webui.Server{}` for no assertion-relevant reason had it
dropped, and the one test that specifically pinned b.web's store
surfaces staying nil is now moot with the field gone.
2026-09-15 10:19:00 +10:00
sam da5b9e7273 refactor(gateway): delete orphaned SessionState goal/steer/queue machinery
No /goal, /steer, or /queue command exists in messaging.localCommands, no
Router handler dispatches them, and BuildGoalPrompt was never merged into
the turn's system prompt. NewSessionState had no caller outside its own
test. Delete the entire mechanism rather than let a fully-built but
unreachable feature be mistaken for a live one.
2026-09-15 10:18:57 +10:00
sam 65d51250ff fix(gateway): delete unwired Router.Dangerous approval path
All four production Router constructions left Dangerous nil; the only
Decide implementation was webui.DangerousService, used directly by the
webui HTTP handler, not through the Router. handleDeny and the typed
/approve branches always returned "not configured" in production. Delete
DangerousApprover, the Dangerous field, /deny, and the dead branches so
the router surface matches what is actually wired; the dashboard's
dangerous-action path is unaffected since it never routed through here.
2026-09-15 10:18:53 +10:00
sam f7815d3b62 fix(channels): delete unreachable Telegram webhook delivery mode
telegram.New only ever constructed with empty webhookURL/webhookSecret
(telegram_setup.go) and config.TelegramConfig has no field to set them, so
the SetWebhook/StartWebhook branch, WebhookHandler, and webhook teardown in
Stop were dead code exercised only by tests. Long-polling is the only
reachable mode; delete the webhook path and its ConfigSchema properties so
the schema no longer advertises unsupported config.
2026-09-15 10:18:48 +10:00
sam 739d4530de refactor(memory): delete the unreachable <memory> fence scrubber
internal/memory/scrubber had no importer anywhere in the repo; the
only emitter of <memory> fences (builtin.Provider.SystemPromptBlock)
also has no caller in the streaming output path, so the whole package
was dead code. Deleted it and the doc comment claiming a scrubber
consumes SystemPromptBlock's output.
2026-09-15 10:18:29 +10:00
sam 0da70ca8f4 refactor(staterpc): delete the superseded single-token auth interceptor
UnaryTokenInterceptor/TokenValidator/checkToken (auth.go) and
constantTimeTokenValidator (state_store.go) had no production caller:
server auth on the bridge-address listener is wired through
TaskGrants.UnaryInterceptor/StreamInterceptor, which replaced this
all-or-nothing token check with per-task scoped grants. Removed the
dead cluster and its now-pointless tests; TaskGrants' own auth
rejection paths are already covered in task_grants_test.go.
2026-09-15 10:18:25 +10:00
sam d7b809e61b fix(agentworker): wire configured tool-result policy into worker's LoopRunner
TaskConfig now carries the daemon's ToolPolicy (MaxResultChars/SpillDir)
via ForTask/ToConfig, and runTask applies it to the constructed
LoopRunner. Previously the worker always built the agent loop with a
zero-value ToolLimits, so tool results in every task's agent stage were
never capped or spilled despite the configured 50k default (agentexec-1,
tools-core-11).
2026-09-15 10:14:50 +10:00
sam 96610bda6e feat(archied): wire the scheduling ticker engine at boot
schedulingConfig translated [scheduling] config into a domain
EngineConfig but nothing ever called it in production: the whole
scheduling/cron family (ticker engine, cronstore, crondelivery) was
built and tested but reachable from no binary, so an operator setting
scheduling.interval etc got a silently inert section.

setupScheduling opens a cronstore.Store as the engine's JobSource,
builds a crondelivery.Router with a workflow-kind runner backed by the
same non-forge gateway.TaskCreator chat's /spawn already uses, and
constructs the scheduling.Engine from schedulingConfig. startServices
starts it alongside every other subsystem; Stop is registered via
addCleanup on the same Background-timeout pattern as the curator
runtime. No chat task creator configured leaves the engine unstarted
rather than running with no reachable job kind -- the "chat" delivery
kind stays unmapped for the same reason (no unified cross-channel
outbound sender exists at this composition root yet).
2026-09-15 10:14:10 +10:00
sam 1957d0ab39 feat(tools): add contractaudit for standing contract-conformance reporting
Reachability (tools/reachaudit, epic archie-core-06ag) answers "is this code
in a shipped binary?". It cannot answer the complementary question: "does
every declared contract surface have a consumer, or a declaration that it
has none?". ratelimit was in the binary closure and called by nothing, which
reachability could not see.

tools/contractaudit classifies each subject of each declared surface as
CONSUMED, DECLARED-UNCONSUMED, UNDECLARED-UNCONSUMED, or STALE-DECLARATION,
and only the last two are findings. The declaration allowlist must match
reality exactly: a missing entry fails and so does an entry that outlived
its subject, because a stale allowlist is how a gate quietly stops checking
anything.

Surfaces: the two gRPC services, whose consumption is derived by scanning
adapter bodies for calls through the generated client, and the dashboard
HTTP API, matched between the registerXRoutes call sites and the path
literals the bundled client calls.

Findings on the current tree, all deliberate and now declared:
ListCaptures and ListUndispatchedCaptures are superseded by their streaming
variants -- staterpc's client calls StreamCaptures -- so no production
client reaches the unary RPCs.

Three bugs this tool found in itself, each recorded because each is the
class of error that makes a conformance check worse than none:

- Joining RPCs to adapter methods by name silently reported live RPCs as
  unconsumed, because adapters do not map one-to-one: StoreClient.Get calls
  GetSession, List calls ListSessions.
- Reflecting over the client value rather than the pointer reported zero
  methods, hence the whole surface unconsumed.
- Treating the asset mount and the health probes as dashboard API routes
  reported four healthy routes as undeclared; they have different consumers
  and are out of scope for this surface.

The consumer extractor fails loudly on a call shape it cannot parse rather
than under-reporting, and every check is negative-tested: a route, an RPC,
and a removed consumer are each injected, confirmed to fail for the right
reason, and reverted. The declaration staleness rule is tested too.

Advisory when run directly; task check runs it -strict. See
docs/prds/contract-conformance-audit.md.
2026-09-15 09:41:20 +10:00