-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix: load full history when compacting a limited session #3827
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
base: main
Are you sure you want to change the base?
Changes from all commits
d6c8424
5469581
10471fd
1ff8d28
d790028
e2ace6c
2788e93
5570d80
8c41741
8a43af3
b798ce2
80afea6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -936,6 +936,7 @@ def _finalize_result(result: RunResult) -> RunResult: | |
| run_state._reasoning_item_id_policy | ||
| ), | ||
| store=store_setting, | ||
| session_settings=run_config.session_settings, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
On a Useful? React with 👍 / 👎. |
||
| ) | ||
| ) | ||
|
|
||
|
|
@@ -1048,6 +1049,7 @@ def _finalize_result(result: RunResult) -> RunResult: | |
| run_state, | ||
| response_id=turn_result.model_response.response_id, | ||
| store=store_setting, | ||
| session_settings=run_config.session_settings, | ||
| ) | ||
| result._original_input = copy_input_items(original_input) | ||
| return _finalize_result(result) | ||
|
|
@@ -1414,6 +1416,7 @@ def _finalize_result(result: RunResult) -> RunResult: | |
| run_state._reasoning_item_id_policy | ||
| ), | ||
| store=store_setting, | ||
| session_settings=run_config.session_settings, | ||
| ) | ||
| run_state._current_turn_persisted_item_count += saved_count | ||
| else: | ||
|
|
@@ -1424,6 +1427,7 @@ def _finalize_result(result: RunResult) -> RunResult: | |
| run_state, | ||
| response_id=turn_result.model_response.response_id, | ||
| store=store_setting, | ||
| session_settings=run_config.session_settings, | ||
| ) | ||
|
|
||
| # After the first resumed turn, treat subsequent turns as fresh | ||
|
|
@@ -1476,6 +1480,7 @@ def _finalize_result(result: RunResult) -> RunResult: | |
| items=session_items_for_turn(turn_result), | ||
| response_id=turn_result.model_response.response_id, | ||
| store=store_setting, | ||
| session_settings=run_config.session_settings, | ||
| ) | ||
| result._original_input = copy_input_items(original_input) | ||
| return _finalize_result(result) | ||
|
|
@@ -1495,6 +1500,7 @@ def _finalize_result(result: RunResult) -> RunResult: | |
| run_state, | ||
| response_id=turn_result.model_response.response_id, | ||
| store=store_setting, | ||
| session_settings=run_config.session_settings, | ||
| ) | ||
| append_model_response_if_new( | ||
| model_responses, turn_result.model_response | ||
|
|
@@ -1556,6 +1562,7 @@ def _finalize_result(result: RunResult) -> RunResult: | |
| items=session_items_for_turn(turn_result), | ||
| response_id=turn_result.model_response.response_id, | ||
| store=store_setting, | ||
| session_settings=run_config.session_settings, | ||
| ) | ||
| continue | ||
| else: | ||
|
|
||
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.
Fresh evidence after the prior unsafe-ID fix: the same
_last_unstored_response_idslot is now used for response IDs that did not cover full history, but this branch clears it whenever a later compaction of the same ID passesstore=True. After an input fallback has shrunk the session inside the limit, that later call can pass the live coverage check and switch back toprevious_response_id, replacing the full-history summary with server history that never saw the hidden older items. Track coverage-unsafe IDs separately, or do not clear them based only onstore=True.Useful? React with 👍 / 👎.