Skip to content

fix(statewrite): raise the state-write retry ceiling with jittered backoff and convergence markers - #538

Merged
joshua-temple merged 1 commit into
mainfrom
fix/state-write-retry-hardening
Jul 9, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
fix/state-write-retry-hardening

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

What

Brings the Contents-API write path and the emitted shell write loop to parity with the git push-retry hardened in #537, so all three state-write paths retry robustly and emit one greppable convergence marker.

  • internal/statewrite/apiwrite.go CommitWithRetry: 5 to 10 attempts; fixed N*500ms backoff replaced with exponential jittered backoff (base 250ms, doubling, capped 8s); emits cascade-state-write: attempt=N/10 per attempt, plus success and exhaustion lines.
  • internal/generate/state_write.go (emitted shell, both branches): loop bound 5 to 10; fixed random sleep replaced with the same exponential jittered backoff in bash; same marker echoed.

State semantics are unchanged. The emitted-output goldens (byte-identical baseline) and cascade's own regenerated orchestrate.yaml move only for the retry, backoff, and marker lines (verified by filtered diff). The backoff helper is duplicated in the low-level statewrite package rather than importing internal/git to avoid a dependency cycle.

Verification

New tests (red-before/green-after): CommitWithRetry now attempts up to ten and emits the markers; the emitted shell contains the raised bound and marker. e2e scenarios 08 and 09 strengthened to assert the bound and marker. go build, full go test ./..., go test ./... -race, golangci-lint all clean.

…ckoff and convergence markers

Bring the Contents-API write path and the emitted shell write loop to parity with the git push-retry hardened earlier. CommitWithRetry goes from five attempts to ten with exponential jittered backoff (base 250ms, doubling, capped at eight seconds) and emits a per-attempt convergence marker plus success and exhaustion lines. The emitted shell state-write loop raises its bound to ten, replaces the fixed random sleep with the same exponential jittered backoff, and echoes the same marker. All three write paths now log one greppable marker so a concurrency proof can assert on convergence and non-exhaustion. State semantics are unchanged; the emitted-output goldens and cascade's own regenerated workflow move only for the retry, backoff, and marker lines. The backoff helper is duplicated in the low-level statewrite package rather than importing the git package to avoid a dependency cycle.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple merged commit acfda02 into main Jul 9, 2026
20 checks passed
@joshua-temple
joshua-temple deleted the fix/state-write-retry-hardening branch July 9, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant