You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: WorkspaceAsyncToolRegistry by-id terminal updates silently no-op (double-slash record path from ls trailing slashes) #3975
The by-id terminal-update overloads on WorkspaceAsyncToolRegistry — complete(String id, String result), fail(String id, String error), markTimeout(String id) (WorkspaceAsyncToolRegistry.java:82-92) — are silent no-ops when the registry is backed by a RemoteFilesystem over any BaseStore.
Root cause chain (all line numbers at main @ f9d717e):
RemoteFilesystem.ls() returns directory entries with a trailing slash — both the index fast path (RemoteFilesystem.java:243) and the store fallback (:269) emit normalizedPath + subdirName + "/".
findRecordPath concatenates sessionDir.path() + "/" + id + ".json" (WorkspaceAsyncToolRegistry.java:180), producing a path with an interior double slash: <root>/<session>//<id>.json.
normalizePath (RemoteFilesystem.java:792) only ensures a leading slash and strips one trailing slash — it does not collapse interior double slashes.
exists() therefore probes a key that never matches the stored <root>/<session>/<id>.json key, findRecordPath returns null, and updateStatus returns early with no logging (WorkspaceAsyncToolRegistry.java:127-131).
Effect: a record updated through the by-id path stays RUNNING forever, so InboxMiddleware stale detection (findStale) later reports it as timed out even when the background execution actually finished. The by-sessionId overloads are unaffected — they build the path via recordPath(sessionId, id), which has no double slash.
To reproduce
Construct WorkspaceAsyncToolRegistry on a RemoteFilesystem over any BaseStore.
Register a record (e.g. via register(...)); note its id and that the on-disk key is <root>/<session>/<id>.json.
WorkspaceAsyncToolRegistry over RemoteFilesystem (BaseStore-backed)
Suggested fix
Strip the trailing slash from sessionDir.path() before appending the record file name in findRecordPath (single-line fix). Alternatively, normalizePath could collapse interior double slashes so exists() is robust against this class of path construction — but the targeted fix in findRecordPath is minimal and safe.
Claiming — the root-cause chain in the report checks out against main. RemoteFilesystem.ls() legitimately emits trailing slashes for directory entries (that's the dir/file distinction surfacing through the store index), and WorkspaceAsyncToolRegistry.findRecordPath then concatenates sessionDir.path() + "/" + id + ".json" onto a path that already ends in /, producing <root>/<session>//<id>.json. RemoteFilesystem.normalizePath strips one trailing slash only, so the interior // survives and the record is written to / read from a different key than complete(id, ...)'s callers expect.
Proposed fix: normalize the composed record path at the registry boundary (collapse duplicate separators before handing it to the filesystem) rather than changing ls()'s trailing-slash contract, which other callers may rely on for directory detection. Regression: build the registry over RemoteFilesystem + InMemoryStore, call complete/fail/markTimeout by id, and assert the terminal state is observable through get (today it silently no-ops).
Activity
aiyili commentedon Nov 15, 2026
Claiming — the root-cause chain in the report checks out against main.
RemoteFilesystem.ls()legitimately emits trailing slashes for directory entries (that's the dir/file distinction surfacing through the store index), andWorkspaceAsyncToolRegistry.findRecordPaththen concatenatessessionDir.path() + "/" + id + ".json"onto a path that already ends in/, producing<root>/<session>//<id>.json.RemoteFilesystem.normalizePathstrips one trailing slash only, so the interior//survives and the record is written to / read from a different key thancomplete(id, ...)'s callers expect.Proposed fix: normalize the composed record path at the registry boundary (collapse duplicate separators before handing it to the filesystem) rather than changing
ls()'s trailing-slash contract, which other callers may rely on for directory detection. Regression: build the registry overRemoteFilesystem+InMemoryStore, callcomplete/fail/markTimeoutby id, and assert the terminal state is observable throughget(today it silently no-ops).