Skip to content

fix(harness): align MemorySearchToolTest mocks with readMemoryFileUtf8 - #3856

Merged
jujn merged 1 commit into
mainfrom
fix/memory-search-tool-test-mock
Oct 29, 2026
Merged

jujn merged 1 commit into
mainfrom
fix/memory-search-tool-test-mock

Conversation

@jujn

@jujn jujn commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

CI build (ubuntu-latest) and build (windows-latest) jobs have been failing on main since commit 269ccd1 (#3113) landed. The single failing test across all three runs is MemorySearchToolTest.errorLookingMemoryIsData.

Root cause

PR #3113 introduced memory-scoped IO on WorkspaceManager (readMemoryFileUtf8 / appendMemoryFileUtf8 / writeMemoryFileUtf8) and switched MemorySearchTool from readManagedWorkspaceFileUtf8 to readMemoryFileUtf8. The test file MemorySearchToolTest was not updated — its Mockito stubs still mock the old method name, so the stub is never invoked. readMemoryFileUtf8 returns null (default for an un-stubbed mock), the file content is skipped, and the search yields 0 matches instead of the expected 2, failing the assertTrue(text.contains("Found 2 matches:")) assertion.

The noMatchesIsASuccessfulSearch test also used the wrong method name but passed coincidentally — both the stubbed path and the null path produce "no matches".

Fix

Update both mock stubs in MemorySearchToolTest to call readMemoryFileUtf8, matching the production code.

Verification

  • mvn -T1C -pl agentscope-harness -am test -Dtest=MemorySearchToolTest — 7 tests, 0 failures.
  • mvn -T1C -pl agentscope-harness spotless:check — clean, 0 changes needed.
  • Diff is limited to 2 lines in a single test file; no production code changes.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 09:36

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 insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jujn
jujn merged commit ff4c3be into main Oct 29, 2026
6 checks passed
@jujn
jujn deleted the fix/memory-search-tool-test-mock branch October 29, 2026 09:50
Buktal added a commit that referenced this pull request Oct 30, 2026
## AgentScope-Java Version

2.1.0-SNAPSHOT

## Summary

Align the parent and child subagent prompts with the existing lifecycle
and delivery paths. Require self-contained tasks and final reports,
distinguish observer events from delivered results, and keep EN/ZH
documentation aligned.

```diff
- All subagents are ephemeral; the parent receives only the final text.
+ Each invocation delivers a final result; intermediate events serve observers.
+ Live local children retain history across sends; remote history depends on the backend.
+ Session persistence and later resumption depend on the declaration and backend.
```

Refs #3834 (slice 08). This shared tracking issue should remain open.

## Evidence

- **Before:** The prompts describe all subagents as ephemeral while also
advertising persistent sessions and follow-up sends, and describe final
text as the only information the parent receives despite the existing
event forwarding path.
- **After:** Local spawn/send tests verify that follow-ups see the first
task and reply, and that a task-less spawn does not invoke the child.
Prompt contract checks retain handle, timeout-promotion, push/wait, and
stable-system guidance. These are offline contract/runtime fixtures, not
model-quality measurements.

Validation on base `616ab47cc`:

- `mvn -B -T1C verify`: full reactor passed, including Spotless and all
9 tests in the three new classes; environment-dependent tests retain
their existing skips.
- `cd docs; npm test`: 13 passed.
- `cd docs; npm run validate`: local checker (432 pages / 584 redirects)
and Mintlify build passed.
- `git diff --cached --check`: passed.
- `npm run broken-links` previously reported 2,222 links across 328
files. That broad CLI report remains unresolved; the local link checker
and build validation pass.

The initial `clean verify` on the older worktree base failed in
`MemorySearchToolTest.errorLookingMemoryIsData`. The branch was then
moved onto current main, which already contains the fix in #3856, and
the full reactor rerun passed.

## Merge Danger

**Door:** Two-way

**Blast Radius:** Harness

Changes prompt guidance, tests, and documentation only. Reuses the
existing local conversation, remote task, final-result delivery, and
observer-event mechanisms; adds no protocol or public API.

## Checklist

- [x] Code formatting verified by Spotless
- [x] All enabled tests are passing (full `mvn verify`; existing
environment-dependent skips retained)
- [x] Javadoc comments are complete and follow project conventions
- [x] Related EN/ZH documentation has been updated
- [x] Code is ready for review
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.

3 participants