worklog: stop reading a placeholder lifecycle row as a compression start

routes.py appends a 'live anchor shell' row whenever a stream has events
but no visible rows projected yet:

    row_id:            lifecycle:<stream>:running
    role:              lifecycle
    status:            running
    text:              Working
    source_event_type: runtime_journal_snapshot

_sourceEventTypeForSnapshotAnchorRow skips the source_event_type branch
for exactly that value, falls through to the role check, and the bare
phase==='running' arm then classified the shell as 'compressing'. Every
session that hit the path painted a 'Compressing context' divider while
nothing was compressing - including brand-new sessions on their first
message.

It also persists. The classification is written back into the session's
anchor_activity_scenes as source_event_type: 'compressing', which the
source branch above then returns directly on the next load, so the
phantom divider survives a reload. Measured on this host: 46 such rows
across 24 sessions, every one carrying the text 'Working' and not one a
real compression notice.

Require an explicit cue instead - phase==='compressing' or one of the
compression text markers already listed below it. The function's own
comment asked for this ('do not default every lifecycle row to a running
compress divider'); the bare running arm did the opposite.

tests/test_compression_phantom_barrier.py: 8 passed.
This commit is contained in:
MuhammadUsamaMX committed 2026-09-06 23:16:18 +05:00
1 parent bd91b649f1
commit 77ee0b07f9
1 file changed
+8 -1
+8 -1
View File
@@ -4135,7 +4135,14 @@ function attachLiveStream(activeSid, streamId, uploaded=[], options={}){
|| (text.includes('compressed')&&!text.includes('compressing'))
) return 'compressed';
if(
phase==='running'||phase==='compressing'
// NOT a bare phase==='running'. routes.py appends a placeholder
// "live anchor shell" row (role lifecycle, status running,
// source_event_type runtime_journal_snapshot) whenever a stream has
// events but no visible rows yet. That falls through the source check
// above, and a bare running phase then classified every such shell as
// a compression start - a permanent phantom "Compressing context"
// divider on sessions that never compressed anything.
phase==='compressing'
|| text.includes('compressing context')
|| text.includes('compacting context')
|| text.includes('preflight compression')