Skip to content

Fix condensation for 0 events by adjusting default parameters - #1523

Merged
xingyaoww merged 1 commit into
mainfrom
openhands/fix-condensation-defaults
Dec 28, 2025
Merged

xingyaoww merged 1 commit into
mainfrom
openhands/fix-condensation-defaults

Conversation

@xingyaoww

@xingyaoww xingyaoww commented Dec 28, 2025 •

Copy link
Copy Markdown
Contributor

Summary

This is a short-term fix for issue #1518 where condensation fails when a tool loop spans almost the entire view, leaving no valid range for forgetting events.

Fixes #1518

Changes

  • Reduce default keep_first from 4 to 2
  • Raise default max_size from 120 to 240

These adjustments make it more likely to get workable manipulation indices for condensation to act on.

Root Cause

When a tool loop (a sequence of ActionEvent/ObservationEvent pairs starting with thinking blocks) spans almost the entire view, the manipulation_indices computed by View leave no valid range for forgetting events. With the previous defaults (keep_first=4, max_size=120), the manipulation indices could be something like [0, 1, 2, 122], leaving no valid range for condensation.

Testing

  • Added a test to verify the new default values
  • All existing tests pass (1562 tests)

@xingyaoww can click here to continue refining the PR


Agent Server images for this PR

• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server

Variants & Base Images

Variant Architectures Base Image Docs / Tags
java amd64, arm64 eclipse-temurin:17-jdk Link
python amd64, arm64 nikolaik/python-nodejs:python3.12-nodejs22 Link
golang amd64, arm64 golang:1.21-bookworm Link

Pull (multi-arch manifest)

# Each variant is a multi-arch manifest supporting both amd64 and arm64
docker pull ghcr.io/openhands/agent-server:b69a3b6-python

Run

docker run -it --rm \
  -p 8000:8000 \
  --name agent-server-b69a3b6-python \
  ghcr.io/openhands/agent-server:b69a3b6-python

All tags pushed for this build

ghcr.io/openhands/agent-server:b69a3b6-golang-amd64
ghcr.io/openhands/agent-server:b69a3b6-golang_tag_1.21-bookworm-amd64
ghcr.io/openhands/agent-server:b69a3b6-golang-arm64
ghcr.io/openhands/agent-server:b69a3b6-golang_tag_1.21-bookworm-arm64
ghcr.io/openhands/agent-server:b69a3b6-java-amd64
ghcr.io/openhands/agent-server:b69a3b6-eclipse-temurin_tag_17-jdk-amd64
ghcr.io/openhands/agent-server:b69a3b6-java-arm64
ghcr.io/openhands/agent-server:b69a3b6-eclipse-temurin_tag_17-jdk-arm64
ghcr.io/openhands/agent-server:b69a3b6-python-amd64
ghcr.io/openhands/agent-server:b69a3b6-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-amd64
ghcr.io/openhands/agent-server:b69a3b6-python-arm64
ghcr.io/openhands/agent-server:b69a3b6-nikolaik_s_python-nodejs_tag_python3.12-nodejs22-arm64
ghcr.io/openhands/agent-server:b69a3b6-golang
ghcr.io/openhands/agent-server:b69a3b6-java
ghcr.io/openhands/agent-server:b69a3b6-python

About Multi-Architecture Support

  • Each variant tag (e.g., b69a3b6-python) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., b69a3b6-python-amd64) are also available if needed

This is a short-term fix for issue #1518 where condensation fails when
a tool loop spans almost the entire view, leaving no valid range for
forgetting events.

Changes:
- Reduce default keep_first from 4 to 2
- Raise default max_size from 120 to 240

These adjustments make it more likely to get workable manipulation
indices for condensation to act on.

Co-authored-by: openhands <openhands@all-hands.dev>
@github-actions

Copy link
Copy Markdown
Contributor

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands-sdk/openhands/sdk/context/condenser
   llm_summarizing_condenser.py905538%47, 54, 68, 72–73, 76–79, 82–83, 85, 88–89, 97, 99–103, 105, 125, 127, 134, 138, 142–146, 148, 171–172, 174, 176–178, 180–182, 184, 188–189, 191–192, 194, 204, 207, 210, 215, 218, 221, 229–230, 234
TOTAL14228663953% 

@xingyaoww
xingyaoww requested a review from csmith49 December 28, 2025 22:25
@xingyaoww
xingyaoww marked this pull request as ready for review December 28, 2025 22:25

@csmith49 csmith49 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@xingyaoww xingyaoww added the integration-test Runs the integration tests and comments the results label Dec 28, 2025
@github-actions

Copy link
Copy Markdown
Contributor

Hi! I started running the integration tests on your PR. You will receive a comment with the results shortly.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Integration Tests Results

Overall Success Rate: 82.0%
Total Cost: $1.66
Models Tested: 6
Timestamp: 2025-12-28 23:42:46 UTC

📁 Detailed Logs & Artifacts

Click the links below to access detailed agent/LLM logs showing the complete reasoning process for each model. On the GitHub Actions page, scroll down to the 'Artifacts' section to download the logs.

📊 Summary

Model Overall Integration (Required) Behavior (Optional) Tests Passed Skipped Total Cost Tokens
litellm_proxy_moonshot_kimi_k2_thinking 100.0% 100.0% N/A 8/8 1 9 $0.21 321,641
litellm_proxy_vertex_ai_gemini_3_pro_preview 100.0% 100.0% N/A 9/9 0 9 $0.56 381,717
litellm_proxy_gpt_5.2_codex 0.0% 0.0% N/A 0/8 1 9 $0.00 0
litellm_proxy_claude_sonnet_4_5_20250929 100.0% 100.0% N/A 9/9 0 9 $0.63 511,894
litellm_proxy_mistral_devstral_2512 87.5% 87.5% N/A 7/8 1 9 $0.19 455,109
litellm_proxy_deepseek_deepseek_chat 100.0% 100.0% N/A 8/8 1 9 $0.07 665,210

📋 Detailed Results

litellm_proxy_moonshot_kimi_k2_thinking

  • Overall Success Rate: 100.0% (8/8)
  • Integration Tests (Required): 100.0% (8/9)
  • Total Cost: $0.21
  • Token Usage: prompt: 311,275, completion: 10,366, cache_read: 259,584
  • Run Suffix: litellm_proxy_moonshot_kimi_k2_thinking_d6233c9_kimi_k2_run_N9_20251228_233502
  • Skipped Tests: 1

Skipped Tests:

  • t08_image_file_viewing: This test requires a vision-capable LLM model. Please use a model that supports image input.

litellm_proxy_vertex_ai_gemini_3_pro_preview

  • Overall Success Rate: 100.0% (9/9)
  • Integration Tests (Required): 100.0% (9/9)
  • Total Cost: $0.56
  • Token Usage: prompt: 364,361, completion: 17,356, cache_read: 211,154, reasoning: 12,541
  • Run Suffix: litellm_proxy_vertex_ai_gemini_3_pro_preview_d6233c9_gemini_3_pro_run_N9_20251228_233453

litellm_proxy_gpt_5.2_codex

  • Overall Success Rate: 0.0% (0/8)
  • Integration Tests (Required): 0.0% (0/9)
  • Total Cost: $0.00
  • Token Usage: 0
  • Run Suffix: litellm_proxy_gpt_5.2_codex_d6233c9_gpt52_codex_run_N9_20251228_233452
  • Skipped Tests: 1

Skipped Tests:

  • t08_image_file_viewing: This test requires a vision-capable LLM model. Please use a model that supports image input.

Failed Tests:

  • t09_token_condenser ⚠️ REQUIRED: Test execution failed: Conversation run failed for id=9add6855-b575-429a-8a6c-0ab8a8225684: litellm.NotFoundError: {"error":{"message":"litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]. Received Model Group=gpt-5.2-codex\nAvailable Model Group Fallbacks=None\nError doing the fallback: litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]","type":null,"param":null,"code":"404"}} (Cost: $0.00)
  • t02_add_bash_hello ⚠️ REQUIRED: Test execution failed: Conversation run failed for id=3bf55be6-43c1-4325-aec4-6b18081a2aed: litellm.NotFoundError: {"error":{"message":"litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]. Received Model Group=gpt-5.2-codex\nAvailable Model Group Fallbacks=None\nError doing the fallback: litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}] LiteLLM Retried: 2 times","type":null,"param":null,"code":"404"}} (Cost: $0.00)
  • t07_interactive_commands ⚠️ REQUIRED: Test execution failed: Conversation run failed for id=eda96809-0656-4bc8-bf32-81e5390e2371: litellm.NotFoundError: {"error":{"message":"litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]. Received Model Group=gpt-5.2-codex\nAvailable Model Group Fallbacks=None\nError doing the fallback: litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}] LiteLLM Retried: 2 times","type":null,"param":null,"code":"404"}} (Cost: $0.00)
  • t06_github_pr_browsing ⚠️ REQUIRED: Test execution failed: Conversation run failed for id=241476c8-3374-4be6-b40f-4265bb890f0b: litellm.NotFoundError: {"error":{"message":"litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]. Received Model Group=gpt-5.2-codex\nAvailable Model Group Fallbacks=None\nError doing the fallback: litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}] LiteLLM Retried: 2 times","type":null,"param":null,"code":"404"}} (Cost: $0.00)
  • t03_jupyter_write_file ⚠️ REQUIRED: Test execution failed: Conversation run failed for id=f95251a0-cd59-42da-a35b-b9a84ffafcd5: litellm.NotFoundError: {"error":{"message":"litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]. Received Model Group=gpt-5.2-codex\nAvailable Model Group Fallbacks=None\nError doing the fallback: litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}] LiteLLM Retried: 2 times","type":null,"param":null,"code":"404"}} (Cost: $0.00)
  • t04_git_staging ⚠️ REQUIRED: Test execution failed: Conversation run failed for id=0e069156-570f-4f86-9337-a0d1aeec1b4e: litellm.NotFoundError: {"error":{"message":"litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]. Received Model Group=gpt-5.2-codex\nAvailable Model Group Fallbacks=None\nError doing the fallback: litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]","type":null,"param":null,"code":"404"}} (Cost: $0.00)
  • t05_simple_browsing ⚠️ REQUIRED: Test execution failed: Conversation run failed for id=27348db0-cc2a-4ceb-b319-36128a801455: litellm.NotFoundError: {"error":{"message":"litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]. Received Model Group=gpt-5.2-codex\nAvailable Model Group Fallbacks=None\nError doing the fallback: litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}] LiteLLM Retried: 2 times","type":null,"param":null,"code":"404"}} (Cost: $0.00)
  • t01_fix_simple_typo ⚠️ REQUIRED: Test execution failed: Conversation run failed for id=e16c7da2-ec77-4e2a-8660-8b1c7e374806: litellm.NotFoundError: {"error":{"message":"litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]. Received Model Group=gpt-5.2-codex\nAvailable Model Group Fallbacks=None\nError doing the fallback: litellm.NotFoundError: OpenAIException - {\n "error": {\n "message": "The model gpt-5.2-codex does not exist or you do not have access to it.",\n "type": "invalid_request_error",\n "param": null,\n "code": "model_not_found"\n }\n}No fallback model group found for original model_group=gpt-5.2-codex. Fallbacks=[{'qwen3-coder-480b': ['qwen3-coder-480b-or']}, {'glm-4.5': ['glm-4.5-or']}]","type":null,"param":null,"code":"404"}} (Cost: $0.00)

litellm_proxy_claude_sonnet_4_5_20250929

  • Overall Success Rate: 100.0% (9/9)
  • Integration Tests (Required): 100.0% (9/9)
  • Total Cost: $0.63
  • Token Usage: prompt: 500,198, completion: 11,696, cache_read: 411,422, cache_write: 87,906, reasoning: 3,349
  • Run Suffix: litellm_proxy_claude_sonnet_4_5_20250929_d6233c9_sonnet_run_N9_20251228_233453

litellm_proxy_mistral_devstral_2512

  • Overall Success Rate: 87.5% (7/8)
  • Integration Tests (Required): 87.5% (7/9)
  • Total Cost: $0.19
  • Token Usage: prompt: 450,627, completion: 4,482
  • Run Suffix: litellm_proxy_mistral_devstral_2512_d6233c9_devstral_2512_run_N9_20251228_233452
  • Skipped Tests: 1

Skipped Tests:

  • t08_image_file_viewing: This test requires a vision-capable LLM model. Please use a model that supports image input.

Failed Tests:

  • t02_add_bash_hello ⚠️ REQUIRED: Shell script is not executable (Cost: $0.01)

litellm_proxy_deepseek_deepseek_chat

  • Overall Success Rate: 100.0% (8/8)
  • Integration Tests (Required): 100.0% (8/9)
  • Total Cost: $0.07
  • Token Usage: prompt: 655,100, completion: 10,110, cache_read: 612,288
  • Run Suffix: litellm_proxy_deepseek_deepseek_chat_d6233c9_deepseek_run_N9_20251228_233452
  • Skipped Tests: 1

Skipped Tests:

  • t08_image_file_viewing: This test requires a vision-capable LLM model. Please use a model that supports image input.

@xingyaoww
xingyaoww merged commit 85ecfd9 into main Dec 28, 2025
@xingyaoww
xingyaoww deleted the openhands/fix-condensation-defaults branch December 28, 2025 23:59
StressTestor pushed a commit to StressTestor/software-agent-sdk that referenced this pull request Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-test Runs the integration tests and comments the results

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Condensation for 0 events

3 participants