Repository navigation
fix(ai): scope stream replay to the requested run - #7393
Merged
Merged
Conversation
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.
Which Issue(s) This PR Fixes
Fixes #7146. Replaces stale-closed #7147, preserving the replay contribution and its current-base merge. Both the old PR and issue were closed by the inactivity bot.
Brief Description
The run-stream endpoint queries conversation-wide event pages. Replaying every row can put other turns' answers and terminal statuses into the requested run, including reporting a reaped FAILED run as COMPLETED.
startSeq - 1, so earlier runs do not consume the requested run's replay budget.runIdbefore decoding, projection, terminal detection, or the live deduplication watermark.startSeqfallback. Do not cap atendSeq, which can retain its admission-time value after a run is reaped.The delta is limited to
AiRunService.attachand its regression tests: two files, +208/-1. SQL, replay limits, observer registration, completion behavior, API shapes, dependencies, and build configuration are unchanged. This addresses content/status correctness within one owned conversation.Tested head:
604a1125610ef98c2fc7cd94e2c6ec1e3bb85b73, based onrocketmq-studio@7abf8adaf660d75f2d686bbe8741be76c3a5ddd3. Admission and executor terminal/EOF changes are not included. Static patch compatibility with the separate admission replacement #7390 was checked; no combined-tree runtime validation is claimed.How Did You Test This Change?
Fresh local verification on November 4, 2026, with Temurin 21.0.13+9 and Maven 3.9.9:
AiRunServiceTest: 43 passed, zero failures/errors/skips.AiRunService.javawith the current base, retaining the new tests. The seven new methods ran as nine instances: 8 expected assertion failures and 1 passing control, zero errors/skips. Theafter=8control already works on base because no later rows remain. Failures cover middle-run isolation, reaped FAILED status, active tailing, history budget, null/zero start metadata, cursor-at-end handling, and the later-run watermark.startSeqlower bound while retaining run filtering. The budget regression failed because the requested answer was not reached.noteWatermarkbefore the foreign-run filter while retaining the start boundary and projection filter. The between-pages regression failed because the requested buffered COMPLETED terminal was dropped. Each mutation produced one expected assertion failure, zero errors/skips.git diff --check, and the clean-tree check passed.The history-budget fixture has exactly 5,000 earlier-run rows, followed by the requested text and terminal at 5001/5002. Null/zero legacy start metadata retains the existing total-row ceiling. Test selections overlap; their counts should not be added as unique tests.
From
server/, each test invocation used these common options with the relevant selection:MAVEN_SETTINGSandMAVEN_REPOdenote the existing local settings and cache. The final related selection wasAiRunExecutorTest,AiRunServiceTest,AgentStreamSessionTest,AgentRunRegistryTest,AgentRunHandleStopTest,AgentEventProjectorTest,AiEventSeqAllocationTest,AiEventContractTest,AiEventJsonSerializationTest. The explicit Mockito startup agent avoids dynamic attachment; no project configuration, assertion, or timeout was changed.Packaging limitation: the subsequent offline
package -DskipTestsattempt stopped during plugin resolution becauseorg.apache.maven.plugins:maven-jar-plugin:3.5.0was not cached. The package lifecycle did not execute. This attempt is not reported as a successful package build.The service regressions exercise real replay/projector/session/registry logic with controlled repository fixtures. H2 persistence/migration coverage is separate. These local selections are not a full backend or frontend aggregate. No live-provider test, multi-connection MySQL concurrency demonstration, or browser reproduction is claimed. Historical CI results from the old PR are not treated as current results.
Fresh CI for this replacement PR
CI run 41919028108, triggered by opening #7393 at head
604a1125610ef98c2fc7cd94e2c6ec1e3bb85b73, completed successfully on November 4, 2026: all 6 jobs passed.AiRunServiceTestcases. The full job log reportsBUILD SUCCESS.These are results from this replacement's new CI run, separate from the local selections and negative controls above. The successful remote build does not change the recorded local offline package-cache limitation or extend the regression fixtures into live-provider or MySQL concurrency evidence.
AI assistance was used for investigation, source review, and validation.
Checklist
...Testsuffix