The loop runner hooks every model call and tool call and reports ordered,
redacted, clipped entries. Each is persisted as an agent_transcript task
event through InsertEvent, left out of the timeline read, and served per
attempt at /api/tasks/{id}/transcript. The step run view shows it with Trace.
* feat(state): durable operator alerts owned by the State Store
Alerts dedup on org+kind+subject, resolve themselves when a condition
clears, and are raised, resolved, dismissed and listed through the state
contract. Task transitions raise needs-human and failed alerts in the same
transaction; the store checks service health and prunes closed alerts.
Each raise and resolve queues a webhook delivery whose attempts are kept.
* feat(notify): deliver operator alerts to the webhook; raise config and release alerts
notify.webhook now receives raised and resolved alerts above a severity
threshold with HMAC-signed payloads, bounded retry and every attempt recorded
on the alert. archied raises model alias, provider and credential-binding
alerts from the effective configuration, an update alert from the release
channel, and a credential-rejected alert from the egress resolver. The
dashboard API lists and dismisses the caller's org's alerts.
* feat(ui): alert bell in the top bar and webhook alert settings
The bell lists the org's open alerts by severity with dismiss and a link per
alert, and refreshes from the event stream. The task settings page gains the
webhook severity threshold and signing secret. ui/dist rebuilt.
Remove PRD/doc paths, bead IDs, phase notes and deleted-test references
from comments; drop test-only hooks left by the test deletion. Includes
in-progress archied bootstrap, gateway and query changes.
VerifyHMAC compared the supplied signature against the computed digest as
case-sensitive hex text, so a sender that emits an uppercase digest failed
verification -- and the failure is indistinguishable from a wrong secret. The
helper is shared by all three inbound surfaces (forge intake, the chat webhook
gateway, capture intake), so one such sender breaks whichever surface it
targets.
Decode both sides to raw bytes and compare those. hex.DecodeString accepts
either case, and comparing digests rather than their text keeps the comparison
constant-time -- strings.EqualFold over the encoded text would not be. A
signature that is not valid hex is rejected outright, and a digest of the
wrong length simply does not match.
archie-core-rl04
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.
RedactPayload only redacted values under a fixed set of sensitive key
names, so a sender that names a secret field something else leaked it into
captured_events.body. Harden the heuristic:
- broaden the key-name markers (compound names like access_token,
client_secret, signing_key, x_api_key, webhook_secret, refresh_token)
and keep gateway.sensitiveParameterKey identical to preserve the
documented agreement between the two redaction paths.
- add value-shape detection: a compact JWT or a PEM private-key block is
redacted under any key, catching the 'sender named the field something
the heuristic misses' gap.
- keep it conservative so schema-by-example field mapping still works:
only unambiguous shapes (eyJ-prefixed JWTs, PEM key blocks) are
redacted by value, never ordinary content.
Best-effort per docs/prds/webhook-intake-security.md point 5.
Refs archie-core-t2db (captured_events.body redaction)
archie-core-7d5u.3 -- storage-agnostic building blocks for vetting inbound
webhook-shaped requests, extracted rather than duplicated:
- VerifyHMAC: behavior-preserving extraction of internal/channels/webhook's
private validateHMAC. internal/channels/webhook now calls it instead of
keeping its own copy; all 10 of that package's existing tests still pass
unmodified, and the one now-redundant unit test was removed with a
comment pointing to where its coverage relocated.
- RateLimiter: per-source token bucket. Source IDs come from a registered,
operator-controlled set, not unbounded attacker input, so the bucket map
is not itself bounded -- documented explicitly rather than left implicit.
- RedactPayload: key-name-based redaction, matching gateway/stream.go's
sensitiveParameterKey marker list. Deliberately does NOT reuse that
function's actual behavior: it replaces every string value regardless of
key, correct for a bounded chat summary and wrong here -- a captured
payload exists to be inspected for field mapping (t2db.3), so only values
under a sensitive-looking key are touched.
Narrowed from 7d5u.3's original scope, which bundled capture storage and an
approval state machine into this package. Both moved to the beads that own
that state (t2db.1's capture store depends on 7d5u.2's still-open NATS
storage decision; t2db.4's binding is the only consumer of approval state
today) rather than building shared abstractions ahead of a second real
consumer.
Adversarially reviewed by a fresh subagent with zero surviving findings:
token-bucket math hand-traced on two scenarios and race-clean under -race,
the redaction/gateway-stream.go behavioral divergence verified by reading
both functions side by side, both the redaction and rate-limit guards
mutation-tested by disabling each and confirming the suite catches it.
task check exit 0, golangci-lint 0 issues, gofumpt clean.