Skip to content

feat(rollout): preserve fork references across replay#13637

Open
friel-openai wants to merge 3 commits intomainfrom
dev/friel/fork-references
Open

feat(rollout): preserve fork references across replay#13637
friel-openai wants to merge 3 commits intomainfrom
dev/friel/fork-references

Conversation

@friel-openai
Copy link
Contributor

@friel-openai friel-openai commented Mar 5, 2026

Summary

  • add fork reference rollout items so forked threads can reuse parent history instead of duplicating it
  • preserve fork references during replay, resume, and thread reads
  • fix nested fork replay and truncation behavior so archived or replayed parents continue to resolve correctly

Notes

  • this keeps fork-heavy sessions from growing rollout files superlinearly
  • replay and summary paths now materialize fork references when needed instead of assuming fully inlined history

Keep forked sessions compact by recording fork references instead of duplicating full parent history.

Repair stale parent rollout paths by resolving the referenced thread id back to the current active or archived rollout location during replay, and materialize fork references before app-server derives thread summaries. Retain the core and app-server regressions that cover archive/unarchive and thread-read behavior.
Copy link
Contributor

@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.

Reviewed commit: d561670c80

ℹ️ 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Hydrate fork-reference chains before truncating forked histories and
before building forked spawn histories, then use the hydrated items
for forked-session startup replay while still persisting only the
compact fork-reference suffix.

This fixes fork-of-fork boundary calculations, preserves inherited
context on forked startup, and updates the regression tests to compare
logical materialized history instead of raw compact storage bytes.
@friel-openai
Copy link
Contributor Author

Addressed on dev/friel/fork-references: truncation now materializes ForkReference items before counting user-message boundaries in truncate_before_nth_user_message(...) (thread_manager.rs). No additional code change is needed here.

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