degrade optional workspace writes safely
This commit is contained in:
6
agent.py
6
agent.py
@@ -409,7 +409,11 @@ def _read_uploaded_workspace_file(ctx: RunContext[PlatformUserAuth], path: str)
|
||||
|
||||
async def _write_workspace_output(ctx: RunContext[PlatformUserAuth], path: str, payload: dict[str, Any], warnings: list[str]) -> None:
|
||||
data = json.dumps(payload, indent=2, sort_keys=True).encode("utf-8")
|
||||
workspace = ctx.workspace
|
||||
try:
|
||||
workspace = ctx.workspace
|
||||
except PermissionError as exc:
|
||||
warnings.append(f"workspace write skipped: {str(exc)[:160]}")
|
||||
return
|
||||
writer = getattr(workspace, "write_bytes", None)
|
||||
if callable(writer):
|
||||
writer(path, data)
|
||||
|
||||
Reference in New Issue
Block a user