Skip to content

feat(filesystem): add conditional UTF-8 workspace writes - #4156

Closed
ningmao-hlyz wants to merge 3 commits into
agentscope-ai:mainfrom
ningmao-hlyz:feat/conditional-workspace-files
Closed

ningmao-hlyz wants to merge 3 commits into
agentscope-ai:mainfrom
ningmao-hlyz:feat/conditional-workspace-files

Conversation

@ningmao-hlyz

@ningmao-hlyz ningmao-hlyz commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT, based on main at a4306d63 (#4154).

Description

Fixes #4165.

Two WorkspaceManager instances can read the same memory file and overwrite one another's appends. Add optional conditional UTF-8 reads/updates to filesystem routes, and retry memory appends when their expected content is stale. Missing and empty files remain distinct.

Local files coordinate cooperating writers across JVMs with an OS lock and atomic replacement. Windows sharing conflicts use bounded retries. Remote files require atomic versioned storage; RemoteFilesystem currently uses supportsAtomicJournalStorage() to identify it. Overlay reads inherit raw lower-layer bytes, and internal lock/temp files are hidden from listings, search and the workspace index.

Backends without the optional capability retain legacy append behavior. External edits, whole-file replacement and archive moves are outside this protocol. This does not add conditional deletion.

Three commits, directly based on main and independent of #4155:

  1. Filesystem capability, implementations and tests.
  2. Workspace memory appends and documentation.
  3. Filter explicitly selected atomic-write artifacts before choosing the grep backend, including when rg is absent.

Validation on Windows with Java 17:

mvn -B -o -T1C -pl agentscope-harness -am -Dtest=LocalAtomicTextFileTest,RemoteFilesystemCASTest,OverlayAtomicTextFileTest -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Djacoco.skip=true spotless:check test

29 tests pass with rg removed from PATH. The existing artifact regression was also run directly in child JVMs: it reproduced the CI assertion before the fix without rg, and passes with and without rg after the fix. Full Harness/dependency tests on the same filesystem implementation pass without rg: 5,909 tests, no failures or errors, 48 skipped.

Checklist

  • Code has been formatted with mvn spotless:apply; Spotless checks pass.
  • Tests pass for the commands listed above.
  • Javadoc comments follow project conventions.
  • Related English and Chinese documentation has been updated.
  • Code is ready for review.

@mintlify

mintlify Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 22e71d2.

Approve preview

Reject an explicitly selected internal file before choosing the search backend.
The Java fallback can otherwise return neighboring files when rg is absent.

Verified the existing artifact regression with and without rg on PATH.
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.

[Feature]: Add conditional text updates for shared memory files

1 participant