fix: TokenBufferMemory pruning no longer leaves orphaned assistant messages#37544
Open
ifer47 wants to merge 1 commit into
Open
fix: TokenBufferMemory pruning no longer leaves orphaned assistant messages#37544ifer47 wants to merge 1 commit into
ifer47 wants to merge 1 commit into
Conversation
…ssages The pruning loop in `get_history_prompt_messages` removed one prompt message at a time from the front of the history list. When it removed a UserPromptMessage but left the corresponding AssistantPromptMessage in place, the history would start with an orphaned assistant turn — a stale answer with no matching user query. This could confuse the agent on its next model call. The fix changes the pruning strategy from per-message to per-turn: each iteration removes a complete user+assistant pair. After the loop, a safety check ensures no orphaned assistant message remains at the front. Finally, if the remaining history still exceeds the budget (even a single turn is too large), all history is dropped — consistent with the intent of PR langgenius#36758 which already handles the over-budget case for the final message. Closes langgenius#37490 Co-Authored-By: zhipu/glm-5 <zai-org@claude-code-best.win>
Contributor
Pyrefly Type Coverage
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-06-17 14:08:51.294521244 +0000
+++ /tmp/pyrefly_pr.txt 2026-06-17 14:08:41.310473831 +0000
@@ -1045,61 +1045,61 @@
ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_dataset_service_permissions.py:67:20
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:129:20
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:128:20
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:130:20
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:129:20
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:209:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:208:16
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:210:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:209:16
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:494:20
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:490:20
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:495:20
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:491:20
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:591:20
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:587:20
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:592:20
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:588:20
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:699:20
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:694:20
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:700:20
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:695:20
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:751:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:746:16
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:752:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:747:16
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:805:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:800:16
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:806:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:801:16
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:928:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:923:16
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:929:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:924:16
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1258:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1253:16
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1259:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1254:16
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1369:20
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1364:20
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1370:20
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1365:20
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1570:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1565:16
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1571:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1566:16
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1691:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1686:16
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1692:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1687:16
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1756:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1751:16
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1757:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1752:16
ERROR Object of class `NoneType` has no attribute `size` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1871:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1866:16
ERROR Object of class `NoneType` has no attribute `limit` [missing-attribute]
- --> tests/test_containers_integration_tests/services/test_feature_service.py:1872:16
+ --> tests/test_containers_integration_tests/services/test_feature_service.py:1867:16
ERROR Argument `Literal['active']` is not assignable to parameter `status` with type `AccountStatus | SQLCoreOperations[AccountStatus]` in function `models.account.Account.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/test_file_service.py:69:20
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
@@ -1865,31 +1865,31 @@
ERROR No attribute `MethodView` in module `builtins` [missing-attribute]
--> tests/unit_tests/controllers/common/test_fields.py:9:5
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:767:74
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:575:74
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:767:98
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:575:98
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:817:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:625:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.completion._create_chat_message` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:818:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:626:27
ERROR Object of class `object` has no attribute `data` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:898:50
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:706:50
ERROR Object of class `object` has no attribute `limit` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:899:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:707:30
ERROR Object of class `object` has no attribute `has_more` [missing-attribute]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:900:33
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:708:33
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._list_chat_messages` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:912:67
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:720:67
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:928:30
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:736:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._update_message_feedback` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:929:27
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:737:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `current_user` with type `Account` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:965:26
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:773:26
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:966:23
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:774:23
ERROR Argument `Literal['00000000-0000-0000-0000-000000000002']` is not assignable to parameter `message_id` with type `UUID` in function `controllers.console.app.message._get_message_suggested_questions` [bad-argument-type]
- --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:967:24
+ --> tests/unit_tests/controllers/console/agent/test_agent_controllers.py:775:24
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
--> tests/unit_tests/controllers/console/app/test_annotation_security.py:221:38
ERROR Object of class `int` has no attribute `lower` [missing-attribute]
@@ -2883,55 +2883,50 @@
--> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:652:52
ERROR `(**kwargs: Unknown) -> Literal['failed']` is not assignable to attribute `workflow_node_finish_to_stream_response` with type `(self: WorkflowResponseConverter, *, event: QueueNodeExceptionEvent | QueueNodeFailedEvent | QueueNodeSucceededEvent, task_id: str) -> NodeFinishStreamResponse | None` [bad-assignment]
--> tests/unit_tests/core/app/apps/advanced_chat/test_generate_task_pipeline_core.py:674:89
-ERROR Object of class `NoneType` has no attribute `prompt_messages` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:168:23
ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:186:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:176:12
ERROR Object of class `NoneType` has no attribute `model` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:187:12
+ --> tests/unit_tests/core/app/apps/agent_app/test_app_runner.py:177:12
ERROR Object of class `NoneType` has no attribute `message` [missing-attribute]
--> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:65:12
-ERROR Object of class `NoneType` has no attribute `prompt_messages` [missing-attribute]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:70:23
ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `AgentAppGenerateEntity` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:82:41
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:75:41
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:83:23
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:76:23
ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:84:21
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:77:21
ERROR Argument `_FakeQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:85:27
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:78:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `AgentAppGenerateEntity` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:98:41
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:91:41
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:99:23
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:92:23
ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:100:21
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:93:21
ERROR Argument `_FakeQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:101:27
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:94:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `AgentAppGenerateEntity` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:114:41
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:107:41
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:115:23
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:108:23
ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:116:21
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:109:21
ERROR Argument `_FakeQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:117:27
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:110:27
ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `AgentAppGenerateEntity` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:131:41
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:123:41
ERROR Argument `SimpleNamespace` is not assignable to parameter `app_model` with type `App` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:132:23
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:124:23
ERROR Argument `SimpleNamespace` is not assignable to parameter `message` with type `Message` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:133:21
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:125:21
ERROR Argument `_FakeQueueManager` is not assignable to parameter `queue_manager` with type `AppQueueManager` in function `core.app.apps.agent_app.app_generator.AgentAppGenerator._run_input_guards` [bad-argument-type]
- --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:134:27
+ --> tests/unit_tests/core/app/apps/agent_app/test_input_guards.py:126:27
ERROR Object of class `LayerConfig` has no attribute `plugin_id`
ERROR Object of class `LayerConfig` has no attribute `model_provider`
ERROR Object of class `LayerConfig` has no attribute `conversation_id`
ERROR Object of class `LayerConfig` has no attribute `user_from`
ERROR Object of class `LayerConfig` has no attribute `invoke_from`
ERROR Object of class `LayerConfig` has no attribute `agent_mode`
-ERROR Object of class `Mapping` has no attribute `model_dump`
ERROR Object of class `LayerConfig` has no attribute `drive_ref`
ERROR Object of class `LayerConfig` has no attribute `skills`
ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
@@ -3069,7 +3064,7 @@
ERROR Cannot index into `str` [bad-index]
--> tests/unit_tests/core/app/apps/pipeline/test_pipeline_generate_response_converter.py:111:12
ERROR Class `PipelineRunner` has no class attribute `call_args` [missing-attribute]
- --> tests/unit_tests/core/app/apps/pipeline/test_pipeline_generator.py:389:12
+ --> tests/unit_tests/core/app/apps/pipeline/test_pipeline_generator.py:342:12
ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `RagPipelineGenerateEntity` in function `core.app.apps.pipeline.pipeline_runner.PipelineRunner.__init__` [bad-argument-type]
--> tests/unit_tests/core/app/apps/pipeline/test_pipeline_runner.py:66:37
ERROR Argument `SimpleNamespace` is not assignable to parameter `application_generate_entity` with type `RagPipelineGenerateEntity` in function `core.app.apps.pipeline.pipeline_runner.PipelineRunner.__init__` [bad-argument-type]
@@ -3702,13 +3697,13 @@
ERROR Argument `object` is not assignable to parameter `event` with type `GraphEngineEvent` in function `core.app.layers.suspend_layer.SuspendLayer.on_event` [bad-argument-type]
--> tests/unit_tests/core/app/layers/test_suspend_layer.py:18:24
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `ReadOnlyGraphRuntimeState` in function `graphon.graph_engine.layers.base.GraphEngineLayer.initialize` [bad-argument-type]
- --> tests/unit_tests/core/app/layers/test_trigger_post_layer.py:54:30
+ --> tests/unit_tests/core/app/layers/test_trigger_post_layer.py:53:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `ReadOnlyGraphRuntimeState` in function `graphon.graph_engine.layers.base.GraphEngineLayer.initialize` [bad-argument-type]
- --> tests/unit_tests/core/app/layers/test_trigger_post_layer.py:104:30
+ --> tests/unit_tests/core/app/layers/test_trigger_post_layer.py:103:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `ReadOnlyGraphRuntimeState` in function `graphon.graph_engine.layers.base.GraphEngineLayer.initialize` [bad-argument-type]
--> tests/unit_tests/core/app/layers/test_trigger_post_layer.py:143:30
ERROR Argument `SimpleNamespace` is not assignable to parameter `graph_runtime_state` with type `ReadOnlyGraphRuntimeState` in function `graphon.graph_engine.layers.base.GraphEngineLayer.initialize` [bad-argument-type]
- --> tests/unit_tests/core/app/layers/test_trigger_post_layer.py:166:30
+ --> tests/unit_tests/core/app/layers/test_trigger_post_layer.py:165:30
ERROR `SimpleNamespace` is not assignable to upper bound `AppGenerateEntity` of type variable `AppGenerateEntityT` [bad-specialization]
--> tests/unit_tests/core/app/task_pipeline/test_based_generate_task_pipeline.py:22:41
ERROR Class member `_FakeQueueManager.listen` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
@@ -3718,11 +3713,11 @@
ERROR Class member `_FakeQueueManager._publish` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
--> tests/unit_tests/core/app/task_pipeline/test_easy_ui_based_generate_task_pipeline_core.py:118:9
ERROR `None` is not subscriptable [unsupported-operation]
+ --> tests/unit_tests/core/app/task_pipeline/test_message_cycle_manager_optimization.py:247:16
+ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/core/app/task_pipeline/test_message_cycle_manager_optimization.py:248:16
ERROR `None` is not subscriptable [unsupported-operation]
--> tests/unit_tests/core/app/task_pipeline/test_message_cycle_manager_optimization.py:249:16
-ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/core/app/task_pipeline/test_message_cycle_manager_optimization.py:250:16
ERROR Argument `dict[str, dict[str, str | dict[str, float | list[str]]]]` is not assignable to parameter `config` with type `AppModelConfigDict` in function `core.app.app_config.easy_ui_based_app.model_config.manager.ModelConfigManager.convert` [bad-argument-type]
--> tests/unit_tests/core/app/test_easy_ui_model_config_manager.py:49:41
ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
@@ -4035,43 +4030,43 @@
ERROR `Literal['not-a-client-metadata']` is not assignable to attribute `metadata` with type `ClientMessageMetadata | ServerMessageMetadata | None` [bad-assignment]
--> tests/unit_tests/core/mcp/client/test_streamable_http.py:1407:24
ERROR `MockNotificationParams` is not assignable to upper bound `NotificationParams | dict[str, Any] | None` of type variable `NotificationParamsT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:51:24
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:50:24
ERROR `MockRequest` is not assignable to upper bound `ClientRequest | ServerRequest` of type variable `SendRequestT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:64:19
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:63:19
ERROR `MockNotification` is not assignable to upper bound `ClientNotification | ServerNotification` of type variable `SendNotificationT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:64:19
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:63:19
ERROR `MockResult` is not assignable to upper bound `ClientResult | ServerResult` of type variable `SendResultT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:64:19
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:63:19
ERROR `ReceiveRequest` is not assignable to upper bound `ClientRequest | ServerRequest` of type variable `ReceiveRequestT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:64:19
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:63:19
ERROR `ReceiveNotification` is not assignable to upper bound `ClientNotification | ServerNotification` of type variable `ReceiveNotificationT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:64:19
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:63:19
ERROR Class member `MockSession._received_request` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:71:9
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:70:9
ERROR Class member `MockSession._received_notification` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:74:9
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:73:9
ERROR Class member `MockSession._handle_incoming` overrides parent class `BaseSession` in an inconsistent manner [bad-override-param-name]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:77:9
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:76:9
ERROR Class member `MockSession._handle_incoming` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:77:9
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:76:9
ERROR `ReceiveRequest` is not assignable to upper bound `ClientRequest | ServerRequest` of type variable `ReceiveRequestT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:93:33
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:92:33
ERROR `MockResult` is not assignable to upper bound `ClientResult | ServerResult` of type variable `SendResultT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:93:33
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:92:33
ERROR `ReceiveRequest` is not assignable to upper bound `ClientRequest | ServerRequest` of type variable `ReceiveRequestT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:120:33
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:119:33
ERROR `MockResult` is not assignable to upper bound `ClientResult | ServerResult` of type variable `SendResultT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:120:33
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:119:33
ERROR Object of class `NoneType` has no attribute `result` [missing-attribute]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:148:5
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:147:5
ERROR Object of class `NoneType` has no attribute `done` [missing-attribute]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:149:12
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:148:12
ERROR Argument `None` is not assignable to parameter `item` with type `HTTPStatusError | JSONRPCError | JSONRPCResponse` in function `queue.Queue.put` [bad-argument-type]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:538:51
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:539:51
ERROR `ReceiveRequest` is not assignable to upper bound `ClientRequest | ServerRequest` of type variable `ReceiveRequestT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:597:26
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:598:26
ERROR `ReceiveNotification` is not assignable to upper bound `ClientNotification | ServerNotification` of type variable `ReceiveNotificationT` [bad-specialization]
- --> tests/unit_tests/core/mcp/session/test_base_session.py:597:26
+ --> tests/unit_tests/core/mcp/session/test_base_session.py:598:26
ERROR Argument `(c: Unknown, p: Unknown) -> None` is not assignable to parameter `sampling_callback` with type `SamplingFnT | None` in function `core.mcp.session.client_session.ClientSession.__init__` [bad-argument-type]
--> tests/unit_tests/core/mcp/session/test_client_session.py:97:54
ERROR Argument `(c: Unknown) -> None` is not assignable to parameter `list_roots_callback` with type `ListRootsFnT | None` in function `core.mcp.session.client_session.ClientSession.__init__` [bad-argument-type]
@@ -4433,7 +4428,7 @@
ERROR Argument `list[str]` is not assignable to parameter `docs` with type `Sequence[Document]` in function `core.rag.docstore.dataset_docstore.DatasetDocumentStore.add_documents` [bad-argument-type]
--> tests/unit_tests/core/rag/docstore/test_dataset_docstore.py:307:37
ERROR Argument `None` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]
- --> tests/unit_tests/core/rag/embedding/test_cached_embedding.py:294:85
+ --> tests/unit_tests/core/rag/embedding/test_cached_embedding.py:293:85
ERROR Object of class `PartialImpl` has no attribute `embed_query` [missing-attribute]
--> tests/unit_tests/core/rag/embedding/test_embedding_base.py:131:13
ERROR Object of class `PartialImpl` has no attribute `embed_documents` [missing-attribute]
@@ -4501,7 +4496,7 @@
ERROR Argument `Iterator[Any | Unknown] | Iterator[Any]` is not assignable to parameter `invoke_result` with type `Generator[Unknown]` in function `core.rag.retrieval.router.multi_dataset_react_route.ReactMultiDatasetRouter._handle_invoke_result` [bad-argument-type]
--> tests/unit_tests/core/rag/retrieval/test_multi_dataset_react_route.py:198:52
ERROR Argument `None` is not assignable to parameter `text` with type `str` in function `core.rag.splitter.text_splitter.RecursiveCharacterTextSplitter.split_text` [bad-argument-type]
- --> tests/unit_tests/core/rag/splitter/test_text_splitter.py:1878:42
+ --> tests/unit_tests/core/rag/splitter/test_text_splitter.py:1877:42
ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
--> tests/unit_tests/core/repositories/test_celery_workflow_node_execution_repository.py:80:53
ERROR Cannot instantiate `CeleryWorkflowNodeExecutionRepository` because the following members are abstract: `save_execution_data` [bad-instantiation]
@@ -5816,9 +5811,9 @@
ERROR Class member `Unserializable.__repr__` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
--> tests/unit_tests/enterprise/telemetry/test_enterprise_trace.py:338:17
ERROR Argument `dict[str, str]` is not assignable to parameter `labels` with type `dict[str, AttributeValue]` in function `enterprise.telemetry.exporter.EnterpriseExporter.increment_counter` [bad-argument-type]
- --> tests/unit_tests/enterprise/telemetry/test_exporter.py:580:71
+ --> tests/unit_tests/enterprise/telemetry/test_exporter.py:582:71
ERROR Argument `dict[str, str]` is not assignable to parameter `labels` with type `dict[str, AttributeValue]` in function `enterprise.telemetry.exporter.EnterpriseExporter.record_histogram` [bad-argument-type]
- --> tests/unit_tests/enterprise/telemetry/test_exporter.py:613:85
+ --> tests/unit_tests/enterprise/telemetry/test_exporter.py:615:85
ERROR Object of class `Events` has no attribute `request_start` [missing-attribute]
--> tests/unit_tests/events/test_events_package_compat.py:10:5
ERROR Object of class `Events` has no attribute `request_end` [missing-attribute]
@@ -6067,40 +6062,34 @@
--> tests/unit_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:55:9
ERROR Argument `list[SimpleNamespace]` is not assignable to parameter `recipients` with type `Sequence[HumanInputFormRecipient]` in function `repositories.sqlalchemy_api_workflow_run_repository._build_human_input_required_reason` [bad-argument-type]
--> tests/unit_tests/repositories/test_sqlalchemy_api_workflow_run_repository.py:56:9
-ERROR Object of class `object` has no attribute `name` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:1435:16
-ERROR Object of class `object` has no attribute `mode` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:1436:16
-ERROR Object of class `object` has no attribute `agent_role` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:1437:16
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.project_draft_bindings_to_graph` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1712:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1273:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1771:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1329:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1840:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1398:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1895:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:1453:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1927:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:1485:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:1959:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:1517:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2005:25
+ --> tests/unit_tests/services/agent/test_agent_services.py:1563:25
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2065:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1623:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2135:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1693:21
ERROR Argument `FakeSession` is not assignable to parameter `session` with type `Session` in function `services.agent.workflow_publish_service.WorkflowAgentPublishService.sync_roster_agent_bindings_for_draft` [bad-argument-type]
- --> tests/unit_tests/services/agent/test_agent_services.py:2168:21
+ --> tests/unit_tests/services/agent/test_agent_services.py:1726:21
ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2380:37
+ --> tests/unit_tests/services/agent/test_agent_services.py:1938:37
ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2417:34
+ --> tests/unit_tests/services/agent/test_agent_services.py:1975:34
ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2441:34
+ --> tests/unit_tests/services/agent/test_agent_services.py:1999:34
ERROR Object of class `object` has no attribute `skills_files` [missing-attribute]
- --> tests/unit_tests/services/agent/test_agent_services.py:2442:12
+ --> tests/unit_tests/services/agent/test_agent_services.py:2000:12
ERROR Object of class `NoneType` has no attribute `workflow_prompt` [missing-attribute]
--> tests/unit_tests/services/agent/test_composer_mention_validation.py:113:5
ERROR Class member `ConcreteApiKeyAuth.validate_credentials` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
@@ -6307,9 +6296,9 @@
ERROR Argument `BillingInfo` is not assignable to parameter `result` with type `dict[Unknown, Unknown]` in function `TestBillingServiceSubscriptionInfoDataType._assert_billing_info_types` [bad-argument-type]
--> tests/unit_tests/services/test_billing_service.py:1884:41
ERROR Argument `FakeRepo` is not assignable to parameter `workflow_run_repo` with type `APIWorkflowRunRepository | None` in function `services.retention.workflow_run.clear_free_plan_expired_workflow_run_logs.WorkflowRunCleanup.__init__` [bad-argument-type]
- --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:126:49
-ERROR Class member `FailingRepo.delete_runs_with_related_by_ids` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
- --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:394:13
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:114:49
+ERROR Class member `FailingRepo.delete_runs_with_related` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
+ --> tests/unit_tests/services/test_clear_free_plan_expired_workflow_run_logs.py:303:13
ERROR Class member `FixedDateTime.now` overrides parent class `datetime` in an inconsistent manner [bad-override]
--> tests/unit_tests/services/test_clear_free_plan_tenant_expired_logs.py:403:13
ERROR Class member `FixedDateTime.now` overrides a member in a parent class but is missing an `@override` decorator [missing-override-decorator]
@@ -6427,17 +6416,17 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.SegmentService.delete_child_chunk` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_segment.py:825:60
ERROR Argument `str` is not assignable to parameter `type` with type `Literal['basic', 'bearer', 'custom'] | None` in function `services.entities.external_knowledge_entities.external_knowledge_entities.AuthorizationConfig.__init__` [bad-argument-type]
- --> tests/unit_tests/services/test_external_dataset_service.py:118:60
+ --> tests/unit_tests/services/test_external_dataset_service.py:117:60
ERROR Argument `str` is not assignable to parameter `type` with type `Literal['api-key', 'no-auth']` in function `services.entities.external_knowledge_entities.external_knowledge_entities.Authorization.__init__` [bad-argument-type]
- --> tests/unit_tests/services/test_external_dataset_service.py:119:35
+ --> tests/unit_tests/services/test_external_dataset_service.py:118:35
ERROR Argument `None` is not assignable to parameter `api_settings` with type `dict[str, Any]` in function `services.external_knowledge_service.ExternalDatasetService.validate_api_list` [bad-argument-type]
- --> tests/unit_tests/services/test_external_dataset_service.py:403:54
+ --> tests/unit_tests/services/test_external_dataset_service.py:402:54
ERROR Argument `str | None` is not assignable to parameter `s` with type `bytearray | bytes | str` in function `json.loads` [bad-argument-type]
- --> tests/unit_tests/services/test_external_dataset_service.py:882:31
+ --> tests/unit_tests/services/test_external_dataset_service.py:881:31
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/services/test_external_dataset_service.py:1423:16
+ --> tests/unit_tests/services/test_external_dataset_service.py:1422:16
ERROR `None` is not subscriptable [unsupported-operation]
- --> tests/unit_tests/services/test_external_dataset_service.py:1424:16
+ --> tests/unit_tests/services/test_external_dataset_service.py:1423:16
ERROR Argument `Literal['invalid']` is not assignable to parameter `session_factory` with type `Engine | sessionmaker[Unknown] | None` in function `services.file_service.FileService.__init__` [bad-argument-type]
--> tests/unit_tests/services/test_file_service.py:48:41
ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]
@@ -6505,9 +6494,9 @@
ERROR Argument `dict[str, Any]` is not assignable to parameter `utm_info` with type `UtmInfo` in function `services.operation_service.OperationService.record_utm` [bad-argument-type]
--> tests/unit_tests/services/test_operation_service.py:117:57
ERROR Argument `Literal['']` is not assignable to parameter `plan` with type `CloudPlan` in function `RagPipelineTaskProxyTestDataFactory.create_mock_features` [bad-argument-type]
- --> tests/unit_tests/services/test_rag_pipeline_task_proxy.py:410:109
+ --> tests/unit_tests/services/test_rag_pipeline_task_proxy.py:409:109
ERROR Argument `None` is not assignable to parameter `plan` with type `CloudPlan` in function `RagPipelineTaskProxyTestDataFactory.create_mock_features` [bad-argument-type]
- --> tests/unit_tests/services/test_rag_pipeline_task_proxy.py:432:109
+ --> tests/unit_tests/services/test_rag_pipeline_task_proxy.py:431:109
ERROR Argument `dict[str, Any]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.schedule_service.ScheduleService.to_schedule_config` [bad-argument-type]
--> tests/unit_tests/services/test_schedule_service.py:521:61
ERROR Argument `dict[str, str | dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.schedule_service.ScheduleService.to_schedule_config` [bad-argument-type]
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TokenBufferMemory.get_history_prompt_messagesto prune complete user+assistant turns rather than individual messages, preventing orphaned assistant messages whose corresponding user query was removedContext
Closes #37490
The old pruning loop removed one prompt message at a time:
When it removed a
UserPromptMessage, the correspondingAssistantPromptMessagewould become orphaned at the start of the history. For example, with history[User("old query"), Assistant("old answer"), User("new query"), Assistant("new answer")]exceeding the budget, pruning could produce[Assistant("old answer"), User("new query"), Assistant("new answer")]— starting with a stale answer whose question was removed.The new logic prunes complete turns (user+assistant pairs), ensuring the remaining history always starts with a user message. If no turn fits the budget, all history is dropped.
Test plan
test_pruning_never_leaves_orphaned_assistant_messageverifies the core bug fixtest_pruning_by_turns_removes_complete_pairsverifies turn-based pruningtest_pruning_drops_all_when_no_turn_fits_budgetverifies the over-budget fallbacktest_token_pruning_drops_all_when_over_budgetto match new behavior (drops all instead of keeping 1 over-budget message)🤖 Generated with Claude Code Best