code-coordinator 0.5.481__py3-none-any.whl → 0.5.482__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.481.dist-info → code_coordinator-0.5.482.dist-info}/METADATA +1 -1
- {code_coordinator-0.5.481.dist-info → code_coordinator-0.5.482.dist-info}/RECORD +12 -11
- coord/auto_loop.py +137 -10
- coord/commands/dispatch.py +22 -3
- coord/commands/dispatch_workers.py +17 -1
- coord/commands/plan_followup.py +66 -7
- coord/failure_classifier.py +243 -0
- coord/review.py +17 -1
- {code_coordinator-0.5.481.dist-info → code_coordinator-0.5.482.dist-info}/WHEEL +0 -0
- {code_coordinator-0.5.481.dist-info → code_coordinator-0.5.482.dist-info}/entry_points.txt +0 -0
- {code_coordinator-0.5.481.dist-info → code_coordinator-0.5.482.dist-info}/licenses/LICENSE +0 -0
- {code_coordinator-0.5.481.dist-info → code_coordinator-0.5.482.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
code_coordinator-0.5.
|
|
1
|
+
code_coordinator-0.5.482.dist-info/licenses/LICENSE,sha256=851BVZZwf_pEv2ydSlMmcZrwnwSS5YJ98wdLze7lyL8,4212
|
|
2
2
|
coord/__init__.py,sha256=3FN2qrrxtW87xSsSD557YcMwHLDahnFK8LvqQI7Wlf4,9783
|
|
3
3
|
coord/_board_mapping.py,sha256=dA5BmLcpDpy_JoK0SbZMUOklT9Dd5o5zxlNEeFM6JPE,12403
|
|
4
4
|
coord/acceptance.py,sha256=FHvFwstoJbFiGik-_a5FzKI5D5_kxSzWi2ePNKTM6hM,116533
|
|
@@ -8,7 +8,7 @@ coord/agent_app.py,sha256=ZYdY1HHkB4MFPfR-jbEewb4hOCSr0ygtaj7ccPGTGl8,99206
|
|
|
8
8
|
coord/agent_update.py,sha256=51ySDSoHT5kTB82nO46uwBwymvbCS2ncLAQ1E7fsAcI,37489
|
|
9
9
|
coord/approved_work.py,sha256=wSoxJe2KeapPtDTfrM7mcCy-BrS6DhRvjnQr48Rnsh0,19207
|
|
10
10
|
coord/audit.py,sha256=PHbwmojBaXpJjk1CVzHygkXKVe-wy6AJGrKsL7yod8I,19451
|
|
11
|
-
coord/auto_loop.py,sha256=
|
|
11
|
+
coord/auto_loop.py,sha256=mvrjseMvSIG__2t65AA5B3zKlRtYML0BzLwuGWQwTRE,94399
|
|
12
12
|
coord/backup.py,sha256=9mkHgsdnMXQ40Uyi_CUAi_4kZEZFCGB1_Rtz0Yh6FAk,37981
|
|
13
13
|
coord/block_log.py,sha256=8_3pvOFBkPl9FWZ7pg0XrINiOE61X1ZXqRkoUZjVvLA,56714
|
|
14
14
|
coord/board_schema.py,sha256=eCR_IM6TXELnTbAdIViS6zjVQYjKWbAM0Ok4_WhCYB4,16968
|
|
@@ -49,6 +49,7 @@ coord/drive_queue.py,sha256=CgQotXffAC-li8I9qxC5fkGnrScCfYzYETXR11efU4Y,345961
|
|
|
49
49
|
coord/drive_state.py,sha256=bBksmfQTwZ1_6pDJpUJDrtxlFJpBK8YKkjOD5_bDerE,60734
|
|
50
50
|
coord/events.py,sha256=EJroWy2kahye59nRyIhAgyciO-Qe2eU0ktkqqDPkWx0,13565
|
|
51
51
|
coord/failure_class.py,sha256=sKSecojnNU7RMDPsMnV-Bk5590Dtzz-qAXghGNmyzR4,37653
|
|
52
|
+
coord/failure_classifier.py,sha256=zrbSJ_fiMG8jLlBQi8XE754H7b0qruYLVHrFDoPRab8,12047
|
|
52
53
|
coord/filelock.py,sha256=UQ1l4JJsfcGRYRsNev3SD7YBxAsnJKOGjnNWnmwmMOI,7124
|
|
53
54
|
coord/fleet_config_health.py,sha256=BLP_ygdfRe2Srt0vLLTt8vo-8zbeElEsDTmKGVJ0lnY,33214
|
|
54
55
|
coord/forge_availability.py,sha256=gzrHrn3Vz3RqU9DHWnvy_b2dTzMl9OgdzShNiSCzgrU,37632
|
|
@@ -111,7 +112,7 @@ coord/repo_onboard.py,sha256=yFCYoaoSfmT9VRuVU56A18hwaXURxMKN7PhSG4Pk7aI,96221
|
|
|
111
112
|
coord/reports.py,sha256=7pAdEGUjWyKTqZ3EKeeg6_jrtOTC7WMKbOvonirFRsQ,170794
|
|
112
113
|
coord/rest_schema.py,sha256=epdKZDnjyogHeuBDcWfAJ2Es8exyMuv54rqwatTAxZM,12348
|
|
113
114
|
coord/revalidate.py,sha256=fQaYCvObqUawSZWMEOkVWFtYswz9PQQwSMApAyP5zeA,66266
|
|
114
|
-
coord/review.py,sha256=
|
|
115
|
+
coord/review.py,sha256=hhsGOs80dSPW_RdF53UbdbSKO9GwXadJcmmW6YIggMY,252516
|
|
115
116
|
coord/scorecard.py,sha256=axe_doBJBBFWtN21JZDRSijwDI0xaZrt2oVYbwJPW7U,20211
|
|
116
117
|
coord/self_health.py,sha256=9PLVdaEReFLUY6y2QXMGVd6U1CdHAh9_8MzduwBOzAY,10651
|
|
117
118
|
coord/serve_app.py,sha256=9jGrSoHFnPuOvkb0_8UhpIgRvrJz5KAq-ljRwI3N8MY,570088
|
|
@@ -144,8 +145,8 @@ coord/commands/audit.py,sha256=r8MzMM4XZX_upQOIOHkksjIo6bv0jT7CuTlm96ACVS0,5283
|
|
|
144
145
|
coord/commands/backup.py,sha256=mqQJG0IOD9ryXNdJV923H6s1KpD1eHLMdCBEoCdyP8s,3270
|
|
145
146
|
coord/commands/chat.py,sha256=iaYHebAIve4jzMzhyWSk8sFwpr2LnUc3y8onwHqns14,11080
|
|
146
147
|
coord/commands/codegen.py,sha256=eQitFmXbPoVY0W4OoqhLVgZPNLIzCgSP5Ktq8K09S04,1933
|
|
147
|
-
coord/commands/dispatch.py,sha256=
|
|
148
|
-
coord/commands/dispatch_workers.py,sha256=
|
|
148
|
+
coord/commands/dispatch.py,sha256=dXMU2NsztsPC_CME3C7SN7S6EagVaYp7r-_18bMGOFA,105567
|
|
149
|
+
coord/commands/dispatch_workers.py,sha256=NDWx95R1YZ01iVMM0xGseLhLqVRXbLlZLhkorjMBGpw,220719
|
|
149
150
|
coord/commands/dr.py,sha256=dVPJN2eZypKBH-YfwXbceveju3noQROI2uPihN66l70,9012
|
|
150
151
|
coord/commands/drive.py,sha256=r0qNudGpVEHGfe_i9GDXRR6jBtpLP2H6yZgeqLbDMsM,29381
|
|
151
152
|
coord/commands/drive_queue.py,sha256=rtV5gd4uxGJxgteBznbI9avlbncwOZ8GjbQONvC-Kio,269632
|
|
@@ -156,7 +157,7 @@ coord/commands/lifecycle.py,sha256=M-SvlBT6k7yhO5TCSGCXs-w2JlnWRwicuI-9YScpvCg,2
|
|
|
156
157
|
coord/commands/machine.py,sha256=cVW7Bb1eO5ovCQm5K4loWW0xrHyEcf70Mqp84--c1p4,21851
|
|
157
158
|
coord/commands/merge.py,sha256=cj8Fhd1EX1FZS-mKC5Fe40xcvF1yB70imChTdeyNPhY,141210
|
|
158
159
|
coord/commands/milestone.py,sha256=gCczpfXAGqG8SQYWtsxY14N7akSSnAObrc-Zsf8GkI0,83472
|
|
159
|
-
coord/commands/plan_followup.py,sha256=
|
|
160
|
+
coord/commands/plan_followup.py,sha256=JqrAGua4bR7m3OdeiS_NcT5aGlUvE6btX_JcW1cpz_Q,71741
|
|
160
161
|
coord/commands/plans.py,sha256=XBIGfF8unUUDJEWo6wntVKGohv7_6mC6-RyQkvwr4DA,10941
|
|
161
162
|
coord/commands/portal.py,sha256=RLUD_tfJ9pH3DplHAa8n3BY58k02870Afa7ayJyNE8E,111522
|
|
162
163
|
coord/commands/pr.py,sha256=J-8wMjymkT50bQdWP6KoHcX5PdfA-ChJuvym6t1byZc,19966
|
|
@@ -267,8 +268,8 @@ coord/skills/review-verdict-recovery/SKILL.md,sha256=Grg8GWkJLK20ct2YiigbTFfNOki
|
|
|
267
268
|
coord/skills/tui-quadraui-workflow/SKILL.md,sha256=4hUZza9wSSnPhf0eRAOh2r_MQZxK2pXYO5g-kxmJq-U,3832
|
|
268
269
|
coord/skills/update-issue/SKILL.md,sha256=VrPinEmLZrCSNDrnz96hQomyO403o5c4i0RdsnUnWA0,3642
|
|
269
270
|
coord/templates/deploy-cloudflare.node.yml,sha256=icsTiWn2ziQJnpZODhhFKYlnqjt2xAXsbwlQufdxhuM,2078
|
|
270
|
-
code_coordinator-0.5.
|
|
271
|
-
code_coordinator-0.5.
|
|
272
|
-
code_coordinator-0.5.
|
|
273
|
-
code_coordinator-0.5.
|
|
274
|
-
code_coordinator-0.5.
|
|
271
|
+
code_coordinator-0.5.482.dist-info/METADATA,sha256=yBcu--SvcRdsb57HydvGkrORcVGlxHQstmVZBjJv5_0,27178
|
|
272
|
+
code_coordinator-0.5.482.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
273
|
+
code_coordinator-0.5.482.dist-info/entry_points.txt,sha256=o-Hq8pvG7ReGePvN_4iOKjLNqiq-MJ43HbPurqjNPZo,41
|
|
274
|
+
code_coordinator-0.5.482.dist-info/top_level.txt,sha256=w5sTrXesTCebhXyYv2qufOZGo0PoD1Lxgn0Q3MAXjh4,6
|
|
275
|
+
code_coordinator-0.5.482.dist-info/RECORD,,
|
coord/auto_loop.py
CHANGED
|
@@ -50,6 +50,7 @@ from coord import sql
|
|
|
50
50
|
from coord.config import Config
|
|
51
51
|
from coord.db import is_lock_contention_error
|
|
52
52
|
from coord.dispatch import AGENT_PORT, ASSIGN_POST_TIMEOUT_SECS
|
|
53
|
+
from coord.failure_classifier import classify_failure
|
|
53
54
|
from coord import github_ops
|
|
54
55
|
from coord.models import (
|
|
55
56
|
SEALED_PATH_AUTHOR_TYPES,
|
|
@@ -775,6 +776,65 @@ def next_fix_iteration_for_branch(
|
|
|
775
776
|
return highest + 1
|
|
776
777
|
|
|
777
778
|
|
|
779
|
+
def last_fix_model_for_branch(
|
|
780
|
+
board: Board,
|
|
781
|
+
*,
|
|
782
|
+
repo_name: str,
|
|
783
|
+
issue_number: int,
|
|
784
|
+
branch: str | None,
|
|
785
|
+
before_iteration: int,
|
|
786
|
+
) -> str | None:
|
|
787
|
+
"""The model alias the most recent fix round on this chain ACTUALLY ran at.
|
|
788
|
+
|
|
789
|
+
#3360 (round-2 review): :func:`_fix_model_for_iteration` used to derive
|
|
790
|
+
the "rung already reached" baseline by replaying the ladder from the
|
|
791
|
+
iteration counter — i.e. by ASSUMING every earlier bounce escalated. The
|
|
792
|
+
moment one of them was gated as a compliance nit (the whole point of
|
|
793
|
+
#3360) that assumption is wrong, and the gate silently evaporated from
|
|
794
|
+
round 3 onwards: the same ratchet failure repeated at iterations 1..5
|
|
795
|
+
still reached the top of the ladder by iteration 3, because only the
|
|
796
|
+
final marginal step was ever classified.
|
|
797
|
+
|
|
798
|
+
This is the board-backed answer instead: scan the same (repo, issue,
|
|
799
|
+
branch) chain :func:`next_fix_iteration_for_branch` scans and report the
|
|
800
|
+
``model`` recorded on the highest fix round STRICTLY BELOW
|
|
801
|
+
*before_iteration* — the rung the previous round really dispatched at,
|
|
802
|
+
whatever the classifier decided back then.
|
|
803
|
+
|
|
804
|
+
Iteration-0 rows (the original work dispatch) are excluded: their model
|
|
805
|
+
comes from the issue's labels / operator choice, not from the fix ladder,
|
|
806
|
+
and iteration 1 deliberately restarts at ``models.default`` regardless.
|
|
807
|
+
|
|
808
|
+
Returns ``None`` when nothing on the chain carries a usable model — a
|
|
809
|
+
fresh chain, a board that predates model recording, or a caller with no
|
|
810
|
+
board at all. Callers then fall back to the old pure-iteration recompute
|
|
811
|
+
rather than refusing to escalate.
|
|
812
|
+
"""
|
|
813
|
+
best_key: tuple[int, float] = (0, 0.0)
|
|
814
|
+
best_model: str | None = None
|
|
815
|
+
for a in (*board.active, *board.completed):
|
|
816
|
+
if a.type not in WORK_LIKE_TYPES:
|
|
817
|
+
continue
|
|
818
|
+
if a.repo_name != repo_name or a.issue_number != issue_number:
|
|
819
|
+
continue
|
|
820
|
+
if a.branch != branch:
|
|
821
|
+
continue
|
|
822
|
+
iteration = a.review_iteration or 0
|
|
823
|
+
if iteration < 1 or iteration >= before_iteration:
|
|
824
|
+
continue
|
|
825
|
+
model = (getattr(a, "model", None) or "").strip()
|
|
826
|
+
if not model:
|
|
827
|
+
continue
|
|
828
|
+
# Tie-break equal iterations (a re-dispatch of the same round) on
|
|
829
|
+
# dispatch time so the answer is deterministic and reflects the row
|
|
830
|
+
# that actually ran most recently.
|
|
831
|
+
key = (iteration, float(getattr(a, "dispatched_at", 0.0) or 0.0))
|
|
832
|
+
if key >= best_key:
|
|
833
|
+
best_key = key
|
|
834
|
+
best_model = model
|
|
835
|
+
return best_model
|
|
836
|
+
|
|
837
|
+
|
|
778
838
|
# #3323: matches a leading run of one or more `[fix-N] ` / `[conflict-fix] `
|
|
779
839
|
# markers — the two title tags a fix round can inherit from its parent row.
|
|
780
840
|
_FIX_TITLE_MARKER_RE = re.compile(r"^(?:\[(?:fix-\d+|conflict-fix)\]\s*)+")
|
|
@@ -813,7 +873,12 @@ def fix_round_title(base_title: str, iteration: int) -> str:
|
|
|
813
873
|
return f"[fix-{iteration}] {stripped}"
|
|
814
874
|
|
|
815
875
|
|
|
816
|
-
def _fix_model_for_iteration(
|
|
876
|
+
def _fix_model_for_iteration(
|
|
877
|
+
config: Config,
|
|
878
|
+
iteration: int,
|
|
879
|
+
failure_text: str | None = None,
|
|
880
|
+
previous_model: str | None = None,
|
|
881
|
+
) -> str | None:
|
|
817
882
|
"""Choose the model alias for a fix worker on a given bounce *iteration*.
|
|
818
883
|
|
|
819
884
|
Pure function so the iteration → model mapping is unit-testable.
|
|
@@ -824,11 +889,37 @@ def _fix_model_for_iteration(config: Config, iteration: int) -> str | None:
|
|
|
824
889
|
|
|
825
890
|
When escalation is enabled:
|
|
826
891
|
- iteration 1 → ``config.models.default`` (first fix stays cheap/fast).
|
|
827
|
-
- iteration 2+ → climb
|
|
828
|
-
|
|
892
|
+
- iteration 2+ → climb ONE rung up ``config.models.escalation`` from
|
|
893
|
+
the rung the previous round dispatched at, capped at the top of the
|
|
894
|
+
ladder — UNLESS *failure_text* (#3360, the review/test-failure text
|
|
895
|
+
that triggered THIS iteration) classifies as a compliance nit (see
|
|
896
|
+
``coord/failure_classifier.py``), in which case this iteration stays
|
|
897
|
+
on the previous round's rung instead of climbing. Escalating a
|
|
898
|
+
review's compliance nit — a ratchet, a lint/formatter check, a
|
|
899
|
+
``files_forbidden`` violation — mis-prices it exactly like #3357: no
|
|
900
|
+
model capability difference lets a worker guess a repo-specific fact
|
|
901
|
+
it was never told. ``failure_text=None`` (the default) preserves the
|
|
902
|
+
old pure-iteration ladder for callers that have no failure text to
|
|
903
|
+
offer.
|
|
904
|
+
|
|
905
|
+
*previous_model* is the rung the PREVIOUS round actually dispatched at,
|
|
906
|
+
read off the board by :func:`last_fix_model_for_branch` (#3360 round-2
|
|
907
|
+
review). It matters because the classifier gate is only sound if the
|
|
908
|
+
baseline it gates is real: deriving the baseline by replaying the ladder
|
|
909
|
+
from the iteration counter assumes every earlier bounce escalated, so a
|
|
910
|
+
compliance failure repeated across three rounds still bought the top of
|
|
911
|
+
the ladder by round 3 — the gate applied to the last marginal step only
|
|
912
|
+
and every step before it climbed unconditionally. When *previous_model*
|
|
913
|
+
is absent (a caller with no board) or off-ladder (an explicit
|
|
914
|
+
``--model`` the escalation list does not contain, so there is no rung to
|
|
915
|
+
step from), the function falls back to that old pure-iteration recompute
|
|
916
|
+
rather than refusing to escalate.
|
|
829
917
|
|
|
830
918
|
Example with escalation ``[haiku, sonnet, opus]`` and default ``sonnet``:
|
|
831
|
-
iter 1 → sonnet, iter 2 → opus, iter 3 → opus (capped).
|
|
919
|
+
iter 1 → sonnet, iter 2 → opus, iter 3 → opus (capped). With a
|
|
920
|
+
compliance-classified *failure_text* at every round and the board-backed
|
|
921
|
+
*previous_model* threaded through: iter 1 → sonnet, iter 2 → sonnet,
|
|
922
|
+
iter 3 → sonnet, … (never climbs, which is the #3360 acceptance bar).
|
|
832
923
|
|
|
833
924
|
#3322: with escalation ENABLED this never returns ``None`` — a fix that
|
|
834
925
|
dispatches with no model at all leaves no record of what actually ran
|
|
@@ -845,11 +936,30 @@ def _fix_model_for_iteration(config: Config, iteration: int) -> str | None:
|
|
|
845
936
|
)
|
|
846
937
|
if not model:
|
|
847
938
|
return None
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
939
|
+
steps = max(iteration, 1) - 1
|
|
940
|
+
if steps <= 0:
|
|
941
|
+
return model
|
|
942
|
+
|
|
943
|
+
# The rung this bounce starts from. Prefer the board's record of what the
|
|
944
|
+
# previous round REALLY ran at (#3360 round-2 review) — replaying the
|
|
945
|
+
# ladder from the iteration counter assumes every earlier bounce
|
|
946
|
+
# escalated, which is exactly the assumption the compliance gate breaks.
|
|
947
|
+
if previous_model and previous_model in config.models.escalation:
|
|
948
|
+
baseline = previous_model
|
|
949
|
+
else:
|
|
950
|
+
# No usable record — an off-ladder explicit --model, a chain with no
|
|
951
|
+
# model recorded, or a caller with no board. Fall back to the old
|
|
952
|
+
# pure-iteration recompute: climb every step EXCEPT the last one
|
|
953
|
+
# unconditionally, since the last step is the rung THIS iteration's
|
|
954
|
+
# failure would buy and #3360 gates it below.
|
|
955
|
+
baseline = model
|
|
956
|
+
for _ in range(steps - 1):
|
|
957
|
+
baseline = config.models.next_model(baseline)
|
|
958
|
+
|
|
959
|
+
if failure_text is not None and not classify_failure(failure_text).should_escalate:
|
|
960
|
+
# Compliance nit (or no evidence) — stay on the rung already reached.
|
|
961
|
+
return baseline
|
|
962
|
+
return config.models.next_model(baseline)
|
|
853
963
|
|
|
854
964
|
|
|
855
965
|
def _merge_blocking_review_findings(
|
|
@@ -1061,7 +1171,24 @@ def _dispatch_fix_for_review(
|
|
|
1061
1171
|
briefing = issue_context_block(work.repo_name, work.issue_number) + _build_fix_briefing(
|
|
1062
1172
|
work, merged_findings, next_iteration, max_iter
|
|
1063
1173
|
)
|
|
1064
|
-
|
|
1174
|
+
# #3360: classify the review findings driving THIS bounce before letting
|
|
1175
|
+
# the iteration counter buy a bigger model — a request-changes review
|
|
1176
|
+
# that flags a compliance nit (ratchet, lint, files_forbidden) must not
|
|
1177
|
+
# climb the ladder just because it landed on a later iteration. The
|
|
1178
|
+
# baseline rung comes off the board (what round N-1 really dispatched at)
|
|
1179
|
+
# rather than being replayed from the counter, so a compliance nit that
|
|
1180
|
+
# survives three rounds still never climbs.
|
|
1181
|
+
model = _fix_model_for_iteration(
|
|
1182
|
+
config, next_iteration,
|
|
1183
|
+
failure_text=merged_findings.body,
|
|
1184
|
+
previous_model=last_fix_model_for_branch(
|
|
1185
|
+
board,
|
|
1186
|
+
repo_name=work.repo_name,
|
|
1187
|
+
issue_number=work.issue_number,
|
|
1188
|
+
branch=work.branch,
|
|
1189
|
+
before_iteration=next_iteration,
|
|
1190
|
+
),
|
|
1191
|
+
)
|
|
1065
1192
|
fix_failure: list[str] = []
|
|
1066
1193
|
fix = _dispatch_fix(
|
|
1067
1194
|
work, briefing, board, config, next_iteration,
|
coord/commands/dispatch.py
CHANGED
|
@@ -2210,9 +2210,28 @@ def retry(assignment_id: str, config_path: Path, acknowledge_cost: bool = False)
|
|
|
2210
2210
|
|
|
2211
2211
|
original_model = assignment.model or cfg.models.default
|
|
2212
2212
|
if provider_type_for(resolved_provider_name, cfg.providers) in IMPLICIT_PROVIDER_TYPES:
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2213
|
+
# #3360: classify what actually failed before climbing the ladder —
|
|
2214
|
+
# a compliance nit (a ratchet, a lint/formatter check, a
|
|
2215
|
+
# files_forbidden violation) re-dispatches at the SAME rung, since no
|
|
2216
|
+
# model-capability difference fixes a repo-specific fact the worker
|
|
2217
|
+
# was never told (#3357 paid for exactly this on the top rung).
|
|
2218
|
+
from coord.failure_classifier import ( # noqa: PLC0415
|
|
2219
|
+
classify_failure,
|
|
2220
|
+
failure_text_for_assignment,
|
|
2221
|
+
)
|
|
2222
|
+
|
|
2223
|
+
classification = classify_failure(failure_text_for_assignment(assignment))
|
|
2224
|
+
if classification.should_escalate:
|
|
2225
|
+
escalated = cfg.models.next_model(original_model)
|
|
2226
|
+
if escalated != original_model:
|
|
2227
|
+
click.echo(f" escalating model: {original_model} → {escalated}")
|
|
2228
|
+
else:
|
|
2229
|
+
escalated = original_model
|
|
2230
|
+
click.echo(
|
|
2231
|
+
f" not escalating model (#3360, {classification.category}"
|
|
2232
|
+
+ (f": {classification.matched}" if classification.matched else "")
|
|
2233
|
+
+ f") — staying on {original_model or 'default'}"
|
|
2234
|
+
)
|
|
2216
2235
|
retry_model = escalated
|
|
2217
2236
|
else:
|
|
2218
2237
|
# Not a claude-family provider — the escalation ladder doesn't
|
|
@@ -2052,6 +2052,7 @@ def _dispatch_fix_of(
|
|
|
2052
2052
|
_build_fix_briefing,
|
|
2053
2053
|
_fix_model_for_iteration,
|
|
2054
2054
|
_load_review_findings,
|
|
2055
|
+
last_fix_model_for_branch as _last_fix_model_fx,
|
|
2055
2056
|
)
|
|
2056
2057
|
from coord.agent import ( # noqa: PLC0415
|
|
2057
2058
|
AssignmentSpec as _AssignmentSpecFx,
|
|
@@ -2217,9 +2218,24 @@ def _dispatch_fix_of(
|
|
|
2217
2218
|
# auto-loop path. Explicit --model always wins; when omitted,
|
|
2218
2219
|
# _fix_model_for_iteration returns the appropriate tier (or None when
|
|
2219
2220
|
# pipeline.escalate_fix_model=False), falling back to cfg.models.default.
|
|
2221
|
+
# #3360: gate the per-iteration climb on what actually failed — a
|
|
2222
|
+
# compliance nit in `_findings_body` stays on the current rung. That rung
|
|
2223
|
+
# is read off the board (what round N-1 really dispatched at), not
|
|
2224
|
+
# replayed from the iteration counter, so a nit that survives three
|
|
2225
|
+
# rounds still never buys a bigger model.
|
|
2220
2226
|
resolved_model = (
|
|
2221
2227
|
model
|
|
2222
|
-
or _fix_model_for_iteration(
|
|
2228
|
+
or _fix_model_for_iteration(
|
|
2229
|
+
cfg, next_iteration,
|
|
2230
|
+
failure_text=_findings_body,
|
|
2231
|
+
previous_model=_last_fix_model_fx(
|
|
2232
|
+
_fx_board,
|
|
2233
|
+
repo_name=work.repo_name,
|
|
2234
|
+
issue_number=work.issue_number,
|
|
2235
|
+
branch=work.branch,
|
|
2236
|
+
before_iteration=next_iteration,
|
|
2237
|
+
),
|
|
2238
|
+
)
|
|
2223
2239
|
or cfg.models.default
|
|
2224
2240
|
)
|
|
2225
2241
|
assignment_id = _uuid.uuid4().hex[:12]
|
coord/commands/plan_followup.py
CHANGED
|
@@ -13,6 +13,7 @@ import httpx
|
|
|
13
13
|
|
|
14
14
|
from coord.config import Config
|
|
15
15
|
from coord.dispatch import DispatchRefused
|
|
16
|
+
from coord.failure_classifier import classify_failure
|
|
16
17
|
|
|
17
18
|
from coord.commands._common import AGENT_PORT, _CONFIG_OPTION, _load_config
|
|
18
19
|
|
|
@@ -1044,6 +1045,14 @@ def fix(
|
|
|
1044
1045
|
or ""
|
|
1045
1046
|
)
|
|
1046
1047
|
|
|
1048
|
+
# #3360: classify the failure BEFORE deciding whether to escalate the
|
|
1049
|
+
# model — see coord/failure_classifier.py for the "compliance vs
|
|
1050
|
+
# capability vs unknown" split. A ratchet/lint/policy failure (compliance)
|
|
1051
|
+
# re-dispatches at the same rung; only a genuine behavioural failure
|
|
1052
|
+
# (capability) climbs the ladder; no evidence at all (unknown) defaults
|
|
1053
|
+
# to NOT escalating.
|
|
1054
|
+
classification = classify_failure(test_output)
|
|
1055
|
+
|
|
1047
1056
|
guidance_text = guidance or "Fix the failing tests and push."
|
|
1048
1057
|
if forced_without_evidence and uat_failed and assignment.uat_reason:
|
|
1049
1058
|
# #3208: a real, board-recorded UAT failure — not the caller merely
|
|
@@ -1065,6 +1074,29 @@ def fix(
|
|
|
1065
1074
|
_what = "red CI" if ci_story is not None else "a failed smoke test"
|
|
1066
1075
|
_failure_heading = "CI failure" if ci_story is not None else "Test failure"
|
|
1067
1076
|
|
|
1077
|
+
# #3360: when the failure classifies as a compliance nit (a ratchet, a
|
|
1078
|
+
# lint/formatter check, a files_forbidden/sealed-path violation), say so
|
|
1079
|
+
# explicitly — the worker is on the SAME model rung as the attempt that
|
|
1080
|
+
# tripped it, and the fix is normally "read the failure output, it names
|
|
1081
|
+
# the exact rule and often the exact fix" rather than a design problem.
|
|
1082
|
+
# Both branches end with the blank line the briefing needs before
|
|
1083
|
+
# "## Guidance", so the assembly below interpolates it unconditionally
|
|
1084
|
+
# and never needs a second conditional `\n` next to it. Written as an
|
|
1085
|
+
# if/else rather than a ternary-into-an-f-string-concat for readability
|
|
1086
|
+
# (nit from the #3360 review).
|
|
1087
|
+
if classification.category == "compliance":
|
|
1088
|
+
_compliance_note = (
|
|
1089
|
+
"\n## Note (#3360)\n"
|
|
1090
|
+
f"This failure classified as a **compliance** check "
|
|
1091
|
+
f"({classification.matched}), not a behavioural bug — the model "
|
|
1092
|
+
"was NOT escalated for this retry. The failure output above "
|
|
1093
|
+
"almost always names the exact repo-specific rule (a pinned "
|
|
1094
|
+
"count, a formatting rule, a forbidden file) and often the fix "
|
|
1095
|
+
"itself. Read it before changing any logic.\n\n"
|
|
1096
|
+
)
|
|
1097
|
+
else:
|
|
1098
|
+
_compliance_note = "\n"
|
|
1099
|
+
|
|
1068
1100
|
briefing = (
|
|
1069
1101
|
f"You are fixing {_what} for issue #{assignment.issue_number}: {assignment.issue_title}\n\n"
|
|
1070
1102
|
f"The previous worker created branch {assignment.branch}. You are already on that branch.\n"
|
|
@@ -1074,7 +1106,8 @@ def fix(
|
|
|
1074
1106
|
f"Run `git fetch origin && git log --oneline origin/{default_branch}..HEAD` to see what was done.\n"
|
|
1075
1107
|
f"Run `git diff origin/{default_branch}...HEAD` to see the full diff.\n\n"
|
|
1076
1108
|
f"## {_failure_heading}\n"
|
|
1077
|
-
f"{test_output}\n
|
|
1109
|
+
f"{test_output}\n"
|
|
1110
|
+
f"{_compliance_note}"
|
|
1078
1111
|
f"## Guidance\n"
|
|
1079
1112
|
f"{guidance_text}\n\n"
|
|
1080
1113
|
f"## Rules\n"
|
|
@@ -1144,11 +1177,26 @@ def fix(
|
|
|
1144
1177
|
"(#3208; the branch is fetched from the remote)",
|
|
1145
1178
|
)
|
|
1146
1179
|
|
|
1147
|
-
#
|
|
1180
|
+
# #3360: classify before escalating. Climbing the model-escalation ladder
|
|
1181
|
+
# on EVERY failed leg mis-prices a compliance failure (a ratchet, a
|
|
1182
|
+
# lint/formatter check, a files_forbidden violation) — no model
|
|
1183
|
+
# capability difference lets a worker guess a repo-specific fact it was
|
|
1184
|
+
# never told, and #3357 shows the top rung can still spin for nothing.
|
|
1185
|
+
# Only a failure classified as "capability" climbs; "compliance" and
|
|
1186
|
+
# "unknown" (no evidence to classify) both stay on the current rung.
|
|
1148
1187
|
original_model = assignment.model or cfg.models.default
|
|
1149
|
-
|
|
1188
|
+
if classification.should_escalate:
|
|
1189
|
+
escalated = cfg.models.next_model(original_model)
|
|
1190
|
+
else:
|
|
1191
|
+
escalated = original_model
|
|
1150
1192
|
if escalated != original_model:
|
|
1151
1193
|
click.echo(f" escalating model: {original_model} → {escalated}")
|
|
1194
|
+
elif not classification.should_escalate:
|
|
1195
|
+
click.echo(
|
|
1196
|
+
f" not escalating model (#3360, {classification.category}"
|
|
1197
|
+
+ (f": {classification.matched}" if classification.matched else "")
|
|
1198
|
+
+ f") — staying on {original_model or 'default'}"
|
|
1199
|
+
)
|
|
1152
1200
|
|
|
1153
1201
|
try:
|
|
1154
1202
|
new_id = _dispatch_followup(
|
|
@@ -1564,11 +1612,22 @@ def resume_stuck(assignment_id: str, config_path: Path, guidance: str) -> None:
|
|
|
1564
1612
|
f"- Commit your work and push with git push origin HEAD"
|
|
1565
1613
|
)
|
|
1566
1614
|
|
|
1567
|
-
#
|
|
1615
|
+
# #3360: `resume-stuck` IS the spin scenario — it exists specifically to
|
|
1616
|
+
# recover a worker the stuck-detector flagged (`!! N turns without a git
|
|
1617
|
+
# commit`), which is neither a capability nor a compliance problem. The
|
|
1618
|
+
# issue's own proposal (category 3, "Spin") is explicit: escalating a
|
|
1619
|
+
# spin is the worst case, because a bigger model spins more expensively
|
|
1620
|
+
# without fixing anything a bigger model *can* fix — #3357 is exactly
|
|
1621
|
+
# this: a spin that got escalated to opus and burned 25 turns for zero
|
|
1622
|
+
# commits. So this door never climbs the ladder; the continuation
|
|
1623
|
+
# dispatches on the SAME rung the stuck worker was already running on.
|
|
1568
1624
|
original_model = assignment.model or cfg.models.default
|
|
1569
|
-
escalated =
|
|
1570
|
-
|
|
1571
|
-
|
|
1625
|
+
escalated = original_model
|
|
1626
|
+
click.echo(
|
|
1627
|
+
f" not escalating model (#3360: resume-stuck is the spin case, "
|
|
1628
|
+
f"escalating buys a more expensive spin, not a fix) — staying on "
|
|
1629
|
+
f"{original_model or 'default'}"
|
|
1630
|
+
)
|
|
1572
1631
|
|
|
1573
1632
|
try:
|
|
1574
1633
|
new_id = _dispatch_followup(cfg, assignment, briefing, model=escalated)
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"""#3360: classify a failed leg's failure text before deciding whether to
|
|
2
|
+
escalate the model on retry.
|
|
3
|
+
|
|
4
|
+
The model-escalation ladder (``ModelsConfig.escalation`` / ``next_model`` in
|
|
5
|
+
``coord/config.py``) used to climb on ANY failed leg — every automatic
|
|
6
|
+
fix-dispatch door treated a red leg as "the model was not strong enough" and
|
|
7
|
+
reached for a pricier one. That is the wrong move for a COMPLIANCE failure: a
|
|
8
|
+
ratchet, a lint/formatter check, a ``files_forbidden``/sealed-path violation.
|
|
9
|
+
No amount of model capability lets a worker guess a repo-specific fact it was
|
|
10
|
+
never told — opus cannot infer a ratchet's pinned count any better than
|
|
11
|
+
sonnet can. #3357 paid for exactly this: a tripped ``sqlite3.connect`` ratchet
|
|
12
|
+
bought an opus worker that spun 25 turns and committed nothing.
|
|
13
|
+
|
|
14
|
+
NOT ``coord/failure_class.py`` (#2096 disambiguation). That neighbouring
|
|
15
|
+
module also exports a ``classify_failure()`` returning a
|
|
16
|
+
``FailureClassification``, but it answers a DIFFERENT question —
|
|
17
|
+
"environmental (529 / usage limit / network) vs work" for resume scheduling
|
|
18
|
+
and the liveness gate — and nothing here duplicates it. The two are
|
|
19
|
+
orthogonal evidence lanes over the same ``failure_reason`` text: a leg can be
|
|
20
|
+
environmental *and* compliance-shaped, and each lane is consulted by its own
|
|
21
|
+
callers. Keep them separate; do not "unify" them into one verdict.
|
|
22
|
+
|
|
23
|
+
``classify_failure()`` is the ONE classifier every escalation-gated dispatch
|
|
24
|
+
door calls (#2096 "one question, one answer" — two independent
|
|
25
|
+
implementations of "is this failure a compliance nit or a real bug" would be
|
|
26
|
+
a split-brain waiting to happen). As of #3360 that is every known door:
|
|
27
|
+
|
|
28
|
+
- ``coord/commands/plan_followup.py``'s ``fix()`` — the Test/CI-failure arm.
|
|
29
|
+
- ``coord/commands/dispatch.py``'s ``retry()`` — via
|
|
30
|
+
:func:`failure_text_for_assignment` below, since this door only has the
|
|
31
|
+
board row, not an already-loaded test/review body.
|
|
32
|
+
- ``coord/auto_loop.py``'s ``_fix_model_for_iteration`` — the headless
|
|
33
|
+
review→fix bounce reached from both ``coord notify``'s completion
|
|
34
|
+
transition and ``coord fix``'s review-triggered arm
|
|
35
|
+
(``_fix_from_review`` → ``process_review_completion`` →
|
|
36
|
+
``_dispatch_fix_for_review``), plus the dashboard's "unstick this row"
|
|
37
|
+
button (``coord.review.dispatch_headless_fix``) and the human-attended
|
|
38
|
+
``coord fix`` CLI (``coord.commands.dispatch_workers``). All three thread
|
|
39
|
+
the review/test findings text through as ``failure_text`` AND the rung the
|
|
40
|
+
previous round actually dispatched at through as ``previous_model``
|
|
41
|
+
(``coord.auto_loop.last_fix_model_for_branch``). Both halves are load
|
|
42
|
+
bearing: gating only the last marginal step of a ladder replayed from the
|
|
43
|
+
iteration counter still climbs unconditionally for every step before it,
|
|
44
|
+
so the gate evaporated from round 3 onwards (#3360 round-2 review).
|
|
45
|
+
- ``coord/commands/plan_followup.py``'s ``resume_stuck()`` is the ONE
|
|
46
|
+
exception, deliberately: it is the recovery path for a worker the
|
|
47
|
+
stuck-detector already flagged (turns elapsed, no commit) — the issue's
|
|
48
|
+
own "Spin" category, which is neither a capability nor a compliance
|
|
49
|
+
question, so it never calls ``classify_failure()`` at all and never
|
|
50
|
+
escalates; see the comment at its call site.
|
|
51
|
+
|
|
52
|
+
NOT an escalation-gated door, and therefore deliberately not a caller:
|
|
53
|
+
``coord/ci_fix.py``'s ``dispatch_ci_fix()``. It is the fourth automatic
|
|
54
|
+
fix-dispatch path, but it calls ``_dispatch_fix`` with no ``model=`` at all,
|
|
55
|
+
so it has never climbed the ladder and there is no escalation decision here
|
|
56
|
+
to gate. Flagged in the #3360 review only so the next reader can confirm the
|
|
57
|
+
"every escalation-gated door" claim above is exhaustive rather than an
|
|
58
|
+
oversight; wiring the classifier in would change nothing about which model
|
|
59
|
+
runs.
|
|
60
|
+
|
|
61
|
+
Classification
|
|
62
|
+
--------------
|
|
63
|
+
- ``"compliance"`` — the failure text matches a known repo-policy signature
|
|
64
|
+
(a ratchet test, a lint/formatter check, a ``files_forbidden``/sealed-path
|
|
65
|
+
violation). ``should_escalate`` is ``False``: re-dispatch at the SAME model
|
|
66
|
+
rung, with the failure text folded into the brief so the worker learns the
|
|
67
|
+
fact it was missing.
|
|
68
|
+
- ``"capability"`` — failure text is present and matches none of the known
|
|
69
|
+
compliance signatures, i.e. it reads like an ordinary behavioural
|
|
70
|
+
assertion failure. ``should_escalate`` is ``True`` — climb the ladder, same
|
|
71
|
+
as today.
|
|
72
|
+
- ``"unknown"`` — there is no failure text to classify at all (empty,
|
|
73
|
+
whitespace-only, or the door was reached with no recorded verdict — e.g. a
|
|
74
|
+
``--force`` dispatch with no test/CI/acceptance evidence). #3360's
|
|
75
|
+
acceptance bar is explicit here: **default to NOT escalating**. The cost of
|
|
76
|
+
a wrongly-skipped escalation is one cheap same-rung retry; the cost of a
|
|
77
|
+
wrong escalation is the most expensive rung on the ladder — and #3357
|
|
78
|
+
shows that rung can still fail outright (opus, 25 turns, 0 commits).
|
|
79
|
+
|
|
80
|
+
This is deliberately the "cheap first cut" the issue calls out as sufficient
|
|
81
|
+
to have kept #3357 on sonnet: classify by known compliance signatures, and
|
|
82
|
+
default everything else (including "no evidence") away from escalation
|
|
83
|
+
rather than assuming capability difficulty. It does not attempt full natural
|
|
84
|
+
-language failure-cause classification.
|
|
85
|
+
|
|
86
|
+
ACCEPTED RISK (flagged in #3360 review, not fixed — the direction is safe).
|
|
87
|
+
Two known false-positive shapes, both reviewed and accepted because they only
|
|
88
|
+
ever cause a WRONGLY-SKIPPED escalation, never a wrong one:
|
|
89
|
+
|
|
90
|
+
- A single failure text can carry BOTH a tripped ratchet and a genuine
|
|
91
|
+
behavioural assertion failure; this classifies the whole blob as
|
|
92
|
+
"compliance" and skips escalation for the real bug too. Cheap because the
|
|
93
|
+
same-rung retry is one leg, and once the ratchet is fixed the genuine
|
|
94
|
+
failure surfaces alone on the next iteration.
|
|
95
|
+
- A signature (e.g. ``ratchet``, ``clippy``) could in principle appear in an
|
|
96
|
+
unrelated domain's own vocabulary (code that itself implements or tests
|
|
97
|
+
something literally named "ratchet"). None of today's signatures look
|
|
98
|
+
dangerously generic, but a false hit here still only means "wrongly skip
|
|
99
|
+
escalation" — the safe-by-design direction per #3360's own cost model
|
|
100
|
+
(a wrong same-rung retry costs one cheap leg; a wrong escalation costs the
|
|
101
|
+
most expensive rung on the ladder, and #3357 shows that rung can still
|
|
102
|
+
fail outright).
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
from __future__ import annotations
|
|
106
|
+
|
|
107
|
+
import re
|
|
108
|
+
from dataclasses import dataclass
|
|
109
|
+
|
|
110
|
+
#: Each entry is (signature name, compiled pattern). Matched
|
|
111
|
+
#: case-insensitively against the full failure text (test output, CI story,
|
|
112
|
+
#: acceptance/UAT reason — whatever a caller has on hand). First match wins;
|
|
113
|
+
#: the name is reported so callers/logs/PRs can say which classifier fired.
|
|
114
|
+
_COMPLIANCE_SIGNATURES: tuple[tuple[str, re.Pattern[str]], ...] = (
|
|
115
|
+
(
|
|
116
|
+
"ratchet",
|
|
117
|
+
# Matches the repo's own ratchet-test naming convention
|
|
118
|
+
# (`tests/test_*_ratchet.py`, e.g. #3357's
|
|
119
|
+
# `test_sqlite_connect_ratchet.py`) as well as the bare word, which
|
|
120
|
+
# is rare enough outside that context to be a safe signal.
|
|
121
|
+
# #3360 review: the inflection group must cover the PLURAL too —
|
|
122
|
+
# `\bratchet\b` never fires on "ratchets" (the word boundary sits
|
|
123
|
+
# between "t" and "s"), and real failure text says "2 ratchets
|
|
124
|
+
# tripped" / "these ratchets" often enough to matter.
|
|
125
|
+
re.compile(r"_ratchet\.py|\bratchet(?:e[sd]|ing|s)?\b", re.IGNORECASE),
|
|
126
|
+
),
|
|
127
|
+
(
|
|
128
|
+
"lint-or-format",
|
|
129
|
+
re.compile(
|
|
130
|
+
r"\bruff\b|\bflake8\b|\bmypy\b|\bpylint\b|\bisort\b|\beslint\b|"
|
|
131
|
+
r"\bshellcheck\b|\bclippy\b|\brustfmt\b|\bcargo fmt\b|"
|
|
132
|
+
r"black would reformat|would reformat \d+ file",
|
|
133
|
+
re.IGNORECASE,
|
|
134
|
+
),
|
|
135
|
+
),
|
|
136
|
+
(
|
|
137
|
+
"files-forbidden-or-sealed",
|
|
138
|
+
re.compile(
|
|
139
|
+
r"files_forbidden|sealed[_ ]path|sealed suite|ownership boundary",
|
|
140
|
+
re.IGNORECASE,
|
|
141
|
+
),
|
|
142
|
+
),
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
@dataclass(frozen=True)
|
|
147
|
+
class FailureClassification:
|
|
148
|
+
"""The verdict :func:`classify_failure` renders on one failure text."""
|
|
149
|
+
|
|
150
|
+
#: ``"compliance"`` | ``"capability"`` | ``"unknown"``
|
|
151
|
+
category: str
|
|
152
|
+
#: Whether the caller should climb the model-escalation ladder.
|
|
153
|
+
should_escalate: bool
|
|
154
|
+
#: The signature name that matched (see ``_COMPLIANCE_SIGNATURES``), or
|
|
155
|
+
#: ``None`` for ``"capability"``/``"unknown"``.
|
|
156
|
+
matched: str | None
|
|
157
|
+
#: Human-readable justification, safe to surface in CLI output or a
|
|
158
|
+
#: worker briefing.
|
|
159
|
+
reason: str
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def classify_failure(text: str | None) -> FailureClassification:
|
|
163
|
+
"""Classify a failed leg's failure text for the escalation decision.
|
|
164
|
+
|
|
165
|
+
Pure function — no board/config/network reads — so every dispatch door
|
|
166
|
+
that gates escalation on it stays unit-testable without a live board.
|
|
167
|
+
See the module docstring for the three categories and their
|
|
168
|
+
``should_escalate`` defaults.
|
|
169
|
+
"""
|
|
170
|
+
stripped = (text or "").strip()
|
|
171
|
+
if not stripped:
|
|
172
|
+
return FailureClassification(
|
|
173
|
+
category="unknown",
|
|
174
|
+
should_escalate=False,
|
|
175
|
+
matched=None,
|
|
176
|
+
reason=(
|
|
177
|
+
"no failure text to classify (#3360) — defaulting to NOT "
|
|
178
|
+
"escalating: a wrong same-rung retry costs one cheap leg, a "
|
|
179
|
+
"wrong escalation costs the most expensive rung on the "
|
|
180
|
+
"ladder"
|
|
181
|
+
),
|
|
182
|
+
)
|
|
183
|
+
for name, pattern in _COMPLIANCE_SIGNATURES:
|
|
184
|
+
if pattern.search(stripped):
|
|
185
|
+
return FailureClassification(
|
|
186
|
+
category="compliance",
|
|
187
|
+
should_escalate=False,
|
|
188
|
+
matched=name,
|
|
189
|
+
reason=(
|
|
190
|
+
f"failure text matches the {name!r} compliance signature "
|
|
191
|
+
"(#3360) — re-dispatching at the same model rung; no "
|
|
192
|
+
"model-capability difference fixes a repo-specific "
|
|
193
|
+
"policy fact the worker was never told"
|
|
194
|
+
),
|
|
195
|
+
)
|
|
196
|
+
return FailureClassification(
|
|
197
|
+
category="capability",
|
|
198
|
+
should_escalate=True,
|
|
199
|
+
matched=None,
|
|
200
|
+
reason=(
|
|
201
|
+
"failure text does not match any known compliance signature "
|
|
202
|
+
"(#3360) — treating it as a genuine behavioural failure and "
|
|
203
|
+
"escalating the model rung"
|
|
204
|
+
),
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
def failure_text_for_assignment(assignment) -> str: # noqa: ANN001
|
|
209
|
+
"""Best-effort failure text for a board ``Assignment``, for feeding
|
|
210
|
+
:func:`classify_failure`.
|
|
211
|
+
|
|
212
|
+
A door that only has the board row (e.g. ``coord retry``, dispatching a
|
|
213
|
+
failed/advisory WORK-like assignment with no CLI-supplied CI story or
|
|
214
|
+
already-loaded review findings) still needs SOME text to classify —
|
|
215
|
+
otherwise it can only ever see ``"unknown"`` and never detect a
|
|
216
|
+
compliance signature at all. This concatenates every reason field the
|
|
217
|
+
board might have recorded, so "which field wins" has one answer (#2096)
|
|
218
|
+
instead of a per-door dialect:
|
|
219
|
+
|
|
220
|
+
- ``failure_reason`` — the worker/dispatch-level failure summary.
|
|
221
|
+
- the fuller test-reason text via ``load_assignment_test_reason``
|
|
222
|
+
(falls back to the board-carried ``test_reason``/``smoke_test_reason``
|
|
223
|
+
previews — #1337).
|
|
224
|
+
- ``acceptance_reason`` (#2344) / ``uat_reason`` (#3208) — trust-gate
|
|
225
|
+
verdicts.
|
|
226
|
+
|
|
227
|
+
Classification only needs ONE field to carry a compliance signature to
|
|
228
|
+
skip escalation, so concatenating costs nothing: a field that doesn't
|
|
229
|
+
apply to this assignment is simply empty and contributes nothing to the
|
|
230
|
+
scan.
|
|
231
|
+
"""
|
|
232
|
+
from coord.state import load_assignment_test_reason # noqa: PLC0415
|
|
233
|
+
|
|
234
|
+
assignment_id = getattr(assignment, "assignment_id", None)
|
|
235
|
+
parts = [
|
|
236
|
+
getattr(assignment, "failure_reason", None),
|
|
237
|
+
load_assignment_test_reason(assignment_id) if assignment_id else None,
|
|
238
|
+
getattr(assignment, "test_reason", None),
|
|
239
|
+
getattr(assignment, "smoke_test_reason", None),
|
|
240
|
+
getattr(assignment, "acceptance_reason", None),
|
|
241
|
+
getattr(assignment, "uat_reason", None),
|
|
242
|
+
]
|
|
243
|
+
return "\n".join(p for p in parts if p)
|
coord/review.py
CHANGED
|
@@ -5107,6 +5107,7 @@ def dispatch_headless_fix(
|
|
|
5107
5107
|
_fix_model_for_iteration,
|
|
5108
5108
|
_load_review_findings,
|
|
5109
5109
|
_work_is_terminal,
|
|
5110
|
+
last_fix_model_for_branch,
|
|
5110
5111
|
next_fix_iteration,
|
|
5111
5112
|
)
|
|
5112
5113
|
from coord.state import issue_context_block # noqa: PLC0415
|
|
@@ -5179,7 +5180,22 @@ def dispatch_headless_fix(
|
|
|
5179
5180
|
issue_context_block(work.repo_name, work.issue_number)
|
|
5180
5181
|
+ _build_fix_briefing(work, findings_obj, next_iteration, max_iter)
|
|
5181
5182
|
)
|
|
5182
|
-
|
|
5183
|
+
# #3360: gate the escalation on what actually failed — a compliance nit
|
|
5184
|
+
# in `findings_obj.body` stays on the current rung instead of climbing.
|
|
5185
|
+
# The rung is the one round N-1 really dispatched at (read off the board),
|
|
5186
|
+
# not one replayed from the iteration counter, so the gate holds for
|
|
5187
|
+
# round 3+ too.
|
|
5188
|
+
model = _fix_model_for_iteration(
|
|
5189
|
+
config, next_iteration,
|
|
5190
|
+
failure_text=findings_obj.body,
|
|
5191
|
+
previous_model=last_fix_model_for_branch(
|
|
5192
|
+
board,
|
|
5193
|
+
repo_name=work.repo_name,
|
|
5194
|
+
issue_number=work.issue_number,
|
|
5195
|
+
branch=work.branch,
|
|
5196
|
+
before_iteration=next_iteration,
|
|
5197
|
+
),
|
|
5198
|
+
)
|
|
5183
5199
|
return _dispatch_fix(
|
|
5184
5200
|
work, briefing, board, config, next_iteration,
|
|
5185
5201
|
model=model, http_client=http_client,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|