code-coordinator 0.5.413__py3-none-any.whl → 0.5.415__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.413.dist-info → code_coordinator-0.5.415.dist-info}/METADATA +1 -1
- {code_coordinator-0.5.413.dist-info → code_coordinator-0.5.415.dist-info}/RECORD +13 -13
- coord/acceptance.py +292 -0
- coord/dashboard/fixture.py +19 -0
- coord/dashboard/server.py +211 -0
- coord/diagnose.py +42 -0
- coord/gates.py +69 -0
- coord/milestone_dispatch.py +62 -0
- coord/review.py +93 -0
- {code_coordinator-0.5.413.dist-info → code_coordinator-0.5.415.dist-info}/WHEEL +0 -0
- {code_coordinator-0.5.413.dist-info → code_coordinator-0.5.415.dist-info}/entry_points.txt +0 -0
- {code_coordinator-0.5.413.dist-info → code_coordinator-0.5.415.dist-info}/licenses/LICENSE +0 -0
- {code_coordinator-0.5.413.dist-info → code_coordinator-0.5.415.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
code_coordinator-0.5.
|
|
1
|
+
code_coordinator-0.5.415.dist-info/licenses/LICENSE,sha256=851BVZZwf_pEv2ydSlMmcZrwnwSS5YJ98wdLze7lyL8,4212
|
|
2
2
|
coord/__init__.py,sha256=3FN2qrrxtW87xSsSD557YcMwHLDahnFK8LvqQI7Wlf4,9783
|
|
3
3
|
coord/_board_mapping.py,sha256=5FTW-8Dg5SzHvszdFj9MuAirpe2KmRqgipZWBAhgUJI,11627
|
|
4
|
-
coord/acceptance.py,sha256=
|
|
4
|
+
coord/acceptance.py,sha256=oAec-wQbrcR5PPfI9NW8JJYipfQ9-3EDpmMmxrP3pQM,90211
|
|
5
5
|
coord/acceptance_drivers.py,sha256=T4HwNHK4ZQz9Zdx1hyX2TS4Jv5-JSj48CHvI8qqoRto,29089
|
|
6
6
|
coord/agent.py,sha256=26RVhxmjS4trdzjA31F60Uu7MEnrFdzzLO6GPjYhBV0,536211
|
|
7
7
|
coord/agent_app.py,sha256=ZYdY1HHkB4MFPfR-jbEewb4hOCSr0ygtaj7ccPGTGl8,99206
|
|
@@ -39,7 +39,7 @@ coord/deploy_manifest.py,sha256=X-deE_n6oRfDQDRSqcnLCEiLUMXbgKqgBUaoU1MD1hg,8103
|
|
|
39
39
|
coord/deploy_units.py,sha256=ZfFueMPXKW4u8geOMEHhmgyseUPuKWNub77NDjMNrHA,24097
|
|
40
40
|
coord/deprecation_telemetry.py,sha256=ZK6wmN3qzF2-Ic1iVpYSC8Y4gw1sA0sJnerErzgKAI8,4149
|
|
41
41
|
coord/deps.py,sha256=WnV5u_zYw_f3oMr88Qy7EUVeb3vBj5cTq8Ts1oGAR2s,3770
|
|
42
|
-
coord/diagnose.py,sha256=
|
|
42
|
+
coord/diagnose.py,sha256=6dyQwHWL7zD1X0lpzKn596h1gPw5hmw2Kk4QNrGkSCk,99433
|
|
43
43
|
coord/dispatch.py,sha256=9TqGs0Mb_IBwmNVav2WnWapjGWLucJWD8PXUOsyEl70,59218
|
|
44
44
|
coord/dist_name.py,sha256=XDhumYscJahwcaKjmSw135HYsnXQjwGGxRo0Qv4b0xM,5583
|
|
45
45
|
coord/dr_promote.py,sha256=xS9fFvzrY-EjSEj1XMSwD7RtjbBhhXZT76XFLnddDng,60329
|
|
@@ -56,7 +56,7 @@ coord/freshness.py,sha256=5suGwN9ly7tKVkxj3R6zLdQv2n1p145Ok5Lwadx0rP8,10302
|
|
|
56
56
|
coord/gate_a.py,sha256=PA8q6L_ZqV2fskmXrhkhsM7P_tRpFidehzHX4SdhvLw,36430
|
|
57
57
|
coord/gate_b.py,sha256=mYwzFJrXw19uK2usNLBnZOq1yP_gfXaG5Kg3kloXy-Y,16566
|
|
58
58
|
coord/gate_snapshot.py,sha256=9rM33TomF1jDgEI-99TI8mL4zw2dEcTgd9762i_4jJc,23708
|
|
59
|
-
coord/gates.py,sha256=
|
|
59
|
+
coord/gates.py,sha256=w_AJcAZPm7x93bSrfAE4uqIWWBrl_pvILVUgrB2qOHo,33876
|
|
60
60
|
coord/gen_board_fixture.py,sha256=f0AKvmbStuCTLpcO1sJM0vO2paqx62qzxUVSTamfpW4,15549
|
|
61
61
|
coord/github_ops.py,sha256=jwbIJFmnC7UVUbyaLxK3ItHphxvp_pmlqbIOCPL4xIc,170507
|
|
62
62
|
coord/github_throttle.py,sha256=SMsqqNWFwX4i5NCL3uTxNUfdGv1B33OWjpw1WzhKgWs,17405
|
|
@@ -74,7 +74,7 @@ coord/machine_pause.py,sha256=6s7Dtr5zLs1qB2NWI2-cfbMdPyigK62FTtLjzmY6slE,47521
|
|
|
74
74
|
coord/machine_stats.py,sha256=fqUo6YmfWdGpIjitgkcGDCqLzRcRzv4oG1bFQOTsg88,5989
|
|
75
75
|
coord/merge_queue.py,sha256=81r6uAYqX5Mh8SpNAVtRpQtNkfgpZEEgyIH9eYK4VAg,411534
|
|
76
76
|
coord/milestone_chat.py,sha256=xfVCm-L-g4SHCpBUpDHtOw7Q--1ZIUMeGe7HY2Rbkko,25310
|
|
77
|
-
coord/milestone_dispatch.py,sha256=
|
|
77
|
+
coord/milestone_dispatch.py,sha256=OXjhUh_FLq6-au3qpFx8KAdw6ua_C5Rwr-EfsEYBRh4,54855
|
|
78
78
|
coord/milestone_gate.py,sha256=W81H0t8bFes9Yf86GEBsqkWiVHjEtj6GRwrZiiGiv4A,30528
|
|
79
79
|
coord/milestone_order.py,sha256=4w4J3s4eYyv4oR6jkwoxveO1arDvLH7D7hsjOOZ76Js,39111
|
|
80
80
|
coord/mock_author.py,sha256=47yBpikn8n0rI5dgdBOU83a1cxyaagcyFgkOGTy9LZ8,34735
|
|
@@ -111,7 +111,7 @@ coord/repo_onboard.py,sha256=HRm-SALgUNcp6h0Zr5B1kR-4RH-6jBucpTZ3-BCL6wY,94132
|
|
|
111
111
|
coord/reports.py,sha256=7pAdEGUjWyKTqZ3EKeeg6_jrtOTC7WMKbOvonirFRsQ,170794
|
|
112
112
|
coord/rest_schema.py,sha256=RymD01eTPN8ckVZEyMlDXlcc5riKjQeCnAtFzuLOuWs,12063
|
|
113
113
|
coord/revalidate.py,sha256=fQaYCvObqUawSZWMEOkVWFtYswz9PQQwSMApAyP5zeA,66266
|
|
114
|
-
coord/review.py,sha256=
|
|
114
|
+
coord/review.py,sha256=Xx-91E4U_u-QE37onmFTE5NegWmmOrEyMSdG93aix-k,235404
|
|
115
115
|
coord/scorecard.py,sha256=axe_doBJBBFWtN21JZDRSijwDI0xaZrt2oVYbwJPW7U,20211
|
|
116
116
|
coord/self_health.py,sha256=9PLVdaEReFLUY6y2QXMGVd6U1CdHAh9_8MzduwBOzAY,10651
|
|
117
117
|
coord/serve_app.py,sha256=WxyeNtwiqxpVbI344vC7zarpe993cZnFsPCPpicnfKc,540068
|
|
@@ -173,9 +173,9 @@ coord/commands/terminal.py,sha256=62dgo7Te3lwQe8oVzPVpjkWdgGS0oOhpCpXINRcboHA,13
|
|
|
173
173
|
coord/commands/test_gate.py,sha256=Novp_WYVIbwQvhleifwM80cXSZUmcyuVmUTO6qv1c-k,39555
|
|
174
174
|
coord/commands/tui.py,sha256=GX4LsgMk08itlURCgkOKqWgjnv38uIfFSWM3xrz9T_A,18193
|
|
175
175
|
coord/dashboard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
176
|
-
coord/dashboard/fixture.py,sha256=
|
|
176
|
+
coord/dashboard/fixture.py,sha256=EX8p0m004lM0cZyQJR1n8-EG-ETEpUB8l0BdBnRQwE8,31519
|
|
177
177
|
coord/dashboard/index.html,sha256=XzipoURZAP46Tggas-pSMq8Fb1ETX9TyAJy2ItNVigc,31463
|
|
178
|
-
coord/dashboard/server.py,sha256=
|
|
178
|
+
coord/dashboard/server.py,sha256=NKAM-wKDPRH_45RvZnxzwHA30BFZWQrP_k4kAlJ10k0,253861
|
|
179
179
|
coord/dashboard/terminal.py,sha256=wR5rfWQCZ0yO5bXCkqa0t-a1g5YAQ-20LC6icZdGWHM,14647
|
|
180
180
|
coord/deploy/README.md,sha256=DG_q36KeW0LQ32ElU11wjfjULO7xGUoiPIFEGPW41k0,1391
|
|
181
181
|
coord/deploy/coord-agent.service,sha256=GSo_2iqCx4zv4-85LGnaINsu-BdPHpG64I8xfULKcUk,6392
|
|
@@ -267,8 +267,8 @@ coord/skills/review-verdict-recovery/SKILL.md,sha256=Grg8GWkJLK20ct2YiigbTFfNOki
|
|
|
267
267
|
coord/skills/tui-quadraui-workflow/SKILL.md,sha256=4hUZza9wSSnPhf0eRAOh2r_MQZxK2pXYO5g-kxmJq-U,3832
|
|
268
268
|
coord/skills/update-issue/SKILL.md,sha256=VrPinEmLZrCSNDrnz96hQomyO403o5c4i0RdsnUnWA0,3642
|
|
269
269
|
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.
|
|
270
|
+
code_coordinator-0.5.415.dist-info/METADATA,sha256=e9HaJgQkUUQSHo7vwPQY3H_l-Oc34DkBKm2pRl87KQk,27178
|
|
271
|
+
code_coordinator-0.5.415.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
272
|
+
code_coordinator-0.5.415.dist-info/entry_points.txt,sha256=o-Hq8pvG7ReGePvN_4iOKjLNqiq-MJ43HbPurqjNPZo,41
|
|
273
|
+
code_coordinator-0.5.415.dist-info/top_level.txt,sha256=w5sTrXesTCebhXyYv2qufOZGo0PoD1Lxgn0Q3MAXjh4,6
|
|
274
|
+
code_coordinator-0.5.415.dist-info/RECORD,,
|
coord/acceptance.py
CHANGED
|
@@ -887,6 +887,298 @@ def dump_manifest_error_hint(acceptance_root: Path) -> str:
|
|
|
887
887
|
)
|
|
888
888
|
|
|
889
889
|
|
|
890
|
+
# ── #3202: Gate-A contract exempt-exposure warning ──────────────────────────
|
|
891
|
+
#
|
|
892
|
+
# A milestone can carry a Gate-A contract (the customer-facing behaviour
|
|
893
|
+
# spec a human signed off on, docs/ORACLE_LOOP.md) while ALSO exempting some
|
|
894
|
+
# or all of its issues from the acceptance-slice gate via manifest.yml's
|
|
895
|
+
# `exempt:` list (the #1138 issue-level opt-out — see `ManifestData`'s
|
|
896
|
+
# docstring above). Each is individually reasonable — the decomposition may
|
|
897
|
+
# judge the work not oracle-shaped, and the contract may exist only because
|
|
898
|
+
# a customer needed a design round — but the combination means NOTHING
|
|
899
|
+
# checks the contract's behaviours except a human at the UAT gate, one step
|
|
900
|
+
# before merge. The format-converter ms-1 incident (#3202) shipped a UI with
|
|
901
|
+
# no source pane at all, contradicting the approved mock's primary screen,
|
|
902
|
+
# through Review, CI and unit tests, caught only by a human looking.
|
|
903
|
+
#
|
|
904
|
+
# Neither side refuses the combination — a refusal here would just get
|
|
905
|
+
# worked around, and it is sometimes the right call. This only makes the
|
|
906
|
+
# trade VISIBLE, with the SAME wording, at every seam that reads this state:
|
|
907
|
+
#
|
|
908
|
+
# - the pre-dispatch guard that suggests the exemption in the first place
|
|
909
|
+
# (`coord.milestone_dispatch.issue_oracle_ready`'s "add it to `exempt:`"
|
|
910
|
+
# refusal reason, via `_gate_a_exempt_trade_off_note`) — also where "say
|
|
911
|
+
# it in the manifest too" is delivered: that note hands the operator
|
|
912
|
+
# `manifest_exempt_generated_comment`'s ready-to-paste text alongside the
|
|
913
|
+
# suggestion, since nothing in this codebase edits `exempt:` on a human's
|
|
914
|
+
# behalf (it is "rare, hand-edited" by design — see
|
|
915
|
+
# `MANIFEST_FRAGMENTS_DIRNAME`'s comment below);
|
|
916
|
+
# - `coord gates` for a milestone already in that state
|
|
917
|
+
# (`coord.gates._gate_a_exempt_note_for_winner`, via
|
|
918
|
+
# :func:`fetch_gate_a_exempt_warning` below — the shared fetch-and-detect
|
|
919
|
+
# seam this module exposes so neither caller re-derives the manifest/
|
|
920
|
+
# contract fetch loop independently); and
|
|
921
|
+
# - the reviewer's own briefing (`coord.review.build_review_briefing`, via
|
|
922
|
+
# the same :func:`fetch_gate_a_exempt_warning`).
|
|
923
|
+
#
|
|
924
|
+
# `gate_a_exempt_warning` below is the single canonical text every one of
|
|
925
|
+
# those seams renders — never re-derive the wording independently, or a
|
|
926
|
+
# future edit updates one copy and silently leaves the others stale (the
|
|
927
|
+
# same "one question, one answer" discipline as #3180's mechanical-verdict
|
|
928
|
+
# helpers in `coord.review`). `coord.diagnose.gate_a_exempt_exposure_lines`
|
|
929
|
+
# renders the same detection + wording for a caller that already has a
|
|
930
|
+
# manifest/contract in hand (no fetch of its own) — not yet called from
|
|
931
|
+
# `coord doctor`, which has no existing per-milestone iteration to hang it
|
|
932
|
+
# off without new fleet-wide scanning plumbing that is out of scope here.
|
|
933
|
+
|
|
934
|
+
_BEHAVIOUR_LABEL_RE = re.compile(r"\*\*(§\d+[a-zA-Z]?|[A-Za-z]{1,3}\d{1,3})\*\*")
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
def count_declared_behaviours(contract_text: str) -> int:
|
|
938
|
+
"""Best-effort count of individually-labelled behaviours in a Gate-A
|
|
939
|
+
``contract.md``'s prose (#3202).
|
|
940
|
+
|
|
941
|
+
Every contract this codebase has authored anchors one assertable
|
|
942
|
+
behaviour with a short bold label — ``**§4a**`` (this repo's own
|
|
943
|
+
``tests/acceptance/ms-51/contract.md``) or ``**B4**`` (the
|
|
944
|
+
format-converter ms-1 incident #3202 describes) — so a distinct-label
|
|
945
|
+
count is a reasonable proxy for "how much of this contract exists"
|
|
946
|
+
without this module needing to parse, or agree on, one fixed markdown
|
|
947
|
+
dialect across repos. Labels are deduplicated (a label referenced
|
|
948
|
+
twice — e.g. once in prose and again in a footnote — counts once).
|
|
949
|
+
|
|
950
|
+
Returns ``0`` for text with no such labels — a contract written in some
|
|
951
|
+
other style, an empty string, or no contract at all — rather than
|
|
952
|
+
falling back to a heading count or another guess: ``0`` is a visible
|
|
953
|
+
"this heuristic found nothing", not a silently wrong number.
|
|
954
|
+
"""
|
|
955
|
+
if not contract_text:
|
|
956
|
+
return 0
|
|
957
|
+
return len({m.group(1) for m in _BEHAVIOUR_LABEL_RE.finditer(contract_text)})
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
@dataclass(frozen=True)
|
|
961
|
+
class GateAExemptExposure:
|
|
962
|
+
"""One milestone's #3202 exposure: it exempts one or more issues from
|
|
963
|
+
the acceptance-slice gate, so a Gate-A contract's behaviours go
|
|
964
|
+
unverified by anything but UAT for that exempted work.
|
|
965
|
+
|
|
966
|
+
Built by :func:`gate_a_exempt_exposure`; a caller that wants the
|
|
967
|
+
canonical detection rule applied should go through that function rather
|
|
968
|
+
than constructing this directly — it is the one place "does this
|
|
969
|
+
milestone have this exposure" is answered (see the module note above).
|
|
970
|
+
"""
|
|
971
|
+
|
|
972
|
+
milestone_number: int
|
|
973
|
+
exempt_issues: "tuple[int, ...]"
|
|
974
|
+
#: :func:`count_declared_behaviours` applied to the milestone's
|
|
975
|
+
#: contract.md, or ``0`` when the contract couldn't be fetched/parsed —
|
|
976
|
+
#: see that function's docstring for why ``0`` is left visible rather
|
|
977
|
+
#: than hidden behind a fallback guess.
|
|
978
|
+
behaviour_count: int
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
def gate_a_exempt_exposure(
|
|
982
|
+
milestone_number: int,
|
|
983
|
+
manifest: ManifestData,
|
|
984
|
+
contract_text: str | None,
|
|
985
|
+
) -> "GateAExemptExposure | None":
|
|
986
|
+
"""Detect #3202's exposure for one milestone: does *manifest* exempt any
|
|
987
|
+
issue from the acceptance-slice gate at all?
|
|
988
|
+
|
|
989
|
+
Returns ``None`` when ``manifest.exempt`` is empty — the ordinary case,
|
|
990
|
+
nothing to warn about. *contract_text* is optional: pass ``None`` when
|
|
991
|
+
the contract couldn't be fetched (every caller here is fail-open) and
|
|
992
|
+
the returned exposure just carries ``behaviour_count=0`` rather than
|
|
993
|
+
blocking detection on a fetch that failed — UNLESS *manifest* itself
|
|
994
|
+
says there is no contract to fetch in the first place (see below), in
|
|
995
|
+
which case ``None`` (no exposure at all) is returned instead.
|
|
996
|
+
|
|
997
|
+
This function does not itself CONFIRM a Gate-A contract exists for
|
|
998
|
+
*milestone_number* — a caller with a genuinely-fetched *contract_text*
|
|
999
|
+
already knows one does (the same "only call this once contract.md
|
|
1000
|
+
exists" precondition every other Gate-A-gated check in this module
|
|
1001
|
+
already applies, e.g. :func:`gate_a_contract_candidates`'s callers) and
|
|
1002
|
+
gets an exposure back regardless of ``manifest.gate_a_exempt``.
|
|
1003
|
+
|
|
1004
|
+
#3202 review: a caller that could NOT fetch a contract (*contract_text*
|
|
1005
|
+
is ``None``) is in a genuinely ambiguous spot — a transient fetch
|
|
1006
|
+
failure and "no contract.md was ever authored" look identical from out
|
|
1007
|
+
here. *manifest* itself resolves that ambiguity in exactly the one case
|
|
1008
|
+
it can: ``manifest.gate_a_exempt`` (``gate_a: {exempt: true, ...}`` —
|
|
1009
|
+
docs/ORACLE_LOOP.md) is the milestone's own declared, reviewable opt-out
|
|
1010
|
+
from Gate-A, recorded in the same file this function already reads. When
|
|
1011
|
+
it's set, "couldn't fetch a contract" is read as "there isn't one to
|
|
1012
|
+
fetch" rather than "unknown" — so this returns ``None`` (no exposure,
|
|
1013
|
+
nothing to warn about) instead of asserting "has a Gate-A contract" with
|
|
1014
|
+
a fabricated "count unavailable". A fetch failure with
|
|
1015
|
+
``gate_a_exempt`` unset keeps the prior fail-loud behaviour (warn with
|
|
1016
|
+
"count unavailable") — the plain network-hiccup case, where hiding the
|
|
1017
|
+
warning would be the wrong direction to fail in.
|
|
1018
|
+
"""
|
|
1019
|
+
if not manifest.exempt:
|
|
1020
|
+
return None
|
|
1021
|
+
if contract_text is None and manifest.gate_a_exempt:
|
|
1022
|
+
return None
|
|
1023
|
+
return GateAExemptExposure(
|
|
1024
|
+
milestone_number=milestone_number,
|
|
1025
|
+
exempt_issues=tuple(sorted(manifest.exempt)),
|
|
1026
|
+
behaviour_count=count_declared_behaviours(contract_text or ""),
|
|
1027
|
+
)
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
def gate_a_exempt_warning(exposure: GateAExemptExposure) -> str:
|
|
1031
|
+
"""The single canonical #3202 warning text for *exposure* — rendered
|
|
1032
|
+
verbatim (never re-derived) by every surface that reads this state: the
|
|
1033
|
+
pre-dispatch guard's exemption suggestion, ``coord doctor``/``coord
|
|
1034
|
+
gates``, the reviewer's briefing (``coord.review.build_review_briefing``),
|
|
1035
|
+
and :func:`manifest_exempt_generated_comment` below.
|
|
1036
|
+
"""
|
|
1037
|
+
n = len(exposure.exempt_issues)
|
|
1038
|
+
issues_str = ", ".join(f"#{i}" for i in exposure.exempt_issues)
|
|
1039
|
+
behaviours_str = (
|
|
1040
|
+
f"{exposure.behaviour_count} declared behaviour"
|
|
1041
|
+
f"{'s' if exposure.behaviour_count != 1 else ''}"
|
|
1042
|
+
if exposure.behaviour_count
|
|
1043
|
+
else "declared behaviours (count unavailable)"
|
|
1044
|
+
)
|
|
1045
|
+
return (
|
|
1046
|
+
f"⚠️ ms-{exposure.milestone_number} has a Gate-A contract "
|
|
1047
|
+
f"({behaviours_str}) but exempts {n} issue{'s' if n != 1 else ''} "
|
|
1048
|
+
f"({issues_str}) from acceptance slices — nothing but a human at the "
|
|
1049
|
+
"UAT gate verifies the contract's behaviours for that work (#3202). "
|
|
1050
|
+
"This can be the right call (the work may not be oracle-shaped), but "
|
|
1051
|
+
"make it deliberately, not as a silent side effect of the exempt: "
|
|
1052
|
+
"list."
|
|
1053
|
+
)
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
def manifest_exempt_generated_comment(exposure: GateAExemptExposure) -> str:
|
|
1057
|
+
"""Generated ``#`` comment block (#3202) recording, in the manifest
|
|
1058
|
+
itself, exactly what an ``exempt:`` list trades away — so the next
|
|
1059
|
+
person reading ``manifest.yml`` sees the consequence stated in writing,
|
|
1060
|
+
rather than an unstated side effect of a bare list of issue numbers.
|
|
1061
|
+
|
|
1062
|
+
Pure text generation; this module never auto-edits a hand-maintained
|
|
1063
|
+
manifest (``exempt:`` is "rare, hand-edited" — see the
|
|
1064
|
+
:data:`MANIFEST_FRAGMENTS_DIRNAME` comment above) — a caller (a human
|
|
1065
|
+
author, or `coord acceptance author` tooling) is responsible for
|
|
1066
|
+
actually inserting the returned text next to the ``exempt:`` block.
|
|
1067
|
+
"""
|
|
1068
|
+
issues_str = ", ".join(f"#{i}" for i in exposure.exempt_issues)
|
|
1069
|
+
behaviours = (
|
|
1070
|
+
f"{exposure.behaviour_count}" if exposure.behaviour_count
|
|
1071
|
+
else "an unknown number of"
|
|
1072
|
+
)
|
|
1073
|
+
return (
|
|
1074
|
+
"# ── #3202: this exempts the contract's behaviours from verification ──\n"
|
|
1075
|
+
f"# ms-{exposure.milestone_number}'s Gate-A contract declares "
|
|
1076
|
+
f"{behaviours} behaviour(s).\n"
|
|
1077
|
+
f"# This exempt: list opts {issues_str} out of authoring an "
|
|
1078
|
+
"acceptance slice, so none\n"
|
|
1079
|
+
"# of those behaviours are checked by anything but a human at the "
|
|
1080
|
+
"UAT gate for\n"
|
|
1081
|
+
"# that work. Confirmed intentional, not an oversight.\n"
|
|
1082
|
+
)
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
# (repo_github: str, path: str, branch: str) -> file content. Raises on
|
|
1086
|
+
# not-found (mirrors ``coord.github_ops.get_repo_file``) — every caller here
|
|
1087
|
+
# treats any exception as "this candidate doesn't exist" and tries the next
|
|
1088
|
+
# one, so a fetcher that instead returned ``None``/``""`` on a miss would be
|
|
1089
|
+
# indistinguishable from a genuinely empty file.
|
|
1090
|
+
GateAExemptFileFetcher = Callable[[str, str, str], str]
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
def fetch_gate_a_exempt_warning(
|
|
1094
|
+
config: Config,
|
|
1095
|
+
repo: Repo,
|
|
1096
|
+
milestone_number: int | None,
|
|
1097
|
+
*,
|
|
1098
|
+
file_fetcher: GateAExemptFileFetcher | None = None,
|
|
1099
|
+
) -> str | None:
|
|
1100
|
+
"""(#3202) Fetch *milestone_number*'s manifest + Gate-A contract off
|
|
1101
|
+
*repo*'s default branch and, if the manifest exempts one or more issues
|
|
1102
|
+
from needing an acceptance slice, return the canonical
|
|
1103
|
+
:func:`gate_a_exempt_warning` text — or ``None`` when there's nothing to
|
|
1104
|
+
warn about, or nothing to check at all.
|
|
1105
|
+
|
|
1106
|
+
THE single fetch-and-detect seam for this state (#3202 review finding:
|
|
1107
|
+
the reviewer's briefing, ``coord gates``, and any future ``coord
|
|
1108
|
+
doctor`` surfacing must all call this rather than re-deriving the
|
|
1109
|
+
manifest/contract fetch loop each independently — a second copy is
|
|
1110
|
+
exactly how the reviewer-briefing-only version of this fix drifted from
|
|
1111
|
+
the "every seam" claim in this module's own docstring).
|
|
1112
|
+
|
|
1113
|
+
Fail-open like every other best-effort fetch this module makes ahead of
|
|
1114
|
+
a briefing/report: a missing manifest/contract, a repo with no
|
|
1115
|
+
acceptance driver configured, no milestone in hand, or a transient
|
|
1116
|
+
network hiccup all return ``None`` rather than raise — this is an
|
|
1117
|
+
advisory surfacing, never a gate, so a fetch failure must never affect
|
|
1118
|
+
whether or how a review/report proceeds.
|
|
1119
|
+
|
|
1120
|
+
*file_fetcher* defaults to :func:`coord.github_ops.get_repo_file` (a
|
|
1121
|
+
real ``gh`` call); inject a stub in tests so this advisory lookup never
|
|
1122
|
+
shells out live.
|
|
1123
|
+
|
|
1124
|
+
``exempt:`` is milestone-level and lives only in the legacy single
|
|
1125
|
+
``manifest.(yml|yaml|json)`` file, never a per-issue ``manifest.d/``
|
|
1126
|
+
fragment (see :data:`MANIFEST_FRAGMENTS_DIRNAME`'s comment: "rare,
|
|
1127
|
+
hand-edited... stays a single shared file by choice"), so only that file
|
|
1128
|
+
needs checking here — unlike a full manifest load, no fragment merge is
|
|
1129
|
+
needed.
|
|
1130
|
+
|
|
1131
|
+
#3202 review (non-blocking): tries ``.yml``/``.yaml``/``.json`` under
|
|
1132
|
+
every :func:`search_roots_for_repo` root, breaking out of the extension
|
|
1133
|
+
loop the moment any fetch succeeds — even if the fetched text then fails
|
|
1134
|
+
to parse (``manifest_data`` resets to ``None`` and the loop moves to the
|
|
1135
|
+
next root, never trying a sibling extension under the SAME root that
|
|
1136
|
+
might have parsed). Accepted: a root carrying two same-named manifests
|
|
1137
|
+
at different extensions, one malformed, is not a shape this codebase
|
|
1138
|
+
produces — not incidental, a deliberate simplicity/rare-edge-case trade.
|
|
1139
|
+
"""
|
|
1140
|
+
if milestone_number is None or not config.acceptance.has_driver(repo.name):
|
|
1141
|
+
return None
|
|
1142
|
+
|
|
1143
|
+
from coord import github_ops # noqa: PLC0415
|
|
1144
|
+
|
|
1145
|
+
fetch = file_fetcher or github_ops.get_repo_file
|
|
1146
|
+
|
|
1147
|
+
manifest_data: ManifestData | None = None
|
|
1148
|
+
for root in search_roots_for_repo(config, repo.name):
|
|
1149
|
+
ms_dir = f"{root.rstrip('/')}/{ms_dirname(milestone_number)}"
|
|
1150
|
+
for ext in (".yml", ".yaml", ".json"):
|
|
1151
|
+
try:
|
|
1152
|
+
text = fetch(repo.github, f"{ms_dir}/manifest{ext}", repo.default_branch)
|
|
1153
|
+
except Exception: # noqa: BLE001 — this extension/root doesn't exist
|
|
1154
|
+
continue
|
|
1155
|
+
try:
|
|
1156
|
+
manifest_data = parse_manifest_text(
|
|
1157
|
+
text, source=f"{ms_dir}/manifest{ext}"
|
|
1158
|
+
)
|
|
1159
|
+
except Exception: # noqa: BLE001 — malformed manifest: fail open
|
|
1160
|
+
manifest_data = None
|
|
1161
|
+
break
|
|
1162
|
+
if manifest_data is not None:
|
|
1163
|
+
break
|
|
1164
|
+
|
|
1165
|
+
if manifest_data is None or not manifest_data.exempt:
|
|
1166
|
+
return None
|
|
1167
|
+
|
|
1168
|
+
contract_text: str | None = None
|
|
1169
|
+
for path in gate_a_contract_candidates(config, repo.name, milestone_number):
|
|
1170
|
+
try:
|
|
1171
|
+
contract_text = fetch(repo.github, path, repo.default_branch)
|
|
1172
|
+
break
|
|
1173
|
+
except Exception: # noqa: BLE001 — try the next candidate root
|
|
1174
|
+
continue
|
|
1175
|
+
|
|
1176
|
+
exposure = gate_a_exempt_exposure(milestone_number, manifest_data, contract_text)
|
|
1177
|
+
if exposure is None:
|
|
1178
|
+
return None
|
|
1179
|
+
return gate_a_exempt_warning(exposure)
|
|
1180
|
+
|
|
1181
|
+
|
|
890
1182
|
def acceptance_capability_gap(
|
|
891
1183
|
capability: str, repo_name: str, config: Config,
|
|
892
1184
|
) -> Machine | None:
|
coord/dashboard/fixture.py
CHANGED
|
@@ -48,6 +48,7 @@ Fixture schema (every key optional except ``board``)::
|
|
|
48
48
|
"report_results": {"issue-activity": {...coord.reports.ReportResult.to_dict()...}},
|
|
49
49
|
"review_findings": {"rev-1": {"verdict": "approve", "body": "..."}},
|
|
50
50
|
"diffs": {"work-1": "diff --git ..."},
|
|
51
|
+
"logs": {"work-1": "{\"type\": \"turn\", ...}\n{\"type\": \"tool\", ...}\n"},
|
|
51
52
|
"chat_reply": "canned /api/chat response text",
|
|
52
53
|
"events": [ {"after": 0.25, "type": "board_updated", "data": {}} ],
|
|
53
54
|
"autoplay_events": false, # play the script at startup too (default: no)
|
|
@@ -213,6 +214,10 @@ class FixtureServer:
|
|
|
213
214
|
report_results_raw: dict = field(default_factory=dict)
|
|
214
215
|
review_findings_raw: dict = field(default_factory=dict)
|
|
215
216
|
diffs: dict = field(default_factory=dict)
|
|
217
|
+
#: #3195: seeded NDJSON log text backing `GET /api/assignment/{id}/log`,
|
|
218
|
+
#: keyed by assignment id — see `log()`. One canned string per id, same
|
|
219
|
+
#: convention as `diffs` above.
|
|
220
|
+
logs: dict = field(default_factory=dict)
|
|
216
221
|
chat_reply: str = "fixture mode: the coordinator assistant is not wired up."
|
|
217
222
|
events: list[ScriptedEvent] = field(default_factory=list)
|
|
218
223
|
autoplay_events: bool = False
|
|
@@ -372,6 +377,15 @@ class FixtureServer:
|
|
|
372
377
|
def diff(self, assignment_id: str) -> str:
|
|
373
378
|
return self.diffs.get(assignment_id, "")
|
|
374
379
|
|
|
380
|
+
def log(self, assignment_id: str) -> str:
|
|
381
|
+
"""Seeded NDJSON log text for *assignment_id* (#3195), or ``""`` if
|
|
382
|
+
unseeded — same one-canned-string-per-id shape as :meth:`diff`. A
|
|
383
|
+
fixture that wants a partial-then-resumed stream seeds the FULL
|
|
384
|
+
text here; `api_assignment_log`'s fixture branch slices it at the
|
|
385
|
+
client's requested `since` offset itself, exactly like the live
|
|
386
|
+
agent-proxy path does with the real file's bytes."""
|
|
387
|
+
return self.logs.get(assignment_id, "")
|
|
388
|
+
|
|
375
389
|
def config(self, fallback: Config | None = None) -> Config:
|
|
376
390
|
"""Resolve the Config the seeded server runs with.
|
|
377
391
|
|
|
@@ -606,6 +620,10 @@ def parse_fixture(raw: Any, *, path: Path | None = None) -> FixtureServer:
|
|
|
606
620
|
if not all(isinstance(v, str) for v in diffs.values()):
|
|
607
621
|
raise FixtureError("fixture 'diffs' values must be strings")
|
|
608
622
|
|
|
623
|
+
logs = _as_dict(raw.get("logs"), "logs")
|
|
624
|
+
if not all(isinstance(v, str) for v in logs.values()):
|
|
625
|
+
raise FixtureError("fixture 'logs' values must be strings")
|
|
626
|
+
|
|
609
627
|
report_catalogue_raw = raw.get("report_catalogue")
|
|
610
628
|
if report_catalogue_raw is not None and not isinstance(report_catalogue_raw, dict):
|
|
611
629
|
raise FixtureError(
|
|
@@ -646,6 +664,7 @@ def parse_fixture(raw: Any, *, path: Path | None = None) -> FixtureServer:
|
|
|
646
664
|
report_results_raw=report_results_raw,
|
|
647
665
|
review_findings_raw=_as_dict(raw.get("review_findings"), "review_findings"),
|
|
648
666
|
diffs=diffs,
|
|
667
|
+
logs=logs,
|
|
649
668
|
events=_parse_events(raw.get("events")),
|
|
650
669
|
autoplay_events=bool(raw.get("autoplay_events", False)),
|
|
651
670
|
now=now,
|
coord/dashboard/server.py
CHANGED
|
@@ -45,6 +45,7 @@ from coord.events import (
|
|
|
45
45
|
EventSource,
|
|
46
46
|
build_events_route,
|
|
47
47
|
)
|
|
48
|
+
from coord.events import _format_log_event as _format_agent_log_sse_event
|
|
48
49
|
from coord.board_schema import BoardDriveQueueEntry
|
|
49
50
|
from coord.board_service import read_board, write_board
|
|
50
51
|
from coord.drive_queue import (
|
|
@@ -684,6 +685,55 @@ def _fetch_agent_status(host: str, port: int = AGENT_PORT, timeout: float = 5.0)
|
|
|
684
685
|
return None
|
|
685
686
|
|
|
686
687
|
|
|
688
|
+
# #3195: GET /api/assignment/{id}/log proxy tuning — the same defaults the
|
|
689
|
+
# agent's own /stream/{id} (coord/events.py's stream_assignment_log) uses for
|
|
690
|
+
# its poll cadence and keepalive, so a live leg feels the same whether the
|
|
691
|
+
# TUI talks to the agent directly or coord-web talks to it through here.
|
|
692
|
+
_LOG_PROXY_POLL_INTERVAL_S = 1.0
|
|
693
|
+
_LOG_PROXY_KEEPALIVE_S = 15.0
|
|
694
|
+
# After this many consecutive network failures reaching the owning agent,
|
|
695
|
+
# give up and tell the client rather than polling forever — an agent that's
|
|
696
|
+
# down for maintenance must not turn into an SSE stream that hangs open with
|
|
697
|
+
# no signal.
|
|
698
|
+
_LOG_PROXY_MAX_CONSECUTIVE_ERRORS = 5
|
|
699
|
+
_LOG_PROXY_SSE_HEADERS = {
|
|
700
|
+
"Cache-Control": "no-cache, no-transform",
|
|
701
|
+
"X-Accel-Buffering": "no",
|
|
702
|
+
"Connection": "keep-alive",
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
def _fetch_agent_log(
|
|
707
|
+
host: str,
|
|
708
|
+
assignment_id: str,
|
|
709
|
+
since: int,
|
|
710
|
+
port: int = AGENT_PORT,
|
|
711
|
+
timeout: float = 10.0,
|
|
712
|
+
) -> tuple[int, bytes, dict]:
|
|
713
|
+
"""Synchronous ``GET /logs/{id}?since=N`` against an agent — safe to call
|
|
714
|
+
from a thread executor (#3195).
|
|
715
|
+
|
|
716
|
+
Returns ``(status_code, body, headers)``. ``status_code`` is ``0`` for a
|
|
717
|
+
network-level failure (agent host unreachable) — distinct from an actual
|
|
718
|
+
HTTP status the agent returned — so the SSE proxy loop above can tell
|
|
719
|
+
"the agent said no" from "we couldn't even ask it" and retry the latter
|
|
720
|
+
a bounded number of times instead of surfacing it as a hard 404.
|
|
721
|
+
"""
|
|
722
|
+
try:
|
|
723
|
+
resp = httpx.get(
|
|
724
|
+
f"http://{host}:{port}/logs/{assignment_id}",
|
|
725
|
+
params={"since": since} if since else None,
|
|
726
|
+
timeout=timeout,
|
|
727
|
+
)
|
|
728
|
+
return (
|
|
729
|
+
resp.status_code,
|
|
730
|
+
resp.content,
|
|
731
|
+
{k.lower(): v for k, v in resp.headers.items()},
|
|
732
|
+
)
|
|
733
|
+
except httpx.HTTPError:
|
|
734
|
+
return 0, b"", {}
|
|
735
|
+
|
|
736
|
+
|
|
687
737
|
async def _poll_once(
|
|
688
738
|
config: Config,
|
|
689
739
|
event_source: EventSource,
|
|
@@ -1781,6 +1831,50 @@ def openapi_spec() -> dict:
|
|
|
1781
1831
|
},
|
|
1782
1832
|
}
|
|
1783
1833
|
},
|
|
1834
|
+
"/api/assignment/{id}/log": {
|
|
1835
|
+
"get": {
|
|
1836
|
+
"summary": (
|
|
1837
|
+
"#3195: stream an assignment's turn-by-turn NDJSON log "
|
|
1838
|
+
"(SSE), proxied from the owning agent's GET /logs/{id}"
|
|
1839
|
+
),
|
|
1840
|
+
"description": (
|
|
1841
|
+
"The dashboard already knows which machine owns an "
|
|
1842
|
+
"assignment (board state) — the caller never passes "
|
|
1843
|
+
"one. Streams `text/event-stream`: `event: log` frames "
|
|
1844
|
+
"carry the agent's NDJSON log bytes verbatim (never "
|
|
1845
|
+
"reparsed here — a second parser here would drift from "
|
|
1846
|
+
"the TUI's own turn-by-turn rendering), a final "
|
|
1847
|
+
"`event: end` frame closes the stream once the "
|
|
1848
|
+
"assignment reaches a terminal status, and "
|
|
1849
|
+
"`event: error` reports an agent-side failure. The "
|
|
1850
|
+
"`id:` on each frame is a byte offset usable as "
|
|
1851
|
+
"`Last-Event-ID` (or a `?since=` query param) to "
|
|
1852
|
+
"resume a dropped connection. A finished assignment "
|
|
1853
|
+
"still gets its whole log back, as the first frame."
|
|
1854
|
+
),
|
|
1855
|
+
"parameters": [
|
|
1856
|
+
_dashboard_path_param("id", "assignment id"),
|
|
1857
|
+
{
|
|
1858
|
+
"name": "since",
|
|
1859
|
+
"in": "query",
|
|
1860
|
+
"required": False,
|
|
1861
|
+
"schema": {"type": "integer"},
|
|
1862
|
+
"description": (
|
|
1863
|
+
"byte offset to resume from — same cursor as "
|
|
1864
|
+
"Last-Event-ID"
|
|
1865
|
+
),
|
|
1866
|
+
},
|
|
1867
|
+
],
|
|
1868
|
+
"responses": {
|
|
1869
|
+
"200": {"description": "text/event-stream"},
|
|
1870
|
+
"404": {
|
|
1871
|
+
"description": (
|
|
1872
|
+
"Unknown assignment, or no machine recorded for it"
|
|
1873
|
+
)
|
|
1874
|
+
},
|
|
1875
|
+
},
|
|
1876
|
+
}
|
|
1877
|
+
},
|
|
1784
1878
|
"/api/chat": {
|
|
1785
1879
|
"post": {
|
|
1786
1880
|
"summary": "Stream a chat reply about current board state (SSE)",
|
|
@@ -3649,6 +3743,122 @@ def build_app(
|
|
|
3649
3743
|
except RuntimeError as e:
|
|
3650
3744
|
return JSONResponse({"error": str(e)}, status_code=500)
|
|
3651
3745
|
|
|
3746
|
+
async def api_assignment_log(request: Request) -> Response:
|
|
3747
|
+
"""GET /api/assignment/{id}/log — #3195: coord-web has no route that
|
|
3748
|
+
reaches an assignment's turn-by-turn log; only the owning agent
|
|
3749
|
+
server does (``GET /logs/{id}``, ``coord/agent_app.py`` — the same
|
|
3750
|
+
seam ``coord log <id> --machine NAME`` reads). This resolves the
|
|
3751
|
+
owning machine from board state (the caller never passes one) and
|
|
3752
|
+
streams the agent's response back as SSE, polling with a byte-offset
|
|
3753
|
+
cursor — the same mechanism the agent's own ``/stream/{id}``
|
|
3754
|
+
(``coord.events.stream_assignment_log``) uses to tail a local file,
|
|
3755
|
+
just polling over HTTP instead of reading bytes off disk directly.
|
|
3756
|
+
|
|
3757
|
+
Parses nothing: each ``event: log`` frame carries the agent's NDJSON
|
|
3758
|
+
log bytes verbatim, via the SAME ``_format_log_event`` framing the
|
|
3759
|
+
agent's own stream uses (imported as ``_format_agent_log_sse_event``)
|
|
3760
|
+
— one answer for "how is a log chunk framed as SSE", not a second
|
|
3761
|
+
implementation that could drift from it. A finished assignment still
|
|
3762
|
+
gets its whole log back, as the very first frame (offset 0 reads the
|
|
3763
|
+
complete file).
|
|
3764
|
+
"""
|
|
3765
|
+
assignment_id = request.path_params["id"]
|
|
3766
|
+
board = _read_board()
|
|
3767
|
+
assignment = board.find_by_id(assignment_id)
|
|
3768
|
+
if assignment is None:
|
|
3769
|
+
return JSONResponse({"error": "assignment not found"}, status_code=404)
|
|
3770
|
+
|
|
3771
|
+
since_raw = (
|
|
3772
|
+
request.headers.get("last-event-id")
|
|
3773
|
+
or request.query_params.get("since")
|
|
3774
|
+
or "0"
|
|
3775
|
+
)
|
|
3776
|
+
try:
|
|
3777
|
+
start_offset = max(0, int(since_raw))
|
|
3778
|
+
except ValueError:
|
|
3779
|
+
start_offset = 0
|
|
3780
|
+
|
|
3781
|
+
if _fixture is not None:
|
|
3782
|
+
# Seeded log text — never reach a real agent in fixture mode.
|
|
3783
|
+
text = _fixture.log(assignment_id)
|
|
3784
|
+
body_bytes = text.encode("utf-8")
|
|
3785
|
+
|
|
3786
|
+
async def canned():
|
|
3787
|
+
yield b"retry: 2000\n\n"
|
|
3788
|
+
if start_offset < len(body_bytes):
|
|
3789
|
+
yield _format_agent_log_sse_event(
|
|
3790
|
+
len(body_bytes),
|
|
3791
|
+
body_bytes[start_offset:].decode("utf-8", errors="replace"),
|
|
3792
|
+
)
|
|
3793
|
+
yield f"id: {len(body_bytes)}\nevent: end\ndata: {{}}\n\n".encode("utf-8")
|
|
3794
|
+
|
|
3795
|
+
return StreamingResponse(
|
|
3796
|
+
canned(), media_type="text/event-stream", headers=_LOG_PROXY_SSE_HEADERS
|
|
3797
|
+
)
|
|
3798
|
+
|
|
3799
|
+
machine = next(
|
|
3800
|
+
(m for m in config.machines if m.name == assignment.machine_name), None
|
|
3801
|
+
)
|
|
3802
|
+
if machine is None:
|
|
3803
|
+
return JSONResponse(
|
|
3804
|
+
{"error": f"no machine recorded for assignment {assignment_id!r}"},
|
|
3805
|
+
status_code=404,
|
|
3806
|
+
)
|
|
3807
|
+
host = machine.host
|
|
3808
|
+
|
|
3809
|
+
async def stream():
|
|
3810
|
+
offset = start_offset
|
|
3811
|
+
yield b"retry: 2000\n\n"
|
|
3812
|
+
loop = asyncio.get_running_loop()
|
|
3813
|
+
last_yield = time.monotonic()
|
|
3814
|
+
consecutive_errors = 0
|
|
3815
|
+
while True:
|
|
3816
|
+
if await request.is_disconnected():
|
|
3817
|
+
return
|
|
3818
|
+
status_code, body, headers = await loop.run_in_executor(
|
|
3819
|
+
None, _fetch_agent_log, host, assignment_id, offset
|
|
3820
|
+
)
|
|
3821
|
+
if status_code == 404:
|
|
3822
|
+
yield (
|
|
3823
|
+
f"id: {offset}\nevent: error\ndata: "
|
|
3824
|
+
f"{json.dumps({'error': 'no log file for this assignment'})}\n\n"
|
|
3825
|
+
).encode("utf-8")
|
|
3826
|
+
return
|
|
3827
|
+
if status_code != 200:
|
|
3828
|
+
# Covers both a real non-200 from the agent and the `0`
|
|
3829
|
+
# sentinel `_fetch_agent_log` returns for a network
|
|
3830
|
+
# failure — bounded retries either way, then a clean
|
|
3831
|
+
# error frame instead of a stream that hangs forever.
|
|
3832
|
+
consecutive_errors += 1
|
|
3833
|
+
if consecutive_errors > _LOG_PROXY_MAX_CONSECUTIVE_ERRORS:
|
|
3834
|
+
yield (
|
|
3835
|
+
f"id: {offset}\nevent: error\ndata: "
|
|
3836
|
+
f"{json.dumps({'error': f'agent unreachable (last status {status_code})'})}\n\n"
|
|
3837
|
+
).encode("utf-8")
|
|
3838
|
+
return
|
|
3839
|
+
await asyncio.sleep(_LOG_PROXY_POLL_INTERVAL_S)
|
|
3840
|
+
continue
|
|
3841
|
+
consecutive_errors = 0
|
|
3842
|
+
if body:
|
|
3843
|
+
offset += len(body)
|
|
3844
|
+
yield _format_agent_log_sse_event(
|
|
3845
|
+
offset, body.decode("utf-8", errors="replace")
|
|
3846
|
+
)
|
|
3847
|
+
last_yield = time.monotonic()
|
|
3848
|
+
continue
|
|
3849
|
+
agent_status = headers.get("x-coord-log-status", "")
|
|
3850
|
+
if agent_status not in ("running", "pending", ""):
|
|
3851
|
+
yield f"id: {offset}\nevent: end\ndata: {{}}\n\n".encode("utf-8")
|
|
3852
|
+
return
|
|
3853
|
+
if time.monotonic() - last_yield >= _LOG_PROXY_KEEPALIVE_S:
|
|
3854
|
+
yield b": keepalive\n\n"
|
|
3855
|
+
last_yield = time.monotonic()
|
|
3856
|
+
await asyncio.sleep(_LOG_PROXY_POLL_INTERVAL_S)
|
|
3857
|
+
|
|
3858
|
+
return StreamingResponse(
|
|
3859
|
+
stream(), media_type="text/event-stream", headers=_LOG_PROXY_SSE_HEADERS
|
|
3860
|
+
)
|
|
3861
|
+
|
|
3652
3862
|
async def api_pipeline(request: Request) -> JSONResponse:
|
|
3653
3863
|
"""GET /api/pipeline — return PipelineView for every type='work' assignment.
|
|
3654
3864
|
|
|
@@ -5170,6 +5380,7 @@ def build_app(
|
|
|
5170
5380
|
Route("/api/approve", api_approve, methods=["POST"]),
|
|
5171
5381
|
Route("/api/reject", api_reject, methods=["POST"]),
|
|
5172
5382
|
Route("/api/diff/{id}", api_diff, methods=["GET"]),
|
|
5383
|
+
Route("/api/assignment/{id}/log", api_assignment_log, methods=["GET"]),
|
|
5173
5384
|
Route("/api/chat", api_chat, methods=["POST"]),
|
|
5174
5385
|
Route("/api/pipeline", api_pipeline, methods=["GET"]),
|
|
5175
5386
|
Route(
|
coord/diagnose.py
CHANGED
|
@@ -49,6 +49,7 @@ from pathlib import Path
|
|
|
49
49
|
from typing import TYPE_CHECKING
|
|
50
50
|
|
|
51
51
|
if TYPE_CHECKING: # avoid import cycles / heavy imports at module load
|
|
52
|
+
from coord.acceptance import ManifestData
|
|
52
53
|
from coord.config import Config
|
|
53
54
|
from coord.models import Assignment, Board, Machine
|
|
54
55
|
|
|
@@ -127,6 +128,47 @@ class DiagnoseResult:
|
|
|
127
128
|
)
|
|
128
129
|
|
|
129
130
|
|
|
131
|
+
# ── #3202: Gate-A exempt-exposure surfacing ─────────────────────────────────
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def gate_a_exempt_exposure_lines(
|
|
135
|
+
milestone_number: int,
|
|
136
|
+
manifest: "ManifestData",
|
|
137
|
+
contract_text: str | None,
|
|
138
|
+
) -> list[str]:
|
|
139
|
+
"""Surfacing (#3202) of a milestone already carrying a Gate-A contract
|
|
140
|
+
AND exempting one or more issues from the acceptance-slice gate — the
|
|
141
|
+
state that let the format-converter ms-1 incident ship a
|
|
142
|
+
contract-violating UI through Review, CI and unit tests, caught only by
|
|
143
|
+
a human at the UAT gate.
|
|
144
|
+
|
|
145
|
+
For a caller that has ALREADY fetched *manifest*/*contract_text* by some
|
|
146
|
+
other means and just wants the lines to print (a future ``coord
|
|
147
|
+
doctor`` per-milestone pass, once one exists — no fleet-wide milestone
|
|
148
|
+
iteration exists to hang it off of today, so nothing calls this yet).
|
|
149
|
+
``coord gates`` (:func:`coord.gates.build_gate_report`) and the
|
|
150
|
+
reviewer's briefing (``coord.review.build_review_briefing``) instead go
|
|
151
|
+
through :func:`coord.acceptance.fetch_gate_a_exempt_warning`, which owns
|
|
152
|
+
the manifest/contract FETCH those two need and isn't a fit for this
|
|
153
|
+
function's "data already in hand" shape — but both paths bottom out in
|
|
154
|
+
the exact same :func:`coord.acceptance.gate_a_exempt_exposure` /
|
|
155
|
+
:func:`coord.acceptance.gate_a_exempt_warning` pair, so the wording can
|
|
156
|
+
never drift between them.
|
|
157
|
+
|
|
158
|
+
Returns ``[]`` when there's nothing to report (no manifest exemptions).
|
|
159
|
+
Delegates the actual detection AND the wording to
|
|
160
|
+
:func:`coord.acceptance.gate_a_exempt_exposure` /
|
|
161
|
+
:func:`coord.acceptance.gate_a_exempt_warning` rather than re-deriving
|
|
162
|
+
either here.
|
|
163
|
+
"""
|
|
164
|
+
from coord.acceptance import gate_a_exempt_exposure, gate_a_exempt_warning # noqa: PLC0415
|
|
165
|
+
|
|
166
|
+
exposure = gate_a_exempt_exposure(milestone_number, manifest, contract_text)
|
|
167
|
+
if exposure is None:
|
|
168
|
+
return []
|
|
169
|
+
return [gate_a_exempt_warning(exposure)]
|
|
170
|
+
|
|
171
|
+
|
|
130
172
|
# ── stage / assignment resolution ───────────────────────────────────────────
|
|
131
173
|
|
|
132
174
|
|
coord/gates.py
CHANGED
|
@@ -309,6 +309,70 @@ def _find_verdict_unparseable_review(
|
|
|
309
309
|
return candidates[-1]
|
|
310
310
|
|
|
311
311
|
|
|
312
|
+
def _gate_a_exempt_note_for_winner(
|
|
313
|
+
issue_number: int, repo_cfg, config: "Config | None", gh_ops: "GhOps | None",
|
|
314
|
+
) -> str | None:
|
|
315
|
+
"""(#3202) ``coord gates``-facing surfacing of a milestone that carries
|
|
316
|
+
a Gate-A contract AND exempts one or more issues from the acceptance-
|
|
317
|
+
slice gate — one of the two surfaces (alongside the pre-dispatch guard,
|
|
318
|
+
:func:`coord.milestone_dispatch.issue_oracle_ready`) the issue names as
|
|
319
|
+
"where a milestone [is] already in that state", so an operator reading
|
|
320
|
+
``coord gates`` output sees the exposure without having to already know
|
|
321
|
+
to go look at the manifest by hand.
|
|
322
|
+
|
|
323
|
+
``Assignment`` carries no ``milestone_number`` column of its own (that
|
|
324
|
+
field lives on the pre-dispatch ``Proposal`` only, spent the moment a
|
|
325
|
+
dispatch is recorded) — so this resolves it the same way
|
|
326
|
+
:func:`coord.branch_model.resolve_base_branch_for_issue_number` resolves
|
|
327
|
+
a milestone issue's base branch just above this call site: a live
|
|
328
|
+
``get_issue`` lookup, gated behind *gh_ops* actually implementing it.
|
|
329
|
+
Looked up against *issue_number* — the issue the caller actually asked
|
|
330
|
+
``coord gates`` about, i.e. ``report.issue_number`` — rather than the
|
|
331
|
+
winning row's own (possibly-tracking-issue) ``issue_number``/
|
|
332
|
+
``for_issue_number``, since that's the milestone membership an operator
|
|
333
|
+
reading this report means.
|
|
334
|
+
|
|
335
|
+
``None`` (nothing to append) when: *config*/*repo_cfg* aren't in hand,
|
|
336
|
+
the repo has no acceptance driver configured at all (cheapest possible
|
|
337
|
+
short-circuit — never spends an issue fetch a milestone-unaware repo has
|
|
338
|
+
no use for), or *gh_ops* doesn't implement the (optional, like
|
|
339
|
+
:meth:`GhOps.branch_has_merge_commit` and friends) ``get_issue``/
|
|
340
|
+
``get_repo_file`` reads — including the common ``gh_ops=None`` case,
|
|
341
|
+
i.e. a caller that didn't ask for live lookups at all (every existing
|
|
342
|
+
``FakeGh`` test stub predates both methods, so this is a true no-op
|
|
343
|
+
against the whole existing test suite until a stub opts in). Delegates
|
|
344
|
+
the actual manifest/contract fetch, detection and wording entirely to
|
|
345
|
+
:func:`coord.acceptance.fetch_gate_a_exempt_warning` — the SAME function
|
|
346
|
+
:func:`coord.review._fetch_gate_a_exempt_warning` delegates to (and, one
|
|
347
|
+
level down, the same ``gate_a_exempt_exposure``/``gate_a_exempt_warning``
|
|
348
|
+
primitives :func:`coord.diagnose.gate_a_exempt_exposure_lines` renders
|
|
349
|
+
for a caller with a manifest/contract already in hand) — so this can
|
|
350
|
+
never drift from what those other surfaces say about the same state.
|
|
351
|
+
Fail-open on any error: advisory only, never worth failing ``coord
|
|
352
|
+
gates`` over.
|
|
353
|
+
"""
|
|
354
|
+
if config is None or repo_cfg is None or not config.acceptance.has_driver(repo_cfg.name):
|
|
355
|
+
return None
|
|
356
|
+
get_issue = getattr(gh_ops, "get_issue", None)
|
|
357
|
+
file_fetcher = getattr(gh_ops, "get_repo_file", None)
|
|
358
|
+
if get_issue is None or file_fetcher is None:
|
|
359
|
+
return None
|
|
360
|
+
try:
|
|
361
|
+
issue_data = get_issue(repo_cfg.github, issue_number) or {}
|
|
362
|
+
milestone = issue_data.get("milestone") or {}
|
|
363
|
+
milestone_number = milestone.get("number") if isinstance(milestone, dict) else None
|
|
364
|
+
if milestone_number is None:
|
|
365
|
+
return None
|
|
366
|
+
|
|
367
|
+
from coord.acceptance import fetch_gate_a_exempt_warning # noqa: PLC0415
|
|
368
|
+
|
|
369
|
+
return fetch_gate_a_exempt_warning(
|
|
370
|
+
config, repo_cfg, milestone_number, file_fetcher=file_fetcher,
|
|
371
|
+
)
|
|
372
|
+
except Exception: # noqa: BLE001 — advisory only, never break `coord gates`
|
|
373
|
+
return None
|
|
374
|
+
|
|
375
|
+
|
|
312
376
|
def build_gate_report(
|
|
313
377
|
board: "Board",
|
|
314
378
|
config: "Config",
|
|
@@ -366,6 +430,11 @@ def build_gate_report(
|
|
|
366
430
|
|
|
367
431
|
winner = _select_winning_work_assignment(work_like)
|
|
368
432
|
report.branch = winner.branch
|
|
433
|
+
|
|
434
|
+
gate_a_exempt_note = _gate_a_exempt_note_for_winner(issue_number, repo_cfg, config, gh_ops)
|
|
435
|
+
if gate_a_exempt_note:
|
|
436
|
+
report.notes.append(gate_a_exempt_note)
|
|
437
|
+
|
|
369
438
|
if not winner.branch:
|
|
370
439
|
report.notes.append(
|
|
371
440
|
f"winning work assignment {winner.assignment_id!r} has no branch — "
|
coord/milestone_dispatch.py
CHANGED
|
@@ -540,6 +540,67 @@ class OracleReadiness:
|
|
|
540
540
|
gate_a_state: str = ""
|
|
541
541
|
|
|
542
542
|
|
|
543
|
+
def _gate_a_exempt_trade_off_note(
|
|
544
|
+
repo_cfg: Repo,
|
|
545
|
+
config: "Config",
|
|
546
|
+
milestone_number: int,
|
|
547
|
+
manifest,
|
|
548
|
+
issue_number: int,
|
|
549
|
+
fetch: ManifestFetch,
|
|
550
|
+
) -> str:
|
|
551
|
+
"""(#3202) Appended to :func:`issue_oracle_ready`'s "no acceptance slice
|
|
552
|
+
yet, add it to `exempt:` instead" suggestion — the pre-dispatch guard
|
|
553
|
+
message the issue names as "the decision is actually made". Names what
|
|
554
|
+
exempting *issue_number* would trade away, using the same canonical
|
|
555
|
+
:func:`coord.acceptance.gate_a_exempt_warning` wording every other
|
|
556
|
+
#3202 surface renders (never re-derived independently here), computed
|
|
557
|
+
AS IF *issue_number* were already added to the milestone's `exempt:`
|
|
558
|
+
list — the exact edit the suggestion above is proposing.
|
|
559
|
+
|
|
560
|
+
Returns ``""`` (nothing appended) on any fetch/parse hiccup, or when the
|
|
561
|
+
milestone's own manifest has already declared it needs no Gate-A
|
|
562
|
+
contract at all (``gate_a_exempt`` — see
|
|
563
|
+
:func:`coord.acceptance.gate_a_exempt_exposure`'s precondition):
|
|
564
|
+
fail-open, this is advisory text glued onto a refusal reason that must
|
|
565
|
+
never itself become a new failure mode.
|
|
566
|
+
|
|
567
|
+
*fetch* is the caller's already-memoized ``(repo_github, path, branch)
|
|
568
|
+
-> content | None`` seam (:func:`issue_oracle_ready`'s local closure) —
|
|
569
|
+
the contract is known to exist at this call site (:func:`gate_a_status`
|
|
570
|
+
already passed), so reusing it costs no extra `gh` round trip.
|
|
571
|
+
"""
|
|
572
|
+
try:
|
|
573
|
+
from coord.acceptance import ( # noqa: PLC0415
|
|
574
|
+
ManifestData,
|
|
575
|
+
gate_a_contract_candidates,
|
|
576
|
+
gate_a_exempt_exposure,
|
|
577
|
+
gate_a_exempt_warning,
|
|
578
|
+
manifest_exempt_generated_comment,
|
|
579
|
+
)
|
|
580
|
+
|
|
581
|
+
contract_text: str | None = None
|
|
582
|
+
for path in gate_a_contract_candidates(config, repo_cfg.name, milestone_number):
|
|
583
|
+
contract_text = fetch(repo_cfg.github, path, repo_cfg.default_branch)
|
|
584
|
+
if contract_text is not None:
|
|
585
|
+
break
|
|
586
|
+
|
|
587
|
+
hypothetical = ManifestData(
|
|
588
|
+
exempt=frozenset(set(manifest.exempt) | {issue_number}),
|
|
589
|
+
gate_a_exempt=manifest.gate_a_exempt,
|
|
590
|
+
)
|
|
591
|
+
exposure = gate_a_exempt_exposure(milestone_number, hypothetical, contract_text)
|
|
592
|
+
if exposure is None:
|
|
593
|
+
return ""
|
|
594
|
+
return (
|
|
595
|
+
f"\n\n{gate_a_exempt_warning(exposure)}\n\nIf you do exempt it, "
|
|
596
|
+
"paste this next to the `exempt:` list in manifest.yml so the "
|
|
597
|
+
"trade is recorded, not just implied:\n\n"
|
|
598
|
+
f"{manifest_exempt_generated_comment(exposure)}"
|
|
599
|
+
)
|
|
600
|
+
except Exception: # noqa: BLE001 — advisory only, never break the refusal
|
|
601
|
+
return ""
|
|
602
|
+
|
|
603
|
+
|
|
543
604
|
def issue_oracle_ready(
|
|
544
605
|
repo_cfg: Repo,
|
|
545
606
|
config: "Config",
|
|
@@ -659,6 +720,7 @@ def issue_oracle_ready(
|
|
|
659
720
|
f"the driver rather than consuming it)? Add {issue_number} to "
|
|
660
721
|
f"tests/acceptance/ms-{milestone_number}/manifest.yml's `exempt:` "
|
|
661
722
|
"list, or label the issue `oracle:exempt`."
|
|
723
|
+
f"{_gate_a_exempt_trade_off_note(repo_cfg, config, milestone_number, manifest, issue_number, fetch)}"
|
|
662
724
|
)
|
|
663
725
|
elif unsupported:
|
|
664
726
|
reason = (
|
coord/review.py
CHANGED
|
@@ -54,6 +54,7 @@ from coord.models import (
|
|
|
54
54
|
Assignment,
|
|
55
55
|
Board,
|
|
56
56
|
Machine,
|
|
57
|
+
Repo,
|
|
57
58
|
coordinator_owned_docs,
|
|
58
59
|
trust_issue_closed_for,
|
|
59
60
|
)
|
|
@@ -1757,6 +1758,7 @@ def build_review_briefing(
|
|
|
1757
1758
|
review_provider: str | None = None,
|
|
1758
1759
|
completion_summary: str | None = None,
|
|
1759
1760
|
commit_messages: list[str] | None = None,
|
|
1761
|
+
gate_a_exempt_warning: str | None = None,
|
|
1760
1762
|
) -> str:
|
|
1761
1763
|
"""Assemble the reviewer's prompt. Pure function — easy to test.
|
|
1762
1764
|
|
|
@@ -1858,6 +1860,19 @@ def build_review_briefing(
|
|
|
1858
1860
|
embed" discipline as ``MAX_CLAUDE_MD_CHARS``/``truncate_diff_text`` above,
|
|
1859
1861
|
since a multi-round fix-review branch can otherwise grow this section
|
|
1860
1862
|
without bound.
|
|
1863
|
+
|
|
1864
|
+
*gate_a_exempt_warning* (#3202) is the pre-computed
|
|
1865
|
+
:func:`coord.acceptance.gate_a_exempt_warning` text for this issue's
|
|
1866
|
+
milestone, or ``None`` when the milestone has no Gate-A contract, its
|
|
1867
|
+
manifest exempts no issues, or the fetch failed — this function stays
|
|
1868
|
+
pure and never fetches the manifest/contract itself, matching every
|
|
1869
|
+
other pre-fetched-by-the-caller input above (*diff_text*, *sealed_paths*,
|
|
1870
|
+
...). When given, an advisory (non-blocking) section is rendered so the
|
|
1871
|
+
reviewer sees the same trade-off text the pre-dispatch guard and
|
|
1872
|
+
``coord doctor``/``coord gates`` show — this is deliberately never a
|
|
1873
|
+
mandatory ``request-changes`` banner: exempting acceptance slices on a
|
|
1874
|
+
milestone with a signed contract can be the right call, this only makes
|
|
1875
|
+
sure the reviewer is not the last human interposed in the loop.
|
|
1861
1876
|
"""
|
|
1862
1877
|
|
|
1863
1878
|
lines: list[str] = []
|
|
@@ -2117,6 +2132,24 @@ def build_review_briefing(
|
|
|
2117
2132
|
"suggestion, regardless of assignment type."
|
|
2118
2133
|
)
|
|
2119
2134
|
|
|
2135
|
+
if gate_a_exempt_warning:
|
|
2136
|
+
# #3202: advisory only — never a mandatory request-changes banner,
|
|
2137
|
+
# unlike the sealed-path/coordinator-doc sections above. Exempting
|
|
2138
|
+
# acceptance slices on a milestone with a signed Gate-A contract can
|
|
2139
|
+
# be the right call; this just makes sure the reviewer sees the same
|
|
2140
|
+
# trade-off text the pre-dispatch guard and `coord doctor`/`coord
|
|
2141
|
+
# gates` show, instead of the contract's behaviours going unverified
|
|
2142
|
+
# by anything but a human at the UAT gate with nobody having said so.
|
|
2143
|
+
lines.append("")
|
|
2144
|
+
lines.append("## Gate-A contract exempts acceptance slices (#3202)")
|
|
2145
|
+
lines.append("")
|
|
2146
|
+
lines.append(gate_a_exempt_warning)
|
|
2147
|
+
lines.append(
|
|
2148
|
+
"Not a blocking finding on its own — note it in your review "
|
|
2149
|
+
"(non-blocking) so it's visible, rather than silently passing "
|
|
2150
|
+
"over it."
|
|
2151
|
+
)
|
|
2152
|
+
|
|
2120
2153
|
lines.append("")
|
|
2121
2154
|
lines.append("## What to do")
|
|
2122
2155
|
lines.append("")
|
|
@@ -2337,6 +2370,33 @@ def _resolve_pr_base_branch(
|
|
|
2337
2370
|
return base_branch
|
|
2338
2371
|
|
|
2339
2372
|
|
|
2373
|
+
def _fetch_gate_a_exempt_warning(
|
|
2374
|
+
repo: Repo,
|
|
2375
|
+
config: Config,
|
|
2376
|
+
milestone_number: int | None,
|
|
2377
|
+
*,
|
|
2378
|
+
file_fetcher=None,
|
|
2379
|
+
) -> str | None:
|
|
2380
|
+
"""(#3202) Thin wrapper over :func:`coord.acceptance.fetch_gate_a_exempt_warning`
|
|
2381
|
+
— kept as a module-level name here (rather than inlined at the one call
|
|
2382
|
+
site below) purely so existing callers/tests that import
|
|
2383
|
+
``coord.review._fetch_gate_a_exempt_warning`` directly keep working.
|
|
2384
|
+
|
|
2385
|
+
#3202 review: the fetch-and-detect logic used to live here directly and
|
|
2386
|
+
was the ONLY wired caller of ``coord.acceptance``'s detection helpers —
|
|
2387
|
+
`coord.diagnose.gate_a_exempt_exposure_lines` and `coord gates` (see
|
|
2388
|
+
:func:`coord.gates.build_gate_report`) now share the exact same fetch
|
|
2389
|
+
loop via that one function instead of each re-deriving it, so a future
|
|
2390
|
+
edit to the fetch/candidate-resolution rules can't update this copy and
|
|
2391
|
+
silently leave the others stale.
|
|
2392
|
+
"""
|
|
2393
|
+
from coord.acceptance import fetch_gate_a_exempt_warning # noqa: PLC0415
|
|
2394
|
+
|
|
2395
|
+
return fetch_gate_a_exempt_warning(
|
|
2396
|
+
config, repo, milestone_number, file_fetcher=file_fetcher,
|
|
2397
|
+
)
|
|
2398
|
+
|
|
2399
|
+
|
|
2340
2400
|
def open_pr_for_completed_work(
|
|
2341
2401
|
completed: Assignment,
|
|
2342
2402
|
config: Config,
|
|
@@ -2663,6 +2723,7 @@ def dispatch_review(
|
|
|
2663
2723
|
commit_messages_fetcher=None,
|
|
2664
2724
|
compare_files_fetcher=None,
|
|
2665
2725
|
compare_diff_fetcher=None,
|
|
2726
|
+
gate_a_manifest_fetcher=None,
|
|
2666
2727
|
) -> Assignment | None:
|
|
2667
2728
|
"""Open a PR for `completed` and dispatch a review assignment.
|
|
2668
2729
|
|
|
@@ -2718,6 +2779,13 @@ def dispatch_review(
|
|
|
2718
2779
|
tips), can't carry that same staleness, so it is the arbiter: any file
|
|
2719
2780
|
*diff_fetcher* claims that a fresh compare doesn't corroborate makes its
|
|
2720
2781
|
whole diff untrustworthy, and the compare's own diff replaces it outright.
|
|
2782
|
+
|
|
2783
|
+
*gate_a_manifest_fetcher* is an optional ``(repo_github: str, path: str,
|
|
2784
|
+
branch: str) -> str`` callable (#3202), the ``file_fetcher`` passed
|
|
2785
|
+
through to :func:`_fetch_gate_a_exempt_warning`. Defaults to
|
|
2786
|
+
:func:`coord.github_ops.get_repo_file`; inject a stub in tests so this
|
|
2787
|
+
advisory lookup never shells out to a live ``gh``. Entirely fail-open —
|
|
2788
|
+
see that function's docstring.
|
|
2721
2789
|
"""
|
|
2722
2790
|
# #1627: every early-exit guard below used to be a bare `return None`,
|
|
2723
2791
|
# collapsing 11 distinct outcomes into one signal the caller couldn't
|
|
@@ -3210,6 +3278,30 @@ def dispatch_review(
|
|
|
3210
3278
|
# repo actually configuring coordinator_only_files.
|
|
3211
3279
|
coordinator_doc_paths = coordinator_owned_docs(repo)
|
|
3212
3280
|
|
|
3281
|
+
# #3202: advisory-only surfacing — does this issue's milestone carry
|
|
3282
|
+
# a Gate-A contract AND exempt one or more issues from the
|
|
3283
|
+
# acceptance-slice gate? Fetched independently of `base_branch`
|
|
3284
|
+
# above: the acceptance driver / Gate-A machinery applies whether or
|
|
3285
|
+
# not the repo opted into the `develop_branch` git model, so this
|
|
3286
|
+
# can't reuse that milestone lookup. Cheap no-op (no `gh` call) for
|
|
3287
|
+
# every repo with no acceptance driver configured at all.
|
|
3288
|
+
_fetch_ms = milestone_fetcher or _fetch_issue_milestone_number
|
|
3289
|
+
try:
|
|
3290
|
+
_gate_a_milestone_number = (
|
|
3291
|
+
_fetch_ms(repo.github, completed.issue_number)
|
|
3292
|
+
if config.acceptance.has_driver(repo.name)
|
|
3293
|
+
else None
|
|
3294
|
+
)
|
|
3295
|
+
except Exception: # noqa: BLE001 — fail-open: advisory, never blocking
|
|
3296
|
+
_gate_a_milestone_number = None
|
|
3297
|
+
try:
|
|
3298
|
+
gate_a_exempt_warning_text = _fetch_gate_a_exempt_warning(
|
|
3299
|
+
repo, config, _gate_a_milestone_number,
|
|
3300
|
+
file_fetcher=gate_a_manifest_fetcher,
|
|
3301
|
+
)
|
|
3302
|
+
except Exception: # noqa: BLE001 — fail-open: advisory, never blocking
|
|
3303
|
+
gate_a_exempt_warning_text = None
|
|
3304
|
+
|
|
3213
3305
|
# #3180: short-circuit BEFORE spending a review leg. `build_review_
|
|
3214
3306
|
# briefing` below would compute this exact same check purely to
|
|
3215
3307
|
# decide which paragraph to print in the reviewer's prompt — the
|
|
@@ -3314,6 +3406,7 @@ def dispatch_review(
|
|
|
3314
3406
|
assignment_type=completed.type,
|
|
3315
3407
|
completion_summary=completed.completion_summary,
|
|
3316
3408
|
commit_messages=commit_messages,
|
|
3409
|
+
gate_a_exempt_warning=gate_a_exempt_warning_text,
|
|
3317
3410
|
)
|
|
3318
3411
|
|
|
3319
3412
|
payload = {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|