Qiao-yq opened a new pull request, #1596: URL: https://github.com/apache/dubbo-admin/pull/1596
## Status Draft. This PR is blocked by and must be merged after [#1592](https://github.com/apache/dubbo-admin/pull/1592) and [#1594](https://github.com/apache/dubbo-admin/pull/1594). Those PRs establish the Session ownership and sensitive-data boundaries used by this work. ## Summary Implements durable interaction idempotency, quotas, retention, and cleanup lifecycle handling for Phase 1 of Issue #1539. - add persisted Interaction, CleanupJob, DerivedArtifact, and OutboxEvent lifecycle records - enforce idempotency-key reuse, one-running-interaction-per-Session, and Turn/byte quotas atomically - replay completed interactions and reclaim expired running leases without duplicating model work - make Session deletion and retention use the same asynchronous, idempotent cleanup path - reconcile expired Sessions and orphaned or failed derived artifacts with bounded keyset scans - preserve idempotency keys and message nodes across logical UI retries - document the interaction ownership, retention, and cleanup decisions ## Scope This PR implements PR 3 of the Issue #1539 Phase 1 plan: interaction idempotency and Session lifecycle management. The streaming chat endpoint validates and acquires an interaction before SSE starts. The handler and Agent have explicit ownership of terminal transitions, completed requests can be replayed, and expired leases can be reclaimed after partial Turn data is removed. Session deletion first commits a deletion-pending state that blocks further access. Canonical data and registered derived artifacts are then cleaned asynchronously, with persisted retry state and periodic reconciliation for crash recovery. Retention follows the same deletion path. ## Out of scope - production identity adapters and resource-level authorization beyond #1592 - encryption and sensitive-data controls beyond #1594 - publishing outbox events to an external broker or consumer - cross-process cleanup-worker leadership or distributed scheduling - later Phase 1 context compiler, usage/cost, and evaluation work ## Compatibility and behavior changes - POST `/api/v1/ai/chat/stream` now requires an `Idempotency-Key` containing 1 to 128 printable ASCII characters - reusing a key with a different request returns `IDEMPOTENCY_CONFLICT` - concurrent work for the same Session returns `SESSION_BUSY` or `INTERACTION_IN_PROGRESS` - Session deletion becomes asynchronous after the deletion-pending state is committed - retention and cleanup settings are validated through the memory and server configuration schemas - the frontend reuses the same idempotency key and message node for a logical retry ## Validation - `cd ai && go test ./...` - `cd ai && go vet ./...` - `git diff --check 2a07a5c..HEAD` - focused regression coverage for Memory/GORM store contracts, interaction ownership and replay, lease recovery, quotas, cleanup retries, retention, HTTP/SSE behavior, and frontend retry state ## Affected areas - [x] Docs - [ ] Installation - [x] User Experience - [ ] Dubboctl - [x] Console - [x] Core Component ## Characteristics - [x] Includes tests Part of #1539. Blocked by #1592 and #1594. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
