Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/langchain/followup_issue_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,11 +988,11 @@ def _invoke_llm(
) -> str:
"""Invoke LLM and return response text."""
try:
from langchain_core import messages as langchain_messages
import langchain_core.messages as lc_messages
except ModuleNotFoundError:
human_message_cls = None
else:
human_message_cls = getattr(langchain_messages, "HumanMessage", None)
human_message_cls = lc_messages.HumanMessage

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refactoring changes the error handling behavior. The original code used getattr with a default of None, which would gracefully handle the case where HumanMessage doesn't exist in the module. The new code directly accesses lc_messages.HumanMessage, which will raise an AttributeError (not caught by the ModuleNotFoundError handler) if HumanMessage doesn't exist. While unlikely in practice since HumanMessage is a core class, this represents a functional change in error handling that deviates from the defensive programming pattern used in the original code.

Suggested change
human_message_cls = lc_messages.HumanMessage
human_message_cls = getattr(lc_messages, "HumanMessage", None)

Copilot uses AI. Check for mistakes.

config = _build_llm_config(
operation=operation,
Expand Down
1 change: 0 additions & 1 deletion scripts/langchain/issue_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@
python scripts/langchain/issue_optimizer.py --input-file issue.md --json
"""

from __future__ import annotations

import argparse
import json
import re
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Any

from pydantic import BaseModel, ConfigDict, Field

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to PEP 8 import conventions, there should be a blank line between third-party imports (pydantic) and first-party imports (scripts). Removing this blank line violates PEP 8 import grouping standards. The ruff configuration in pyproject.toml includes isort (line 82: "I") which enforces these conventions and would likely flag this as an issue.

Suggested change
from pydantic import BaseModel, ConfigDict, Field
from pydantic import BaseModel, ConfigDict, Field

Copilot uses AI. Check for mistakes.

from scripts.langchain.structured_output import (
DEFAULT_REPAIR_PROMPT,
build_repair_callback,
parse_structured_output,
)

Check failure on line 24 in scripts/langchain/issue_optimizer.py

View workflow job for this annotation

GitHub Actions / Python CI / lint-ruff

Ruff (I001)

scripts/langchain/issue_optimizer.py:9:1: I001 Import block is un-sorted or un-formatted

Check failure on line 24 in scripts/langchain/issue_optimizer.py

View workflow job for this annotation

GitHub Actions / Python CI / lint-ruff

Ruff (I001)

scripts/langchain/issue_optimizer.py:9:1: I001 Import block is un-sorted or un-formatted

try:
from scripts.langchain.injection_guard import check_prompt_injection
Expand Down
1 change: 0 additions & 1 deletion scripts/langchain/pr_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,24 @@
python scripts/langchain/pr_verifier.py --context-file verifier-context.md --json
"""

from __future__ import annotations

import argparse
import json
import logging
import os
import re
import sys
from dataclasses import dataclass
from pathlib import Path
from typing import Literal

from pydantic import BaseModel, Field

Copilot AI Feb 15, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to PEP 8 import conventions, there should be a blank line between third-party imports (pydantic) and first-party imports (scripts). Removing this blank line violates PEP 8 import grouping standards. The ruff configuration in pyproject.toml includes isort (line 82: "I") which enforces these conventions and would likely flag this as an issue.

Suggested change
from pydantic import BaseModel, Field
from pydantic import BaseModel, Field

Copilot uses AI. Check for mistakes.

from scripts import api_client
from scripts.langchain.structured_output import (
build_repair_callback,
parse_structured_output,
)

Check failure on line 26 in scripts/langchain/pr_verifier.py

View workflow job for this annotation

GitHub Actions / Python CI / lint-ruff

Ruff (I001)

scripts/langchain/pr_verifier.py:9:1: I001 Import block is un-sorted or un-formatted

Check failure on line 26 in scripts/langchain/pr_verifier.py

View workflow job for this annotation

GitHub Actions / Python CI / lint-ruff

Ruff (I001)

scripts/langchain/pr_verifier.py:9:1: I001 Import block is un-sorted or un-formatted

LOGGER = logging.getLogger(__name__)

Expand Down
Loading