-
Notifications
You must be signed in to change notification settings - Fork 5.5k
feat: context compaction #3446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: context compaction #3446
Conversation
There was a problem hiding this 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 suggestions.
Reply with @codex fix comments
to fix any unresolved comments.
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, or 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 fix this CI failure" or "@codex address that feedback".
# Conflicts: # codex-rs/core/src/codex.rs # codex-rs/core/src/openai_model_info.rs
sess: Arc<Session>, | ||
turn_context: Arc<TurnContext>, | ||
) { | ||
let sub_id = sess.next_internal_sub_id(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how much do we care about this being an ordered id vs just appending a random suffix? (for the sake of keeping session state smaller.
We are including a copy of environment information and AGENTS.md into summary message. |
If compaction doesn't get the session under the limit (large user input) the agent will try to compact again. |
codex-rs/core/src/codex.rs
Outdated
}); | ||
break; | ||
} | ||
sess.enqueue_pending_responses(responses); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't figure out why this had to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how it was working before lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid duplicating environment context and agents.md between summary and normal session prefix.
If possible can we reduce amount of state we store on SessionState? I think we can calculate token_limit_reached
inline and get away without compaction counter.
We should keep total token usage across compactions.
If compaction doesn't get the session under the limit (large user input) the agent will try to compact again and again until it runs out of context.
# Conflicts: # codex-rs/core/src/unified_exec/mod.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! The last question I have is about #3446 (comment)
Compact feature: