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.
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.
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.
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.
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.
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.
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.
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.
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.
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).
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.
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).
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.
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.
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.
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.
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.
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.
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).
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).
TestResolveProviderSecretsDegradesInsteadOfFailing matched a substring of the
warning's prose. Assert the structured provider attribute instead so a
rewording can't break the suite while a missing warning still fails it.
Surfaces configuration.Document.UnknownKeys as a warning naming the
offending keys. Stays a warning, not a boot failure, per
docs/architecture/configuration.md's startup policy: only an invalid
config is fatal, and a stray key is far more likely an operator typo in an
otherwise-working file.
decodeTOML discarded toml.DecodeFile's metadata, so a misspelled or
renamed key parsed, validated and silently did nothing. Document.UnknownKeys
now carries the dotted key paths a loaded file's decode targets left
undecoded.
One file feeds two decode targets (&doc.Config and &doc.Scheduling), so a
key legitimately owned by one shows up as undecoded in the other -- a key
is only reported when both leave it undecoded (unknownKeys intersects the
two sets), which is what keeps a valid [scheduling] block from being
misreported as unknown on every config that uses it.
YAML config sources are unchanged for now (no equivalent metadata hook in
the yaml decoder); this covers the TOML path, which is what
config.example.toml, every shipped deployments/*.toml profile, and
install.sh's generated config.toml all use.
TestSubscribeAgentEventsFlushesBeforeReturning only checked that main.go's
source text contained the string "flush task event subscription", so it
passed whether or not subscribeAgentEvents actually flushed and failed if
the message were merely reworded. Replace it with a real embedded-NATS
test: subscribe, then publish on a separate connection with no delay, and
assert the event arrives -- repeated to make the SUB/PUB ordering race
observable. Mutation-verified: removing the flush call makes this fail
reliably (multiple iterations lose the race) while the text-grep version
would have kept passing.
rotate() closed the current file before attempting the rename+reopen, so
when the reopen failed (a full disk, a permission change) every write
afterward went to a closed *os.File and was silently dropped -- the sink
stayed permanently broken rather than recovering once the transient
condition cleared. Keep the old descriptor open across the rename/reopen
and only close it once the new one is confirmed, so a write during (or
after) a failed rotation always lands somewhere.
extractBody re-split the already-isolated body on the first blank line it
found, intending to strip a stray content-header block some MTAs emit.
That heuristic can't distinguish a header block from an ordinary blank
line between paragraphs, so any multi-paragraph plain-text email silently
lost everything before the first paragraph break.
Clone's own doc comment promises mutating the clone cannot touch memory
shared with the original, but Image.Hosted/Image.Local were left as a
shallow map copy -- a runtime overlay or dashboard PATCH decoding into the
clone could mutate the published config's image provider maps.
Registry.Resolve and Getenv called engine.Resolve directly with no panic
recovery, so a defective interpreted engine (sops/Vault plugin) took the
whole daemon down at boot when resolving a provider credential
(provider_secrets.go's only caller has no recovery of its own). Wrap both
call sites in yaegiutil.Safe, the same recovery every other Yaegi
extension surface in this repo already uses.
handleTaskAction, the config and workflow write handlers all call
authorizeTaskMutation before mutating, but the binding and mapping
create/update/delete/approve handlers never did, leaving those dashboard
endpoints reachable by a cross-origin request with no CSRF header -
contradicting dynamic-curators.md's documented mutation contract.
BindingDispatcher and BindingTaskCreator are documented "optional: nil
disables the dispatch loop", same as Bindings, but dispatchBindings only
checked Bindings before dereferencing the other two. Any composition that
wires Bindings without also wiring both handles panicked on the first
dispatch cycle.
Two things fall out of one principle: a test that asserts against a
hand-written file is testing an artifact a human or an agent may legitimately
rewrite at any moment, so only generated output is a valid target.
install.sh generated config.toml two ways -- a full heredoc for the self-host
path and an awk splice of the [forge] block into config.example.toml -- with a
forge_block shell helper feeding both. That is the arrangement
docs/architecture/configuration.md decided against: it "must stop generating
config.toml; archied setup owns it", because the installer hand-rolling TOML
already drifted once (choosing Gitea produced a config naming a token the
installer never wrote). Both generators and forge_block are gone; install.sh
collects its answers as before and passes them to archied setup as parameters,
with secrets passed as REFERENCES to the env keys it just wrote rather than as
values, which would put them on a command line. The installer also now asks for
a cloud model, which archied setup requires and the old path never emitted.
deployment_contract_test.go tested the removed generators by parsing install.sh's
shell text, reconstructing the heredoc and asserting on its content. It broke the
instant install.sh stopped generating config -- "install.sh has no heredoc
declaring the daemon config's [nats] table" -- which is the failure mode in
miniature: the test was coupled to an artifact, not to behaviour. Deleted.
What it actually protected is kept, asserted on the GENERATED config instead:
TestRunSetup_GeneratedConfigSatisfiesDaemonRequirements runs archied setup and
loads what it wrote, requiring services.state.target and bot_user. A test against
generated output fails when generation breaks and passes when a human merely
tidies the template.
Found by an adversarial package sweep (temp tracker: config-1,
repo-root-deployment-1, repo-root-deployment-2).
configuration.md's startup policy -- "a missing credential disables a capability.
Only an invalid config stops the daemon" -- names this exact case: "Apply the same
reasoning to any future capability credential, LLM keys especially: start, report
the capability as unavailable, let the operator see it." The code did the
opposite. resolveProviderMap returned an error when a provider's api_key could not
be resolved, and again when it resolved empty, so configuredSecretRegistry failed
and the daemon would not start. A provider nobody referenced still blocked boot,
because the walk covers every entry in cfg.Providers rather than the ones [models]
uses.
The forge path was fixed to degrade for precisely this reason (resolveForge,
guarded by TestResolveForgeDegradesInsteadOfFailing); this is its provider
counterpart. A credential that cannot be resolved now disables that provider with
a warning naming it and why, and the daemon starts.
Disabling clears the reference rather than leaving it. webui's ProviderView
derives Configured from api_key or APIKeyEnv, so an unresolvable reference left in
place would advertise a provider nothing can use -- the "looks configured and is
not" shape this codebase keeps having to remove. Consumers already treat an empty
APIKeyEnv as no credential (agentexec/runtime skips such a provider, the daemon
exports nothing to the agent container), so clearing it is the whole disable.
The other half of the policy is kept: a reference naming only one of engine and
key is a config error, not a missing credential, and stays fatal.
applyForgeDefaults only ever builds a ref with both halves, so a half-named one can
only come from a hand-edited config.
This also defuses the trap 027dc99 introduced. archied setup can now write a
provider reference to any engine (-provider-secret-ref bws:OPENAI_API_KEY), and on
a machine without that engine the config used to load clean and then brick the
daemon. It now starts with that provider disabled and a warning.
The comment on templateDefaultActiveProvider described the old fatal behaviour and
is corrected rather than left to mislead the next reader.
All three behaviours are mutation-verified: returning an error again, accepting a
half-named reference, and disabling without clearing the reference each fail the
corresponding test. The red was an assertion failure, not a compile error -- the
logger parameter was threaded through first so the new test could be run against
unchanged behaviour.
A parameterised install could not configure a cloud provider without a terminal:
the only way a secret value entered was the prompt, so an unattended run was
limited to the keyless self-hosted provider. The missing piece is the reference
form.
A reference is not a secret. An engine name and a key name are not sensitive --
which is exactly why a reference may be a parameter while a value may not -- so
setup gains -forge-secret-ref, -provider-secret-ref and -telegram-secret-ref,
each taking engine:key, parsed by one new setup.ParseSecretRef. When a reference
is given the step writes it to TOML and asks nothing, and setup neither reads nor
stores the value, because the value is not its to hold. That is the difference
from the prompt path, where the operator supplies a value and setup writes it
into the env engine and references it there.
Engine names are identifiers, not paths: the shipped engines are registered as
age, sops and vault, so a reference like vault/openbao:KEY is refused rather than
written into a config that could never resolve it.
Two refusals guard the silent no-op. A reference naming a key for the keyless
self-hosted provider, or for a forge that is disabled, would sit in the config
looking configured while nothing read it -- the failure shape this flow exists to
remove -- so both are refused rather than written.
telegram keeps writing token_env for the prompt path, because that form names an
env var and the prompt path is the env engine; a supplied reference may name any
engine, which token_env cannot express, so the reference path writes the
preferred token = {engine, key} form. Noted as the one asymmetry.
Also folded stepCloudProvider's key handling into cloudKeyEdit and cloudModel.
That was a lint fix for nested blocks, but the split is the honest shape: the two
branches obtain a key edit by different means and then resolve a model the same
way.
Every new test was mutation-verified by reintroducing the absence: ignoring the
forge reference, making ParseSecretRef validate nothing, and dropping the keyless
-provider guard each fail the corresponding test.
archied setup took -forge-token, -provider-api-key and -telegram-token, each
carrying a secret VALUE. That is wrong twice over: the value lands in shell
history and in every process listing, and it is a second way to set a secret
that no secret engine knows about.
The codebase already holds the opposite invariant, and had before this landed:
- configuration.md:423-425 states it directly -- "setup writes the reference to
TOML and the value to the secret engine".
- No CLI flag anywhere in the repository accepted a secret value; these three
were the only ones.
- install.sh already does it correctly: read_secret prompts without echoing so
the value never reaches scrollback, and set_env_key writes it into the systemd
EnvironmentFile, which is the env engine's backing store.
So the SecretSink half was right -- writing the value to the env file IS writing
it to the secret engine, for the env engine -- and the prompt path was right.
Only the three value-carrying flags were wrong.
Removed: Params.ForgeToken, Params.ProviderAPIKey, Params.TelegramToken and the
flags that fed them, along with the parameter plumbing in step_forge,
step_provider and step_chat. Those steps now always read the secret from the
prompt surface. Params gains a comment recording why it deliberately has no
secret-valued field, so the absence is a decision rather than an oversight.
TelegramUserIDs stays: an allowlist of user IDs is access policy, not a
credential.
Two tests pinned the wrong behaviour and are replaced rather than deleted:
- TestRunParams_ProviderAPIKeyNeverPrompts asserted a secret could arrive as a
parameter. It becomes TestRunParams_SecretsComeOnlyFromThePrompter, which
supplies every non-secret answer through Params and scripts only the secret
reads, so it fails if a secret ever comes from anywhere else.
- TestRunSetup_DefaultsWithForgeTokenWritesEnv exercised the removed flag. It
becomes TestRunSetupRejectsSecretValueFlags, which asserts all three flags are
rejected with exit 2 and that neither a config nor an env file is written --
verified by re-adding -forge-token and watching it fail.
The unused rejectingPrompter went with them; its remaining replacement uses a
scripted prompter instead.
docs/architecture/configuration.md decides that "install.sh must stop generating
config.toml; archied setup owns it", and gives the reason: the installer
hand-rolling TOML already drifted from the schema once, and "the durable fix is
that the code writing the config is the code that reads it". setup.Run,
tomlwrite, configtemplate.Example and terminalprompt were all built for that and
had no production caller between them. This adds the caller.
setup.Run's own doc comment states the obligations, and they are the shape of
installValidatedConfig: render the edits, prove the result loads through a real
configuration.Loader, and only then install the file and commit the secrets. A
validation failure returns before either write, so a bad config leaves neither a
config nor a secret on disk. The rendered bytes are proven from a temp file, so
a load failure cannot have already installed anything. The config is written
0600 via same-directory temp and rename.
Parameterisation is typed, not matched against prompt text. A flag-to-prompt
mapping would have to match strings, which is the brittleness removed in
9a4f11c, so setup.Params is consulted before each question instead and the
prompts are only reached for answers nothing supplied. Run stays a wrapper
passing the zero value, so the package's existing tests keep passing untouched.
No environment variable is consulted anywhere: flags and prompts are the only
two ways an answer arrives.
--defaults is a known-valid unattended baseline, not "each prompt's own default".
That cannot work, and the test proves it: the provider step's first option is
OpenAI, whose model prompt hard-errors on an empty answer. The baseline therefore
covers every required answer and leaves optional ones to answer themselves as
"skip" -- ollama is the only keyless provider, so an unattended install boots
without needing a secret.
Two gaps closed after review rather than left as accepted work:
- A cloud provider was not configurable without a terminal, because the provider
API key had no typed parameter: unattended setup could only ever pick the
keyless self-hosted provider. Params.ProviderAPIKey and -provider-api-key fix
that. The key goes to the env file and TOML carries only the secret reference.
- The write order was unpinned. Inverting installValidatedConfig's two writes --
committing secrets before the config -- left every test green, so nothing held
the invariant the SecretSink contract states. The new
TestInstallValidatedConfig_ConfigWriteFailureLeavesNoSecret fails on that
inversion; the existing validation-failure test does not cover it.
Also fixed three lint failures in the first pass (gocyclo on RunSetup, and two
ineffectual `choice` initialisers): RunSetup's flag surface, the flag-to-Params
mapping, the prompter choice and the existing-config read are now separate
functions, which is the real fix for the complexity rather than a suppression.
The setup flow no longer hand-rolls its own answer format: -telegram-user-ids
reuses setup.ParseTelegramUserIDs, the same parser the prompt path uses, so the
allowlist cannot be parsed two ways.
Found by an adversarial package sweep (temp tracker: config-1,
repo-root-deployment-2, .local/issue-tracker/). Plan of record:
.local/issue-tracker/design-archied-setup.md. install.sh still generates its own
config; that is phase 2 and is not claimed here.
Two fresh-context reviews of the preceding five fixes found that the tests were
mostly sound but that three things were not: one harness was coupled to shell
source text, one assertion was coupled to a tool count, and -- worse -- the two
changes carrying the most weight were pinned by nothing at all.
Composition order. review_pr worked only because Run builds the worktree manager
before the gateways; no test observed it. Reverting the order left every test
green while the daemon silently stopped offering review_pr, because the producer
guard then returns nil instead of advertising a broken tool. Pin the order by
source position, matching the existing
TestSetupBackendsRegistersContainerCleanupAfterNATS, since no runtime seam can
see it. methodBody now resolves package-level funcs as well as methods.
Composition wiring. The daemon fix's whole point is that resolved routing
bindings reach the worker, yet nothing verified that buildDaemon puts them on the
daemon: with b.kindWorkflows replaced by nil, only the new test fails and both
the daemon and worker packages stay green. That is the "tested in isolation,
never verified wired" shape this work exists to remove, so pin the hop.
The wire contract itself. taskrun.Request's json tags are the interface between
two binaries, and a same-type round trip cannot see a tag rename. Assert the
emitted keys literally; renaming one now fails with the key list.
Brittleness. selfHostConfig no longer string-matches install.sh's heredoc opener
or assumes the delimiter is EOF, and no longer hand-substitutes a copy of
forge_block's output -- it discovers heredocs by shape and selects the one
declaring [nats], a table the assertions never touch. Verified against four
behaviour-preserving refactors that previously failed: renaming the delimiter,
reordering the redirect, factoring the path into a variable, and <<-. The two
[services.gateway] source greps are gone: defaults.go already supplies that
target, so there was no behaviour to pin. review_pr is asserted present by name
rather than by entry count, so a sibling review tool cannot turn it red.
Also carry the published request's decode error instead of discarding it, so a
payload-shape break reports as itself rather than as an empty routing binding.
Every new test was verified non-vacuous by reintroducing the defect.
An operator's kind/label -> workflow overrides were decoded, validated and
installed into the DAEMON's package-level state via
workflow.SetKindWorkflows/SetLabelWorkflows -- but workflow.Route's only
production caller is app/agentworker/task_execution.go, in the separate
archie-agent process. The bindings never crossed the boundary, so every
configured override was silently ignored and routing always fell back to the
built-in defaults (bug -> tdd, feature -> feasibility, bootstrap -> bootstrap).
Carry the resolved bindings on taskrun.Request, mirroring how MCPServers already
crosses this boundary, and apply them in the worker before Route is called.
Resolved values are carried rather than file paths, so the worker does not need
the routing files to be readable in its sandbox. nil still means "use the
built-in defaults", so this is backward compatible for any request built by an
older daemon.
routeTask is a named seam for that install-then-route step. It mutates
package-level routing state, which is sound here because each archie-agent
process is task-scoped and ephemeral; if the worker ever served more than one
task that assumption would need revisiting.
Tests are mutation-verified: removing either the two Set calls in routeTask or
the two request fields in runViaAgent reproduces the exact assertion failures
the lane observed red-first, so neither test is vacuous.
Found by an adversarial package sweep (temp tracker: workflow-engine-1,
.local/issue-tracker/).
review_pr was registered on every channel and failed on every call with
"worktree manager is not configured". Two independent causes, one contract:
The daemon ran setupGateways before buildTreesAndIdentities, so setupGateways
reached prReviewer() while b.trees was still nil and captured it; the memoised
reviewer then held that nil for the process lifetime. Build the worktree
manager before the gateways, which is the ordering the reviewer depends on.
Ordering alone cannot fix the standalone Gateway, which calls prReviewer() and
never builds trees at all. Have prReviewer() return nil when b.trees is nil, so
a reviewer that can never run is not produced. That is what
gateway.ReviewTools' existing nil-reviewer guard always intended -- "a tool that
cannot run must not be advertised" -- but the guard never fired because the
daemon never passed nil.
TestPrReviewerIsMemoized asserted a trees-less boot yields a non-nil cached
reviewer, encoding the broken precondition as expected behaviour, which is why
a green suite hid this since review_pr shipped. It now gives the boot a real
worktree manager so its actual subject -- one shared in-flight set across
channels -- stays pinned, and two tests are added: one for the nil-trees
invariant, and one that composes the real wiring (prReviewer -> ReviewTools)
and asserts review_pr is registered only when the reviewer can run.
Found by an adversarial package sweep (temp tracker: app-archied-5,
.local/issue-tracker/).
UpdateBinding documents that an empty caller Secret is preserved by
COALESCE(NULLIF(?, ''), secret), and binding.ValidateForUpdate explicitly makes
an empty Secret mean "keep the current one". The sentinel was defeated before
the SQL saw it: encryptBindingSecret ran first and, with a binding cipher
configured, sealed the empty string into a non-empty
"arcie-binding:v1:<fp>:<base64>" envelope. NULLIF(?, '') then no longer matched,
COALESCE took the envelope, and a routine PATCH that changed only name/source/
workflow overwrote the shared HMAC secret with the encrypted empty value. Once
re-approved the binding could never authenticate an inbound webhook again, and
nothing surfaced the loss.
Fix it at the producer rather than by re-testing emptiness at the SQL layer: an
empty secret is the store's "no secret" sentinel, so it stays empty and the
existing COALESCE guard keeps working. decryptBindingSecret already treats an
empty stored value as nothing-to-decrypt, so this is symmetric.
The only existing coverage, TestUpdateBindingPreservesSecretWhenEmpty, opens the
store without a cipher and so never exercised this path. Add a table-driven test
over the cipher path covering both directions -- an empty caller secret must
preserve the stored secret, and a supplied one must still replace it, so the fix
cannot degrade into "updates never change the secret".
Found by an adversarial package sweep (temp tracker: persistence-1,
.local/issue-tracker/).
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/).
internal/ratelimit was fully built (sliding-window limiter, ticker-driven
eviction) but had no consumer, leaving multi-identity deployments with no
inbound request budget on any channel (archie-core-6wxb / GH #797).
Adds Message.SenderID (Telegram numeric user ID, SMTP from address, or
webhook route path -- the closest thing webhook has to a caller identity),
threads it into Router.Route/RouteStream via a shared checkRateLimit, and
wires an opt-in [chat.rate_limit] config section through bootstrap with the
documented EvictStale ticker.
Components are independently versioned (RELEASING.md), so the newest
archied/v* and archie/v* tags usually sit on different commits --
gateway-only releases are the norm. The installer required both tags to
resolve to the same commit whenever both components changed, which
refused every update once the two newest releases diverged
(archied/v1.24.0 at 8950bde, archie/v1.23.0 at 6cf73db).
Build each changed component from its own tag's commit instead: daemon
binaries and the adapter refresh from the daemon release, the managed
worker image from the agent release.