Skip to content

[Bug]: WorkspaceAsyncToolRegistry by-id terminal updates silently no-op (double-slash record path from ls trailing slashes) #3975

Open

Description

@yuanshichao1988

Describe the bug

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):

  1. 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 + "/".
  2. findRecordPath concatenates sessionDir.path() + "/" + id + ".json" (WorkspaceAsyncToolRegistry.java:180), producing a path with an interior double slash: <root>/<session>//<id>.json.
  3. normalizePath (RemoteFilesystem.java:792) only ensures a leading slash and strips one trailing slash — it does not collapse interior double slashes.
  4. 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

  1. Construct WorkspaceAsyncToolRegistry on a RemoteFilesystem over any BaseStore.
  2. Register a record (e.g. via register(...)); note its id and that the on-disk key is <root>/<session>/<id>.json.
  3. Call asyncToolRegistry.markTimeout(id).block() (or complete(id, result) / fail(id, error)).
  4. Read the record back: the status is still RUNNING.

Expected behavior

The by-id overloads should find and update the record, the same way the by-sessionId overloads do.

Environment

  • agentscope-harness @ main f9d717e
  • 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.

Activity

  1. added
    bug
    on Nov 4, 2026
  2. aiyili commented on Nov 15, 2026

    @aiyili
    Contributor

    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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions