Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Move compaction state into the React hook and finalize on stream-end. Handles tool-only results and reconnection gracefully. Generated with .

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Comment on lines +223 to +237
// Clear compaction state at stream end
compactingRef.current.delete(workspaceId);

Choose a reason for hiding this comment

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

P1 Badge Avoid clearing compaction flag for unrelated streams

The compaction state (compactingRef) is tracked per workspace, but it is deleted unconditionally whenever any stream-end event arrives. Because the aggregator can maintain multiple concurrent streams, a non‑compaction stream ending first will clear this flag before the compaction stream finishes. If the compaction summary only arrives in that later stream’s parts, isCompacting will be false and the summary replacement path is skipped, leaving the history un-compacted. The previous implementation tied compaction state to the specific stream context and avoided this race. Consider storing the compaction flag keyed by messageId and only clearing it when the corresponding stream completes.

Useful? React with 👍 / 👎.

…e tool-only + reconnection; remove aggregator compaction logic

- Move compaction state out of StreamingMessageAggregator and into useWorkspaceAggregators
- Track compacting and pending summary per workspace
- Finalize on stream-end using pending summary; fallback by scanning parts if compacting
- Apply immediately if tool result arrives with no active stream (reconnection/tool-only)
- Clear state on error/abort; trim noisy logs

Generated with
@ammario
Copy link
Member

ammario commented Oct 15, 2025

Has been better fixed in #197

@ammario ammario closed this Oct 15, 2025
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.

2 participants