I3eka opened a new pull request, #44497: URL: https://github.com/apache/superset/pull/44497
### SUMMARY Resolve a cancellation target through the supplied owned conversation before recording its stop flag. Reuse the same `_find_run_message` lookup and owner-scoped DAO path already used by the stream endpoint; no new authorization abstraction or storage schema. The existing endpoint checked ownership of `thread_uuid` but forwarded an independent `run_id` without checking that association. An unrelated or unknown run is now `404`; a matching owned run remains `200`, and a missing required run identifier remains `400`. Depends on unmerged #42805 at `0e4a15cca1c5be2b7e68d609a9062f5e51193024`. The focused fix is [one three-file commit](https://github.com/I3eka/superset/commit/68836a2738bed7db5ecca1485addf127fde387a9); the full Apache-master comparison includes the inherited AI implementation. This draft preserves the parent SIP/dependency hold. @sadpandajoe, this isolates the cancellation-target association requested in [your review](https://github.com/apache/superset/pull/43135#discussion_r3872143098), independently reproduced alongside the equivalent Copilot finding. It does not claim to repair shared cancellation caches, duplicate-consumer cleanup, worker-loss recovery or automatic resumption. Boundary: an authenticated Alpha or custom principal granted `can_write` on `AIAssistant` may act on its own conversation. This follows SECURITY.md's Roles and Capabilities/custom-grant rule and Async Execution and Realtime Notifications task-metadata restriction. This is a correction to an already-reviewed, unmerged feature, not a supported-release vulnerability report. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF API-only change. Before, an owned conversation accepted an unrelated or nonexistent run with `200`. After, that mismatch returns `404` without invoking cancellation; normal Stop remains accepted. ### TESTING INSTRUCTIONS - All 708 backend AI unit tests pass on the exact parent-based branch. - The 14 route/DAO scenarios exercise both inline and worker configurations against real isolated SQLite conversation/message rows: correct pair, different owned conversation, foreign run, unknown run, foreign conversation, missing conversation and missing request field. Six mismatch cases fail on the unmodified parent; all pass with this guard. The cancellation callback is checked for exact forwarding or no invocation. - The tests stub route permission grants and caller identity to focus on the owned-run association. This is not a live multi-user authentication or cross-process cancellation test. - All applicable changed-file pre-commit checks pass, including mypy, Ruff, pylint and formatting. - Required `pre-commit run --all-files` completed in an isolated checkout. Both mypy hooks, pylint, custom/style rules, metadata/feature-flag validation and workflow checks pass. Unrelated baseline formatting/lint checks still fail, as do full frontend typing with missing/out-of-date generated declarations, docs lint without Yarn and Helm docs without its executable. The 51 auto-modified files remain only in that checkout; none of this PR's three files was changed by that run. Manual check in a development deployment: submit turns in two distinct conversations, then post the second run ID to the first conversation's cancellation endpoint. It must return `404`; cancelling with the matching conversation/run pair must return `200`. Repeat with another user's run and verify the cancellation callback is never reached. No inference or tool work needs to start to check this association. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [x] Required feature flags: `AI_ASSISTANT` - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- 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]
