fix(test): reset recording proxy between 502 retries to fix telemetry flake - #327
Merged
Merged
Conversation
… flake The acceptance-telemetry job flaked when a transient API 502 triggered a CLI-command retry: the recording proxy kept the failed attempt's requests (one invocation_id) alongside the successful retry's (a different invocation_id), so AssertTelemetryConsistent saw two invocation_ids and failed. runWithHTTP502Retry now resets the proxy referenced by --api-base before each retry, so only the final attempt's requests remain. Proxies self-register by URL, so no per-test wiring is needed and the reset only fires on an actual retry. Adds a deterministic regression test (fake upstream + simulated 502). Part of #326. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UQV9qtvETd62qg2iDRR6kY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the
acceptance-telemetryflakiness tracked in #326 (task 1) — the prerequisite for gating releases on acceptance tests.Root cause
The harness already retries transient API 502/500s (
runWithHTTP502Retry). But a retry re-runs the whole CLI command, which emits a newinvocation_id. TheRecordingProxykept the failed attempt's requests alongside the successful retry's, soAssertTelemetryConsistentsaw two differentinvocation_ids and failed. This is what took down theacceptance-telemetryjob during the v2.3.2 release window.Fix
runWithHTTP502Retrynow resets the recording proxy referenced by--api-basebefore each retry, so only the final (successful) attempt's requests remain — preserving the strict "oneinvocation_idper run" assertion.StartRecordingProxyregisters,Closederegisters), so none of the 64 call sites change and no future test can forget to wire it up.Test
Adds
TestRunWithHTTP502RetryResetsRecordingProxy— a deterministic regression test using a fake upstream and a simulated 502→success, so it validates the fix without a live API and never flakes. Passes locally under-tags=telemetry.Part of #326.
🤖 Generated with Claude Code
https://claude.ai/code/session_01UQV9qtvETd62qg2iDRR6kY