qwen-code/docs/superpowers
jinye 06549daa9b
fix(sdk): self-heal stale clientId on invalid_client_id prompts (#5797)
* fix(sdk): self-heal stale clientId on invalid_client_id prompts

After a daemon restart or session reload the daemon's in-memory client
registration is wiped, so a prompt sent with our now-unknown clientId is
rejected at admission with 400 invalid_client_id (PR #5784). That rejection
happens before the turn registers, so the prompt never ran and retrying cannot
double-execute.

DaemonSessionClient.prompt() now wraps the admission call (both the blocking and
non-blocking paths) in a self-heal: on invalid_client_id it re-registers via
resumeSession to obtain a fresh clientId and retries the admission exactly once.
A single-flight guard coalesces concurrent prompts so re-registration happens
once; any other error (and a second invalid_client_id) propagates.

Adds 6 tests covering both paths, the retry bound, the non-matching-error guard,
reattach-failure propagation, and concurrent single-flight.

Design: docs/superpowers/specs/2026-06-24-daemon-clientid-self-heal-design.md

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* test(integration): cover real-daemon invalid_client_id contract for self-heal

Adds an integration case to qwen-serve-routes.test.ts validating the three
real-daemon behaviors DaemonSessionClient's clientId self-heal depends on:
(1) an unregistered prompt clientId is rejected at admission with
400 invalid_client_id, (2) resume re-registers and mints a fresh clientId, and
(3) retrying admission with that clientId is accepted (202). Model-free: prompt
admission runs before any model call, so promptNonBlocking returns 202 on
acceptance without reaching the model.

🤖 Generated with [Qwen Code](https://github.com/QwenLM/qwen-code)

* fix(sdk): Adjust daemon browser bundle budget

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(sdk): Cover clientId self-heal review cases

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-06-24 13:59:59 +08:00
..
plans feat(serve): add daemon idle detection to GET /health?deep=true (#4934) 2026-06-18 06:55:03 +00:00
specs fix(sdk): self-heal stale clientId on invalid_client_id prompts (#5797) 2026-06-24 13:59:59 +08:00