Commit e7834df
fix(agent): retry upstream clones so a GitHub 429 stops failing the image build (#67)
## Symptom
`docker compose build` has been failing intermittently on unrelated PRs
— most recently twice today on `cursor/admin-profile-switch-c497`. Every
other job passes; only the agent image fails.
## Root cause
Not a code defect. Both upstream clones in `agent/Dockerfile` are
**unauthenticated** requests to github.com, issued **once, with no
retry**:
```
Cloning into 'runtime'...
remote: This request was rate-limited due to too many requests.
fatal: unable to access 'https://github.com/NousResearch/hermes-agent.git/':
The requested URL returned error: 429
exit code: 128
```
GitHub rate-limits unauthenticated traffic **per source IP**, and
Actions runners share pooled egress addresses. Under load the clone is
refused and the whole image build dies with it. Nothing about the PR
under test is involved — which is exactly why it looked random and kept
landing on innocent branches.
**Failure rate: 2 of the last 15 `docker compose build` runs.** That
flakiness pattern is itself the diagnosis; a real build break would fail
15 of 15.
## Fix
Both clones retry up to 5 times with escalating backoff (15/30/45/60s).
Retry is the right layer *because* the condition is transient — but the
loop still prints `FATAL` and **exits 1** on the last attempt, so an
upstream that is genuinely gone fails the build loudly rather than
yielding an image with no runtime in it.
This is not CI-only defensiveness: `scripts/self-host/install.sh` runs
the same build, so a self-host user behind a shared NAT hits the
identical refusal.
Also noted in a comment: the webui clone's existing `|| git clone`
fallback only ever handled a *moved ref*. Against a rate-limit it just
re-issued the same refused request, so it needed the outer retry to be
of any use at all.
## Verification
- [x] Both edited `RUN` blocks pass `sh -n` as the shell actually
receives them (continuations joined, in-`RUN` comments stripped).
Baseline check caught a bug in my own extractor first — all 6 blocks
including 3 untouched ones flagged, which is how I knew the harness was
wrong rather than the Dockerfile.
- [x] Success path: the wrapper performs a real `git clone` of
hermes-agent — exit 0, 76 entries, `pyproject.toml` present.
- [x] Give-up path: against an unreachable repo it retries 5×, prints
`FATAL`, exits **1** (not 0).
- [ ] CI `docker compose build` green on this PR — the authoritative
test.
## Follow-up, deliberately not bundled here
`AGENT_RUNTIME_REF=main` and `AGENT_API_REF=master` are **unpinned
branches**, which contradicts the pinning rule in `CLAUDE.md` (*"PINNED
for reproducibility ... Bump deliberately and re-validate"*). That's a
second, independent failure mode — an upstream commit can break this
build with no change on our side, which is precisely the class of bug
the `mcp>=1.0,<2` pin two lines below exists to prevent. Current
upstream tags are `v2026.8.18` (hermes-agent) and `v0.52.76`
(hermes-webui). Worth a separate PR that pins and re-validates.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Venkat SF <venkatesh.sakamuri@stayflexi.com>1 parent 0aa2b77 commit e7834df
2 files changed
Lines changed: 45 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
241 | 256 | | |
242 | 257 | | |
243 | 258 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
57 | 73 | | |
58 | 74 | | |
59 | 75 | | |
| |||
64 | 80 | | |
65 | 81 | | |
66 | 82 | | |
67 | | - | |
68 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
69 | 95 | | |
70 | 96 | | |
71 | 97 | | |
| |||
0 commit comments