fix: post_turn consumes pending meanwhile digests (T82.1)

Wire chat.services.prompt.consume_pending_meanwhile_digests into
chat.web.turns.post_turn at the END of the handler, after scene-close
detection and before the response broadcast. Without this call digests
created by a meanwhile close stay pending forever — they surface in the
next you-turn's prompt (via T65) but are never marked consumed, so they
re-render on every subsequent turn.

Idempotent: re-calling the helper produces zero events when nothing's
pending. The T66 cross-feature note is updated to reflect the new
wiring; the existing direct-helper test in test_phase3_integration.py
is preserved as defensive coverage of the helper contract in isolation.
This commit is contained in:
Joseph Doherty
2026-04-26 22:02:25 -04:00
parent 6f50ce5b7a
commit be92691f9a
3 changed files with 100 additions and 10 deletions
+10 -9
View File
@@ -39,11 +39,11 @@ Cross-feature notes discovered while writing these tests:
swallowed. Tests that don't care about thread coverage can omit the
slot; test 2 includes a valid thread response to exercise the path.
- ``consume_pending_meanwhile_digests`` is defined in chat.services.prompt
but is NOT currently wired into the post_turn flow. The digest stays
pending across turns until the helper is called explicitly. Test 4
reflects this: it asserts the digest renders pre-consumption AND
post-consumption (driven via the helper directly), and that the
meanwhile_digest_consumed event lands in the event_log.
and is wired into the END of post_turn (after scene-close detection)
by T82.1. Test 4 still drives the helper directly because it asserts
the helper's contract in isolation (no post_turn round-trip in scope);
the explicit call doubles as defensive coverage and is idempotent — a
second call on already-consumed digests is a no-op.
- The host-only ``apply_scene_close_summary`` canned queue layout is
``[host_pov, thread_detection]`` (2 slots) when a single bot is present
and there are dialogue rows, with thread_detection being optional /
@@ -769,10 +769,11 @@ def test_meanwhile_close_digest_surfaces_then_consumed(
— the digest is gone, and a meanwhile_digest_consumed event landed.
Cross-feature finding: ``consume_pending_meanwhile_digests`` is
defined in chat.services.prompt but is NOT wired into the post_turn
flow. The digest stays pending across turns until callers invoke
the helper. Test exercises the helper directly so the consumption
contract is pinned independent of any future post_turn integration.
defined in chat.services.prompt and wired into post_turn by T82.1
(after scene-close detection). This test exercises the helper
directly so the consumption contract is pinned in isolation from
the post_turn round-trip; T82.1's wiring is covered by a dedicated
test in tests/test_turn_flow.py.
Canned queue for the meanwhile turn:
1. parse_turn