fix(effectors): recover failed deliveries in the API, not by heartbeat resync #637
All Vouch review confidence checks passed
Residual risk 0.30 = Change Risk (0.52) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #637"
general
weight: 0.35
gusfcarvalho
Stacked on #632. First of three follow-up PRs from the 2026-12-04 owner decisions on effector delivery recovery (items D1–D4). They change the wire contract, so they land before rc1.
Owner decisions behind this PR: the heartbeat held-digest resync is dropped, because under a delivery backlog it makes every agent re-fetch everything every minute. The agent pulls effects only at startup (
GET /api/agent/effectsstays). Recovery belongs to the API: its retries, its 24h give-up, failed deliveries shown to users, and users re-sending them.Changes (one commit per item)
e666770)-
Service.Heartbeatnow records the heartbeat time, re-checks rule actions, enqueues verification while pending, and answers the delivery keys.-
DesiredHeldDigest,HeldDigest, the storedheld_digestand the NUL check on it are gone.- The response is
{"effector": {"delivery_keys": [...]}}, with noresync.80ad9f1)-
POST /api/admin/agents/{id}/effector/resyncis gone, withEffectorAdminHandler.Resync,Service.RequestResync,AgentEffector.ResyncRequestedand the view'sresync-requested.- The route used the
admin:manageadmin guard, so there was no authz manifest entry to drop.06dd90c)- Answers of 400, 413, 422 and 431 are recorded like the 24h give-up, in
UndeliveredGeneration,UndeliveredAtandUndeliveredReason. The reason quotes the status, the agent'serrorcode and its message, e.g.the agent refused the delivery (422, not retried): unknown-event: ….- These answers are not retried.
- Users see them where they see the give-up:
delivery-failedon the effect view and on a rule's effects list.f6ba189)-
POST /api/effects/{id}/redeliveron an effect whose latest generation is undelivered (UndeliveredGeneration == Generation) delivers that same generation again, in any state, without bumping it. This is how a lostclearedreaches the agent.- A successful delivery clears the undelivered record. All other cases keep today's semantics.
- Both cases are documented on the route and on
Machine.Redeliver.- Deliveries are River jobs unique by args, and River keeps the generation's completed job, which would swallow a re-send.
DeliverArgsand its outbox payload therefore getresend, the re-send's time in Unix ns, omitted otherwise. Other deliveries keep their args and their uniqueness.-
RedeliverAction, the redelivery after a params change, still always bumps.Mixed versions
held_digestand readsresync. The heartbeat ignoresheld_digestlike any unknown field (a NUL in it is no longer a 400), and a missingresyncreads as false. A test sends that old body raw.AgentEffectorandAgentEffectorInstanceare unreleased, soresync_requestedandheld_digestare simply dropped from the models. AutoMigrate leaves any column a dev database already has, which does no harm.Companion change
EffectorHeartbeat.HeldDigestandEffectorHeartbeatResponse.Resync(decision 1 below).TestRuntime_RegisterFetchHeartbeat(which waits for a resync) andTestAgent_EffectorPluginEndToEnd(which assertsheld_digest) fail against this PR.agent-idisn't the agent's own with421 wrong-recipient, also oneffector.verify.UI follow-up (D2 and D1): files that use what this removes
UI stack #420–#437, at
effectors/18-routes-navigation:src/composables/effectors/useAgentEffector.ts(ui#422):resync()POSTs/api/admin/agents/{id}/effector/resync, plusisResyncing.src/components/effectors/AgentEffectorTab.vue(ui#424): the Resync button anddoResync.src/components/effectors/__tests__/AgentEffectorTab.spec.ts(ui#424): theresyncmock and the "resyncs" test.src/types/effectors.ts(ui#420):resyncRequested: booleanon the agent effector view, andheldDigest?: stringon the instance view (D1 dropsheld-digest).src/composables/effectors/useEffects.ts(ui#422) documents redeliver as "New generation with transitionredelivered". That is no longer always true.Decisions to confirm
1. The SDK keeps two deprecated, wire-less fields. _Superseded by #640: both fields are deleted, and the agent follow-up above is the companion change._
- The spec says to drop
held_digest/resyncfromsdk/types, and also that an sdk/ change must stay buildable by the agent.- agent#180 references
EffectorHeartbeat.HeldDigestandEffectorHeartbeatResponse.Resync. I kept both as// Deprecated:fields:HeldDigestisjson:"-", andResyncis never marshalled or read and is hidden from swagger. Neither is on the wire, and the agent still builds.- They can be deleted once the agent's follow-up stops using them. If you'd rather delete them now, the agent's follow-up must land in the same step.
2. A permanent refusal (D3) doesn't turn the agent's effector
failing; the 24h give-up does. _#640 also records 401, 421, 410 and every other non-delivered answer, and turns the agentfailingon 401 and 421._ The agent answered and takes other deliveries; the problem is that one delivery.Docs
docs/effectors/*.md(wire-interface, operations, plugin-runtime and others) still describe the resync. Per the spec's grouping, that cleanup is D7, in the third PR of this follow-up.docs/swagger is regenerated here.Verification (at
f6ba189)make swag: no diff.make lint(golangci-lint v2.15.0): the 6 issues it reports are all pre-existing and identical on 80a604b (3× govet inline inworkflows/, 3× SA1019 in worker risk tests). None are in touched code.make test: passes.go vet -tags integration ./...: passes.-
./internal/service/effector/(all),./internal/service/effects/(all) and./sdk/....-
./internal/api/handler/ -run 'TestEffect|TestHeartbeatApi|TestRules'.-
./internal/api/handler/oscal/ -run TestComponentChanges.-
./internal/service/worker/ -run 'TestEffectors|TestDomainEvents'.- D1:
TestEffectorHeartbeatHasNoResync(sdk/types).- D2:
TestEffectorAdminHasNoResync.- D3:
TestDelivererIntegration/TestPermanentRefusalsAreRecorded.- D4:
TestEffectsApi/TestRedeliverUndelivered.Open questions for reviewers
None.
🤖 Generated with Claude Code