Skip to content

Commit 458d053

Browse files
foleydangclaude
andcommitted
fix: address code review findings in files, transport, and models
- Fix files.py fetch_next to use after_id instead of page for IdCursorPage - Remove dead sync close() body in AsyncTransport (AsyncClient has no sync close) - Handle string agent values in Session.agent_id property Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d21b099 commit 458d053

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

dashscope/agentstudio/resources/files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def list(
190190
def fetch_next(token: str) -> IdCursorPage[File]:
191191
return self.list(
192192
limit=limit,
193-
page=token,
193+
after_id=token,
194194
scope_id=scope_id,
195195
)
196196

@@ -291,7 +291,7 @@ async def list(
291291
async def fetch_next(token: str) -> AsyncIdCursorPage[File]:
292292
return await self.list(
293293
limit=limit,
294-
page=token,
294+
after_id=token,
295295
scope_id=scope_id,
296296
)
297297

dashscope/agentstudio/transport.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -664,12 +664,7 @@ async def _parse(self, resp: httpx.Response) -> APIResponse:
664664
)
665665

666666
def close(self) -> None:
667-
"""Best-effort synchronous close (for __del__ / GC safety)."""
668-
if self._owns_client:
669-
try:
670-
self._client.close()
671-
except Exception:
672-
pass
667+
"""No-op: AsyncClient requires async cleanup via aclose()."""
673668

674669
async def aclose(self) -> None:
675670
if self._owns_client:

dashscope/agentstudio/types/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,9 @@ def __init__(self, **kwargs: Any) -> None:
475475
@property
476476
def agent_id(self) -> Optional[str]:
477477
a = self.agent
478-
return a.id if isinstance(a, Agent) else None
478+
if isinstance(a, Agent):
479+
return a.id
480+
return a if isinstance(a, str) else None
479481

480482
@property
481483
def agent_version(self) -> Optional[int]:

0 commit comments

Comments
 (0)