Repository navigation
fix(harness): route native journals to remote sessions backend - #4146
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
aiyili
left a comment
There was a problem hiding this comment.
Reviewed the full diff — this is exactly the right shape, and I can say that with unusual confidence: I independently arrived at the identical design in my own (now withdrawn) attempt — optional explicit backend constructor parameter on CompositeFilesystem, RemoteFilesystemSpec passing the sessions overlay it already builds, two-arg constructor behavior preserved. Convergent independent implementations are about as strong a design cross-validation as it gets.
Your version has three things mine didn't, all good:
- Fallback resolved at construction (
sessionBackend != null ? sessionBackend : routeForPath("agents/").backend()in the constructor) rather than per-call — one resolution instead of a route scan on everysessionStoragecall, same semantics since the route table is immutable after construction. - Recovery and isolation regressions (
RemoteSessionRoutingTest): persistence + recovery against a different local workspace + isolation scope coverage + history discovery — wider than the single store-namespace assertion I had planned, and the recovery-across-workspaces case is the one that actually bites multi-replica deployments. - Docs updated in both languages — something I skipped.
One blocking-to-merge note: #4154 (a4306d63) renamed this API under you — sessionStorage(RuntimeContext) → journalStorage(RuntimeContext), io.agentscope.core.session.AtomicSessionStorage → io.agentscope.core.journal.AtomicJournalStorage. Your head b704ba0 predates the rename and the branch is now mergeable_state: dirty; as-is it won't compile against current main. The adaptation is mechanical (rename + import in CompositeFilesystem, OverlayFilesystem already delegates under the new name), but the rebase is required before review can conclude.
My PR #4193 is withdrawn in favor of this one — branch deleted. #4140 stays fixed here.
b704ba0 to
579de9d
Compare
aiyili
left a comment
There was a problem hiding this comment.
Re-reviewed the rebase — approving.
The #4154 adaptation is exactly right: journalStorage / io.agentscope.core.journal.AtomicJournalStorage rename applied through the composite and the spec, and the regression suite was rebuilt on the new primitives rather than mechanically renamed — RemoteJournalRoutingTest drives the real journal path (WorkspaceThreadJournalStore.open/commit with ThreadKey/JournalEvent) instead of asserting on raw storage, parameterizes all four IsolationScopes against their expected store namespaces, verifies recovery into a fresh local workspace, and asserts the local .agentscope-runtime journal never materializes on either side. That last assertion is the sharpest formulation of the original bug: in the pre-fix behavior the composite wrote journals to the local default backend, so any correct test must fail on Files.exists(<workspace>/.agentscope-runtime) — this one proves the negative on both workspaces.
For the record from my withdrawn attempt (#4193): independently-derived same design, so the approach here carries a second implementation's cross-validation. Nothing blocking from my side. The ci(harness): avoid background memory race commit is a sensible de-flake for the new parameterized test.
|
Assign to @aiyili (Review) |
AgentScope-Java Version
2.1.0-SNAPSHOT
Description
Fixes #4140.
Native thread journals configured through
RemoteFilesystemSpecwere silently written to the local workspace.CompositeFilesystem.journalStorage()looked upagents/, which cannot match the more specificagents/<agentId>/sessions/route.Add an optional explicit journal backend to
CompositeFilesystemand haveRemoteFilesystemSpecpass its sessions backend. File routing and the existing two-argument constructor retain their behavior. Journals now use the remote sessions namespace and its configured isolation scope. Existing local journals are not migrated automatically.Rebased onto main at
a4306d63dand adapted to the journal API introduced by #4154:journalStorage,AtomicJournalStorage,ThreadKey,JournalEvent, andWorkspaceThreadJournalStore. Regression tests are in the journal package and the English and Chinese guides are updated underdocs/dev.Tests cover all four isolation scopes, recovery with a different local workspace, user isolation, history discovery, constructor compatibility, and propagation of unsupported-backend errors. The existing isolation example test disables background memory consolidation to avoid racing temporary workspace cleanup.
Validation after rebase:
mvn -B -T1C clean verifypassed, including Spotless checks.npm test,npm run validate, andnpm run broken-linkspassed.The remote storage regression tests use
InMemoryStore; no live MySQL integration was run.Checklist
mvn spotless:applymvn test)