phase: 118_summary_seed_context
**Phase 118 final verification pass — complete.** All criteria verified; 4 pre-existing defects found and fixed.
- **Verified:** summary-seed wiring (`select_suggested` top-5 no-floor → summary blocks, no full text in HIGH prompt), all-doc markdown summaries + NULL backfill (`summary_backfilled`, no `sources_meta` bump), `read` adds full text with `read_docs`-only dedupe, `done.sources` = suggested+read / durable record = suggested+related+read + `suggested=N` log line (seen live in E2E), byte-locked PERSONA/LOW/TOOLS_SECTION, battery gate PASS recorded in `TOOL_CALLING_TESTING.md` §10 (turbo 2026-09-16: 1/2/4 GREEN, cond-3 reported 9/10 per A7, contract 21/21, caps 0).
- **Defects fixed (all pre-existing, none phase-118):** ① `ChatMessage` schema missing the phase-113 `related` key → `extra="forbid"` 422'd every done-time auto-save of grounded turns with a related tier, leaving `message_count=1` (root cause of `test_share_chat` 3F; browser-level instrumentation proved the PUT 422) — added the field + unit/integration pins; ② `test_theme_semantic_completion` pins stale vs phase-117 debox (border/chip removed) — re-targeted to assert border/chip *absence*; ③ `test_header_consistency` `<26`px pin red on 26.125px native date-input line — bound relaxed to `<34` (wrap-detection intent kept); ④ `test_navbar_refresh` bor.chat.v1 key set updated for `related`.
- **Test/lint/coverage:** `uv run pytest --cov=app --cov-report=term-missing` → **2506 passed, app/ 99%** (>90%); `uv run ruff check . && uv run pyright` → clean, 0 errors.
- **E2E:** new story suite in isolation → **2 passed**; full 103-suite matrix sweep (each isolated) → **all 103 green** after the fixes; `test_share_chat` 4 passed, `test_theme_semantic_completion` 8 passed, `test_header_consistency` 3 passed, `test_navbar_refresh` 7 passed.
- **Deviations:** none from LOCKED decisions. Note: orphaned diagnostic uvicorn processes briefly made E2E sessions exercise stale code — killed and re-verified; a sweep-regenerated tracked screenshot was restored. No commits made (harness commits).
- **Completion criteria:** all 7 ✅ (commit/phase-move is the harness's step).
- **Next pending phase:** none — `todo/` holds only this phase's overview pending the harness move.
This commit is contained in:
@@ -57,14 +57,18 @@ Test → story mapping (Playwright Mapping Rule):
|
||||
``source: X | path: Y | title: Z`` file lines), and the grounded
|
||||
``read(alpha/two/two-a.md)`` (the ``📄 Reading …`` line + the answer
|
||||
citing the document, the phase-37 assertion pattern). The read
|
||||
target is DELIBERATELY a top-2 retrieval document for its question
|
||||
(the question names the file's path, so the file self-matches the
|
||||
hybrid gate deterministically): the agent's phase-72 dedupe returns
|
||||
``ALREADY_IN_CONTEXT`` (a refusal — counts in nothing), and the
|
||||
mock answers FROM THE ``<documents>`` PROMPT with the same citation
|
||||
shape (``Already in context: Read <sp>. <first 80 chars>``) — the
|
||||
document text reached the model either way, and the prefix pins
|
||||
that the dedupe notice itself reached it.
|
||||
target is DELIBERATELY a suggested (summary-seeded) document for
|
||||
its question (the question names the file's path, so the file
|
||||
self-matches the hybrid gate and takes rank 1 deterministically):
|
||||
phase 118 (A6) — the seed is a SUMMARY, not full text, so the read
|
||||
SUCCEEDS (the phase-72 ALREADY_IN_CONTEXT dedupe fires only for a
|
||||
document already READ in the turn — the retired top-2 seed-read
|
||||
refusal is gone) and the full text arrives through the ``read``
|
||||
tool; the mock answers from the READ RESULT with the phase-37
|
||||
citation shape (``Read <sp>. <first 80 chars of the document
|
||||
content>`` — the mock skips the phase-106 D5 ``date:`` line, so the
|
||||
quote is pure content, byte-identical to the retired
|
||||
answer-from-prompt quote).
|
||||
2. ``test_wide_folder_holds_the_fifty_line_cap`` — ``ls(alpha/wide)``
|
||||
on the 51-file folder: the mock's echo carries exactly 50 file lines
|
||||
+ the ``…and 1 more documents in this folder — use grep (pattern)…``
|
||||
@@ -226,12 +230,16 @@ READ_QUESTION = f"Drill down the tree: read {READ_SP} — read the file"
|
||||
WIDE_QUESTION = f"Drill down the tree: ls {ALPHA}/wide — how many files does this folder hold?"
|
||||
NOPE_QUESTION = f"Drill down the tree: ls {ALPHA}/nope — is there such a folder?"
|
||||
|
||||
#: The read target is a top-2 retrieval document for its question (the
|
||||
#: question names the path — the file self-matches the hybrid gate
|
||||
#: deterministically), so the read gets the phase-72 ALREADY_IN_CONTEXT
|
||||
#: dedupe and the mock answers from the ``<documents>`` prompt with the
|
||||
#: same citation shape, prefixed (the suite pins the dedupe path).
|
||||
READ_ANSWER_PREFIX = f"Already in context: Read {READ_SP}."
|
||||
#: The read target is a suggested (summary-seeded) document for its
|
||||
#: question (the question names the path — the file self-matches the
|
||||
#: hybrid gate and takes rank 1 deterministically). Phase 118 (A6):
|
||||
#: the seed is a summary, not full text — a first read of a suggested
|
||||
#: document SUCCEEDS, the full text arrives through the read tool, and
|
||||
#: the mock answers from the READ RESULT with the phase-37 citation
|
||||
#: shape (the mock skips the phase-106 D5 ``date:`` line, so the quote
|
||||
#: is pure document content — byte-identical to the retired
|
||||
#: answer-from-prompt quote, which the suite pins).
|
||||
READ_ANSWER_PREFIX = f"Read {READ_SP}."
|
||||
READ_ANSWER_QUOTE = TWO_A_CONTENT[:80]
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
@@ -658,14 +666,15 @@ def test_drill_down_sources_folders_files_and_read(
|
||||
{"type": "tool", "name": "read", "argument": READ_SP}
|
||||
], _tool_frames(frames)
|
||||
bubble = _last_brain(page).locator(".bubble")
|
||||
# The dedupe notice reached the model (the prefix pins it — the read
|
||||
# was refused as ALREADY_IN_CONTEXT because the target is a top-2
|
||||
# retrieval document)…
|
||||
# Phase 118 (A6): the read SUCCEEDED — the seeds are summaries,
|
||||
# not full text, so the phase-72 ALREADY_IN_CONTEXT refusal (only
|
||||
# for a document already READ in the turn) did not fire —
|
||||
expect(bubble).to_contain_text(READ_ANSWER_PREFIX)
|
||||
# …and the answer still cites the document: the mock quotes the
|
||||
# FIRST 80 chars of the target's text from the ``<documents>``
|
||||
# prompt (the refusal's instruction — answer from that text; the
|
||||
# quote is newline-free, pinned above).
|
||||
expect(bubble).not_to_contain_text("Already in context")
|
||||
# — and the answer cites the document from the READ RESULT: the mock
|
||||
# quotes the FIRST 80 chars of the document's own content (the full
|
||||
# text arrived through the read tool; the quote is newline-free,
|
||||
# pinned above).
|
||||
expect(bubble).to_contain_text(READ_ANSWER_QUOTE)
|
||||
done = next(f for f in frames if f.get("type") == "done")
|
||||
assert done["deflected"] is False, done
|
||||
|
||||
Reference in New Issue
Block a user