fix(agent): "In short supply" is not a short version
Round 5. Two of the eight findings are the em-dash mid-rune slice, which
the orientation matrix had already caught and fixed in 285789c before
this round returned — the harness doing the reviewers' job, which is the
point of it.
Of the rest:
**A marker phrase can open a sentence and still be prose** (kimi).
"That's the chain above. In short supply of alternatives, we went with
B." opens a sentence with "In short" and announces nothing. The marker
must now be followed by the delimiter a model puts after a real
announcement — the colon in "Short version:", the comma in "In short,".
No delimiter means no match, which keeps the terminal: fails closed.
Adding that made the sentence-opening anchor look redundant — a
break-check that removed it survived, because every mid-sentence case in
the table was by then rejected for want of a delimiter. It is not
redundant: "…, and in short, we went with B" is a clause continuation
with a comma. The missing thing was a case for what the anchor alone
does, not the anchor.
**backRefHeadChars was named for the wrong family** (opus; sonnet raised
the same constant from the other side). It is applied only to the
deictic offset test, never to backRefRe. Renamed abovePointerHeadChars.
It stays defined as `= weakFinalMaxChars` rather than inlined, because an
earlier round asked for exactly that linkage and the reason still holds.
**The clause-boundary comment narrated my review history** (opus) — the
same class of finding I took two rounds ago and then reintroduced one
comment over. Rewritten as behaviour, pointing at the matrix.
**analysis1611 was a function returning a constant string** (sonnet) —
now a var.
Accepted, not fixed: a comparative "above," plus a sentence-opening
marker can still reach isSummaryCloser. That needs the comparative false
positive, a real marker, a terminal under 300 bytes, and a same-turn
prior at least 3x longer, all at once; the dwarf ratio is the backstop
and no lexical test separates the comparative from the deictic.
Break-check: seventeen mutations, each killed by a named test.
This commit is contained in:
+32
-19
@@ -161,7 +161,7 @@ func pointsAbove(t string) bool { return aboveRefLoc(t) != nil }
|
||||
// bareAbovePointer cannot disagree about what counts as a pointer.
|
||||
func aboveRefLoc(t string) []int {
|
||||
loc := aboveRefRe.FindStringIndex(t)
|
||||
if loc == nil || loc[0] > backRefHeadChars {
|
||||
if loc == nil || loc[0] > abovePointerHeadChars {
|
||||
return nil
|
||||
}
|
||||
return loc
|
||||
@@ -204,12 +204,11 @@ func bareAbovePointer(t string) bool {
|
||||
|
||||
// clauseBoundaryChars ends the clause the reference belongs to. Commas,
|
||||
// semicolons, colons and dashes are in it, not just sentence terminators,
|
||||
// because the answer can share the reference's SENTENCE: "Ship Tuesday, as
|
||||
// shown above." is a decision plus a pointer, and cutting back only to the
|
||||
// previous full stop swallowed the decision and made the whole thing look
|
||||
// bare. That is the same defect as treating a pointer as disposable because
|
||||
// something followed it — mirrored, and it survived a round of review because
|
||||
// every case I had written put the answer AFTER the pointer.
|
||||
// because the answer can share the reference's SENTENCE — "Ship Tuesday, as
|
||||
// shown above." is a decision plus a pointer, and cutting back to the previous
|
||||
// full stop would swallow the decision and make the whole terminal look bare.
|
||||
// Content on either side of the pointer disqualifies it equally; see
|
||||
// TestBareAbovePointerOrientations, which checks every placement.
|
||||
const clauseBoundaryChars = ".!?\n,;:—"
|
||||
|
||||
// pointerResidueCutset is trimmed from both ends of what survives cutting the
|
||||
@@ -238,12 +237,22 @@ var bareRemainderRe = regexp.MustCompile(`(?i)^(` + fillerWords + fillerSep + `*
|
||||
// comment explains: a user who asked for brevity is answered with exactly that
|
||||
// shape.
|
||||
//
|
||||
// The marker must OPEN a sentence. Mid-sentence the same words are ordinary
|
||||
// prose carrying new content — "Given the analysis above, the bottom line is
|
||||
// that we need a different vendor" states a conclusion, it does not announce a
|
||||
// condensation — and treating that as disposable is the very failure the
|
||||
// two-part test exists to prevent.
|
||||
var compressionMarkerRe = regexp.MustCompile(`(?i)(^|[.!?:;—]\s*|\n\s*)(short version|shorter version|short answer|tl;?dr|in short|in brief|in summary|in sum|bottom line|net[- ]net|the gist)\b`)
|
||||
// The marker must OPEN a sentence AND be followed by a delimiter — the colon
|
||||
// or comma a model puts after it when it is genuinely introducing the short
|
||||
// form. Both halves are needed against a different failure each:
|
||||
//
|
||||
// - Mid-sentence the same words are ordinary prose carrying new content.
|
||||
// "Given the analysis above, the bottom line is that we need a different
|
||||
// vendor" states a conclusion; it does not announce a condensation.
|
||||
// - At a sentence opening the words can still run on into ordinary prose.
|
||||
// "In short supply of alternatives, we went with B" opens a sentence with
|
||||
// "In short" and is not a summary at all.
|
||||
//
|
||||
// A marker with no delimiter ("In short we chose B") is not matched, which
|
||||
// fails closed: the terminal is kept, which is today's behaviour.
|
||||
var compressionMarkerRe = regexp.MustCompile(`(?i)(^|[.!?:;—]\s*|\n\s*)` +
|
||||
`(short version|shorter version|short answer|tl;?dr|in short|in brief|in summary|in sum|bottom line|net[- ]net|the gist)` +
|
||||
`\s*([:,—-]|$)`)
|
||||
|
||||
// summaryCloserRe matches a terminal turn that OPENS with a bookkeeping
|
||||
// acknowledgment of the citation round — "Citations are logged.", "Sources
|
||||
@@ -319,15 +328,19 @@ const (
|
||||
// genuine final answer that merely contains "as I said" mid-sentence is
|
||||
// longer than this, so it is never treated as weak.
|
||||
weakFinalMaxChars = 120
|
||||
// backRefHeadChars bounds how far into the terminal a deictic "above" may
|
||||
// sit and still read as pointing OUTSIDE this message (see pointsAbove).
|
||||
// It IS weakFinalMaxChars — the same guard ("there is not enough text
|
||||
// abovePointerHeadChars bounds how far into the terminal a deictic "above"
|
||||
// may sit and still read as pointing OUTSIDE this message (see
|
||||
// pointsAbove). It applies to the deictic family only — backRefRe's fixed
|
||||
// phrases are matched anywhere under the weak cap — so it is named for the
|
||||
// pointer, not for the back-reference family as a whole.
|
||||
//
|
||||
// It IS weakFinalMaxChars: the same guard ("there is not enough text
|
||||
// before the reference for it to be pointing at content inside this
|
||||
// turn"), expressed as an offset because a summary closer carries a
|
||||
// compression AFTER the pointer and so is not itself short. Defined by
|
||||
// reference, not by repeating the literal: tuning the weak cap without the
|
||||
// offset following it would split one rule into two.
|
||||
backRefHeadChars = weakFinalMaxChars
|
||||
// reference rather than by repeating the literal, because tuning the weak
|
||||
// cap without the offset following it would split one rule into two.
|
||||
abovePointerHeadChars = weakFinalMaxChars
|
||||
// recoverMinChars: a prior assistant turn this long is treated as a real
|
||||
// answer regardless of how it opens (the preamble filter is not applied at
|
||||
// this length — see isSubstantiveAnswer).
|
||||
|
||||
Reference in New Issue
Block a user