code-coordinator 0.5.781__py3-none-any.whl → 0.5.783__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {code_coordinator-0.5.781.dist-info → code_coordinator-0.5.783.dist-info}/METADATA +1 -1
- {code_coordinator-0.5.781.dist-info → code_coordinator-0.5.783.dist-info}/RECORD +16 -14
- coord/board_doctor.py +205 -22
- coord/board_doctor_policy.py +36 -5
- coord/commands/drive_queue.py +51 -5
- coord/decomposition_chat.py +57 -2
- coord/deploy/coord-board-doctor-fast.service +57 -0
- coord/deploy/coord-board-doctor-fast.timer +42 -0
- coord/deploy/coord-board-doctor.service +10 -0
- coord/deploy/coord-board-doctor.timer +14 -4
- coord/models.py +14 -0
- coord/preflight_size.py +57 -15
- {code_coordinator-0.5.781.dist-info → code_coordinator-0.5.783.dist-info}/WHEEL +0 -0
- {code_coordinator-0.5.781.dist-info → code_coordinator-0.5.783.dist-info}/entry_points.txt +0 -0
- {code_coordinator-0.5.781.dist-info → code_coordinator-0.5.783.dist-info}/licenses/LICENSE +0 -0
- {code_coordinator-0.5.781.dist-info → code_coordinator-0.5.783.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
code_coordinator-0.5.
|
|
1
|
+
code_coordinator-0.5.783.dist-info/licenses/LICENSE,sha256=851BVZZwf_pEv2ydSlMmcZrwnwSS5YJ98wdLze7lyL8,4212
|
|
2
2
|
coord/__init__.py,sha256=3FN2qrrxtW87xSsSD557YcMwHLDahnFK8LvqQI7Wlf4,9783
|
|
3
3
|
coord/_board_mapping.py,sha256=Qxht1x0e3EzawMtqgNf-SeiJjCNiZHP-AERoVf75A7A,13332
|
|
4
4
|
coord/acceptance.py,sha256=WspJv7soXc2cSXgn9s78BHD8y0qeGBIyaNmsAl4pYVc,119974
|
|
@@ -13,10 +13,10 @@ coord/audit.py,sha256=8cYVK8ODjrOGqfxpabORZSvtjROZAWKhzV-Fbt4Ap64,23682
|
|
|
13
13
|
coord/auto_loop.py,sha256=E0nzv1trRpT2Z8RgAieNegCjJA17q-hGwBHzEPBQFJU,120936
|
|
14
14
|
coord/backup.py,sha256=9mkHgsdnMXQ40Uyi_CUAi_4kZEZFCGB1_Rtz0Yh6FAk,37981
|
|
15
15
|
coord/block_log.py,sha256=Zk2d-e13ftibSuvu3dVA1BzJBlmBrLk7CcVIQe998aE,57901
|
|
16
|
-
coord/board_doctor.py,sha256=
|
|
16
|
+
coord/board_doctor.py,sha256=FvmpgKpYCGfEb1byrs42rjitrCe__RnOnb5_uU5IQGo,205451
|
|
17
17
|
coord/board_doctor_followthrough.py,sha256=7oQECx1khCoYEH70RIoddIKDB0IwCa4iZKoL96Jz3G0,53955
|
|
18
18
|
coord/board_doctor_permissions.py,sha256=oztwZCKhP-m7vInQJ8V5tnHzMrdoAOtdcpFi4qWp7RI,145529
|
|
19
|
-
coord/board_doctor_policy.py,sha256=
|
|
19
|
+
coord/board_doctor_policy.py,sha256=xZOgz6Vo3PBRAVtKnbt63OqByMtj_VeasobLnRQKAIw,181446
|
|
20
20
|
coord/board_schema.py,sha256=5eUL7pgVOTM8YQ_aswhS7Ahv3RYwtH4nz09AUVlo_Dg,30265
|
|
21
21
|
coord/board_service.py,sha256=sZocSH9LVDS-al_acRJ08lLl8MOEHFa-yo7odkiGIhc,13798
|
|
22
22
|
coord/board_wire.py,sha256=ytWfr50aZc4Wk8_TpZTNNO_Ug690F0-TP5_u-50IuUc,22654
|
|
@@ -43,7 +43,7 @@ coord/conflict_fix.py,sha256=Yeql1IpIfh_7dkp_OpfAouMmRTQ001bvoCTR0v5FlD4,125554
|
|
|
43
43
|
coord/dao.py,sha256=C6hjwdpD2rTbWOPLKvgMcBgd8YLVWyv2VzjAsfK-Rbw,34343
|
|
44
44
|
coord/db.py,sha256=tOULd_hxVXA9wUjcXsT6umiS7sXE6hDaUkaEtnlijaM,185206
|
|
45
45
|
coord/dead_end.py,sha256=glt87vdE-2q31JZAu9W-pB8c-SJilFrQDWRvYWRxsmo,20945
|
|
46
|
-
coord/decomposition_chat.py,sha256=
|
|
46
|
+
coord/decomposition_chat.py,sha256=bt3MC4Q9voLRpYbNauDhj4GBc-l5auslZMYZ4y5L8q4,91716
|
|
47
47
|
coord/deploy_manifest.py,sha256=FIeF0sNHL3d3dyV3BbI8W99ZtZP-VwIQHKBi-POd7UE,8140
|
|
48
48
|
coord/deploy_units.py,sha256=ZfFueMPXKW4u8geOMEHhmgyseUPuKWNub77NDjMNrHA,24097
|
|
49
49
|
coord/deprecation_telemetry.py,sha256=ZK6wmN3qzF2-Ic1iVpYSC8Y4gw1sA0sJnerErzgKAI8,4149
|
|
@@ -97,7 +97,7 @@ coord/milestone_dispatch.py,sha256=08UZ_6lL4yBHCITBL0zvbQ-T3XkRJfSTmXe0g_Ujcc0,7
|
|
|
97
97
|
coord/milestone_gate.py,sha256=W81H0t8bFes9Yf86GEBsqkWiVHjEtj6GRwrZiiGiv4A,30528
|
|
98
98
|
coord/milestone_order.py,sha256=uwSXBo6PgvgcxbDMLK4jUOEVYdl-HvRj5wqybjGjN38,40901
|
|
99
99
|
coord/mock_author.py,sha256=mZWSMCPsIqhpQeOgvW11geHrCrDml8v0LdJJY8TyjmA,35784
|
|
100
|
-
coord/models.py,sha256=
|
|
100
|
+
coord/models.py,sha256=LbSeW5TMEHbrhQNInhgQzhr2VYTbBVX3JrOJoWUHHCM,111142
|
|
101
101
|
coord/native_fs_wait.py,sha256=nt4YMjh2dhWsKowuJgiHQJctq8uZwIL2x6r8CBRgwGs,6123
|
|
102
102
|
coord/native_pixels.py,sha256=mskQbMEnwPxLssXc_S35mLfjVYLiGNQx3fb6gJfY3EQ,22291
|
|
103
103
|
coord/network.py,sha256=s8Ujts1qalc7Q5clPIdIm8km1eSbhTuXb3BkOZanAZQ,25556
|
|
@@ -120,7 +120,7 @@ coord/portal_bridge.py,sha256=74GNtxhcCA688SQZakFNxr2vfSh1aOZ_6cFjwMKlLsw,27517
|
|
|
120
120
|
coord/portal_store.py,sha256=ajlr0vBSVakL0Jj0xJP66Po5yuc-qMZM79Tj6Is5S8Q,147543
|
|
121
121
|
coord/portal_sync.py,sha256=6f7g-GVCfVokQd53HYbpa22WhXON4wJMtOsz8UUlb4k,163111
|
|
122
122
|
coord/pr_body_lint.py,sha256=hD1tB2Z9xPCnNsHd6tdrPtBVDJ0Ixuyyxtl6xJeMUVo,2828
|
|
123
|
-
coord/preflight_size.py,sha256=
|
|
123
|
+
coord/preflight_size.py,sha256=5tEp8q_eNJs5TATgZHOoBz4qCHhsoF8HU4_PIgO_Ra8,28536
|
|
124
124
|
coord/prereqs.py,sha256=_ClfiS1XgoVvP9eAmU3WpCwYJSgV9N7wQ1jBqlS8f8k,79795
|
|
125
125
|
coord/prereview_gate.py,sha256=KBt5MaHQAyXZYJX8I12rMFctq9nfX9KXGqZlg0T8gYI,23252
|
|
126
126
|
coord/progress.py,sha256=uwHE7uaBt69EmQmYhXFe25iHGbAeEkr2z1kTG8xZhw4,28879
|
|
@@ -186,7 +186,7 @@ coord/commands/dispatch.py,sha256=oKVDmybYCVHXKun3vjFJPNQNI99I7nHmhqHVgIYohyQ,11
|
|
|
186
186
|
coord/commands/dispatch_workers.py,sha256=9Sd0dMqGDekHnV2CVUelxk0-JEAwEbr2pl6zKUOYRv4,224186
|
|
187
187
|
coord/commands/dr.py,sha256=dVPJN2eZypKBH-YfwXbceveju3noQROI2uPihN66l70,9012
|
|
188
188
|
coord/commands/drive.py,sha256=r0qNudGpVEHGfe_i9GDXRR6jBtpLP2H6yZgeqLbDMsM,29381
|
|
189
|
-
coord/commands/drive_queue.py,sha256=
|
|
189
|
+
coord/commands/drive_queue.py,sha256=_HodJjVbqbvkkDvv43ZSPafaS5Io4N_u8ov6W6wETWs,483195
|
|
190
190
|
coord/commands/gate_a.py,sha256=Sc9WRNke_c70WV2crXMgiuMgd66Ctsv254iHGIEGwSc,14613
|
|
191
191
|
coord/commands/gates.py,sha256=wr-v0KOmQdBGaKR6ao9HDHdTl8ZLZOlra9rtN-RrBww,4877
|
|
192
192
|
coord/commands/issues.py,sha256=jD9h9Xems7EpL3BYFzYvJLrB-cNSIvCqYpZwH__gSyc,45483
|
|
@@ -221,8 +221,10 @@ coord/deploy/README.md,sha256=DG_q36KeW0LQ32ElU11wjfjULO7xGUoiPIFEGPW41k0,1391
|
|
|
221
221
|
coord/deploy/coord-agent.service,sha256=GSo_2iqCx4zv4-85LGnaINsu-BdPHpG64I8xfULKcUk,6392
|
|
222
222
|
coord/deploy/coord-backup.service,sha256=2FgpzG9bGNOA9QPIxyWilS5yUDo8ZzvjYmoBpJluB4g,6705
|
|
223
223
|
coord/deploy/coord-backup.timer,sha256=SIm6_xpZH_l4y2IFF5n_o2oJi6vJMIwIg0O41_PFLSc,1475
|
|
224
|
-
coord/deploy/coord-board-doctor.service,sha256=
|
|
225
|
-
coord/deploy/coord-board-doctor.timer,sha256=
|
|
224
|
+
coord/deploy/coord-board-doctor-fast.service,sha256=tA1-S77I51rDl76lg_GQ48HmJza_ef0U265D4b7hUA0,3029
|
|
225
|
+
coord/deploy/coord-board-doctor-fast.timer,sha256=_dGl0F7K3otAZza-7Ma4DO5ImGzup-sae9Wu013ogS0,1993
|
|
226
|
+
coord/deploy/coord-board-doctor.service,sha256=HNwwM45bJsFeMJ3dhmTCucqf5c51ZNnDjPo7TfhoPTE,3917
|
|
227
|
+
coord/deploy/coord-board-doctor.timer,sha256=L_FsIjpan9wVGzRoWnSJxVdpmRzdtdcn40x9-vrl55s,1347
|
|
226
228
|
coord/deploy/coord-db-backup.service,sha256=v-l4L2EiSSoaD0V7AXe5b9-dtY_pBh7H6-iSPxEHa-c,4844
|
|
227
229
|
coord/deploy/coord-db-backup.sh,sha256=ep2fTUdHr3eNfG-s5vna66dH6BwncrN5CwTnyoO2EEE,6032
|
|
228
230
|
coord/deploy/coord-db-backup.timer,sha256=uIOVQgC_EfoUgEsjISgTdpX9KFWmZYSF4JPpFYF6WVM,515
|
|
@@ -314,8 +316,8 @@ coord/skills/review-verdict-recovery/SKILL.md,sha256=Grg8GWkJLK20ct2YiigbTFfNOki
|
|
|
314
316
|
coord/skills/tui-quadraui-workflow/SKILL.md,sha256=4hUZza9wSSnPhf0eRAOh2r_MQZxK2pXYO5g-kxmJq-U,3832
|
|
315
317
|
coord/skills/update-issue/SKILL.md,sha256=VrPinEmLZrCSNDrnz96hQomyO403o5c4i0RdsnUnWA0,3642
|
|
316
318
|
coord/templates/deploy-cloudflare.node.yml,sha256=icsTiWn2ziQJnpZODhhFKYlnqjt2xAXsbwlQufdxhuM,2078
|
|
317
|
-
code_coordinator-0.5.
|
|
318
|
-
code_coordinator-0.5.
|
|
319
|
-
code_coordinator-0.5.
|
|
320
|
-
code_coordinator-0.5.
|
|
321
|
-
code_coordinator-0.5.
|
|
319
|
+
code_coordinator-0.5.783.dist-info/METADATA,sha256=tXJNj9gY9Am2nMzV79dH_uSf-XVIwS9ZzLDy_j00LkA,17855
|
|
320
|
+
code_coordinator-0.5.783.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
321
|
+
code_coordinator-0.5.783.dist-info/entry_points.txt,sha256=o-Hq8pvG7ReGePvN_4iOKjLNqiq-MJ43HbPurqjNPZo,41
|
|
322
|
+
code_coordinator-0.5.783.dist-info/top_level.txt,sha256=w5sTrXesTCebhXyYv2qufOZGo0PoD1Lxgn0Q3MAXjh4,6
|
|
323
|
+
code_coordinator-0.5.783.dist-info/RECORD,,
|
coord/board_doctor.py
CHANGED
|
@@ -88,6 +88,13 @@ ALERT_SKIPPED = "skipped"
|
|
|
88
88
|
#: re-acting on it and falls back to the (backoff-gated) alert tier.
|
|
89
89
|
CONVERGENCE_LIMIT = 3
|
|
90
90
|
|
|
91
|
+
#: :func:`sweep`'s *counter_namespace* for a ``mechanical_causes``-filtered
|
|
92
|
+
#: :func:`run_sweep` call — keeps that tight-cadence pass's convergence
|
|
93
|
+
#: counter separate from the plain hourly call's, so running this pass 60x
|
|
94
|
+
#: more often does not burn :data:`CONVERGENCE_LIMIT` 60x faster on the
|
|
95
|
+
#: SAME counter the hourly sweep still relies on for these causes.
|
|
96
|
+
MECHANICAL_SWEEP_COUNTER_NAMESPACE = "mechanical-only"
|
|
97
|
+
|
|
91
98
|
#: Merge-queue states this sweep treats as "stuck". A row merely waiting
|
|
92
99
|
#: its turn (``pending``/``merging``) or past (``merged``/``skipped``) is
|
|
93
100
|
#: not this doctor's problem — only a row that cannot progress on its own.
|
|
@@ -220,6 +227,23 @@ CAUSE_CONFLICT_FIX_HEAD_UNMOVED = "conflict-fix-head-unmoved"
|
|
|
220
227
|
#: does not wait indefinitely for a human to notice.
|
|
221
228
|
MERGE_PENDING_STALE_AFTER_SECONDS = 1800.0
|
|
222
229
|
|
|
230
|
+
#: #4027: the staleness floor :func:`run_sweep` uses in place of
|
|
231
|
+
#: :data:`MERGE_PENDING_STALE_AFTER_SECONDS` for a ``mechanical_causes``-
|
|
232
|
+
#: filtered (tight-cadence) call ONLY — the plain hourly call keeps the
|
|
233
|
+
#: 30-minute floor unchanged. 30 minutes exists to keep a row merely
|
|
234
|
+
#: waiting its ordinary turn off this sweep's radar; it was never a
|
|
235
|
+
#: correctness requirement, since :func:`_confirm_merge_pending_stuck` /
|
|
236
|
+
#: :func:`_reclassify_merge_never_attempted`'s own LIVE ``entry_gate_
|
|
237
|
+
#: status`` re-check is what actually proves a row safe to act on, not
|
|
238
|
+
#: this pre-filter. Left at the hourly value, the motivating "green,
|
|
239
|
+
#: approved, mergeable, not merging" shape would still sit for up to 30
|
|
240
|
+
#: minutes no matter how often the fast timer fires; this value (2
|
|
241
|
+
#: minutes — long enough that a row the ordinary `merge.auto_drain` tick
|
|
242
|
+
#: (30s cadence) is still actively retrying does not flap in and out of
|
|
243
|
+
#: this sweep) is what actually closes that gap down to the fast timer's
|
|
244
|
+
#: own cadence.
|
|
245
|
+
MECHANICAL_MERGE_PENDING_STALE_AFTER_SECONDS = 120.0
|
|
246
|
+
|
|
223
247
|
#: #3901 (#3887 case 4, the remainder #3887 itself claimed but never
|
|
224
248
|
#: wired): a `blocked`/`parked` drive-queue row that was DISPATCHED at
|
|
225
249
|
#: least once (it has at least one `coord.gates.assignments_for_issue`
|
|
@@ -1291,7 +1315,12 @@ class SweepReport:
|
|
|
1291
1315
|
)
|
|
1292
1316
|
|
|
1293
1317
|
|
|
1294
|
-
def merge_queue_rows(
|
|
1318
|
+
def merge_queue_rows(
|
|
1319
|
+
entries: Sequence[Any],
|
|
1320
|
+
*,
|
|
1321
|
+
now: float | None = None,
|
|
1322
|
+
stale_after_seconds: float | None = None,
|
|
1323
|
+
) -> list[StuckRow]:
|
|
1295
1324
|
"""Local cause mapping for merge-queue rows (#3758).
|
|
1296
1325
|
|
|
1297
1326
|
:func:`coord.queue_diagnose.run_pass` only understands drive-queue
|
|
@@ -1338,12 +1367,24 @@ def merge_queue_rows(entries: Sequence[Any], *, now: float | None = None) -> lis
|
|
|
1338
1367
|
|
|
1339
1368
|
*now* defaults to :func:`time.time` — overridable so a replay test can
|
|
1340
1369
|
assert on a fixed, reproducible staleness window.
|
|
1370
|
+
|
|
1371
|
+
*stale_after_seconds* (#4027) overrides :data:`MERGE_PENDING_STALE_AFTER_SECONDS`
|
|
1372
|
+
for this call only — :func:`run_sweep`'s ``mechanical_causes``-filtered
|
|
1373
|
+
(tight-cadence) call threads a much shorter window through here so the
|
|
1374
|
+
"green/approved/mergeable but the ordinary merge tick keeps missing it"
|
|
1375
|
+
shape does not wait up to 30 minutes just because the general-purpose
|
|
1376
|
+
pre-filter does; the live re-check in :func:`_confirm_merge_pending_stuck`
|
|
1377
|
+
still has to confirm the row before anything acts on it either way, so
|
|
1378
|
+
shortening this cheap candidate window never trades away correctness.
|
|
1341
1379
|
"""
|
|
1342
1380
|
import time as _time # noqa: PLC0415
|
|
1343
1381
|
|
|
1344
1382
|
from coord.merge_queue import CONFLICT_FIX_HEAD_UNMOVED_SIGNAL, PENDING # noqa: PLC0415
|
|
1345
1383
|
|
|
1346
1384
|
moment = _time.time() if now is None else now
|
|
1385
|
+
stale_after = (
|
|
1386
|
+
MERGE_PENDING_STALE_AFTER_SECONDS if stale_after_seconds is None else stale_after_seconds
|
|
1387
|
+
)
|
|
1347
1388
|
rows: list[StuckRow] = []
|
|
1348
1389
|
for entry in entries:
|
|
1349
1390
|
cause = _MERGE_QUEUE_STUCK_CAUSE.get(entry.state)
|
|
@@ -1356,7 +1397,7 @@ def merge_queue_rows(entries: Sequence[Any], *, now: float | None = None) -> lis
|
|
|
1356
1397
|
if (
|
|
1357
1398
|
entry.state == PENDING
|
|
1358
1399
|
and entry.last_attempt is not None
|
|
1359
|
-
and moment - entry.last_attempt >=
|
|
1400
|
+
and moment - entry.last_attempt >= stale_after
|
|
1360
1401
|
):
|
|
1361
1402
|
cause = CAUSE_MERGE_PENDING_STUCK
|
|
1362
1403
|
else:
|
|
@@ -2215,6 +2256,7 @@ def _reclassify_merge_never_attempted(
|
|
|
2215
2256
|
board: Board,
|
|
2216
2257
|
config,
|
|
2217
2258
|
now: float | None = None,
|
|
2259
|
+
stale_after_seconds: float | None = None,
|
|
2218
2260
|
) -> list[StuckRow]:
|
|
2219
2261
|
"""#3929: promote a no-progress drive-queue row to
|
|
2220
2262
|
:data:`CAUSE_MERGE_NEVER_ATTEMPTED` when its merge-queue row is
|
|
@@ -2265,6 +2307,11 @@ def _reclassify_merge_never_attempted(
|
|
|
2265
2307
|
*now* defaults to :func:`time.time` — overridable so a replay test can
|
|
2266
2308
|
assert on a fixed, reproducible staleness window, same convention as
|
|
2267
2309
|
:func:`merge_queue_rows`.
|
|
2310
|
+
|
|
2311
|
+
*stale_after_seconds* (#4027) overrides :data:`MERGE_PENDING_STALE_AFTER_SECONDS`
|
|
2312
|
+
for this call only — same rationale and same caller
|
|
2313
|
+
(:func:`run_sweep`'s ``mechanical_causes``-filtered call) as
|
|
2314
|
+
:func:`merge_queue_rows`'s own override.
|
|
2268
2315
|
"""
|
|
2269
2316
|
import time as _time # noqa: PLC0415
|
|
2270
2317
|
|
|
@@ -2273,6 +2320,9 @@ def _reclassify_merge_never_attempted(
|
|
|
2273
2320
|
from coord.merge_queue import PENDING, PLAN_READY, entry_gate_status # noqa: PLC0415
|
|
2274
2321
|
|
|
2275
2322
|
moment = _time.time() if now is None else now
|
|
2323
|
+
stale_after = (
|
|
2324
|
+
MERGE_PENDING_STALE_AFTER_SECONDS if stale_after_seconds is None else stale_after_seconds
|
|
2325
|
+
)
|
|
2276
2326
|
entries_by_key = {
|
|
2277
2327
|
f"{entry.repo_name}#{entry.issue_number}": entry for entry in merge_entries
|
|
2278
2328
|
}
|
|
@@ -2292,7 +2342,7 @@ def _reclassify_merge_never_attempted(
|
|
|
2292
2342
|
or entry.last_attempt is not None
|
|
2293
2343
|
or (
|
|
2294
2344
|
entry.enqueued_at is not None
|
|
2295
|
-
and moment - entry.enqueued_at <
|
|
2345
|
+
and moment - entry.enqueued_at < stale_after
|
|
2296
2346
|
)
|
|
2297
2347
|
):
|
|
2298
2348
|
out.append(row)
|
|
@@ -2960,18 +3010,30 @@ def no_progress_rows(
|
|
|
2960
3010
|
return rows
|
|
2961
3011
|
|
|
2962
3012
|
|
|
2963
|
-
def collect_rows(
|
|
3013
|
+
def collect_rows(
|
|
3014
|
+
*,
|
|
3015
|
+
config,
|
|
3016
|
+
trigger: str = "board-doctor-sweep",
|
|
3017
|
+
merge_pending_stale_after_seconds: float | None = None,
|
|
3018
|
+
) -> list[StuckRow]:
|
|
2964
3019
|
"""The impure production walk over both queues (#3758). Thin wrapper
|
|
2965
3020
|
over :func:`_collect_rows_with_board` for every caller that only wants
|
|
2966
3021
|
the rows — :func:`run_sweep` wants the :class:`Board` this walk
|
|
2967
3022
|
already built too, so it unpacks both instead of paying for a second
|
|
2968
3023
|
:func:`coord.state.build_board` read of its own."""
|
|
2969
|
-
rows, _board = _collect_rows_with_board(
|
|
3024
|
+
rows, _board = _collect_rows_with_board(
|
|
3025
|
+
config=config,
|
|
3026
|
+
trigger=trigger,
|
|
3027
|
+
merge_pending_stale_after_seconds=merge_pending_stale_after_seconds,
|
|
3028
|
+
)
|
|
2970
3029
|
return rows
|
|
2971
3030
|
|
|
2972
3031
|
|
|
2973
3032
|
def _collect_rows_with_board(
|
|
2974
|
-
*,
|
|
3033
|
+
*,
|
|
3034
|
+
config,
|
|
3035
|
+
trigger: str = "board-doctor-sweep",
|
|
3036
|
+
merge_pending_stale_after_seconds: float | None = None,
|
|
2975
3037
|
) -> tuple[list[StuckRow], Board]:
|
|
2976
3038
|
"""The impure production walk over both queues (#3758).
|
|
2977
3039
|
|
|
@@ -3015,6 +3077,12 @@ def _collect_rows_with_board(
|
|
|
3015
3077
|
Deferred imports, same reason ``drive_queue_diagnose`` defers them: this
|
|
3016
3078
|
module is imported by the CLI's thin registration layer, and these
|
|
3017
3079
|
pull in `gh`-touching modules this harness's own tests must not need.
|
|
3080
|
+
|
|
3081
|
+
*merge_pending_stale_after_seconds* (#4027) is forwarded, unchanged, as
|
|
3082
|
+
both :func:`merge_queue_rows`'s and :func:`_reclassify_merge_never_
|
|
3083
|
+
attempted`'s own *stale_after_seconds* override — ``None`` (every
|
|
3084
|
+
caller except :func:`run_sweep`'s ``mechanical_causes``-filtered one)
|
|
3085
|
+
keeps today's :data:`MERGE_PENDING_STALE_AFTER_SECONDS` floor.
|
|
3018
3086
|
"""
|
|
3019
3087
|
from coord import block_log # noqa: PLC0415
|
|
3020
3088
|
from coord.commands.drive_queue import ( # noqa: PLC0415
|
|
@@ -3075,7 +3143,11 @@ def _collect_rows_with_board(
|
|
|
3075
3143
|
rows.extend(refreshed_rows)
|
|
3076
3144
|
rows.extend(row for ep in settled_episodes if (row := _episode_stuck_row(ep)) is not None)
|
|
3077
3145
|
merge_entries = load_merge_queue()
|
|
3078
|
-
rows.extend(
|
|
3146
|
+
rows.extend(
|
|
3147
|
+
merge_queue_rows(
|
|
3148
|
+
merge_entries, stale_after_seconds=merge_pending_stale_after_seconds,
|
|
3149
|
+
)
|
|
3150
|
+
)
|
|
3079
3151
|
|
|
3080
3152
|
# #3945: a `merged-partial` row carries no open `block_log` episode (it
|
|
3081
3153
|
# is terminal/done-like, never `blocked`/`parked`) and no merge-queue
|
|
@@ -3140,7 +3212,10 @@ def _collect_rows_with_board(
|
|
|
3140
3212
|
)
|
|
3141
3213
|
rows = _reclassify_blocked_on_prereq(rows, entries_by_key)
|
|
3142
3214
|
rows = _confirm_merge_pending_stuck(rows, merge_entries, board=board, config=config)
|
|
3143
|
-
rows = _reclassify_merge_never_attempted(
|
|
3215
|
+
rows = _reclassify_merge_never_attempted(
|
|
3216
|
+
rows, merge_entries, board=board, config=config,
|
|
3217
|
+
stale_after_seconds=merge_pending_stale_after_seconds,
|
|
3218
|
+
)
|
|
3144
3219
|
rows.extend(smoke_no_verdict_rows(board))
|
|
3145
3220
|
|
|
3146
3221
|
# #3944: a `waiting` row stranded on an open, unqueued `after=` pre-req
|
|
@@ -3470,6 +3545,7 @@ def sweep(
|
|
|
3470
3545
|
backoff_initial_hours: float | None = None,
|
|
3471
3546
|
backoff_cap_hours: float | None = None,
|
|
3472
3547
|
outcome_grace_hours: float | None = None,
|
|
3548
|
+
counter_namespace: str | None = None,
|
|
3473
3549
|
) -> SweepReport:
|
|
3474
3550
|
"""The pure harness core: classify-already-done rows in, decisions out.
|
|
3475
3551
|
|
|
@@ -3535,10 +3611,15 @@ def sweep(
|
|
|
3535
3611
|
driving a partial row set out of it) drops its counter entirely via
|
|
3536
3612
|
``coord.state.clear_board_doctor_row``, so a later recurrence starts
|
|
3537
3613
|
fresh at ``count=1, escalated=False`` instead of resuming a stale count
|
|
3538
|
-
or staying permanently escalation-blind.
|
|
3614
|
+
or staying permanently escalation-blind. "Did not appear in *rows*" is
|
|
3615
|
+
decided on the real row behind each stored counter, so counters another
|
|
3616
|
+
caller wrote under its own *counter_namespace* are dropped on the same
|
|
3617
|
+
evidence as the plain one — the row genuinely left the walk — and kept
|
|
3618
|
+
whenever it is still stuck here.
|
|
3539
3619
|
|
|
3540
3620
|
*escalation_resolver*, if given, is called as ``escalation_resolver
|
|
3541
|
-
(queue, key)``
|
|
3621
|
+
(queue, key)`` (always the real, un-namespaced row key, once per row)
|
|
3622
|
+
for every row :func:`clear_absent_rows` drops — the
|
|
3542
3623
|
counterpart to the alert path: once a row's cause has resolved (it
|
|
3543
3624
|
stopped appearing), whatever alert was filed for it is stale and the
|
|
3544
3625
|
resolver is expected to dismiss it. Called only on real (non-dry-run)
|
|
@@ -3591,6 +3672,31 @@ def sweep(
|
|
|
3591
3672
|
:func:`coord.state.board_doctor_alert_due`/
|
|
3592
3673
|
:func:`coord.state.mark_board_doctor_escalated`'s re-alert schedule.
|
|
3593
3674
|
|
|
3675
|
+
*counter_namespace*, when given, is folded into the convergence
|
|
3676
|
+
counter's storage key (never into *rows*' own ``(queue, key)`` identity
|
|
3677
|
+
used for ``touched``/decision-log/outcome-grading) so this call's
|
|
3678
|
+
observations land in a counter distinct from a plain (unnamespaced)
|
|
3679
|
+
call's. Without this, two callers sweeping the SAME rows at different
|
|
3680
|
+
cadences (:func:`run_sweep`'s hourly default call and its
|
|
3681
|
+
``mechanical_causes``-filtered call, run every minute or two
|
|
3682
|
+
alongside it) would silently SHARE one counter — the tight-cadence
|
|
3683
|
+
caller would then burn *convergence_limit* in minutes instead of
|
|
3684
|
+
sweeps, and the slower caller would inherit that exhausted count the
|
|
3685
|
+
next time it ran, permanently pre-empting its own dispatch decision
|
|
3686
|
+
for a cause the fast pass merely saw a transient no-op on. Each
|
|
3687
|
+
distinct namespace gets its own independent budget against the SAME
|
|
3688
|
+
*convergence_limit*, so a caller meant to run 60x more often does not
|
|
3689
|
+
have to compensate with a 60x larger limit just to behave as if it
|
|
3690
|
+
were the only writer.
|
|
3691
|
+
|
|
3692
|
+
``"::"`` is reserved as that namespace separator and never appears in
|
|
3693
|
+
a real ``repo#issue`` row key, so a stored counter key always decodes
|
|
3694
|
+
back to the row it belongs to. ``clear_absent_rows`` below relies on
|
|
3695
|
+
that: it judges presence on the REAL row identity behind each stored
|
|
3696
|
+
key, so a namespaced counter is cleared when (and only when) its row
|
|
3697
|
+
has genuinely left this sweep's walk — never merely because a
|
|
3698
|
+
different call's namespace wrote it.
|
|
3699
|
+
|
|
3594
3700
|
*outcome_grace_hours* (#3907) defaults to ``None``, resolved below to
|
|
3595
3701
|
:data:`coord.state.BOARD_DOCTOR_OUTCOME_GRACE_HOURS`. Outcome
|
|
3596
3702
|
backfill (see :func:`_grade_open_outcomes`) grades BOTH #3889's
|
|
@@ -3632,6 +3738,12 @@ def sweep(
|
|
|
3632
3738
|
else state.BOARD_DOCTOR_OUTCOME_GRACE_HOURS
|
|
3633
3739
|
)
|
|
3634
3740
|
|
|
3741
|
+
def _counter_key(key: str) -> str:
|
|
3742
|
+
"""*key*, namespaced for the convergence counter only (never for
|
|
3743
|
+
``touched``/decision-log/outcome-grading identity) — see
|
|
3744
|
+
*counter_namespace* above."""
|
|
3745
|
+
return key if counter_namespace is None else f"{key}::{counter_namespace}"
|
|
3746
|
+
|
|
3635
3747
|
touched: set[tuple[str, str]] = set()
|
|
3636
3748
|
# Outcome backfill: decisions from EARLIER sweeps still open for a
|
|
3637
3749
|
# verdict, read once up front so this sweep's own decisions below
|
|
@@ -3681,7 +3793,7 @@ def sweep(
|
|
|
3681
3793
|
if not outcome:
|
|
3682
3794
|
return False, "alert-failed"
|
|
3683
3795
|
state.mark_board_doctor_escalated(
|
|
3684
|
-
row.queue, row.key, now=moment,
|
|
3796
|
+
row.queue, _counter_key(row.key), now=moment,
|
|
3685
3797
|
backoff_initial_hours=backoff_initial_hours,
|
|
3686
3798
|
backoff_cap_hours=backoff_cap_hours,
|
|
3687
3799
|
)
|
|
@@ -3697,7 +3809,7 @@ def sweep(
|
|
|
3697
3809
|
# (never writes) the persisted counter purely so the decision
|
|
3698
3810
|
# log / CLI can still show what this row was last known at,
|
|
3699
3811
|
# instead of a misleading ``count=0``.
|
|
3700
|
-
prior = state.board_doctor_row_state(row.queue, row.key) or {}
|
|
3812
|
+
prior = state.board_doctor_row_state(row.queue, _counter_key(row.key)) or {}
|
|
3701
3813
|
decision = Decision(
|
|
3702
3814
|
queue=row.queue,
|
|
3703
3815
|
key=row.key,
|
|
@@ -3743,13 +3855,13 @@ def sweep(
|
|
|
3743
3855
|
# moved the counter that decides when to stop deferring and
|
|
3744
3856
|
# page a human instead).
|
|
3745
3857
|
if dry_run:
|
|
3746
|
-
prior = state.board_doctor_row_state(row.queue, row.key) or None
|
|
3858
|
+
prior = state.board_doctor_row_state(row.queue, _counter_key(row.key)) or None
|
|
3747
3859
|
counter_state = state.next_board_doctor_counter(
|
|
3748
3860
|
prior, row.cause, backoff_initial_hours=backoff_initial_hours,
|
|
3749
3861
|
)
|
|
3750
3862
|
else:
|
|
3751
3863
|
counter_state = state.record_board_doctor_observation(
|
|
3752
|
-
row.queue, row.key, row.cause,
|
|
3864
|
+
row.queue, _counter_key(row.key), row.cause,
|
|
3753
3865
|
backoff_initial_hours=backoff_initial_hours,
|
|
3754
3866
|
)
|
|
3755
3867
|
count, escalated = counter_state["count"], counter_state["escalated"]
|
|
@@ -3801,13 +3913,13 @@ def sweep(
|
|
|
3801
3913
|
)
|
|
3802
3914
|
continue
|
|
3803
3915
|
if dry_run:
|
|
3804
|
-
prior = state.board_doctor_row_state(row.queue, row.key) or None
|
|
3916
|
+
prior = state.board_doctor_row_state(row.queue, _counter_key(row.key)) or None
|
|
3805
3917
|
counter_state = state.next_board_doctor_counter(
|
|
3806
3918
|
prior, row.cause, backoff_initial_hours=backoff_initial_hours,
|
|
3807
3919
|
)
|
|
3808
3920
|
else:
|
|
3809
3921
|
counter_state = state.record_board_doctor_observation(
|
|
3810
|
-
row.queue, row.key, row.cause,
|
|
3922
|
+
row.queue, _counter_key(row.key), row.cause,
|
|
3811
3923
|
backoff_initial_hours=backoff_initial_hours,
|
|
3812
3924
|
)
|
|
3813
3925
|
count, escalated = counter_state["count"], counter_state["escalated"]
|
|
@@ -3902,12 +4014,28 @@ def sweep(
|
|
|
3902
4014
|
)
|
|
3903
4015
|
|
|
3904
4016
|
if not dry_run and clear_absent_rows:
|
|
4017
|
+
# A single resolved row can have several stored counters (a plain
|
|
4018
|
+
# one plus one per namespace that observed it); its escalation is
|
|
4019
|
+
# one object, so dismiss it once rather than per stored key.
|
|
4020
|
+
dismissed: set[tuple[str, str]] = set()
|
|
3905
4021
|
for queue, key in state.board_doctor_tracked_rows():
|
|
3906
|
-
|
|
4022
|
+
# *key* here is the RAW stored key, which carries a
|
|
4023
|
+
# ``"::<namespace>"`` suffix whenever the call that wrote it
|
|
4024
|
+
# passed a *counter_namespace* — this one's, or any other
|
|
4025
|
+
# caller's. Presence is judged on the REAL row identity
|
|
4026
|
+
# behind that key, never on the stored key itself: this
|
|
4027
|
+
# sweep's own `touched` only ever holds plain row keys, so
|
|
4028
|
+
# comparing raw would read EVERY foreign-namespaced counter
|
|
4029
|
+
# as absent and wipe it (plus dismiss the row's live
|
|
4030
|
+
# escalation) even while the row sits stuck in this very
|
|
4031
|
+
# sweep's own walk.
|
|
4032
|
+
real_key = key.split("::", 1)[0]
|
|
4033
|
+
if (queue, real_key) not in touched:
|
|
3907
4034
|
state.clear_board_doctor_row(queue, key)
|
|
3908
|
-
if escalation_resolver is not None:
|
|
4035
|
+
if escalation_resolver is not None and (queue, real_key) not in dismissed:
|
|
4036
|
+
dismissed.add((queue, real_key))
|
|
3909
4037
|
try:
|
|
3910
|
-
escalation_resolver(queue,
|
|
4038
|
+
escalation_resolver(queue, real_key)
|
|
3911
4039
|
except Exception: # noqa: BLE001, S110 — one row's cleanup
|
|
3912
4040
|
# failing must not abort the walk and leave the
|
|
3913
4041
|
# remaining tracked rows' counters uncleared.
|
|
@@ -3935,6 +4063,7 @@ def run_sweep(
|
|
|
3935
4063
|
followthrough_sweep: Callable[..., list[board_doctor_followthrough.Disposition]] = (
|
|
3936
4064
|
run_followthrough_sweep
|
|
3937
4065
|
),
|
|
4066
|
+
mechanical_causes: frozenset[str] | None = None,
|
|
3938
4067
|
) -> SweepReport:
|
|
3939
4068
|
"""Production entry point: :func:`collect_rows` then :func:`sweep` (#3758).
|
|
3940
4069
|
|
|
@@ -3972,16 +4101,60 @@ def run_sweep(
|
|
|
3972
4101
|
for this invocation regardless of any repo's own opt-in
|
|
3973
4102
|
(:func:`coord.board_doctor_followthrough.followthrough_enabled` is
|
|
3974
4103
|
still consulted per-row on top of this).
|
|
4104
|
+
|
|
4105
|
+
*mechanical_causes*, when given, restricts this call to ONLY the
|
|
4106
|
+
named causes — every other row :func:`collect_rows` found (including
|
|
4107
|
+
every ``merged-partial`` follow-through row) is dropped before
|
|
4108
|
+
:func:`sweep` ever sees it, not merely alert-suppressed. This is the
|
|
4109
|
+
tight-cadence entry point a scheduler can run every minute or two
|
|
4110
|
+
alongside an hourly full sweep: a narrower, more frequent pass that
|
|
4111
|
+
only ever touches the deterministic, pre-approved queue repairs
|
|
4112
|
+
(``coord.board_doctor_policy.mechanical_causes()``), never the
|
|
4113
|
+
investigate or decomposition tiers' convergence counters,
|
|
4114
|
+
escalations or `gh`/leg-dispatch load. ``clear_absent_rows=False`` is
|
|
4115
|
+
forced alongside the filter for exactly this reason: this call's own
|
|
4116
|
+
row set is a deliberate subset, so a row outside it going "absent"
|
|
4117
|
+
from THIS sweep's point of view must never be read as "resolved" and
|
|
4118
|
+
have its counter wiped — only a full (unfiltered) sweep's own absence
|
|
4119
|
+
check may draw that conclusion. This call also threads
|
|
4120
|
+
:data:`MECHANICAL_SWEEP_COUNTER_NAMESPACE` through as *sweep*'s
|
|
4121
|
+
*counter_namespace* — its own convergence counter, independent of the
|
|
4122
|
+
plain (unfiltered) call's, so a tight-cadence scheduler running this
|
|
4123
|
+
pass every minute or two does not burn the SAME ``convergence_limit``
|
|
4124
|
+
budget the hourly call still relies on for these causes. The budgets
|
|
4125
|
+
are independent, not immortal: the plain call's absence check judges
|
|
4126
|
+
presence on real row identity, so it retires this call's namespaced
|
|
4127
|
+
counter too — once the row it belongs to has genuinely left the full
|
|
4128
|
+
walk, and never while it is still stuck.
|
|
4129
|
+
|
|
4130
|
+
It also collects with :data:`MECHANICAL_MERGE_PENDING_STALE_AFTER_SECONDS`
|
|
4131
|
+
in place of :data:`MERGE_PENDING_STALE_AFTER_SECONDS` for
|
|
4132
|
+
:data:`CAUSE_MERGE_PENDING_STUCK`/:data:`CAUSE_MERGE_NEVER_ATTEMPTED`'s
|
|
4133
|
+
own staleness pre-filter — the motivating "green, approved, mergeable,
|
|
4134
|
+
but the ordinary merge tick keeps missing it" row would otherwise stay
|
|
4135
|
+
invisible to THIS call for up to 30 minutes regardless of how often the
|
|
4136
|
+
tight cadence fires, since both causes are minted off that same floor.
|
|
4137
|
+
The plain (unfiltered) call keeps the 30-minute floor unchanged.
|
|
3975
4138
|
"""
|
|
3976
|
-
|
|
4139
|
+
board_doctor_cfg = getattr(config, "board_doctor", None)
|
|
4140
|
+
rows, board = _collect_rows_with_board(
|
|
4141
|
+
config=config,
|
|
4142
|
+
merge_pending_stale_after_seconds=(
|
|
4143
|
+
MECHANICAL_MERGE_PENDING_STALE_AFTER_SECONDS
|
|
4144
|
+
if mechanical_causes is not None
|
|
4145
|
+
else None
|
|
4146
|
+
),
|
|
4147
|
+
)
|
|
3977
4148
|
followthrough_rows = [r for r in rows if r.cause == CAUSE_MERGED_PARTIAL]
|
|
3978
4149
|
other_rows = [r for r in rows if r.cause != CAUSE_MERGED_PARTIAL]
|
|
4150
|
+
if mechanical_causes is not None:
|
|
4151
|
+
other_rows = [r for r in other_rows if r.cause in mechanical_causes]
|
|
4152
|
+
followthrough_rows = []
|
|
3979
4153
|
resolved_capacity_check = (
|
|
3980
4154
|
default_investigate_capacity(config)
|
|
3981
4155
|
if capacity_check is _CAPACITY_CHECK_UNSET
|
|
3982
4156
|
else capacity_check
|
|
3983
4157
|
)
|
|
3984
|
-
board_doctor_cfg = getattr(config, "board_doctor", None)
|
|
3985
4158
|
report = sweep(
|
|
3986
4159
|
other_rows,
|
|
3987
4160
|
tier_of=tier_of,
|
|
@@ -3991,12 +4164,22 @@ def run_sweep(
|
|
|
3991
4164
|
convergence_limit=convergence_limit,
|
|
3992
4165
|
escalation_resolver=escalation_resolver,
|
|
3993
4166
|
capacity_check=resolved_capacity_check,
|
|
4167
|
+
clear_absent_rows=mechanical_causes is None,
|
|
3994
4168
|
log_retention_days=getattr(board_doctor_cfg, "log_retention_days", None),
|
|
3995
4169
|
backoff_initial_hours=getattr(board_doctor_cfg, "backoff_initial_hours", None),
|
|
3996
4170
|
backoff_cap_hours=getattr(board_doctor_cfg, "backoff_cap_hours", None),
|
|
3997
4171
|
outcome_grace_hours=getattr(board_doctor_cfg, "outcome_grace_hours", None),
|
|
4172
|
+
counter_namespace=(
|
|
4173
|
+
MECHANICAL_SWEEP_COUNTER_NAMESPACE if mechanical_causes is not None else None
|
|
4174
|
+
),
|
|
3998
4175
|
)
|
|
3999
|
-
report.rows_observed = len(
|
|
4176
|
+
# `sweep()` already set `report.rows_observed = len(other_rows)` (the
|
|
4177
|
+
# *rows* it was actually handed) — only the unfiltered call needs
|
|
4178
|
+
# correcting here, to the FULL walk (`rows`, before the mechanical
|
|
4179
|
+
# filter/`merged-partial` split above), so "nothing stuck" keeps
|
|
4180
|
+
# meaning the whole board, not just this call's own narrowed subset.
|
|
4181
|
+
if mechanical_causes is None:
|
|
4182
|
+
report.rows_observed = len(rows)
|
|
4000
4183
|
if followthrough and followthrough_rows:
|
|
4001
4184
|
report.followthrough = followthrough_sweep(
|
|
4002
4185
|
followthrough_rows, config=config, board=board, dry_run=dry_run,
|
coord/board_doctor_policy.py
CHANGED
|
@@ -354,6 +354,26 @@ def _register_auto_action(
|
|
|
354
354
|
AUTO_DISPATCHERS[cause] = _gated
|
|
355
355
|
|
|
356
356
|
|
|
357
|
+
def _is_mechanical_route(cause: str) -> bool:
|
|
358
|
+
"""The #3760 mechanical route's own predicate (#4027 review, epic
|
|
359
|
+
#2096/#2085 "one question, one answer") — *cause* present in BOTH
|
|
360
|
+
:data:`ALLOWLIST` and :data:`AUTO_DISPATCHERS`, and the action
|
|
361
|
+
:data:`ALLOWLIST` names for it is on ``SAFE_TIER_ACTIONS``.
|
|
362
|
+
|
|
363
|
+
The ONE place that answers "is this cause on the mechanical route?" —
|
|
364
|
+
:func:`policy_tier_of`'s first branch and :func:`mechanical_causes`
|
|
365
|
+
both call this rather than each re-deriving the same conjunction from
|
|
366
|
+
the same three structures. Without that, the two could silently
|
|
367
|
+
diverge the moment the mechanical route gained a fourth term: a
|
|
368
|
+
cause :func:`policy_tier_of` had moved to :data:`coord.board_doctor.
|
|
369
|
+
TIER_ALERT` would stay in :func:`mechanical_causes`' result, and the
|
|
370
|
+
tight-cadence sweep would then escalate it every minute instead of
|
|
371
|
+
hourly.
|
|
372
|
+
"""
|
|
373
|
+
action = ALLOWLIST.get(cause)
|
|
374
|
+
return action is not None and cause in AUTO_DISPATCHERS and action in SAFE_TIER_ACTIONS
|
|
375
|
+
|
|
376
|
+
|
|
357
377
|
def policy_tier_of(cause: str) -> str:
|
|
358
378
|
"""#3745's C2 (extended by #3769): cause -> tier policy.
|
|
359
379
|
|
|
@@ -364,9 +384,7 @@ def policy_tier_of(cause: str) -> str:
|
|
|
364
384
|
the third answers to its own, separate mechanical gate instead (see
|
|
365
385
|
:data:`DECOMPOSITION_CAUSES`'s own docstring for why):
|
|
366
386
|
|
|
367
|
-
* The #3760 mechanical route —
|
|
368
|
-
:data:`ALLOWLIST` and :data:`AUTO_DISPATCHERS`, and the action
|
|
369
|
-
:data:`ALLOWLIST` names for it is on ``SAFE_TIER_ACTIONS``.
|
|
387
|
+
* The #3760 mechanical route — :func:`_is_mechanical_route`.
|
|
370
388
|
* The #3769 investigate route — *cause* present in BOTH
|
|
371
389
|
:data:`INVESTIGATE_CAUSES` and :data:`AUTO_DISPATCHERS`, and
|
|
372
390
|
``"dispatch_fixit_leg"`` is on ``SAFE_TIER_ACTIONS``.
|
|
@@ -380,8 +398,7 @@ def policy_tier_of(cause: str) -> str:
|
|
|
380
398
|
as a cause with no entry at all. This is the function `coord
|
|
381
399
|
drive-queue sweep` wires in as `tier_of`.
|
|
382
400
|
"""
|
|
383
|
-
|
|
384
|
-
if action is not None and cause in AUTO_DISPATCHERS and action in SAFE_TIER_ACTIONS:
|
|
401
|
+
if _is_mechanical_route(cause):
|
|
385
402
|
return TIER_AUTO
|
|
386
403
|
if (
|
|
387
404
|
cause in INVESTIGATE_CAUSES
|
|
@@ -394,6 +411,20 @@ def policy_tier_of(cause: str) -> str:
|
|
|
394
411
|
return TIER_ALERT
|
|
395
412
|
|
|
396
413
|
|
|
414
|
+
def mechanical_causes() -> frozenset[str]:
|
|
415
|
+
"""The causes a tight-cadence sweep is safe to run unattended on.
|
|
416
|
+
|
|
417
|
+
Exactly :func:`policy_tier_of`'s mechanical route
|
|
418
|
+
(:func:`_is_mechanical_route`) — never the investigate or
|
|
419
|
+
decomposition routes, which dispatch a worker leg or a split rather
|
|
420
|
+
than a direct, pre-reviewed queue repair and stay on the hourly
|
|
421
|
+
cadence's own budget and per-repo opt-in. Passed to
|
|
422
|
+
:func:`coord.board_doctor.run_sweep` as *mechanical_causes* to narrow
|
|
423
|
+
a sweep invocation to only this set.
|
|
424
|
+
"""
|
|
425
|
+
return frozenset(cause for cause in ALLOWLIST if _is_mechanical_route(cause))
|
|
426
|
+
|
|
427
|
+
|
|
397
428
|
def _board_doctor_stage(queue: str) -> str:
|
|
398
429
|
return f"board-doctor:{queue}"
|
|
399
430
|
|
coord/commands/drive_queue.py
CHANGED
|
@@ -3380,10 +3380,26 @@ def drive_queue_diagnose(output_json: bool, dry_run: bool, config_path: Path) ->
|
|
|
3380
3380
|
"invocation."
|
|
3381
3381
|
),
|
|
3382
3382
|
)
|
|
3383
|
+
@click.option(
|
|
3384
|
+
"--mechanical-only",
|
|
3385
|
+
is_flag=True,
|
|
3386
|
+
default=False,
|
|
3387
|
+
help=(
|
|
3388
|
+
"Restrict this sweep to the deterministic, pre-reviewed queue "
|
|
3389
|
+
"repairs (mark_done/clear_latch/merge/conflict_fix_redispatch/"
|
|
3390
|
+
"drive_queue_requeue/restage/drive_queue_add — "
|
|
3391
|
+
"coord.board_doctor_policy.mechanical_causes()) and drop every "
|
|
3392
|
+
"other row before it is even classified: no investigate-tier "
|
|
3393
|
+
"fix-it leg, no decomposition act, no `merged-partial` follow-"
|
|
3394
|
+
"through, no alert-tier escalation for a non-mechanical cause. "
|
|
3395
|
+
"Meant for a tight (sub-hourly) cadence alongside the full "
|
|
3396
|
+
"hourly sweep — see coord-board-doctor-fast.timer."
|
|
3397
|
+
),
|
|
3398
|
+
)
|
|
3383
3399
|
@_CONFIG_OPTION
|
|
3384
3400
|
def drive_queue_sweep(
|
|
3385
3401
|
output_json: bool, dry_run: bool, no_investigate: bool, no_followthrough: bool,
|
|
3386
|
-
config_path: Path,
|
|
3402
|
+
mechanical_only: bool, config_path: Path,
|
|
3387
3403
|
) -> None:
|
|
3388
3404
|
"""Board-doctor sweep: classify every stuck row, dispatch, record (#3758).
|
|
3389
3405
|
|
|
@@ -3468,6 +3484,18 @@ def drive_queue_sweep(
|
|
|
3468
3484
|
kill switch scoped to this command would disarm nothing it does. Use
|
|
3469
3485
|
`coord fix <REVIEW_ID> --no-finish` instead — that IS the call site
|
|
3470
3486
|
where Trigger A fires.
|
|
3487
|
+
|
|
3488
|
+
`--mechanical-only` narrows a single invocation to just the
|
|
3489
|
+
deterministic mechanical repairs (`coord.board_doctor.run_sweep`'s
|
|
3490
|
+
own `mechanical_causes` parameter) — a row outside that set is
|
|
3491
|
+
dropped before classification, so it is never auto-dispatched,
|
|
3492
|
+
never investigate-dispatched, never alerted on and never counted
|
|
3493
|
+
toward that row's own convergence/backoff clock by THIS invocation;
|
|
3494
|
+
only a full (non-`--mechanical-only`) sweep's absence check may ever
|
|
3495
|
+
treat a row as resolved. This is the shape a tight, sub-hourly
|
|
3496
|
+
cadence runs safely alongside the full hourly sweep: cheap, narrow,
|
|
3497
|
+
side-effect-bounded to the handful of causes `coord.
|
|
3498
|
+
board_doctor_policy.mechanical_causes()` names.
|
|
3471
3499
|
"""
|
|
3472
3500
|
from coord import board_doctor, board_doctor_followthrough, board_doctor_policy # noqa: PLC0415
|
|
3473
3501
|
from coord.board_service import is_remote # noqa: PLC0415
|
|
@@ -3498,6 +3526,9 @@ def drive_queue_sweep(
|
|
|
3498
3526
|
dry_run=dry_run,
|
|
3499
3527
|
escalation_resolver=board_doctor_policy.dismiss_resolved_escalation,
|
|
3500
3528
|
followthrough=not no_followthrough,
|
|
3529
|
+
mechanical_causes=(
|
|
3530
|
+
board_doctor_policy.mechanical_causes() if mechanical_only else None
|
|
3531
|
+
),
|
|
3501
3532
|
)
|
|
3502
3533
|
finally:
|
|
3503
3534
|
# Restore rather than blindly delete: a caller already running with
|
|
@@ -3552,10 +3583,25 @@ def drive_queue_sweep(
|
|
|
3552
3583
|
return
|
|
3553
3584
|
|
|
3554
3585
|
if not report.decisions and not report.followthrough:
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3586
|
+
if mechanical_only:
|
|
3587
|
+
# #4027 review: this invocation deliberately dropped every
|
|
3588
|
+
# non-mechanical row before classification (see
|
|
3589
|
+
# `--mechanical-only`'s own help text above) — a plain "nothing
|
|
3590
|
+
# stuck" here would claim a health verdict this walk never
|
|
3591
|
+
# actually observed. A stuck-but-non-mechanical row may well
|
|
3592
|
+
# exist right now; only a full (non-`--mechanical-only`) sweep
|
|
3593
|
+
# can say otherwise.
|
|
3594
|
+
click.echo(
|
|
3595
|
+
"nothing stuck among the mechanical-only causes observed "
|
|
3596
|
+
"this pass (coord.board_doctor_policy.mechanical_causes()) "
|
|
3597
|
+
"— a full sweep without --mechanical-only is the only one "
|
|
3598
|
+
"that can say the board overall has nothing stuck"
|
|
3599
|
+
)
|
|
3600
|
+
else:
|
|
3601
|
+
click.echo(
|
|
3602
|
+
"nothing stuck: no drive-queue, merge-queue, or baseline-red row "
|
|
3603
|
+
"was observed"
|
|
3604
|
+
)
|
|
3559
3605
|
return
|
|
3560
3606
|
for d in report.decisions:
|
|
3561
3607
|
escalated = " (escalated)" if d.escalated else ""
|
coord/decomposition_chat.py
CHANGED
|
@@ -1226,12 +1226,24 @@ def build_size_triage_briefing(
|
|
|
1226
1226
|
"that splitting it into independently-assignable children first is "
|
|
1227
1227
|
"safer (SPLIT)? For a SPLIT, give each child a clear title, a short "
|
|
1228
1228
|
"prose rationale/scope, and a `## Files` list of exactly the files "
|
|
1229
|
-
"it should touch
|
|
1229
|
+
"it should touch, with no unfilled placeholder like `<new-file>` or "
|
|
1230
|
+
"`<name>` in it — the same declaration convention every issue in "
|
|
1230
1231
|
"this repo already uses for its own scope. List the children in the "
|
|
1231
1232
|
"order they should be worked, chaining later ones on earlier ones "
|
|
1232
1233
|
"where one genuinely depends on another."
|
|
1233
1234
|
)
|
|
1234
1235
|
lines.append("")
|
|
1236
|
+
lines.append(
|
|
1237
|
+
"File-overlap between two children's `## Files` lists is detected "
|
|
1238
|
+
"and chained automatically — you do not need to declare that case. "
|
|
1239
|
+
"Declare an `After: Child N[, Child M...]` line (see the format "
|
|
1240
|
+
"below) ONLY when a child depends on another in a way file overlap "
|
|
1241
|
+
"can never see: it consumes a type, API, or other seam an earlier "
|
|
1242
|
+
"child adds, even though the two children's `## Files` are "
|
|
1243
|
+
"disjoint. Omit it when there is no such dependency — most splits "
|
|
1244
|
+
"need no `After:` line at all."
|
|
1245
|
+
)
|
|
1246
|
+
lines.append("")
|
|
1235
1247
|
|
|
1236
1248
|
lines.append("## Required output format — HARD REQUIREMENT")
|
|
1237
1249
|
lines.append(
|
|
@@ -1253,7 +1265,11 @@ def build_size_triage_briefing(
|
|
|
1253
1265
|
lines.append("- path/b.py")
|
|
1254
1266
|
lines.append("")
|
|
1255
1267
|
lines.append("## Child 2: <title>")
|
|
1256
|
-
lines.append("
|
|
1268
|
+
lines.append("<one paragraph of rationale/scope>")
|
|
1269
|
+
lines.append("After: Child 1")
|
|
1270
|
+
lines.append("")
|
|
1271
|
+
lines.append("## Files")
|
|
1272
|
+
lines.append("- path/c.py")
|
|
1257
1273
|
lines.append("")
|
|
1258
1274
|
lines.append("END_SIZE_TRIAGE")
|
|
1259
1275
|
lines.append("")
|
|
@@ -1282,9 +1298,46 @@ _SIZE_TRIAGE_CHILD_HEADING_RE = re.compile(
|
|
|
1282
1298
|
_SIZE_TRIAGE_FILES_HEADING_RE = re.compile(
|
|
1283
1299
|
r"^##\s*Files\s*$", re.IGNORECASE | re.MULTILINE
|
|
1284
1300
|
)
|
|
1301
|
+
#: #4031: a child's declared dependency on an earlier one — see
|
|
1302
|
+
#: `build_size_triage_briefing`'s own "when to use it" guidance (a seam a
|
|
1303
|
+
#: child consumes that file-overlap can never see). Matched only against
|
|
1304
|
+
#: the scope prose ahead of a child's own `## Files` heading, never across
|
|
1305
|
+
#: the whole response — see `_split_after_declaration`.
|
|
1306
|
+
_SIZE_TRIAGE_AFTER_RE = re.compile(r"^After:\s*(.+)$", re.IGNORECASE | re.MULTILINE)
|
|
1285
1307
|
SIZE_TRIAGE_END_MARKER = "END_SIZE_TRIAGE"
|
|
1286
1308
|
|
|
1287
1309
|
|
|
1310
|
+
def _split_after_declaration(scope_text: str) -> tuple[str, tuple[int, ...]]:
|
|
1311
|
+
"""Pull an `After: Child N[, Child M...]` line (#4031) out of
|
|
1312
|
+
*scope_text*, returning ``(scope_without_that_line, positions)``.
|
|
1313
|
+
|
|
1314
|
+
*positions* are every integer found in the line's value, in the order
|
|
1315
|
+
they appear, deduplicated — "Child 1, Child 2" and "1, 2" both parse
|
|
1316
|
+
the same way, since the agent is free to phrase it either way and only
|
|
1317
|
+
the numbers matter to the caller. ``()`` (and *scope_text* returned
|
|
1318
|
+
unchanged) when no `After:` line is present — the common case, and the
|
|
1319
|
+
one that keeps a response with no declared dependency behaving exactly
|
|
1320
|
+
as it did before this line existed.
|
|
1321
|
+
|
|
1322
|
+
Only the FIRST `After:` line is recognised, matching `## Child N:`'s
|
|
1323
|
+
own one-heading-per-child convention — a child declares at most one
|
|
1324
|
+
dependency line, even though it may name several earlier children on
|
|
1325
|
+
it.
|
|
1326
|
+
"""
|
|
1327
|
+
match = _SIZE_TRIAGE_AFTER_RE.search(scope_text)
|
|
1328
|
+
if match is None:
|
|
1329
|
+
return scope_text, ()
|
|
1330
|
+
positions: list[int] = []
|
|
1331
|
+
seen: set[int] = set()
|
|
1332
|
+
for raw in re.findall(r"\d+", match.group(1)):
|
|
1333
|
+
n = int(raw)
|
|
1334
|
+
if n not in seen:
|
|
1335
|
+
seen.add(n)
|
|
1336
|
+
positions.append(n)
|
|
1337
|
+
remaining = scope_text[: match.start()] + scope_text[match.end() :]
|
|
1338
|
+
return remaining, tuple(positions)
|
|
1339
|
+
|
|
1340
|
+
|
|
1288
1341
|
def parse_size_triage_response(
|
|
1289
1342
|
text: str,
|
|
1290
1343
|
*,
|
|
@@ -1362,6 +1415,7 @@ def parse_size_triage_response(
|
|
|
1362
1415
|
|
|
1363
1416
|
files_heading = _SIZE_TRIAGE_FILES_HEADING_RE.search(block)
|
|
1364
1417
|
scope_text = block[: files_heading.start()] if files_heading else block
|
|
1418
|
+
scope_text, after_positions = _split_after_declaration(scope_text)
|
|
1365
1419
|
files_likely = parse_declared_files(block)
|
|
1366
1420
|
if not files_likely:
|
|
1367
1421
|
raise SizeTriageError(
|
|
@@ -1375,6 +1429,7 @@ def parse_size_triage_response(
|
|
|
1375
1429
|
title=title,
|
|
1376
1430
|
scope=scope_text.strip(),
|
|
1377
1431
|
files_likely=files_likely,
|
|
1432
|
+
after=after_positions,
|
|
1378
1433
|
)
|
|
1379
1434
|
)
|
|
1380
1435
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# coord board-doctor FAST sweep — the mechanical-only half of the
|
|
2
|
+
# scheduled harness over the stuck rows, paired with
|
|
3
|
+
# coord-board-doctor-fast.timer.
|
|
4
|
+
#
|
|
5
|
+
# Runs `coord drive-queue sweep --mechanical-only` on a tight cadence:
|
|
6
|
+
# exactly the same classify-and-log harness as coord-board-doctor.service,
|
|
7
|
+
# restricted to the handful of pre-reviewed queue repairs named by
|
|
8
|
+
# `coord.board_doctor_policy.mechanical_causes()` (mark_done, clear_latch,
|
|
9
|
+
# merge, conflict_fix_redispatch, drive_queue_requeue, restage,
|
|
10
|
+
# drive_queue_add). A row outside that set is dropped before this
|
|
11
|
+
# invocation ever classifies it — no fix-it leg, no escalation, no
|
|
12
|
+
# convergence-counter write for anything this unit does not name. The
|
|
13
|
+
# investigate/alert tiers and `merged-partial` follow-through are entirely
|
|
14
|
+
# this unit's own no-op; they keep running on `coord-board-doctor.timer`'s
|
|
15
|
+
# hourly cadence, with their existing per-repo opt-in and budget untouched.
|
|
16
|
+
#
|
|
17
|
+
# Same packaged-dry-run-by-default posture as coord-board-doctor.service:
|
|
18
|
+
# the ExecStart below passes `--dry-run`, so installing this unit gets
|
|
19
|
+
# classification + logging with ZERO dispatch until an operator
|
|
20
|
+
# deliberately edits this unit (after install) to drop the flag.
|
|
21
|
+
#
|
|
22
|
+
# Install ONLY on the box that owns ~/.coord/coord.db — same host and same
|
|
23
|
+
# `is_remote()` guard as coord-board-doctor.service; do not install this on
|
|
24
|
+
# a thin client.
|
|
25
|
+
#
|
|
26
|
+
# Install (alongside coord-board-doctor.service/.timer):
|
|
27
|
+
# mkdir -p ~/.config/systemd/user
|
|
28
|
+
# cp deploy/coord-board-doctor-fast.service deploy/coord-board-doctor-fast.timer ~/.config/systemd/user/
|
|
29
|
+
# loginctl enable-linger "$USER" # survive logout / reboot
|
|
30
|
+
# systemctl --user daemon-reload
|
|
31
|
+
# systemctl --user enable --now coord-board-doctor-fast.timer
|
|
32
|
+
#
|
|
33
|
+
# This is a Type=oneshot service activated BY THE TIMER — do not
|
|
34
|
+
# `systemctl --user enable coord-board-doctor-fast.service` directly (it
|
|
35
|
+
# has no [Install] section; the timer unit is what you enable).
|
|
36
|
+
#
|
|
37
|
+
# Prereqs: same as coord-board-doctor.service (coordinator.yml at
|
|
38
|
+
# ~/.coord/coordinator.yml, a `gh`-authenticated environment).
|
|
39
|
+
|
|
40
|
+
[Unit]
|
|
41
|
+
Description=coord board-doctor mechanical-only sweep (tight cadence)
|
|
42
|
+
After=network-online.target
|
|
43
|
+
Wants=network-online.target
|
|
44
|
+
# Same escalation wiring as coord-board-doctor.service — if this unit
|
|
45
|
+
# itself fails (not a row it looked at; this unit's own process), page and
|
|
46
|
+
# attempt the mechanical fleet repair.
|
|
47
|
+
OnFailure=coord-failure-notify.service coord-fleet-watchdog.service
|
|
48
|
+
|
|
49
|
+
[Service]
|
|
50
|
+
Type=oneshot
|
|
51
|
+
# Byte-identical PATH to coord-board-doctor.service / coord-notify.service
|
|
52
|
+
# / coord-serve.service — same host, same role family, same reasoning
|
|
53
|
+
# (see those units' comments for why each entry is there and why the
|
|
54
|
+
# ordering matters).
|
|
55
|
+
Environment=PATH=%h/.cargo/bin:%h/.local/bin:%h/src/code-coordinator/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
|
|
56
|
+
ExecStart=%h/.coord-venv/bin/coord drive-queue sweep --mechanical-only --dry-run --config %h/.coord/coordinator.yml
|
|
57
|
+
TimeoutStartSec=300
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# coord board-doctor FAST sweep: the deterministic mechanical repairs
|
|
2
|
+
# only (`coord drive-queue sweep --mechanical-only`), on a tight cadence —
|
|
3
|
+
# split off from `coord-board-doctor.timer`'s hourly full sweep.
|
|
4
|
+
#
|
|
5
|
+
# The hourly sweep's own rationale ("no correctness reason to run it
|
|
6
|
+
# tighter") only ever covered the expensive half: walking both queues
|
|
7
|
+
# and classifying every cause with `gh`, then — if a repo opted in — a
|
|
8
|
+
# fix-it leg for an ambiguous cause. That reasoning never applied to the
|
|
9
|
+
# mechanical half: a handful of pre-reviewed, side-effect-safe queue
|
|
10
|
+
# repairs (a PR merged out-of-band, a stale HUMAN_REQUIRED latch, a
|
|
11
|
+
# PENDING merge-queue row that already reads green/approved/mergeable
|
|
12
|
+
# but the ordinary merge tick keeps missing, a conflict-fix that
|
|
13
|
+
# completed clean but never moved the branch, a frozen blocked/parked
|
|
14
|
+
# row whose block cause already resolved) — exactly as safe to run every
|
|
15
|
+
# minute or two as `coord-serve`'s own `merge.auto_drain` tick. Left on
|
|
16
|
+
# the hourly-only cadence, one of these can sit broken for up to an
|
|
17
|
+
# hour even though the fix is a plain `coord merge --only` (or
|
|
18
|
+
# equivalent) away the whole time.
|
|
19
|
+
#
|
|
20
|
+
# `--mechanical-only` (coord/commands/drive_queue.py) makes this
|
|
21
|
+
# genuinely a DIFFERENT, narrower invocation, not just a faster repeat
|
|
22
|
+
# of the same one: it drops every row outside
|
|
23
|
+
# `coord.board_doctor_policy.mechanical_causes()` before classification,
|
|
24
|
+
# so this timer never dispatches a fix-it leg, never escalates a
|
|
25
|
+
# non-mechanical cause, and never touches that row's own convergence
|
|
26
|
+
# counter. The investigate/alert tiers keep their current hourly budget
|
|
27
|
+
# and per-repo opt-in entirely via `coord-board-doctor.timer`, unaffected
|
|
28
|
+
# by this one running underneath it.
|
|
29
|
+
#
|
|
30
|
+
# Install: see deploy/coord-board-doctor-fast.service's header.
|
|
31
|
+
|
|
32
|
+
[Unit]
|
|
33
|
+
Description=Run coord board-doctor's mechanical-only sweep on a tight cadence
|
|
34
|
+
|
|
35
|
+
[Timer]
|
|
36
|
+
OnBootSec=2min
|
|
37
|
+
OnUnitActiveSec=1min
|
|
38
|
+
AccuracySec=10s
|
|
39
|
+
Persistent=true
|
|
40
|
+
|
|
41
|
+
[Install]
|
|
42
|
+
WantedBy=timers.target
|
|
@@ -9,6 +9,16 @@
|
|
|
9
9
|
# records the decision with provenance. It takes no board-mutating action
|
|
10
10
|
# itself — see coord/board_doctor.py's module docstring.
|
|
11
11
|
#
|
|
12
|
+
# The mechanical-only half of this same sweep also runs on its own,
|
|
13
|
+
# much tighter cadence — see coord-board-doctor-fast.service/.timer
|
|
14
|
+
# (`coord drive-queue sweep --mechanical-only`). Installing that sibling
|
|
15
|
+
# unit is independent of this one; this unit's hourly full sweep keeps
|
|
16
|
+
# running unchanged either way — the fast unit's own convergence counter
|
|
17
|
+
# is namespaced separately (`coord.board_doctor.
|
|
18
|
+
# MECHANICAL_SWEEP_COUNTER_NAMESPACE`) from this unit's, so running the
|
|
19
|
+
# fast unit 60x more often than this one never pre-empts this unit's own
|
|
20
|
+
# dispatch decision for a mechanical cause.
|
|
21
|
+
#
|
|
12
22
|
# #3758 requires this ship DRY-RUN BY DEFAULT: the packaged ExecStart below
|
|
13
23
|
# passes `--dry-run`, so even a host that installs and enables this unit
|
|
14
24
|
# gets classification + logging with ZERO dispatch and ZERO convergence-
|
|
@@ -2,10 +2,20 @@
|
|
|
2
2
|
# (Type=oneshot) on a cadence. See that unit's header for the full
|
|
3
3
|
# rationale, including the dry-run-by-default requirement.
|
|
4
4
|
#
|
|
5
|
-
# Hourly
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
5
|
+
# Hourly by design — the FULL sweep this unit runs walks two queues and
|
|
6
|
+
# classifies with `gh`, then — for a repo that has opted in — dispatches
|
|
7
|
+
# the expensive investigate tier (a fix-it leg) or files an alert. There
|
|
8
|
+
# is no correctness reason to run that half any tighter than hourly; it
|
|
9
|
+
# keeps its own fixed budget regardless of how often it fires.
|
|
10
|
+
#
|
|
11
|
+
# The sweep's OTHER half — the deterministic, pre-reviewed mechanical
|
|
12
|
+
# queue repairs — runs on its own, much tighter cadence instead: see
|
|
13
|
+
# coord-board-doctor-fast.timer / `coord drive-queue sweep
|
|
14
|
+
# --mechanical-only`. That split means a mechanical repair (e.g. an
|
|
15
|
+
# already green/approved/mergeable PR the ordinary merge tick keeps
|
|
16
|
+
# missing) is corrected within minutes, not within this unit's own
|
|
17
|
+
# hourly window — this timer still re-classifies and re-attempts those
|
|
18
|
+
# same causes every run too, it is just no longer the ONLY thing that does.
|
|
9
19
|
#
|
|
10
20
|
# Install: see deploy/coord-board-doctor.service's header.
|
|
11
21
|
|
coord/models.py
CHANGED
|
@@ -1862,6 +1862,20 @@ class SplitChunk:
|
|
|
1862
1862
|
title: str
|
|
1863
1863
|
scope: str
|
|
1864
1864
|
files_likely: list[str] = field(default_factory=list)
|
|
1865
|
+
#: #4031: 1-based positions (matching this proposal's own `## Child N:`
|
|
1866
|
+
#: numbering, i.e. `chunks` index + 1 — never a real GitHub issue
|
|
1867
|
+
#: number, which doesn't exist until the proposal is filed) of other
|
|
1868
|
+
#: chunks this one was EXPLICITLY declared to depend on, e.g. an
|
|
1869
|
+
#: `After: Child 1` line in the size-triage wire format
|
|
1870
|
+
#: (`coord.decomposition_chat.parse_size_triage_response`). Empty by
|
|
1871
|
+
#: default — every existing producer (`coord.brain.parse_split_
|
|
1872
|
+
#: proposals`'s JSON wire shape) never sets this, so it keeps
|
|
1873
|
+
#: producing chunks with no declared dependency, exactly as before
|
|
1874
|
+
#: this field existed. `coord.preflight_size.verify_split_proposal`
|
|
1875
|
+
#: unions this with whatever file-overlap prediction finds; it does
|
|
1876
|
+
#: not trust this field on its own, since a child can declare a
|
|
1877
|
+
#: dependency on something undeclared or filed later.
|
|
1878
|
+
after: tuple[int, ...] = field(default_factory=tuple)
|
|
1865
1879
|
|
|
1866
1880
|
|
|
1867
1881
|
@dataclass
|
coord/preflight_size.py
CHANGED
|
@@ -379,35 +379,54 @@ def verify_split_proposal(
|
|
|
379
379
|
) -> SplitVerification:
|
|
380
380
|
"""Mechanically verify *proposal* is safe to file as a real epic.
|
|
381
381
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
382
|
+
Checks, each of which rejects on its own (no check is skipped because
|
|
383
|
+
an earlier one happened to pass — see the module's "a gate must be able
|
|
384
|
+
to fail" bar):
|
|
385
385
|
|
|
386
386
|
1. Every chunk declares a non-empty `## Files` scope
|
|
387
387
|
(``chunk.files_likely``) — checked directly against the proposal,
|
|
388
388
|
independently of whichever parser produced it, because one of the
|
|
389
389
|
two legitimate producers (`coord.brain.parse_split_proposals`,
|
|
390
390
|
the JSON wire shape) does not enforce this itself.
|
|
391
|
-
2.
|
|
391
|
+
2. No declared file is an unfilled template placeholder (containing a
|
|
392
|
+
literal ``<``/``>``, e.g. ``quadraui/examples/tui_<name>.rs``) —
|
|
393
|
+
meaningless to :func:`coord.overlap_predict.predict_overlap` and not
|
|
394
|
+
safe to file onto a real issue's ``## Files`` section (#4031, the
|
|
395
|
+
quadraui#2664 incident).
|
|
396
|
+
3. *epic_body* — the `## Sub-issues` block that would actually be
|
|
392
397
|
written to the real epic issue — parses under the create-epic
|
|
393
398
|
grammar (:func:`coord.milestone_order.parse_sub_issues`) and
|
|
394
399
|
produces exactly one node per proposed chunk (so every child will
|
|
395
400
|
actually be visible once filed).
|
|
396
|
-
|
|
401
|
+
4. When the caller has no real epic body yet (the common case: the
|
|
397
402
|
real issue numbers don't exist until the epic and its children are
|
|
398
403
|
filed), one is COMPUTED here — sequential placeholder numbers in
|
|
399
|
-
proposal order, with each child's ``after`` edges
|
|
400
|
-
:
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
404
|
+
proposal order, with each child's ``after`` edges the UNION (#4031)
|
|
405
|
+
of:
|
|
406
|
+
|
|
407
|
+
* whatever each chunk explicitly declared via ``chunk.after`` — a
|
|
408
|
+
semantic dependency (e.g. "consumes a type/API another child
|
|
409
|
+
adds") that file overlap can never see, carried from the
|
|
410
|
+
size-triage wire format's ``After: Child N`` line
|
|
411
|
+
(:func:`coord.decomposition_chat.parse_size_triage_response`);
|
|
412
|
+
rejected right here, with no work order even attempted, when it
|
|
413
|
+
names a position that isn't an earlier chunk in *this* proposal
|
|
414
|
+
— a nonexistent child or a forward/self reference; and
|
|
415
|
+
* :func:`coord.overlap_predict.predict_overlap` against only the
|
|
416
|
+
chunks strictly before it.
|
|
417
|
+
|
|
418
|
+
This construction is a DAG by built-in (every edge, declared or
|
|
419
|
+
predicted, only ever points strictly backward), so it can never
|
|
420
|
+
itself trip check 3's cycle/undeclared-target failure; those
|
|
421
|
+
failure modes are reachable through the *epic_body* override
|
|
422
|
+
instead — see the test suite.
|
|
405
423
|
|
|
406
424
|
*epic_body*, when given, is validated AS GIVEN — this lets a caller
|
|
407
425
|
that already has real issue numbers (or a test asserting a specific
|
|
408
426
|
failure mode) hand the gate the exact text about to be filed, rather
|
|
409
427
|
than only ever checking this module's own self-computed convenience
|
|
410
|
-
default.
|
|
428
|
+
default. ``chunk.after`` plays no role in that path: a caller handing
|
|
429
|
+
over a real epic body has already decided what it says.
|
|
411
430
|
"""
|
|
412
431
|
if not proposal.chunks:
|
|
413
432
|
return SplitVerification(
|
|
@@ -423,16 +442,39 @@ def verify_split_proposal(
|
|
|
423
442
|
f"child {i} ({chunk.title!r}) declares no '## Files' scope"
|
|
424
443
|
),
|
|
425
444
|
)
|
|
445
|
+
placeholders = [f for f in files if "<" in f or ">" in f]
|
|
446
|
+
if placeholders:
|
|
447
|
+
return SplitVerification(
|
|
448
|
+
ok=False,
|
|
449
|
+
reason=(
|
|
450
|
+
f"child {i} ({chunk.title!r}) declares unfilled template "
|
|
451
|
+
f"placeholder(s) in '## Files': {placeholders!r}"
|
|
452
|
+
),
|
|
453
|
+
)
|
|
426
454
|
|
|
427
455
|
if epic_body is None:
|
|
428
456
|
nodes: list[WorkOrderNode] = []
|
|
429
457
|
footprints_so_far: list[Footprint] = []
|
|
430
458
|
for i, chunk in enumerate(proposal.chunks, start=1):
|
|
459
|
+
declared_after = sorted({int(p) for p in (chunk.after or ())})
|
|
460
|
+
for target in declared_after:
|
|
461
|
+
if not (1 <= target < i):
|
|
462
|
+
return SplitVerification(
|
|
463
|
+
ok=False,
|
|
464
|
+
reason=(
|
|
465
|
+
f"child {i} ({chunk.title!r}) declares "
|
|
466
|
+
f"'After: Child {target}', but child {target} is "
|
|
467
|
+
"not an earlier child of this proposal (it has "
|
|
468
|
+
f"{len(proposal.chunks)} chunk(s)) — a declared "
|
|
469
|
+
"dependency must never name a nonexistent or "
|
|
470
|
+
"later child, since nothing later can have "
|
|
471
|
+
"landed yet"
|
|
472
|
+
),
|
|
473
|
+
)
|
|
431
474
|
files = tuple(f for f in chunk.files_likely if str(f).strip())
|
|
432
475
|
prediction = predict_overlap(files, footprints_so_far)
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
)
|
|
476
|
+
predicted_after = {int(k) for k in prediction.after_keys}
|
|
477
|
+
after = tuple(sorted(set(declared_after) | predicted_after))
|
|
436
478
|
nodes.append(WorkOrderNode(issue_number=i, after=after))
|
|
437
479
|
footprints_so_far.append(
|
|
438
480
|
Footprint(key=str(i), issue_number=i, files=files)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|