Skip to content

test: No CI test checks session sharing with interleaved conversations or off-screen streaming #1551

Closed

Description

@huang195

Problem

No test checks that the session store still shares message text when more than one conversation lands in a session. That is the normal case with subagents, and it is where #1541 hides (60x duplication).

What exists today

  • core/session/intern_test.go checks sharing with backing() (pointer identity). Every fixture is one conversation with one model (Model: "m"), turns in order.
  • core/session/retention_bench_test.go measures heap, but only as benchmarks. No workflow runs -bench, so they never gate a PR.
  • cmd/agentop/tui/event_retention_test.go (TestStreamedEvents_AreRetainedWithoutACap) checks that the on-screen session keeps every event. Nothing checks sessions that are not on screen (bug: agentop keeps every streamed event for every session, growing ~18 MB/min idle #1542).

Proposed tests

Deterministic checks, not heap thresholds, so they cannot flake:

  1. Interleaved conversations share (core/session/intern_test.go). Append turns from 2–4 conversations taking turns, with contentless tunnel-open events between them, as CLAUDE.md gotcha 14 asks. Assert that conversation A's message 0 has the same backing() in every one of A's events. Fails today; passes once bug: Session store keeps conversations 14-60x over when subagents interleave #1541 is fixed.
  2. Streamed events for off-screen sessions are not kept (cmd/agentop/tui). Stream N large events for a session no pane shows. Assert m.events[id] stays empty (or bounded), and that UpdatedAt still moves. Fails today; passes once bug: agentop keeps every streamed event for every session, growing ~18 MB/min idle #1542 is fixed.
  3. Optional heap budget. If a heap figure is wanted too, make it a Test with a generous ratio (say retained ≤ 5× distinct content), not a benchmark. Today it measures 60× for interleaved conversations, against 1.9× for a single one.

How to land

Each test goes in the PR that fixes its bug (#1541, #1542). Or land it first as t.Skip("#1541"), and remove the skip in the fix.


Found while checking why the bugs from an experiment-driven audit (#1541–#1547) got past CI. Grounded on main at 43cf553.

Assisted-By: Claude (Anthropic AI) [email protected]

Metadata

Metadata

Assignees

Labels

enhancementgo

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions