phase: 118_summary_seed_context
Build and Push Containers / build-and-push-app (push) Successful in 2m2s
Build and Push Containers / build-and-push-db (push) Successful in 14s

**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:
2026-09-16 06:57:49 -04:00
parent 21aad84a6d
commit 9820c361b0
80 changed files with 4690 additions and 1302 deletions
+1 -1
View File
@@ -376,7 +376,7 @@ async def run_turn(
lambda: SessionLocal(),
system_prompt=plan.system_prompt,
user_message=question,
seed_docs=plan.docs,
seed_docs=plan.suggested_docs, # phase 118: the suggestion tier
settings=settings,
holder=holder,
)
+14 -8
View File
@@ -35,9 +35,11 @@ guessable by any model. This script:
comparing a per-table checksum**.
Re-run it only when the fixture documents, the chunker, the embedding
model, or the folder-summary prompt (its ``lite`` output is baked into
the dump) change — everyday iterations restore the dump in sub-second
time (``scripts/restore_test_kb`` / the gate's ``--restore``), never
model, the folder-summary prompt (its ``lite`` output is baked into
the dump), or the importer's summary policy (phase 118: every document
gets a stored summary + an embedded ``is_summary`` chunk) change —
everyday iterations restore the dump in sub-second time
(``scripts/restore_test_kb`` / the gate's ``--restore``), never
re-embedding (see ``TOOL_CALLING_TESTING.md``).
Exit codes: **0** built + verified, **1** build/verification failure,
@@ -105,10 +107,12 @@ FIXTURE_KB_OVERVIEW: str = (
#: tsvector column is excluded; Postgres recomputes it).
_TABLES: tuple[tuple[str, type, tuple[str, ...]], ...] = (
("documents", Document, ("id", "source", "path", "full_path", "title",
"content", "content_hash", "indexed_at", "summary")),
"content", "content_hash", "indexed_at",
"created_at", "created_at_manual", "summary")),
("chunks", Chunk, ("id", "document_id", "position", "content",
"embedding", "is_summary")),
("git_sources", GitSource, ("id", "url", "kind", "path", "added_at")),
("git_sources", GitSource, ("id", "url", "kind", "path", "ignore_paths",
"include_hidden", "added_at")),
("kb_overview", KbOverview, ("id", "content", "updated_at")),
("sources_meta", SourcesMeta, ("id", "version", "updated_at")),
("steering_notes", SteeringNote, ("id", "note", "created_at")),
@@ -125,7 +129,8 @@ _TABLES: tuple[tuple[str, type, tuple[str, ...]], ...] = (
# step 5 of :func:`_build` (the build truncates first, so the sync
# paths' table-empty first-run trigger holds).
("folder_summaries", FolderSummary, ("source", "folder_path",
"summary", "updated_at")),
"summary", "manually_edited",
"updated_at")),
)
@@ -209,7 +214,7 @@ async def _retrieval_report(llm: LLMClient, battery: list[str]) -> int:
vec = await llm.embed_one(question)
chunks = retrieve(db, question, vec)
plan = plan_turn(chunks, settings)
seed = ", ".join(f"{d.source}/{d.path}" for d in plan.docs) or "—"
seed = ", ".join(f"{d.source}/{d.path}" for d in plan.suggested_docs) or "—"
if plan.deflected:
deflected += 1
print(
@@ -317,7 +322,8 @@ async def _build(kb_dir: Path, dump_path: Path) -> int:
"-- Data-only snapshot (the schema stays alembic-managed; the",
"-- generated chunks.tsv column is recomputed on restore).",
f"-- Sources: {', '.join(FIXTURE_SOURCES)} "
f"({summary.added} documents, {summary.chunks} chunks).",
f"({summary.added} documents, {summary.chunks} content "
f"+ {summary.summaries + summary.summary_backfilled} summary chunks)",
"-- Restore (one transaction, sub-second):",
"-- uv run python -m scripts.restore_test_kb",
"-- psql \"$BOR_DATABASE_URL\" --single-transaction -f "