agentscope-ai / agentscope-ai/QwenPaw
fix(config): invalid single-channel payloads return HTTP 500
- Lenguaje dominante
- Python
- Estrellas
- 34.9k
- Forks
- 3.1k
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 225
Descripción
## QwenPaw Version
`2.1.0b3`, current `main` at `e09e1a28f515e71f687f0ed5c4b04ed4f152181e`.
## Description
`PUT /api/config/channels/{channel_name}` accepts an untyped JSON object and
constructs the selected built-in channel model inside the route. If that
construction raises a Pydantic `ValidationError`, the exception is not mapped
to a client validation response, so the API returns HTTP 500.
The complete-channel endpoint already returns HTTP 422 for the same class of
invalid input. The single-channel endpoint should preserve that API contract
and must not turn user input errors into internal server errors.
**Related PR(s):** Follow-up to #6864.
**Security considerations:** None. This is error classification for invalid
configuration input; the invalid value is not persisted.
## Component(s) Affected
- [x] Core / Backend (app, agents, config, providers, utils, local_models)
- [ ] Console (frontend web UI)
- [x] Channels (DingTalk, Lark, QQ, Discord, iMessage, etc.)
- [ ] Skills
- [ ] CLI
- [ ] Documentation (website)
- [x] Tests
- [ ] CI/CD
- [ ] Scripts / Deploy
## Environment
- **QwenPaw version:** `2.1.0b3` / `e09e1a28`
- **OS:** macOS 26.5.1
- **Install method:** source checkout with repository `.venv`
- **Python version:** 3.11.15
## Steps to Reproduce
1. Start the FastAPI config router with a valid agent workspace.
2. Send:
```http
PUT /api/config/channels/onebot
Content-Type: application/json
{"enabled": true, "ws_port": "not-a-port"}
```
3. Inspect the response and persistence call.
## Actual vs Expected
- **Actual:** HTTP 500 with `Internal Server Error`; `save_agent_config()` is
not called.
- **Expected:** HTTP 422 with validation details; `save_agent_config()` remains
uncalled.
## Logs / Screenshots
```text
status=500
body=Internal Server Error
save_called=False
```
The current regression test
`test_put_onebot_channel_rejects_invalid_value` accepts either 422 or 500 and
notes that the Pydantic error currently propagates.
## Additional Notes
Open issue/PR searches for channel config validation, HTTP 422, Pydantic
`ValidationError`, and OneBot invalid config handling found no active
implementation. The report and proposed fix were AI-assisted and personally
reproduced against the exact current `main` revision above.
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.