agentscope-ai / agentscope-ai/agentscope

[Bug]: Subagent HITL confirm card spins forever; every click logs "Agent is not waiting for user confirmation" (same event re-posted 400+ times)

Ouverte
#2,324 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
31.5k
Forks
3.5k
Merge moyen
1 j 23 h
PR mergées (30 j)
95

Description

### Prerequisites

- [x] I have searched the existing [issues](https://github.com/agentscope-ai/agentscope/issues) and [discussions](https://github.com/agentscope-ai/agentscope/discussions), and this is not a duplicate.
- [x] This is a bug, not a usage question. (For questions, please use [Discussions](https://github.com/agentscope-ai/agentscope/discussions/new?category=general) instead.)

### Background / Description

When a **team leader invites a worker** (`AgentCreate`), the worker session is created with the default permission mode (`default`). If the worker immediately triggers a tool that requires HITL confirmation (in my case: `AgenticMemoryMiddleware` writing a `Memory/*.md` file via the `Write` tool), a `SubagentHitlCard` is projected onto the leader's view.

Clicking **Allow** on that card does nothing visible — the card spins forever. Interrupting the run does not dismiss the card either; the UI stays stuck. The user clicks again and again with no effect.

### Error Messages

```shell
The backend logs one `ValueError` per click:

ValueError: Agent is not waiting for user confirmation, but received
UserConfirmResultEvent: id='49438755-3d78-4d6f-a6ae-c8c518b46850' ...
reply_id='cdf9b9d0720c4b0491ed6b0fbef7d731' ...
tool_call=ToolCallBlock(... name='Write', input='{"file_path":
".../workspaces//Memory/feedback_team-discipline.md", ...}',
state='asking', ...)

1. **The exact same `UserConfirmResultEvent` id (`49438755-...`) appears 437 times** in `backend.log` — the frontend re-posts the same confirm result on every click/retry instead of giving up or refreshing its state.
2. The worker's tool call is still `state='asking'` server-side, yet the confirm result is rejected with "Agent is not waiting for user confirmation" — the worker session's awaiting state and the projected HITL card have desynchronized (consistent with the replay/live boundary loss described in #2123).
3. The stuck card survives an **interrupt** — `POST /sessions/{id}/interrupt` completes, but the card keeps spinning on the leader view. Only deleting the session clears it.
```

### Steps to Reproduce

1. Deploy the Agent Service (Redis storage + Redis message bus) and the bundled web UI.
2. In a leader session with permission mode `default`, ask the leader to create a team and spawn a worker (`AgentCreate`). Fresh worker sessions inherit `default` mode.
3. Have the worker do something that triggers HITL confirmation on first action — e.g. with `extra_agent_middlewares=AgenticMemoryMiddleware`, the worker writing its first `Memory/*.md` file via `Write` reliably raises a confirm card on the leader view.
4. Click **Allow** on the projected card. Nothing happens. Click repeatedly; check backend log — one `ValueError: Agent is not waiting for user confirmation...` per click, all with the same event id.
5. Press interrupt on the session; the card still spins. Only deleting the session recovers.

### Environment

- AgentScope: 2.0.6 (PyPI, `agentscope[full]`)
- Backend: Agent Service via `create_app` (RedisStorage + RedisMessageBus), running on WSL2 Ubuntu 26.04
- Frontend: bundled `examples/web_ui` (React, `pnpm dev`)
- Model: OpenAI-compatible endpoint (Zhipu AI / glm-5.2), if relevant

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.