Skip to content

Re-fetch session snapshot before post-run event assertions #4547

@davidahmann

Description

@davidahmann

Problem

Post-run_async assertions that inspect a previously held in-memory session object can read stale event state, leading to false negatives and flaky test/operator checks.

Why now

This stale-snapshot pattern is recurring friction in runner/session assertions and can misdiagnose persistence behavior.

Evidence packet

  • Commit under test: f27a9cfb87caecb8d52967c50637ed5ad541cd07 (origin/main, 2026-02-19)
  • Runtime environment: Python 3.14.0, macOS 26.3
  • Minimal repro:
    1. Create a session and retain the returned object.
    2. Execute runner.run_async(...) and append events.
    3. Assert counts from the original retained session object.
  • Expected: assertions reflect persisted post-run event state.
  • Actual: retained session objects may be stale; fresh get_session(...) is required to observe authoritative state.

Acceptance

  • Update runner/session tests to assert event counts using freshly fetched session snapshots after run completion.
  • Add/adjust regression coverage documenting stale-object vs re-fetch behavior.

Metadata

Metadata

Assignees

Labels

services[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions