Skip to content

fix(webfetch): score returned structured page fields - #252

Merged
lanyue-llk merged 8 commits into
mainfrom
codex/webfetch-returned-content-audit
Nov 10, 2026
Merged

lanyue-llk merged 8 commits into
mainfrom
codex/webfetch-returned-content-audit

Conversation

@Maisiqi

@Maisiqi Maisiqi commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

PR #252: what returned structured fields may and may not prove in the shared scorer

Structured extraction responses retained headings, review records, dates and other page information in raw evidence, but the scorer could receive only the main text and resource fields. Plain extracted code examples could also be mistaken for HTML. Preserve declared representations and hash-bound fields, then evaluate them through the shared scorer.

Under an explicit, unscoped acceptance contract, extracted page information can satisfy independent information checks. It cannot replace body coverage, comments, record counts or explicitly scoped content. Field values are never concatenated to manufacture a phrase. Returned link labels never count as page text, and legacy tasks without an acceptance contract keep body-only facts. The document title stays the title field and is not declared as extracted page information. Native projections retain historical policies and support structural field-name aliases without site or case branches.

Report pages show the evidence for each stable-text check: the located response excerpt, or the returned field that matched, with returned fields viewable on the result page.

Measured evidence, credentials and run-specific prose stay outside Git. No provider calls or online report updates are made.

Update 2026-11-09

  • Ported onto feat(webfetch): retain native Lexmount API execution evidence #224, which is rebased on main after feat(webfetch): verify uniform category results and reviewed scoring #131 merged. The 16 original commits (head cebd6aa1) are one commit here, resolved once against main's scorer changes.
  • Main's CJK rule (fix(web-fetch): accept spaced anchors, indented links; cache tokenizing #253) is kept: plain text folds only letter-spaced single characters, so separate CJK words or paragraphs never join. cjk-separate-paragraphs-fact-rejected passes again. The plain-text-typography control no longer depends on joining 中文 文本.
  • Independent review found two false passes, both fixed with paired controls bound in code-migration.json:
    • Returned link labels (Firecrawl, Exa and Lexmount return page-wide link lists) satisfied required facts and stable anchors, so a truncated body plus a table-of-contents link passed. returned-link-label is now a negative control, and returned-link-fact-cross-page is new.
    • The Lexmount projection copied the document title into page_information.title, so it could pass title contracts that reject document titles.
  • The earlier result (local 390/530, API 113/530) was measured at cebd6aa1. These changes can lower the API count. That paired replay must be rerun before any report uses these numbers.
  • Validation: 12,021 scorer and controls tests plus 470 subtests, every registered control through the public score_attempt, the native route baseline (policy source hash only), golden snapshots (source hashes only), and lint.

Update 2026-11-10

  • Returned headings no longer pass title checks whose task excludes page regions: a flat field cannot show it came from outside them (same rule the extracted title already followed). Test: test_returned_headings_respect_title_exclusions.
  • Removed the dev.to-specific comment-card parser. The shared scorer has no site-specific branches.
  • Reverted to main the scoring changes that had no bound controls or correction record: named-link label ranking (ratings, View All, icons), catalog price-heading boundaries, Han spacing after ©/Latin labels, and section-heading boundaries from extra.section_headings. They address real HF review findings but belong in their own bound corrections; section_headings is still projected and retained as evidence, not scored.
  • code-migration.json hashes refreshed; dynamic_lists.py and document_structure.py match main again. The golden snapshot changes only by the scorer source hash.
  • The 390/530 (local) and 113/530 (API) results were measured at cebd6aa1 and need a replay on the final head before any report uses them.
  • Review follow-ups (bot rounds on 0c8ce9f1, 3847a017, adbc6d01), all fixed:
    • Repeated returned records reach the duplicate-record check. Each text row, including an equivalent quote, absorbs only one returned copy, and API paths differing only in case stay separate. Controls: returned-records-duplicate-unique-count, returned-records-duplicate-with-body-copy, returned-records-duplicate-quote-with-body-copy.
    • Plain-text paragraphs ending in CJK punctuation no longer join. Control: plain-text-cjk-punctuated-paragraphs-fact-rejected.
    • A complete returned record replaces the same fields parsed as invalid text.
    • The discussion-heading comment start rule was reverted to main, because a reply-form heading could hide earlier comments. article_comments.py is unchanged from main.
    • Report evidence for an anchor shows only fields the scorer accepts, and never link labels. The method-comparison caption is localized.
  • Known non-blocking (P2, report display or feature gap, no score change from main):
    • The report's fallback excerpt can come from an excluded region when the scorer matched elsewhere.
    • Returned product rows keep only name and price, not optional shipping or financing.

lanyue-llk added a commit that referenced this pull request Nov 9, 2026
Port of #252 (16 commits, head cebd6aa) onto #224 rebased on current #131,
resolved once. Same behavior as cebd6aa except:

- Keep main's CJK rule (#253): plain text folds letter-spaced single
  characters only, so separate CJK words or paragraphs never join
  (cjk-separate-paragraphs-fact-rejected passes again). The
  plain-text-typography control no longer relies on joining 中文 文本.
- Catalog price-heading cards keep #252's broader condition, which covers
  main's #250 case.
- Keep both stable-anchor fallbacks (escaped prose from #131, link labels
  and extracted fields from #252).
- Bind loop variables for B023 and recompute scorer source hashes; add
  #252's two correction records to the migration receipt.

Co-authored-by: Maisiqi <[email protected]>
@lanyue-llk
lanyue-llk force-pushed the codex/webfetch-returned-content-audit branch from cebd6aa to 661138c Compare November 9, 2026 13:55
lanyue-llk added a commit that referenced this pull request Nov 9, 2026
Port of #252 (16 commits, head cebd6aa) onto #224 rebased on current #131,
resolved once. Same behavior as cebd6aa except:

- Keep main's CJK rule (#253): plain text folds letter-spaced single
  characters only, so separate CJK words or paragraphs never join
  (cjk-separate-paragraphs-fact-rejected passes again). The
  plain-text-typography control no longer relies on joining 中文 文本.
- Catalog price-heading cards keep #252's broader condition, which covers
  main's #250 case.
- Keep both stable-anchor fallbacks (escaped prose from #131, link labels
  and extracted fields from #252).
- Bind loop variables for B023 and recompute scorer source hashes; add
  #252's two correction records to the migration receipt.

Co-authored-by: Maisiqi <[email protected]>
@lanyue-llk
lanyue-llk force-pushed the codex/webfetch-returned-content-audit branch from 661138c to bb73243 Compare November 9, 2026 14:00
lanyue-llk added a commit that referenced this pull request Nov 9, 2026
…ent checks

Independent review of #252 found two false passes in the shared scorer:

- Labels of returned links (Firecrawl, Exa and Lexmount return page-wide
  link lists) satisfied required body facts and stable anchors, so a
  truncated body plus a table-of-contents link passed. Link labels no
  longer feed facts or anchors, and tasks without an acceptance contract
  keep body-only facts.
- The Lexmount projection copied the document title (result.title) into
  page_information.title, letting it pass title contracts that reject
  document titles. It is already scored as the title field.

returned-link-label becomes a negative control; returned-link-fact-cross-page
is new. Both are bound in a new correction record.
@lanyue-llk lanyue-llk changed the title Fix Web Fetch scoring for returned structured page fields fix(webfetch): score returned structured page fields Nov 9, 2026
lanyue-llk added a commit that referenced this pull request Nov 9, 2026
Port of #252 (16 commits, head cebd6aa) onto #224 rebased on current #131,
resolved once. Same behavior as cebd6aa except:

- Keep main's CJK rule (#253): plain text folds letter-spaced single
  characters only, so separate CJK words or paragraphs never join
  (cjk-separate-paragraphs-fact-rejected passes again). The
  plain-text-typography control no longer relies on joining 中文 文本.
- Catalog price-heading cards keep #252's broader condition, which covers
  main's #250 case.
- Keep both stable-anchor fallbacks (escaped prose from #131, link labels
  and extracted fields from #252).
- Bind loop variables for B023 and recompute scorer source hashes; add
  #252's two correction records to the migration receipt.

Co-authored-by: Maisiqi <[email protected]>
@lanyue-llk
lanyue-llk force-pushed the codex/webfetch-returned-content-audit branch from b0b73a0 to 3f8cd71 Compare November 9, 2026 14:15
lanyue-llk added a commit that referenced this pull request Nov 9, 2026
…ent checks

Independent review of #252 found two false passes in the shared scorer:

- Labels of returned links (Firecrawl, Exa and Lexmount return page-wide
  link lists) satisfied required body facts and stable anchors, so a
  truncated body plus a table-of-contents link passed. Link labels no
  longer feed facts or anchors, and tasks without an acceptance contract
  keep body-only facts.
- The Lexmount projection copied the document title (result.title) into
  page_information.title, letting it pass title contracts that reject
  document titles. It is already scored as the title field.

returned-link-label becomes a negative control; returned-link-fact-cross-page
is new. Both are bound in a new correction record.
@lanyue-llk

Copy link
Copy Markdown
Contributor

Status at 3f8cd710. This PR is now ported onto #224, which sits on main after #131 merged. The PR body describes the port and the two false-pass fixes (returned link labels, and the document title reaching title contracts).

A second independent review found three more blocking issues. Fixes keep surfacing new problems in the shared scorer, so I stopped patching here and am leaving them to you. Please address them or split them out:

P1. Returned headings bypass reviewed title exclusions (false pass). article_title.py:172-176, fed by required_components.py:22-26. extracted_title is accepted only without excluded_html_selectors. Headings from page_structure.headings (Lexmount extra.dom_summary) or page_information.headings have no such guard. A DOM-wide summary includes the excluded h1.screen-reader-only nodes, which a frozen article task really uses.
Repro through score_attempt:

  • case source_benchmark.title_contract = {"version":1,"alternatives":["Observed title"],"html_selector":"h1","excluded_html_selectors":["h1.screen-reader-only"]}, min_content_chars: 20
  • body "Other title\nThe body text of the article continues here at length."
  • metadata {"answer_format":"plain_text","page_structure":{"headings":["Observed title"]}}

The head passes (returned_heading_field); the base fails. Apply the same exclusion guard and add paired controls.

P1. A site-specific comment parser inside the shared scorer. _rendered_comment_cards (article_comments.py:326-374, preferred at :384-387) runs only on dev.to/Forem widget strings (Collapse Expand, - [Copy link](, - [Report abuse](, Like comment: … Reply). Main forbids site branches in the scorer. It also has no paired controls, and no correction record names it. Please generalize it or remove it.

P1. Verdict changes in dynamic_lists.py, document_structure.py and stable_tasks._product_start have no root cause or controls. Their new after_sha256 values are bound, but no correction record lists these modules. The changes alter named-record verdicts:

  • rating labels such as 4/5 are rejected;
  • numeric and \d+[kmb] labels are rejected in nonempty mode;
  • view all and 查看详情 become calls to action;
  • duplicate names now match by owned title or slug agreement instead of earliest position.

Main requires each scoring correction to bind its root cause and paired controls. A smaller PR per behavior would be much easier to verify.

Also, the 390/530 and 113/530 results were measured at cebd6aa1. The fixes so far can change the API count, so rerun the paired replay before quoting those numbers.

Base automatically changed from codex/moli-api-530 to main November 9, 2026 14:42
lanyue-llk and others added 3 commits November 9, 2026 21:43
Port of #252 (16 commits, head cebd6aa) onto #224 rebased on current #131,
resolved once. Same behavior as cebd6aa except:

- Keep main's CJK rule (#253): plain text folds letter-spaced single
  characters only, so separate CJK words or paragraphs never join
  (cjk-separate-paragraphs-fact-rejected passes again). The
  plain-text-typography control no longer relies on joining 中文 文本.
- Catalog price-heading cards keep #252's broader condition, which covers
  main's #250 case.
- Keep both stable-anchor fallbacks (escaped prose from #131, link labels
  and extracted fields from #252).
- Bind loop variables for B023 and recompute scorer source hashes; add
  #252's two correction records to the migration receipt.

Co-authored-by: Maisiqi <[email protected]>
…ent checks

Independent review of #252 found two false passes in the shared scorer:

- Labels of returned links (Firecrawl, Exa and Lexmount return page-wide
  link lists) satisfied required body facts and stable anchors, so a
  truncated body plus a table-of-contents link passed. Link labels no
  longer feed facts or anchors, and tasks without an acceptance contract
  keep body-only facts.
- The Lexmount projection copied the document title (result.title) into
  page_information.title, letting it pass title contracts that reject
  document titles. It is already scored as the title field.

returned-link-label becomes a negative control; returned-link-fact-cross-page
is new. Both are bound in a new correction record.
After rebasing onto main (#224), a non-JSON body still merged projected
page fields into metadata without a declaration, so its evidence failed
verification. Merge answer fields only for a parsed envelope. Refresh the
route baseline for the projection source hash.
@lanyue-llk
lanyue-llk force-pushed the codex/webfetch-returned-content-audit branch from 3f8cd71 to 8439d70 Compare November 9, 2026 14:50
@lanyue-llk

Copy link
Copy Markdown
Contributor

Rebased onto main after #224 merged (8439d70e). The diff now shows only this PR. One interaction is fixed: a non-JSON Lexmount body no longer merges projected page fields into metadata, so its evidence verifies again. 12,501 targeted tests pass. The three blockers in my previous comment are still open.

@lexmount-ocr lexmount-ocr Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Review complete · 8439d70

This review found 7 issue(s), including 7 blocking issue(s).

str(passed), f'{passed/len(selected):.1%}'))
context = _table([('方法', 'Method'), ('保存结果', 'Saved results'),
('通过', 'Passed'), ('通过率', 'Pass rate')], rows,
'本轮方法对比')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · low
P2 — This caption is always Chinese, including on English report routes. _table escapes its caption directly into both <caption> and aria-label; it does not translate it. Thus every saved-matrix explainer rendered in English gains untranslated visible and accessibility text, contrary to the report-language contract. Pass a localized string (for example, bilingual_text('本轮方法对比', 'Method comparison')) and cover the English rendering.

Comment on lines +1524 to +1525
field_match=next(((field,text) for field,text in candidates if any(
_stable_literal_match(text,value,representation='plain_text') for value in item.get('matched',[]))),None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2 — The fallback can attribute a passing anchor to evidence that the scorer explicitly excludes. For example, with an unscoped body_text contract, empty body, page_information.published_at='October 2024', and a returned link labeled 'October 2024', the scorer passes on page_information, but this renderer selects the link first and displays links as the justification. The same fallback also accepts page fields for scoped anchors without checking their eligibility. Remove returned link labels from page-text evidence candidates and apply the scorer's unscoped_page_information(contract) and anchor scope/control guards before using page information. Add a report regression using real scored metrics so excluded fields cannot be presented as proof of a pass.

return None
content, fences = mask_markdown_code(content, retain=True)
lines = content.splitlines()
start, _, _ = _coverage_text_start(lines, contract)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2 — The new card parser discards the discussion heading level and stops only at named end markers. Unlike _coverage_text_records, it therefore continues through a same-level heading such as ## Related and counts matching cards in that unrelated section. For example, ## Comments with one valid card followed by ## Related with another valid card now satisfies a two-comment minimum; the existing section-boundary behavior requires only the first to count. Retain the returned section level and stop at the next peer/ancestor heading as well as reviewed end markers. Add a rendered-card counterpart to test_explicit_comment_heading_stops_at_same_level_even_without_known_footer.

Comment thread src/lexbench_webfetch/article_title.py Outdated
Comment on lines +172 to +174
if matched is None:
matched = next((text for text in headings
if _title_key(text, representation='plain_text') in expected), None)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2 — Returned headings bypass the title contract's exclusions. _title forwards both page_structure.headings and page_information.headings unchanged, so a matching heading from an excluded aside or screen-reader-only element makes this pass even when the HTML candidate was explicitly removed. The adjacent extracted-title fallback already rejects contracts with excluded_html_selectors, but this fallback does not. Apply the same exclusion guard to returned headings (or require evidence of eligible ownership), and add a negative control combining an excluded title with a matching returned heading. This is a blocking scoped-title false pass.

events = _text_events(content, headings, key_function, literal=representation == 'plain_text')
declared = {key_function(h['text']): h for h in headings}
if not definitions and not html_document and not any(level is not None for _, level in events):
events = _declared_section_events(content, section_headings, declared) or events

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2 — The new fallback searches the raw Markdown after _text_events has deliberately excluded code from heading recognition. Consequently, a response containing only a fenced example with the declared section names and enough example text can pass document structure when section_headings repeats those names: the fallback promotes matches inside the fence to headings and counts the remaining code as their section bodies. Preserve heading eligibility when locating returned headings (in particular, exclude fenced and indented code for Markdown), and add a negative control for a code-only response with matching returned headings.

Comment thread src/lexbench_webfetch/dynamic_lists.py Outdated
Comment on lines +1068 to +1069
heading_title = bool(re.fullmatch(r' {0,3}#{1,6}[ \t]+', content[line_start:link.start]))
items.append(LocatedItem(destination, title, link.start, owned_title=heading_title))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2 — A heading prefix does not establish that this link is the heading's title. For example, ## [18](/person/alice) [Alice](/person/alice) marks only 18 as owned_title; _is_named_label consequently admits the numeric badge, and the new deduplication rank prefers it over Alice even though Alice agrees with the destination slug. Previously the default name validator rejected the numeric label. This can now produce the wrong record title (or count a badge-only link as a named record). Require the link to own the complete heading title, or derive the title from the complete heading through the card parser, before granting ownership. Add paired controls for a genuine numeric heading title and a heading-leading numeric badge.

Comment thread src/lexbench_webfetch/metrics.py Outdated
value = normalize_native_markdown_layout(value)
# Preserve the punctuation itself while folding layout gaps after CJK
# punctuation, before NFKC turns some marks into ASCII punctuation.
value = re.sub(r'([,。!?、;:])\s+', r'\1', value)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: This substitution also removes paragraph breaks in declared plain text. For example, a required fact 编者按:日前,BBC发布消息。 now matches the artifact 编者按:\n\n日前,BBC发布消息。: both normalize to the same string, and _stable_literal_match has no remaining paragraph boundary to reject. This introduces a false pass contrary to the stated preservation of separate plain-text paragraphs. Restrict this layout folding to horizontal whitespace (or otherwise preserve paragraph boundaries), and add a negative control with a paragraph break immediately after CJK punctuation alongside the inline-spacing positive control.

Returned headings no longer satisfy title checks that exclude page regions,
since a flat field cannot prove it came from outside them. Remove the
dev.to-specific comment-card parser and revert the unbound named-link,
catalog-boundary, Han-spacing and section-heading scoring changes to main;
they need their own bound corrections.

@lexmount-ocr lexmount-ocr Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Re-review complete · 0c8ce9f

This review found 5 issue(s), including 5 blocking issue(s).

str(passed), f'{passed/len(selected):.1%}'))
context = _table([('方法', 'Method'), ('保存结果', 'Saved results'),
('通过', 'Passed'), ('通过率', 'Pass rate')], rows,
'本轮方法对比')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · low
P2: Localize the new table caption and accessible label. _table() inserts this argument verbatim into both <caption> and aria-label, and this string has no translation entry. Consequently, English saved-matrix reports retain a Chinese comparison heading and screen-reader label. This violates the English-route localization requirement in presentation-quality.md. Use an English-source t(...) entry with a Chinese catalog translation, and cover the caption and accessible label in an English rendering test.

Comment thread src/harness/web_fetch/report.py Outdated
from lexbench_webfetch.stable_tasks import _stable_literal_match
fields=_returned_answer_fields(metadata or {})
_,links,_,_=answer_input(b'',fields)
candidates=[('links',label) for _,label in safe_named_links(links,base_url)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: The evidence fallback still considers returned link labels before eligible page-information fields, although the scorer now excludes those labels from page-text anchors. With body text lacking Help center, an unscoped body-text anchor can legitimately pass from page_information.headings=['Help center']; if the response also returns a link with that label, this renderer attributes the pass to links instead of the heading. Scope-restricted checks can likewise be attributed to ineligible fields because the field fallback has no eligibility guard. Build evidence candidates using the scorer's schema/scope rules (and only use returned links for checks that actually accept named-link records), so the report identifies evidence capable of supporting the saved verdict.

Comment on lines +183 to +184
if heading and label in markers:
return index + 1, len(heading[1]), True

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: This also treats a trailing comment-form heading as the start of the discussion, discarding genuine comments before it. The supported contract in test_article_comment_boundaries.py includes both Comments and Post your reply as section markers. For The article ends right here.\n\n**Alice**\nFirst actual reply.\n\n**Bob**\nSecond actual reply.\n## Post your reply, the new scan returns the position after the final heading and counts zero comments; previously both records counted. Preserve the existing trailing-form behavior while excluding biographies before a discussion heading, and extend the existing trailing-form regression test to cover a Markdown heading.

Comment thread src/lexbench_webfetch/metrics.py Outdated
value = normalize_native_markdown_layout(value)
# Preserve the punctuation itself while folding layout gaps after CJK
# punctuation, before NFKC turns some marks into ASCII punctuation.
value = re.sub(r'([,。!?、;:])\s+', r'\1', value)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: This whitespace fold also removes paragraph boundaries in declared plain text. For example, 第一段。\n\n第二段 now normalizes to 第一段。第二段, so that contiguous required fact or stable anchor passes even though the response separates the paragraphs. The previous plain-text branch preserved a separating space. This contradicts the stated requirement that separate CJK paragraphs never join; preserve paragraph boundaries for plain text here and add a punctuation-ending negative control alongside the existing separate-paragraph control.

Comment thread src/lexbench_webfetch/stable_tasks.py Outdated
records.append(record)
else:
records[equivalent] = record
known.add(identity)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · high
P1: Updating known for every returned row silently removes duplicates within returned_records, bypassing the existing duplicate_records failure. For example, a review contract with minimum_records: 1 and two identical valid returned reviews passes, whereas the same repeated records parsed from text fail. The registered returned-records-duplicate control uses a minimum of 2, so it fails only on count and does not detect this bypass. Deduplicate overlap with text-derived records separately, while preserving repeated returned rows for the normal duplicate-policy checks; add a control where the unique count already meets the minimum.

…to checks

Repeated returned records now reach the duplicate-record check, and plain-text
paragraphs ending in CJK punctuation no longer join. A trailing reply-form
heading no longer hides earlier comments. Report evidence shows only fields
the scorer accepts for an anchor, and the method-comparison caption is
localized. Bind two new controls.

@lexmount-ocr lexmount-ocr Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Re-review complete · 3847a01

This review found 5 issue(s), including 5 blocking issue(s).

field_detail=('<p class="source-note">' + t('whole_records_are_judged_by_field_text', 'Whole records are judged by field; text appearing does not mean list boundaries are intact.') + f"</p>{table([t('field', 'Field'), t('reference_answer', 'Reference answer'), t('actually_parsed', 'Actually parsed'), t('verdict', 'Verdict')], rows, metrics=[])}")
badge=t('invalid_field_boundaries', 'Invalid field boundaries')
actual=(f'<p translate="no">{esc(excerpt)}</p>' if excerpt else ('<p class="empty">' + t('no_continuous_source_excerpt_could_be_located', 'No continuous source excerpt could be located in the actual output.') + '</p>'))
actual=f'<p translate="no">{esc(excerpt)}</p>' if excerpt else ''

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: Field-backed passes can be displayed as body-backed matches that the scorer explicitly rejects. For example, with answer_format='plain_text', output 中文 文本, an unscoped body-text contract anchoring 中文文本, and page_information.description='中文文本', the scorer passes only via the returned field (separate multi-character CJK words must not join). However, the initial _exact_evidence_lines search normalizes without the representation, joins those words, and populates actual, so the new field-evidence branch never runs. The report incorrectly presents the body as proof and omits the matching field reference. Select excerpts using the scorer's representation and scope restrictions before accepting them, or retain match-source provenance and render that source; add a regression for this field-only pass.

Comment on lines +184 to +185
if heading and label in markers and any(line.strip() for line in lines[index + 1:]):
return index + 1, len(heading[1]), True

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: A populated trailing reply form still discards valid earlier comments. Using the existing boundary-test contract, append \n## Post your reply\nWrite a reply to the article ending plus the Alice/Bob comments. Because Post your reply is a section marker and now has nonblank text below it, this branch starts extraction after that heading and loses both comments (the previous loop retained them). The new trailing-form test only covers an empty form heading. Preserve earlier records when the later heading introduces a reply form, and add a control with form instructions or fields below the heading; nonempty trailing content does not establish that this is the discussion start.

Comment thread src/lexbench_webfetch/stable_tasks.py Outdated
if not isinstance(returned_records, list):
raise ValueError('returned records must be a list')
names = SCHEMA_FIELDS[schema]
known = {source_record_hash(row['fields'], names, schema) for row in records}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: Only valid text-derived records should suppress a complete returned record. known currently includes invalid parse candidates. For example, a Markdown review table with headers date | text and a row 2026-11-01 | Great service | extra produces a record with the correct date/text but invalid_table_columns. A returned {date: '2026-11-01', text: 'Great service'} hashes identically and is skipped, so a minimum-one contract still fails even though the structured response supplies a complete valid record. Build the suppression set from valid records (or replace equivalent invalid candidates), and add a regression covering this mixed-evidence case.

for fields in returned_records:
if not isinstance(fields, dict) or not all(isinstance(fields.get(key), str) for key in names):
continue
selected = {key: fields[key] for key in names}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: Preserve supported optional product fields when admitting returned records. product contracts allow field_minimum_records and fixed source_membership.fields to include financing and shipping, but this projection retains only name and price. A complete returned product with shipping: 'free shipping' therefore fails a shipping requirement (and a source hash bound to shipping) even though the response supplied it. Include the schema-supported optional fields in the admitted record and account for them when comparing it with text-derived records; add a structured-only product control with an optional-field requirement.

Comment thread src/lexbench_webfetch/stable_tasks.py Outdated
Comment on lines +1948 to +1949
identity = source_record_hash(selected, names, schema)
if identity not in known:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: Do not use the case-folded source hash alone to merge API-operation records. source_record_hash() case-folds the path, whereas the uniqueness check below deliberately preserves API path case. With a text-derived GET /Foo and a returned GET /foo having the same summary, this check silently drops the latter. A two-operation contract then falsely fails its minimum (or a maximum-one contract falsely passes). Use a merge key that preserves the schema's case-sensitive path identity, without changing frozen source-hash normalization, and cover this mixed text/structured case.

…t rows

A complete returned record replaces the same fields parsed as invalid text, and
API paths that differ only in case stay separate records. Revert the comment
discussion-heading start rule to main: a populated reply-form heading could
hide earlier comments.

@lexmount-ocr lexmount-ocr Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Re-review complete · adbc6d0

This review found 2 issue(s), including 2 blocking issue(s).

Comment on lines +1515 to +1516
visible = _visible(output, metrics.get('stable_task_schema'),
representation=(metadata or {}).get('answer_format'))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2 — Apply the scorer's scope/exclusions before locating fallback evidence. This new fallback calls _visible on the entire response, without the contract's text_exclusions or content_scope, and runs before the non_record_lines branch. For example, a body_text contract excluding .biography can pass on a multiline phrase in the accepted body, yet this fallback can select an earlier, inline-marked-up occurrence in .biography after rendering removes the tags. The scorer explicitly removes excluded selectors and text patterns before matching (stable_tasks.py:1836–1856), so the displayed excerpt is not evidence for the saved pass. The later passage fallback likewise starts from unfiltered output. Construct the accepted surface using the same scope/exclusion rules before either fallback, and add a regression with duplicate text in excluded and accepted regions. This is a localized report-correctness issue; it does not change the score.

Comment thread src/lexbench_webfetch/stable_tasks.py Outdated
if not isinstance(fields, dict) or not all(isinstance(fields.get(key), str) for key in names):
continue
selected = {key: fields[key] for key in names}
if merge_key(selected) not in known:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2: Repeated returned rows evade duplicate validation when the same row is also parsed from the body. known is a set of text-derived keys, so every occurrence of that returned row is skipped. For example, extend returned-records-duplicate-unique-count so the artifact contains one valid copy of its review: both returned copies disappear here and the one-record contract passes, although the same returned list correctly fails with artifact Reviews. Consume each text/returned overlap once (rather than skipping unlimited occurrences), retaining subsequent returned copies for the existing duplicate_records check. Add a paired regression with and without the body copy.

Further identical returned rows reach the duplicate-record check even when the
body also contains the record. Bind a paired control.

@lexmount-ocr lexmount-ocr Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Re-review complete · 7574c97

This review found 1 issue(s), including 1 blocking issue(s).

Comment thread src/lexbench_webfetch/stable_tasks.py Outdated
Comment on lines +1960 to +1961
if known[key]:
known[key] -= 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
P2 — A quote body row can absorb two returned copies because known and text_quotes track the same row independently. For example, with schema quote, minimum_records=1, body “A complete quotation” by Alex Writer Tags: books reading, and two returned copies of {quote: 'A complete quotation', author: 'Alex Writer', tags: 'books reading'}, the first copy decrements known; the second pops the still-available text_quotes entry and replaces that same row. Only one record reaches the duplicate check, so the task incorrectly passes. Consume the text-row match in both indexes (including the reverse, equivalent-tags replacement path) so each body row absorbs at most one returned row. Add a quote-specific negative control; the current duplicate-with-body-copy control only exercises reviews.

…atches

A body quote could absorb one returned copy by exact fields and another by
equivalent tags. Track consumed text rows by index. Bind a quote control.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Re-review complete · 6b29ac0

No findings in this incremental review.

@lanyue-llk
lanyue-llk marked this pull request as ready for review November 10, 2026 04:12
@lanyue-llk
lanyue-llk merged commit 62f7d55 into main Nov 10, 2026
8 checks passed
@lanyue-llk
lanyue-llk deleted the codex/webfetch-returned-content-audit branch November 10, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants