1
00:00:00,000 --> 00:00:02,640
Right, so this one's brought to you by
Jellypod AI.

2
00:00:02,920 --> 00:00:08,980
A couple of episodes back we skated past
CLAUDE_CODE_OVERLOADED_RETRY_BASE_DELAY_MS,

3
00:00:09,000 --> 00:00:13,413
and then the max delay setting got a quick
mention too, just tossed out as a closing

4
00:00:13,520 --> 00:00:14,080
bullet.

5
00:00:14,147 --> 00:00:16,640
Turns out those were pieces of a set.

6
00:00:16,800 --> 00:00:23,280
Versions 2.1.295 and 2.1.296, released
October 8 and 9,

7
00:00:23,520 --> 00:00:25,573
finish it.

8
00:00:25,640 --> 00:00:31,973
2.1.295 added
CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS,

9
00:00:32,267 --> 00:00:38,544
and 2.1.296 added
CLAUDE_CODE_OVERLOADED_RETRY_MAX_DELAY_MS.

10
00:00:38,576 --> 00:00:44,349
Between them you can finally shape how
Claude Code behaves when the API throws a 529

11
00:00:44,400 --> 00:00:46,480
overloaded error during an unattended job.

12
00:00:46,500 --> 00:00:51,540
And the reason you'd care is the default
window is shorter than people think.

13
00:00:51,780 --> 00:00:56,660
At your desk, a 529 is no big deal, you
wait and hit enter again.

14
00:00:56,873 --> 00:01:02,660
In headless mode, a CI runner, or a loop,
it kills the process with exit code 1

15
00:01:02,720 --> 00:01:03,620
halfway through.

16
00:01:03,800 --> 00:01:07,380
One write up tested this against a mock
529 server.

17
00:01:07,480 --> 00:01:14,260
Default backoff starts around 0.55
seconds, then 1.26, 2.05,

18
00:01:14,340 --> 00:01:21,300
4.04, 9.5, 17.7, and levels off around 34
to 38 seconds.

19
00:01:21,440 --> 00:01:25,220
Ten retries burn through in 176.2 seconds.

20
00:01:25,300 --> 00:01:26,500
Under three minutes.

21
00:01:26,740 --> 00:01:30,180
So any capacity crunch longer than that
fails your pipeline.

22
00:01:30,208 --> 00:01:34,768
Now, the obvious fix was
CLAUDE_CODE_RETRY_WATCHDOG set to 1.

23
00:01:34,896 --> 00:01:40,688
That retries 429 and 529 capacity errors
indefinitely, backing off up to five

24
00:01:40,738 --> 00:01:42,048
minutes between attempts.

25
00:01:42,158 --> 00:01:46,048
Problem is, indefinitely means
indefinitely.

26
00:01:46,178 --> 00:01:49,488
Picture a GitHub Actions job with a 30
minute limit.

27
00:01:49,608 --> 00:01:53,808
The watchdog's still patiently waiting
when the platform sends a SIGKILL.

28
00:01:53,995 --> 00:01:58,048
No error log, no debugging details,
nothing salvageable.

29
00:01:58,192 --> 00:02:00,208
That's what the new wait cap fixes.

30
00:02:00,395 --> 00:02:05,008
It bounds how long the watchdog waits per
request, and then the job fails cleanly

31
00:02:05,104 --> 00:02:09,488
with an explanatory 529 message, before
the runner pulls the plug.

32
00:02:09,500 --> 00:02:10,900
Here's the CI pattern.

33
00:02:11,020 --> 00:02:17,340
In your job definition, export
CLAUDE_CODE_RETRY_WATCHDOG equals 1,

34
00:02:17,388 --> 00:02:23,900
then export
CLAUDE_CODE_RETRY_WATCHDOG_MAX_WAIT_MS equals

35
00:02:24,300 --> 00:02:27,340
1,800,000, which is 30 minutes.

36
00:02:27,452 --> 00:02:33,820
Then run claude with the p flag, your
prompt, say run tests and fix failures,

37
00:02:33,920 --> 00:02:38,860
and add the fallback model flag with
Sonnet 5.5 and Haiku 5.5.

38
00:02:38,972 --> 00:02:43,340
Each model in that chain gets its own
retry budget, and since capacity is tracked

39
00:02:43,380 --> 00:02:47,900
per model, falling back from an overloaded
model often succeeds straight away.

40
00:02:47,917 --> 00:02:51,517
If you'd rather skip the watchdog, there's
a tuned backoff pattern.

41
00:02:51,697 --> 00:02:55,117
Set CLAUDE_CODE_MAX_RETRIES to 5.

42
00:02:55,207 --> 00:02:59,677
Default is 10, and it's capped at 15
unless the watchdog is on.

43
00:02:59,821 --> 00:03:06,077
Then set the base delay to 4,000
milliseconds and the new max delay to 60,000.

44
00:03:06,205 --> 00:03:11,597
Base delay has a range of 500 to 32,000,
with a 500 default,

45
00:03:11,637 --> 00:03:14,637
and it arrived in 2.1.292.

46
00:03:14,777 --> 00:03:19,357
The point is a small retry budget now
stretches across several minutes,

47
00:03:19,397 --> 00:03:21,517
instead of getting blown through in
seconds.

48
00:03:21,682 --> 00:03:22,602
A few gotchas.

49
00:03:23,182 --> 00:03:26,282
First, the wait cap is per request, not
per job.

50
00:03:26,742 --> 00:03:30,642
A session with many turns can burn several
wait periods, so leave headroom under

51
00:03:30,662 --> 00:03:31,562
your runner timeout.

52
00:03:32,322 --> 00:03:36,602
Second, retries only happen for requests
that failed before Claude produced any

53
00:03:36,682 --> 00:03:39,142
completed text or ran any tool calls.

54
00:03:39,842 --> 00:03:43,382
If a stream dies after tools have run,
Claude Code won't replay them,

55
00:03:43,862 --> 00:03:47,682
which protects you from duplicate writes
or a repeated destructive shell command.

56
00:03:48,402 --> 00:03:54,582
Third, a 429 from a hard spend cap,
exhausted credits, or an org policy denial comes

57
00:03:54,602 --> 00:03:58,282
back with a header telling it not to
retry, so it fails immediately.

58
00:03:58,962 --> 00:04:03,422
And please don't put the watchdog in your
.bashrc or .zshrc.

59
00:04:03,922 --> 00:04:05,662
Your interactive sessions will look
frozen.

60
00:04:06,142 --> 00:04:08,582
Scope it to CI containers and automated
jobs.

61
00:04:08,667 --> 00:04:10,027
Quick quality of life round.

62
00:04:10,160 --> 00:04:16,987
In 2.1.296, Edit and NotebookEdit now
refuse to edit files that aren't valid UTF

63
00:04:17,067 --> 00:04:23,947
8, like Shift JIS, Windows 1252, or GBK,
where before they quietly

64
00:04:24,027 --> 00:04:26,667
mangled every non ASCII character.

65
00:04:26,760 --> 00:04:30,907
Turns or bang commands started while a
session moves to the background with the left

66
00:04:30,960 --> 00:04:33,787
arrow are now stopped, not run out of
sight.

67
00:04:33,947 --> 00:04:38,427
On Windows, PowerShell commands over 1 KB
used to always prompt,

68
00:04:38,447 --> 00:04:43,067
and allow rules and read only detection
now apply up to 32 KB.

69
00:04:43,083 --> 00:04:43,843
Two more.

70
00:04:43,933 --> 00:04:48,283
Run claude with debug, and command hooks
now log their command,

71
00:04:48,352 --> 00:04:53,883
plugin, outcome, and duration when they
finish, so a slow hook is easy to spot.

72
00:04:53,923 --> 00:05:00,763
And CLAUDE_CODE_WORKFLOW_SUBAGENT_MODEL
runs every workflow agent on one

73
00:05:00,830 --> 00:05:05,403
model, say Haiku 5.5, while your regular
subagents keep their own.

74
00:05:05,590 --> 00:05:10,683
If a nightly job's been dying on a 529,
set the wait cap and a fallback chain this

75
00:05:10,747 --> 00:05:11,083
week.

