chore: linting

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-04-28 21:37:51 -07:00
parent b9a66cb417
commit ca9bbee06d
41 changed files with 314 additions and 244 deletions

View file

@ -59,7 +59,7 @@ class AgentFeatureFlagsRead(BaseModel):
enable_otel: bool
@classmethod
def from_flags(cls, flags: AgentFeatureFlags) -> "AgentFeatureFlagsRead":
def from_flags(cls, flags: AgentFeatureFlags) -> AgentFeatureFlagsRead:
# asdict() avoids missing-field bugs when AgentFeatureFlags grows.
return cls(**asdict(flags))

View file

@ -210,7 +210,7 @@ async def create_rule(
session.add(row)
try:
await session.commit()
except IntegrityError:
except IntegrityError as err:
await session.rollback()
raise HTTPException(
status_code=409,
@ -218,7 +218,7 @@ async def create_rule(
"An identical rule already exists for this scope. Update the "
"existing rule instead."
),
)
) from err
await session.refresh(row)
return _to_read(row)
@ -248,12 +248,12 @@ async def update_rule(
try:
await session.commit()
except IntegrityError:
except IntegrityError as err:
await session.rollback()
raise HTTPException(
status_code=409,
detail="Update would create a duplicate rule for this scope.",
)
) from err
await session.refresh(row)
return _to_read(row)

View file

@ -97,10 +97,12 @@ async def revert_agent_action(
action=action,
requester_user_id=str(user.id) if user is not None else None,
)
except Exception:
except Exception as err:
logger.exception("Revert dispatch raised for action_id=%s", action_id)
await session.rollback()
raise HTTPException(status_code=500, detail="Internal error during revert.")
raise HTTPException(
status_code=500, detail="Internal error during revert."
) from err
if outcome.status == "ok":
await session.commit()

View file

@ -1242,7 +1242,9 @@ async def handle_new_chat(
await session.close()
image_urls = (
[p.as_data_url() for p in request.user_images] if request.user_images else None
[p.as_data_url() for p in request.user_images]
if request.user_images
else None
)
return StreamingResponse(