Skip to content

fix(harness): delegate session journals to the sessions route backend (#4140) - #4193

Closed
aiyili wants to merge 1 commit into
agentscope-ai:mainfrom
aiyili:fix/sessionjournal-route
Closed

aiyili wants to merge 1 commit into
agentscope-ai:mainfrom
aiyili:fix/sessionjournal-route

Conversation

@aiyili

@aiyili aiyili commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Summary

CompositeFilesystem.journalStorage() selected its backend with a synthetic single-segment query — routeForPath("agents/") — which can never prefix-match the spec's registered session route agents/{agentId}/sessions/ (prefix matching requires the query path to start with the route prefix). Every Native Session Log silently landed on the default local backend: no exception, no WARN, agentscope_store stays empty, and pod recycling loses session history in multi-replica deployments.

Same "prefix-hierarchy mismatch" family as #2918 / #2693, but a call site PR #3386 did not touch.

Fix

Session journals are a capability outside the route table's path space — they cannot be selected with a synthetic query path at all. The party that assembles the route table knows the sessions backend, so it names it explicitly:

  • CompositeFilesystem gains an optional journalStorageBackend constructor parameter; journalStorage() delegates to it when set, keeping the legacy fallback for composites assembled without one (non-spec composites — RoutedSandboxFilesystem, builder routes — behave exactly as before).
  • RemoteFilesystemSpec.toFilesystem keeps a reference to the sessions overlay it already builds and passes it to the composite. OverlayFilesystem.journalStorage delegates to its upper RemoteFilesystem, so the storage is StoreJournalStorage(store, <user-namespace> + sessions segment) — the backend the reporter verified as correct when bypassing the composite.

Regression

journalStorageDelegatesToTheSessionsRouteBackend: a CAS write through the spec-composed composite must land in the store under the sessions namespace (agents/{agentId}/users/{uid}/sessions/__agentscope_session_log_v1__) and round-trip through a read on the same storage — the exact discriminator from the reporter's reproduction.

Full harness module suite green on the merged batch state (1833/1833).

…e-ai#4140)

- CompositeFilesystem 新增可选 journalStorageBackend 构造参数:
  Native Session Log 属于路由表之外的能力面,无法用合成查询路径选择
- RemoteFilesystemSpec 装配时保留 sessions overlay 引用并显式传入:
  'agents/' 永远 prefix-match 不到 'agents/{agentId}/sessions/' 路由,
  旧实现静默把 journal 落到本地默认后端,远程 store 始终为空
- 保留无参构造的旧回退行为(非 spec 装配的 composite 不受影响)
- 回归:复合面写入必须落在 store 的 sessions 命名空间并可读回
@aiyili

aiyili commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Withdrawing in favor of #4146 — @iluv7 submitted the same approach three days before I started (#4146 opened 11-12; I claimed the issue on 11-15 and missed it because my timeline check relied on the events API, which did not surface the cross-reference).

Design note: my independent implementation converged on the identical shape (optional explicit backend + spec passes the sessions overlay + two-arg constructor preserved), which I've posted as a review on #4146 — plus one actionable point there: #4154 renamed sessionStorage → journalStorage under this PR, so it needs a rebase onto current main before merge.

My branch is deleted; the regression idea I had (CAS write through the composite must land in the store's sessions namespace) is covered by the broader RemoteSessionRoutingTest here.

@aiyili aiyili closed this Nov 15, 2026
@aiyili
aiyili deleted the fix/sessionjournal-route branch November 15, 2026 02:28
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.

1 participant