fix(configuration): reject forge intake settings nothing reads

IdentityConfig.Forge is the same type as the root [forge] block, so
[identities.forge].intake, .webhook_secret and .webhook_addr all decode --
but every intake read is of the root block (validate.go,
bootstrap.setupForgeWebhook) and per-identity intake never reached
validateForgeIntake. The setting parsed, was ignored, and was not even
validated. Separately, root intake = "webhook"/"both" with [[identities]]
started the daemon, logged "forge webhook disabled" and polled instead.

Extend validateForgeIntake to fail closed on both shapes: a per-identity
webhook/both intake (or webhook_secret/webhook_addr) is rejected naming the
identity, the setting and the reason, and root webhook/both intake alongside
[[identities]] is rejected naming both settings and the supported
alternative. Poll and empty stay valid per identity; the two shipped forge
profiles still validate.
This commit is contained in:
sam committed 2026-09-22 03:35:55 +10:00
1 parent 2eeef60b31
commit 3ee259a919
4 files changed
+328 -6

No files matched your search

+12 -2
View File
@@ -47,14 +47,24 @@ token = { engine = "env", key = "ARCHIE_GITHUB_TOKEN" }
# on the GitHub webhook, and the host:port the receiver listens on. On
# GitHub, set the webhook's Content type to application/json (the UI
# default) -- the alternate form-encoded delivery is not supported.
# Not supported alongside [[identities]] (each identity keeps polling).
# Webhook intake is single-identity, and that is enforced: with [[identities]]
# configured this combination is REJECTED at startup rather than silently
# downgraded to polling. The receiver binds one secret and one dispatch
# predicate, so it could only judge another identity's events by the wrong
# rules. Either drop the [[identities]] blocks, or keep intake = "poll" and
# let each identity poll.
# webhook_secret = { engine = "env", key = "ARCHIE_WEBHOOK_SECRET" }
# webhook_addr = "0.0.0.0:8645"
# intake, webhook_secret and webhook_addr exist only here. Set on a
# [identities.forge] entry they are REJECTED for the same reason: nothing
# reads them, so the identity would silently keep polling. Serving webhook
# intake per identity is a pending migration, not a setting.
# [[identities]] runs more than one bot identity from a single daemon, each
# with its own forge/dispatch/models/providers/budgets/notify -- see
# docs/architecture/identity.md for the full design and constraints (e.g.
# not combinable with [forge].intake = "webhook"/"both"). Minimal shape:
# intake settings are rejected per identity, and [forge].intake =
# "webhook"/"both" is rejected alongside [[identities]]). Minimal shape:
# [[identities]]
# name = "personal" # required; namespaces logs/events/NATS subjects
# bot_user = "your-bot" # required