Repository navigation
test(runtime): drain observers around chat SQL budget capture - #1145
Closed
loveRhythm1990 wants to merge 3 commits into
Closed
loveRhythm1990 wants to merge 3 commits into
loveRhythm1990 wants to merge 3 commits into
Conversation
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Capability assessment: N/A: test measurement boundaries only; no production capability, auth policy, or deployment behavior changes.
Summary
PR #1139's online integration lane fails
ordinary_chat_and_readonly_rounds_have_bounded_total_sql: the warm-context scenario records 22 statements against the existing limit of 20. The warm-up response can finish before its detached observer, allowing that observer's authorization query into the next turn's capture.drain_background_runsdoes not own that observer. A SQLx connection-initialization statement also appears in the failed capture.This independent fix prepares a bounded connection reserve before measurement, consumes the full warm-up SSE response and waits for its observer before starting capture, and drains the final measured run and waits for its observer before stopping capture. Shutdown drain is deliberately not called after warm-up because it closes admission for the measured turn. The probe uses the production observer's completion metrics and rejects errors, dropped work, extra completions, and missing completions. It retains the 20-statement raw total limit, transaction/control accounting, and the no-extra-SQL assertion for readonly tool rounds. No query inside the capture window is filtered out. The readonly-round delta also accounts for at most one exact account/session authentication snapshot when the existing 30-second cache expires. This does not match Memoria authority queries; duplicate authentication snapshots still fail, and every query still counts toward the raw limit.
Related issue
Follow-up validation fix for #1139 / #1138. This PR targets main independently; it does not replace or include the observer authorization change in #1139. After this lands, #1139 needs to incorporate the updated main and rerun CI.
Change type
User and compatibility impact
None. No runtime, authorization, schema, API, or deployment change. The probe remains a scripted-provider integration test against an isolated MatrixOne database.
Architecture and complexity delta
chat_sql_budgetintegration probe and its testing guide.Verification
cargo fmt --all -- --check,git diff --check, andpython3 scripts/ci/validate_repository.py(repository metadata check before the final small assertion/documentation follow-up).27387141:cargo test -p astra-runtime --features e2e-hooks --test chat_sql_budget --no-run.make checkwas not completed./chat/stream, ordinary/warm-context chat and readonly discovery/agent-list. No live LLM is involved. No schema or production query changes; all database validation used a dedicated local test database, without QA/production mutations.Self-review covered both modified files (2 reviewed, 0 skipped; Rust rules plus manual documentation review). The premature warm-up shutdown found during local testing was corrected before the successful focused warm run.
Final checklist