Repository navigation
revert: drop the backup-reserve hedge of #449 (MAG-3923) - #516
Conversation
This reverts commit 2d18323. This reverts commit 334fda5. This reverts commit ea5ad0a. This reverts commit a90ef62. #449 added a second timer to the relay state machine, keyed to the request's processing budget. One attempt window before the budget ran out, it sent one attempt that preferred the backup tier, whether or not any primary was still unused on the request. That changed when the backup tier is used. Before, a backup served only once every primary had been used on the request. With #449 a backup could serve while primaries were still untried. And when the budget is a whole number of windows (the chart's 10s window and 30s budget), the timer fired at the same moment as the hedge to the third primary. In the MAG-3945 test, with two quiet primaries and a healthy third, a backup answered instead of the healthy primary in 2 of 3 runs. The router owner had confirmed before the merge that the quiet-primary behaviour MAG-3923 reports is intended, and a change to it needs a design discussion first. This restores the behaviour of v1.5.8 and every earlier release: the budget only ends a request, attempts go out one window apart, and the backup tier is reached once the primary pool is exhausted. No release tag contains #449. Changes beyond the plain revert: - consumer_session_manager.go keeps the gofumpt form of ProbeLoopInterval that #449 introduced. Restoring the old var block would fail lint on a file this commit touches. - cross_validation_threshold_guard_test.go and health_check_crafted_relay_test.go were written after #449. Their calls to sendRelayToEndpoint drop the trailing backupReserve argument. - The rpcsmartrouter README drops the two sentences #452 added about the hedge not being armed when the window equals the budget. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Took 3 minutes
AnnaR-prog
left a comment
There was a problem hiding this comment.
Reviewed and approving.
The revert is exact. I ran git revert --no-commit on the four #449 commits (a90ef629, ea5ad0a9, 334fda5f, 2d18323c) on top of main and diffed the result against this PR's tree. The only differences are the three adjustments the body lists:
- the gofumpt form of
ProbeLoopInterval; - the dropped trailing
backupReserveargument incross_validation_threshold_guard_test.goandhealth_check_crafted_relay_test.go; - the README sentences #452 added.
Nothing of the hedge is left. git grep -i "backup.reserve|backupReserve|reserve hedge|MAG-3923" on the merged tree finds nothing in code or docs.
Verified on the updated head fc49e210 (main a2d8148b + this PR, which now includes #504, #513 and #505):
go build ./...andgo vet ./...are clean.go test -count=1passes forprotocol/relaycore,protocol/relaypolicy,protocol/lavasessionandprotocol/rpcsmartrouter.
As the body says, once this is deployed, the three smart-router-automation tests that #1416 un-marked will fail again until they are rewritten. The next release section also needs #449's four commits and this revert removed by hand.
Conflicts resolved: - protocol/lavasession: #516 reverted #449's backup-reserve hedge while this branch dropped the backup selector's unused stateful parameter. Kept #516's code shape without stateful, and the unparam note on virtualEpoch. - protocol/chainlib (consumer_websocket_manager.go, grpc.go): #513 moved the subscription-delivery constants into metrics while this branch dropped the goroutine around the usage metric. Kept both. Also follows #494's endpoint_state_reason_test.go onto probeDirectRPCEndpoints' new signature (no ctx, no latency); without it the lavasession tests do not compile. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Jira ticket: MAG-3923
What this reverts
#449, which was rebase-merged on 2026-10-05 as four commits:
2d18323c,334fda5f,ea5ad0a9anda90ef629. It added a second timer to the relay state machine, keyed to the request's processing budget. One attempt window before the budget ran out, that timer sent one attempt that preferred the backup tier, whether or not any primary was still unused on the request.Why
docs/configuration/config-file.mdin Magma-Devs/docs). With fix(relaycore)!: hedge to the backup tier before the budget ends when primaries go quiet (MAG-3923) #449 a backup could serve while primaries were still untried. With the chart defaults (10s window, 30s budget) the new timer fired at the same moment as the hedge to the third primary. In the MAG-3945 test, with two quiet primaries and a healthy third, a backup answered instead of the healthy primary in 2 of 3 runs.!and its body aBREAKING CHANGE:footer, but the rebase-merge kept only the four commit messages, which have neither. The next release would have listed the change as four plainfixlines.Behaviour after this PR
The same as v1.5.8 and every earlier release. The processing budget only ends a request, attempts go out one window apart, and the backup tier is reached once the primary pool is exhausted. With the chart defaults and three quiet primaries, a read again ends with a 500 at 30s. That is the behaviour MAG-3923 reports, which the router owner has confirmed is intended. Whether to change it is for the design discussion.
No release tag contains #449, and every tenant pins a release between v1.4.0 and v1.5.8, so no deployed router changes.
Changes beyond the plain
git revertThe revert of the four commits applies onto main (
55bb8650) with no conflicts. Three things needed adjusting:consumer_session_manager.gokeeps the gofumpt form ofProbeLoopIntervalthat fix(relaycore)!: hedge to the backup tier before the budget ends when primaries go quiet (MAG-3923) #449 introduced. Restoring the oldvar ( … )block would fail lint on a file this PR touches.cross_validation_threshold_guard_test.goandhealth_check_crafted_relay_test.gowere written after fix(relaycore)!: hedge to the backup tier before the budget ends when primaries go quiet (MAG-3923) #449. Their calls tosendRelayToEndpointpassed the trailingbackupReserveargument, which no longer exists. A plain revert breaks the test build, and CI does not rungo test, so it would have merged green.Verification
All run locally on the committed tree, because CI does not run
go test:go build ./...andgo vet ./...are clean.go test -count=1passes forprotocol/relaycore,protocol/relaypolicy,protocol/lavasessionandprotocol/rpcsmartrouter.golangci-linton the three touched packages reports the same 20 issues as main, none of them new.gofumpt -lis clean on every changed file.Follow-ups outside this PR
test_two_quiet_main_nodes_still_do_not_wake_the_backup_tiershould pass again.scripts/changelog-bump.shhas no revert handling. The next release section will list fix(relaycore)!: hedge to the backup tier before the budget ends when primaries go quiet (MAG-3923) #449's four commits under Bug fixes and this revert under Other work, so all five should be removed from it by hand.Please squash-merge.
🤖 Generated with Claude Code