fix(proxy): put the mitmproxy cache warm on the shared retry window - #912
Open
tend-agent wants to merge 1 commit into
Open
fix(proxy): put the mitmproxy cache warm on the shared retry window#912tend-agent wants to merge 1 commit into
tend-agent wants to merge 1 commit into
Conversation
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.
Problem
lib/retry.shcovers three pre-agent third-party reaches. There is a fourth:proxy/setup-sandbox.shwarms the uvx cache before backgrounding the proxy, and on a cache miss that resolves and downloads mitmproxy from PyPI. The script runs underset -euo pipefail, and its step —Set up credential-isolation sandbox— sits three steps ahead ofRun Claude, so a PyPI blip there loses the whole run having done none of the work the trigger asked for.The miss is scheduled rather than rare: the
actions/cachekey is version-scoped (tend-mitmproxy-${{ runner.os }}-${{ inputs.mitmproxy_version }}), so everymitmproxy_versionbump misses on each workflow's first run — which is exactly when a lost run is most expensive, since it reddens the weekly bump PR that carries the security-relevant pin.Solution
Source the shared lib from
setup-sandbox.shand wrap the warm inretry_install. The source sits up top, next to the env checks, so a wrong path fails before the user creation and the workspace chown rather than mid-setup.Stacked on #910 — the lib it sources lands there.
The two questions #911 left open
Is 60s enough for a cold mitmproxy resolve? Yes, with room to spare. The
~20s resolvefigure inclaude/action.yamlwas undated and is now wrong. Measured on a GitHub-hosted runner (this triage job), 2026-08-09, withuv 0.12.3and the pinnedmitmproxy==12.2.3:UV_CACHE_DIR(43 packages, ~100MB downloaded)So no third
TIMEOUTparameter is needed — the case #909 raised and #910 declined stays declined. This PR also corrects the stale figure in the action comment, keeping the cache's real justification (not re-pulling ~100MB from PyPI on every run) rather than the seconds.Does the backgrounded
mitmdumpneed its own retry? No — retrying the warm already covers it. The launch sharesUV_CACHE_DIR, and a cache warmed by this line serves the same--frominvocation with no network at all:Once the warm succeeds, PyPI is off the launch path, so the
nohup-plus-readiness-wait shape never has to be retried. That's recorded in the comment at the warm.Testing
Two tests in
generator/tests/test_shared_steps.py, both failing before the change:test_setup_sandbox_resolves_the_shared_retry_windowruns the script's own. "${ACTION_PATH}/…"line (matched by content, not position) withACTION_PATHset the way the action sets it, and assertsretry_installbecomes a defined function. A path that doesn't resolve wouldn't degrade to an unretried warm — underset -euo pipefailit loses every run, not just the ones that hit a blip.test_setup_sandbox_warms_the_mitmproxy_cache_through_the_windowasserts the warm is an argument toretry_installrather than a bare command.The second is a call-site assertion rather than the behavioural suite the three installers get.
setup-sandbox.shcreates the sandbox user, chowns the workspace and installs a CA before reaching the warm, so faking a path to that line would assert more about the fakes than about the script; what the window itself does is already covered by the installer suites. Flagging the asymmetry rather than hiding it.pre-commit run(shellcheck, ruff, actionlint) and the full 393-test generator suite pass.Closes #911 — automated triage