Commit fbf4712
authored
fix(engine): normalize worktree-pool maxConcurrency so a NaN cap can't disable it (#6041)
availableWorktreeSlots and acquireWorktree read WorktreePoolConfig.maxConcurrency
directly in a comparison. A NaN cap (e.g. derived upstream from Number() of an
unparsable config value) makes `length >= NaN` always false, so at_capacity never
fires and the pool allocates worktrees without bound — contradicting the module's
documented "non-positive cap allocates nothing" contract — while
availableWorktreeSlots returns NaN. Normalize maxConcurrency through a
finiteNonNegativeInt helper at both read sites (non-finite or negative floors to 0,
fractional floors down), mirroring governor/rate-limit.ts, governor/budget-cap.ts,
and tenant-quota.ts.
Adds regression tests for NaN, negative, and fractional maxConcurrency.
Closes #5828
Co-authored-by: reyanthony062001-ops <reyanthony062001-ops@users.noreply.github.com>1 parent f938c75 commit fbf4712
2 files changed
Lines changed: 45 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
44 | 53 | | |
45 | 54 | | |
46 | | - | |
| 55 | + | |
47 | 56 | | |
48 | 57 | | |
49 | 58 | | |
| |||
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
63 | | - | |
| 72 | + | |
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
81 | 115 | | |
0 commit comments