Skip to content

fix(harness): isolate memory consolidation watermarks - #3513

Open
saddddboi wants to merge 2 commits into
agentscope-ai:mainfrom
saddddboi:codex/fix-memory-watermark-3510
Open

saddddboi wants to merge 2 commits into
agentscope-ai:mainfrom
saddddboi:codex/fix-memory-watermark-3510

Conversation

@saddddboi

@saddddboi saddddboi commented Oct 12, 2026 •

Copy link
Copy Markdown

AgentScope-Java Version

2.1.0-SNAPSHOT

Description

Closes #3510.

When two isolated users share a BaseStore, consolidating Alice's daily ledger advances a global watermark that can cause Bob's unprocessed ledger to be skipped. Bob's existing MEMORY.md then remains stale.

Resolve the distributed watermark namespace through WorkspaceManager's configured NamespaceFactory for both reads and CAS writes. Preserve the legacy shared slot for empty namespace mappings and the filesystem-state fallback. Isolated scopes ignore the old global cursor, since it may describe another user's consolidation progress.

Add regression coverage for USER isolation, two sessions of the same user, repeated consolidation, legacy cursor fallback, missing namespace factories, null-context normalization, and CAS conflict retries. Update the English and Chinese Harness memory guides. No public API signatures change.

Validation

  • Relevant memory, compaction, middleware and search tests pass (94 tests, no failures, errors or skips) on upstream main 65a35d40 plus this fix.
  • Local JaCoCo reports all 15 added executable production lines covered, with no missing or partially covered lines/branches. Codecov will recalculate after CI uploads the new report.
  • Spotless apply/check and git diff --check pass.
  • Documentation script tests, local documentation checks, Mint build validation and the full-site broken-links check pass. The latter runs with Node 22 on Linux: the pinned checker incorrectly compares forward-slash URL directories with backslash file directories on Windows, reporting existing pages as missing.
  • An optional live-provider check outside the default test suite uses synthetic Alice/Bob ledgers with the real OpenAIChatModel and InMemoryStore/RemoteFilesystem. Before the fix: one model call, Alice updated, Bob skipped. After the fix: two model calls, both updated; repeating consolidation makes no further calls. Credentials and endpoint values are not included.

The full repository test suite and a real distributed-database integration were not run locally. The committed regression tests use deterministic model responses and require no provider credentials.

mvn -B -T1 -pl agentscope-harness -am spotless:check test \
  '-Dtest=Memory*Test,WorkspaceContextMiddlewareMemoryPromptTest,ConversationCompactorTest,TokenCounterUtilTest' \
  -Dsurefire.failIfNoSpecifiedTests=false

Documentation checks: npm ci, npm test, npm run validate, and npm run broken-links with Node 22 on Linux.

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test) — the relevant 94 tests pass; the full repository suite was not run locally.
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

Copilot AI balanced review requested due to automatic review settings October 12, 2026 01:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CLAassistant

CLAassistant commented Oct 12, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@saddddboi
saddddboi force-pushed the codex/fix-memory-watermark-3510 branch from c2da3e4 to 97ccb96 Compare October 12, 2026 01:21
@saddddboi
saddddboi requested a balanced review from Copilot October 12, 2026 01:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@saddddboi
saddddboi requested a balanced review from Copilot October 12, 2026 01:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@saddddboi
saddddboi requested a balanced review from Copilot October 12, 2026 06:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Shared MemoryConsolidator watermark skips unprocessed ledgers across isolated users

3 participants