agentscope-ai / agentscope-ai/QwenPaw

[Bug]: Session permanently freezes during multi-step CLI tasks when max_input_length is set to a large value

Aberta
#3,397 4 comentários 0 reações 0 responsáveis Ver no GitHub
question
Linguagem predominante
Python
Estrelas
34.9k
Forks
3.1k
Merge médio
1d 15h
PRs com merge (30d)
225

Descrição

## QwenPaw Version

v1.1.1 (installed via pip)

## Description

When the agent executes multi-step CLI tasks (repeated `execute_shell_command` calls), it permanently stops responding after a certain step. All subsequent messages receive no reply and no error is shown.

Restarting the service does not fix this — sending `/new` to start a new session is required to recover.

Suspected root cause: tool outputs are written to session memory without size truncation. When `max_input_length` is set to a large value (e.g., 200K), the compaction threshold scales proportionally (200K × 0.75 = 150K), allowing context to accumulate up to 150K before compaction triggers — potentially exceeding the model's effective processing capacity.

## Component(s) Affected

- [x] Core / Backend (app, agents, config, providers, utils, local_models)

## Environment

- **QwenPaw version:** v1.1.1
- **OS:** Ubuntu (Linux 6.8.0-100-generic, x86_64)
- **Install method:** pip
- **Python version:** 3.12

## Steps to Reproduce

1. Set `max_input_length` to a large value (e.g., 204800) in agent config
2. Start a conversation session
3. Ask the agent to perform a task requiring multiple sequential CLI calls (e.g., installing software, cloning repos, reading configs — 5+ calls)
4. CLI commands produce large output (each >10KB)
5. Session freezes at some step, all subsequent messages get no response

## Actual vs Expected

- **Actual:** Agent permanently stops responding after a CLI command. Restarting the service does not recover. Sending `/new` to start a new session is required.
- **Expected:** Agent should complete the task normally, or gracefully handle context overflow with an error message and recovery suggestion instead of silently hanging.

## Logs / Screenshots

No specific error logs. The agent stops producing output after the last tool call, with no response to any subsequent messages.

## Additional Notes

**Workaround:** When setting `max_input_length` to a large value, tighten compaction parameters accordingly:
- `memory_compact_ratio`: 0.75 → 0.4 (trigger compaction earlier)
- `recent_max_bytes`: 50000 → 10000 (lower tool result truncation limit)

Proactively send `/compact` during long multi-step tasks, or use `| head -100` in CLI commands to limit output. Send `/new` to recover after a freeze.

**Investigation directions:**
1. Whether tool outputs have size limits or truncation before being written to session memory
2. Whether there is coordination logic between `max_input_length` and compaction parameters (`memory_compact_ratio`, `recent_max_bytes`)
3. Whether error handling and recovery flow is robust when context overflow occurs

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.