Repository navigation
fix(harness): support asynchronous memory flush - #2833
guslegend0510 wants to merge 16 commits into
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…s-async-memory-flush
…s-async-memory-flush
…s-async-memory-flush
…s-async-memory-flush
There was a problem hiding this comment.
LGTM — the approach looks good, and the tests cover the core #2821 scenario.
Two things I’d like to confirm:
ASYNC_FLUSH_SCHEDULER is static, so the whole process shares one worker and a queue of three. Different agents / workspaces don’t share the same MEMORY.md, so serializing writes doesn’t seem like a reason to share this queue across agents. I’m more worried about a slow flush blocking or rejecting another agent’s flush. Is the process-wide limit intentional, or would you consider splitting schedulers by isolation key / instance later?
Also, in memory.md under “When flush fires”, flush is described as fire-and-forget and not blocking call(), which doesn’t match the code — the default is still to wait synchronously for flush. Now that asyncFlush exists, it’d be good to fix that sentence.
感谢仔细审阅,这两个问题都很有价值。 |
This reverts commit 2e05f67.
|
This PR has conflicts with the git fetch origin
git checkout codex/fix-2821-harness-async-memory-flush
git rebase origin/main
# resolve conflicts, then:
git push --force-with-leaseThis is a one-time reminder. Feel free to @mention me for a re-review after conflicts are resolved. Automated notification by github-manager-bot |
Summary
MemoryConfig.asyncFlush(boolean)option forHarnessAgentMotivation
HarnessAgentcurrently waits for the per-call memory flush to complete before completing the response stream.When the memory model responds slowly, this can significantly delay the agent response. The deprecated
ReActAgent.longTermMemoryAsyncRecord(...)option does not apply toHarnessAgent.This change provides an equivalent opt-in asynchronous mode:
The default remains
false, preserving the existing completion and persistence semantics.Behavior
When
asyncFlushis enabled:Asynchronous flushes are fire-and-forget. In-flight flushes are not awaited during
HarnessAgent.close(), so applications that exit immediately may stop before persistence completes.Testing
Results:
Fixes #2821