refactor(agent): gadfly round 2 — shared leadingMarkers, explicit mode, comment altitude
CI / Tidy (pull_request) Successful in 9m24s
CI / Build & Test (pull_request) Successful in 9m52s

All tidiness, no behavior change: the leading-marker class is one shared
constant for citationLabelRe and summaryCloserRe (hand-copying it is how
'+' went missing the first time); the deliberate 'all' duplication across
summaryCopulas/summaryArticle is now stated at both sites; the weak-final
switch case assigns modeBackRef explicitly; test comments state the
constraint they guard instead of which reviewer asked for them.

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
2026-08-05 20:29:19 -04:00
co-authored by Claude Fable 5
parent 21b4775d16
commit 1bbbdaa1e5
2 changed files with 24 additions and 14 deletions
+10 -10
View File
@@ -354,11 +354,11 @@ func TestFinalOutput(t *testing.T) {
want: b3cb9ee9Closer,
},
{
// Gadfly (opus, correctness): the modeSummary scan must stop at the
// most recent user message. Here the current turn's answer sits in
// the 1x-3x band (rejected by the ratio) while a dwarfing answer to
// a DIFFERENT question sits in history — resurrecting it would be
// strictly worse than keeping the closer.
// The modeSummary scan must stop at the most recent user message.
// Here the current turn's answer sits in the 1x-3x band (rejected
// by the ratio) while a dwarfing answer to a DIFFERENT question
// sits in history — resurrecting it would be strictly worse than
// keeping the closer.
name: "summary closer never resurrects a stale answer across the user boundary",
msgs: []llm.Message{
llm.UserText("earlier, unrelated question?"),
@@ -388,11 +388,11 @@ func TestFinalOutput(t *testing.T) {
want: hugeAnswer,
},
{
// Gadfly (opus, error-handling): a closer matching BOTH the ack
// shape and a back-reference carries no answer content, so the
// back-ref test must win and the ordinary recovery bar apply —
// under the summary bar this ~106-byte terminal would demand a
// ~318-byte prior and wrongly keep the closer over longAnswer.
// A closer matching BOTH the ack shape and a back-reference
// carries no answer content, so the back-ref test must win and the
// ordinary recovery bar apply — under the summary bar this
// ~106-byte terminal would demand a ~318-byte prior and wrongly
// keep the closer over longAnswer.
name: "back-reference wins over the summary ack when both match",
msgs: []llm.Message{
llm.UserText("q?"),