Skip to content

fix(streaming): defer round log serialization - #40

Merged
laceyp99 merged 1 commit into
mainfrom
fix/stream-history-serialization
Aug 6, 2026
Merged

laceyp99 merged 1 commit into
mainfrom
fix/stream-history-serialization

Conversation

@laceyp99

@laceyp99 laceyp99 commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • defer full round-log serialization while response deltas stream
  • preserve final history and reasoning snapshots at complete/error boundaries and generation finalization
  • add regression coverage for the hot path and terminal history persistence

Root cause

Every streaming delta serialized all panel histories, which made log bookkeeping grow with accumulated response length. The resulting repeated full-history work was quadratic over a generation.

Impact

Streaming updates now retain incremental response state without repeatedly copying every panel's history. Vote persistence and final generation state retain their complete serialized histories.

Validation

  • py -3.13 -m pytest
  • py -3.13 -m ruff format --check arena/app.py tests/integration/test_generation_flow.py
  • py -3.13 -m ruff check arena/app.py tests/integration/test_generation_flow.py

@laceyp99
laceyp99 marked this pull request as ready for review August 6, 2026 04:51
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Agent PR review

Validation

Validation passed: python -m ruff format --check ., python -m ruff check ., and python -m pytest all completed successfully.

Summary

PR #40 defers _finalize_round_state_logs() during non-terminal streaming deltas in arena/app.py, so accumulated chat histories are no longer serialized on every chunk. It keeps finalization on complete, error, and generation finalization paths, with regression tests covering the streaming hot path and terminal history persistence.

Issues and risks

No blocking correctness, security, performance, or maintainability issues found in the changed files.

Review evidence:

  • Read README.md and codex-review-context.md.
  • No applicable project AGENTS.md exists in the tracked project tree.
  • Compared origin/main...origin/pr/40.
  • Inspected streaming, terminal finalization, vote readiness, UI reconstruction, and persistence paths.
  • git diff --check reported no whitespace issues.

Test coverage

The PR updates integration coverage for:

  • Delta chunks updating in-memory histories without finalizing slot_logs[*]["message_history"].
  • Complete chunks persisting terminal message history, including the generation stats footer.
  • Existing tests also cover mixed success/error, stream failure recovery, vote readiness, and persisted history use.

Remaining gap: there is no explicit end-to-end assertion that a submitted vote after a streamed round writes histories.json with the fully finalized terminal histories, but the existing final-state and vote-submission tests cover the relevant pieces separately.

The review context reports that python -m ruff format --check ., python -m ruff check ., and python -m pytest all passed.

Recommendation

Looks safe to continue review.


This is an automated review. Please treat it as advisory; human review is still required.

@laceyp99
laceyp99 merged commit 916d396 into main Aug 6, 2026
5 checks passed
@laceyp99
laceyp99 deleted the fix/stream-history-serialization branch August 6, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant