Repository navigation
Conversation
exportCommitted() returned as soon as the exporting flag was taken, so a commit that landed while a drain was running was never exported by that drain. The one second heartbeat normally caught it later, but close() disposes the heartbeat, so events committed near the end of a run waited for an external retry before reaching the sink, leaving exported state behind the durable journal. Record the request before taking the flag and let the drain loop until no new request arrived, re-arming when one lands while the flag is cleared. Regression: a sink that blocks inside accept() while a second message is committed now receives both events after close() disposes the heartbeat; before the change it only ever received the first.
wahllllll
force-pushed
the
fix/issue-3836-export-drain-pending
branch
from
October 29, 2026 06:23
055bbf7 to
e106ce4
Compare
Contributor
Author
|
Closing in favour of #3840, which was opened earlier and is already approved on the same fix. A second PR for the same behaviour only splits review attention. One note for whoever lands #3840, also recorded here: its re-arm calls |
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.
Problem
SessionRecorder.exportCommitted()takes theexportingflag and returns silently when another drain already holds it:Nothing records that another drain is required, so a commit that lands during a running drain is never exported by it. The one second heartbeat usually hides this, but
close()disposes the heartbeat, so events committed near the end of a run stay unexported until an external retry — the case reported in #3836, whererun/endcommitted at12:51:50.351but the sink cursor only advanced at12:52:07.255.Change
exportCommitted()now records the request before taking the flag, and the drain runs in a loop that continues while requests are pending. Thefinallyblock re-arms when a request landed between the last check and clearing the flag, so no window is left where a committed event waits for a retry.Behavior is otherwise unchanged: the drain still runs on
Schedulers.boundedElastic()and never on the committing thread, the existing warning for a failed drain is preserved, and the cursor still advances per acknowledged event throughSessionLogExporter.Regression
SessionRecorderExportDrainTest.eventCommittedDuringDrainIsStillExporteduses a sink that blocks insideaccept():close()the recorder, which disposes the heartbeat;Before the change the sink receives only
[1]and the test fails with:After the change it receives
[1, 2].Verification
mvn -B -pl agentscope-core -Dtest=SessionRecorderExportDrainTest,io.agentscope.core.session.*Test test: 23 tests, 0 failures.mvn -B -pl agentscope-core test: 2873 tests, 0 failures, 2 errors — only the pre-existingDangerousPathBypassTestsymlink cases that need Windows symlink privileges unavailable on this machine (they also fail on unmodifiedmain).mvn -B -pl agentscope-core spotless:check: BUILD SUCCESS.Fixes #3836.