Fix workspace instruction lifecycle edge cases

This commit is contained in:
Yichen Jiang
2026-07-13 20:39:32 +08:00
parent a0e917ffe3
commit c2f2740a3e
10 changed files with 431 additions and 45 deletions

View File

@@ -117,6 +117,7 @@ export class LocalFileSystem extends FileSystem {
override async stat(target: FsTarget, signal?: AbortSignal): Promise<FsInfo | undefined> {
if (signal?.aborted) throw new FsError('stat aborted', 'FS_ABORTED')
const info = await probe(target.targetKey)
if (signal?.aborted) throw new FsError('stat aborted', 'FS_ABORTED')
if (!info) return undefined
return { version: info.version, type: info.type, size: info.size }
}
@@ -125,6 +126,7 @@ export class LocalFileSystem extends FileSystem {
if (signal?.aborted) throw new FsError('lstat aborted', 'FS_ABORTED')
if (path.trim().length === 0) throw new FsError('file_path must be a non-empty string', 'FS_NOT_FOUND')
const info = await probeNoFollow(resolve(opts?.cwd ?? this.config.cwd, path))
if (signal?.aborted) throw new FsError('lstat aborted', 'FS_ABORTED')
if (!info) return undefined
return { version: info.version, type: info.type, size: info.size }
}