fix(pdf): split pagesRead from pagesConsulted — the honest badge count
Live-smoke follow-up the user approved (2026-09-19): the GEB read showed
"78 pages consulted" when the reader genuinely READ ~12 - pdf_search hit
snippets inflated the count. PdfResult now carries both:
- pagesRead: extract/render output entered the loop - the honest count
the badge and brief footer show ("read N pages", "Pages read: ...").
- pagesConsulted: every page whose content entered the loop, search-hit
context lines included - unchanged, still the citation audit set (the
reader's instructions still say "Pages consulted: N, N, ..." and the
footer still lists it when it exceeds the read set).
The unread-finish gate deliberately stays on CONSULTED: search hits are
genuine consultation (anti-fabrication duty), so a search-only brief is
honest and must deliver - pagesRead is a reporting refinement, not a
delivery gate. Pinned by the search-only faux test (read [], consulted
[1], delivered).
UI tolerates pre-split persisted records via ?? fallbacks (old steers
lack pagesRead).
This commit is contained in:
@@ -422,13 +422,14 @@ describe("steer card rendering (the delivered artifact)", () => {
|
||||
path: "/Users/x/course/chapter-3.pdf",
|
||||
question: "What is the integral of x dx?",
|
||||
brief: "The power rule appears on **page 1**: the integral of x dx is x^2/2 + C.",
|
||||
pagesRead: [1],
|
||||
pagesConsulted: [1, 2],
|
||||
},
|
||||
);
|
||||
const html = renderToStaticMarkup(<SubagentSteerCard message={steer as never} />);
|
||||
assert.match(html, /PDF/);
|
||||
assert.match(html, /reading complete/);
|
||||
assert.match(html, /2 pages consulted/);
|
||||
assert.match(html, /read 1 page/, "the badge counts READ pages, not search hits");
|
||||
assert.match(html, /<details[^>]*data-testid="pdf-complete-badge"/, "a real disclosure like the research badge");
|
||||
assert.ok(!/<details[^>]*open/.test(html), "collapsed by default");
|
||||
assert.ok(html.includes("power rule"), "the brief rides inside the details");
|
||||
@@ -439,7 +440,7 @@ describe("steer card rendering (the delivered artifact)", () => {
|
||||
it("renders the PDF failure brief with the failed badge when the reader FAILED", () => {
|
||||
const steer = buildSubagentSteer(
|
||||
{ id: "jpf2", kind: "pdf", toolCallId: "cpf2" },
|
||||
{ path: "/tmp/doc.pdf", question: "q", brief: "PDF failed: the file could not be opened", pagesConsulted: [] },
|
||||
{ path: "/tmp/doc.pdf", question: "q", brief: "PDF failed: the file could not be opened", pagesRead: [], pagesConsulted: [] },
|
||||
);
|
||||
const html = renderToStaticMarkup(<SubagentSteerCard message={steer as never} />);
|
||||
assert.match(html, /pdf-brief-card/);
|
||||
|
||||
Reference in New Issue
Block a user