Skip to content

Use in-memory event history for condenser replay#252

Merged
neubig merged 13 commits into
mainfrom
condenser-inmemory-replay
Jun 3, 2026
Merged

Use in-memory event history for condenser replay#252
neubig merged 13 commits into
mainfrom
condenser-inmemory-replay

Conversation

@neubig
Copy link
Copy Markdown
Contributor

@neubig neubig commented Jun 2, 2026

No description provided.

Co-authored-by: openhands <openhands@all-hands.dev>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Acceptable — the in-memory replay approach is sound, but two things need attention before this merges.

This review was generated by an AI agent (OpenHands) on behalf of the repository maintainers.


Was this automated review useful? React with 👍 or 👎 to this review to help us measure review quality.
Workflow run: https://github.com/neulab/agent-data-protocol/actions/runs/26795767723

conversation = Conversation(agent=agent, workspace=tmpdir, visualizer=None)
try:
conversation.send_message(first_event.content)
conversation._ensure_agent_ready()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Important: _ensure_agent_ready() is a private (underscore-prefixed) SDK method. Coupling to internal implementation details is fragile — the SDK can rename or remove it without a major version bump and this will break silently. If there is no public API for "initialize without sending a message", that gap should be raised with the SDK team. At minimum, add a comment explaining why this private method is called here and what it guards against.

segment_index += 1
records.append(prompt_record)
event_history.append(condensation)
conversation.state.events.append(condensation)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: conversation.state.events is no longer read anywhere in this function after the refactor — event_history is the canonical source for all condensation logic. Yet TrackingSDKEventBuilder.append still calls super().append() (line 115), which writes every event to conversation.state.events; and here the condensation is also written there explicitly to keep the two lists in sync.

This dual-write pattern obscures what the true source of truth is. If conversation.state.events is being kept in sync intentionally (e.g. as a guard against unknown SDK side effects that read it internally), add a brief comment saying so. If it is not needed, remove the super().append() call in TrackingSDKEventBuilder and this explicit append, which would make the migration complete and the code self-documenting.

neubig and others added 12 commits June 1, 2026 23:21
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
@neubig neubig merged commit ffb4f55 into main Jun 3, 2026
5 checks passed
@neubig neubig deleted the condenser-inmemory-replay branch June 3, 2026 01:54
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