Skip to content

Commit 81b0560

Browse files
pylint fix
1 parent ab6dd0a commit 81b0560

3 files changed

Lines changed: 19 additions & 26 deletions

File tree

src/backend/api/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,4 +1466,4 @@ async def get_generated_image(blob_name: str):
14661466
return Response(content=data, media_type="image/png")
14671467
except Exception as exc:
14681468
logging.error(f"Error retrieving image '{blob_name}': {exc}")
1469-
raise HTTPException(status_code=404, detail="Image not found")
1469+
raise HTTPException(status_code=404, detail="Image not found")

src/backend/orchestration/orchestration_manager.py

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@
2020
from common.config.app_config import config
2121
from common.database.database_base import DatabaseBase
2222
from common.models.messages import TeamConfiguration
23-
from common.utils.markdown_utils import (
24-
normalize_markdown_tables as _normalize_markdown_tables,
25-
reflow_collapsed_table_line as _reflow_collapsed_table_line,
26-
)
23+
from common.utils.markdown_utils import \
24+
normalize_markdown_tables as _normalize_markdown_tables
2725
from models.messages import AgentMessageStreaming, WebsocketMessageType
2826
from orchestration.connection_config import (connection_config,
2927
orchestration_config)
@@ -39,18 +37,18 @@
3937
apply_tool_history_leak_patch()
4038

4139
_BARE_IMAGE_URL_RE = re.compile(
42-
r"(?<![\(\]])"
43-
r"(?<!\]\()"
44-
r"("
45-
# Absolute image URL (any host, or a backend /api/v4/images path)
46-
r"https?://[^\s)]+?(?:/api/v4/images/[^\s)]+?|[^\s)]+?\.(?:png|jpe?g|gif|webp))"
47-
# Bare relative backend image path (emitted by the MCP/backend image tools).
48-
# The (?<![^\s]) guard requires the path to start at whitespace/string-start so
49-
# it never matches the same substring inside an absolute URL.
50-
r"|(?<![^\s])/api/v4/images/[^\s)]+?\.(?:png|jpe?g|gif|webp)"
51-
r")"
52-
r"(?=[\s)\]]|$)",
53-
re.IGNORECASE,
40+
r"(?<![\(\]])"
41+
r"(?<!\]\()"
42+
r"("
43+
# Absolute image URL (any host, or a backend /api/v4/images path)
44+
r"https?://[^\s)]+?(?:/api/v4/images/[^\s)]+?|[^\s)]+?\.(?:png|jpe?g|gif|webp))"
45+
# Bare relative backend image path (emitted by the MCP/backend image tools).
46+
# The (?<![^\s]) guard requires the path to start at whitespace/string-start so
47+
# it never matches the same substring inside an absolute URL.
48+
r"|(?<![^\s])/api/v4/images/[^\s)]+?\.(?:png|jpe?g|gif|webp)"
49+
r")"
50+
r"(?=[\s)\]]|$)",
51+
re.IGNORECASE,
5452
)
5553

5654

@@ -222,25 +220,20 @@ async def get_current_or_new_orchestration(
222220
current is not None and current_team_id != team_config.team_id
223221
)
224222

225-
226223
cls.logger.info(
227224
"get_current_or_new_orchestration: user='%s' selected_team='%s' "
228225
"cached_team='%s' team_switched=%s team_changed=%s current_is_none=%s",
229226
user_id, team_config.team_id, current_team_id,
230227
team_switched, team_changed, current is None,
231228
)
232229

233-
234230
# Full rebuild: no workflow exists, team explicitly switched, or the
235231
# cached workflow belongs to a different team than the selected one.
236232
needs_full_rebuild = current is None or team_switched or team_changed
237233

238-
239234
# Lightweight reset: workflow finished but agents are still valid for the
240235
# same team (a team change always routes to full rebuild above so we
241236
# never reuse the previous team's agents here).
242-
243-
244237
needs_workflow_reset = not needs_full_rebuild and workflow_terminated
245238

246239
if needs_full_rebuild:
@@ -859,4 +852,4 @@ async def _process_event_stream(
859852
if tool_approvals:
860853
result["tool_approvals"] = tool_approvals
861854
return result
862-
return None
855+
return None

src/tests/backend/orchestration/test_orchestration_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,12 +1006,12 @@ def test_given_new_instance_when_init_then_logger_is_set(self):
10061006
assert isinstance(manager.logger, logging.Logger)
10071007

10081008

1009-
# =========================================================================
10101009
# _normalize_markdown_tables (Bug 47810)
1011-
# =========================================================================
10121010
from backend.orchestration.orchestration_manager import ( # noqa: E402
10131011
_normalize_markdown_tables,
1014-
_reflow_collapsed_table_line,
1012+
)
1013+
from common.utils.markdown_utils import ( # noqa: E402
1014+
reflow_collapsed_table_line as _reflow_collapsed_table_line,
10151015
)
10161016

10171017

0 commit comments

Comments
 (0)