Skip to content

fix(harness): normalize double-slash record paths in async tool registry (#3975) - #4194

Open
aiyili wants to merge 1 commit into
agentscope-ai:mainfrom
aiyili:fix/async-registry-record-path
Open

aiyili wants to merge 1 commit into
agentscope-ai:mainfrom
aiyili:fix/async-registry-record-path

Conversation

@aiyili

@aiyili aiyili commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Summary

The by-id terminal updates on WorkspaceAsyncToolRegistry — complete(id, ...), fail(id, ...), markTimeout(id) — are silent no-ops when the backing filesystem is a RemoteFilesystem.

Root cause chain (as reported, verified at main a4306d63):

  1. RemoteFilesystem.ls() emits directory entries with a trailing slash (both the index fast path and the store fallback — that slash is the dir/file marker).
  2. findRecordPath concatenates sessionDir.path() + "/" + id + ".json" onto a path that already ends in /, producing <root>/<session>//<id>.json.
  3. RemoteFilesystem.normalizePath only ensures a leading slash and strips one trailing slash — the interior // survives, no key matches, findRecordPath returns null, and the update silently does nothing.

register writes the record to the clean path (recordPath()), so the mismatch is purely on the lookup side. The local backend never surfaced this because its ls entries carry no trailing slash — the existing test suite is exclusively local-fs.

Fix

Normalize the composed record path at the registry boundary (strip trailing slashes from the ls-derived directory entry before joining) instead of changing RemoteFilesystem.ls()'s trailing-slash contract, which other callers may rely on for directory detection.

Regression

byIdTerminalUpdatesReachRecordsOnRemoteBackends: registry over RemoteFilesystem + InMemoryStore — complete and markTimeout must actually update the record (observable via findStale), which today silently no-ops.

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

- findRecordPath 拼接 ls 目录条目时剥离尾部斜杠:RemoteFilesystem 的
  目录条目带尾部 '/',原样拼接产生 '<session>//<id>.json',
  normalizePath 不清内部双斜杠,complete/fail/markTimeout 全部静默 no-op
- 不改 RemoteFilesystem.ls 的尾部斜杠契约(其他调用方依赖目录标记)
- 回归:RemoteFilesystem + InMemoryStore 后端上 complete/markTimeout
  必须真实更新记录
aiyili added a commit to aiyili/agentscope-java that referenced this pull request Nov 15, 2026
The ubuntu job failed on RocketMqExecutionTest.agentScopeResumesThroughSeparateLedgersDespitePublicationAndAckFailures (polling deadline 'Condition did not become true', 10s await under CI load). The test lives in the durable-rocketmq extension, references no HarnessAgent API, and passed on the sibling PR runs (agentscope-ai#4194/agentscope-ai#4196) minutes earlier — a timing flake, not a regression from this diff. Re-triggering CI.
@jujn jujn added the P1 紧急不重要 label Nov 16, 2026

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

P1 紧急不重要

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants