Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

fix agent remarks

thomashebrardd06960187ed5
diff --git a/pipelex/cli/commands/doctor_cmd.py b/pipelex/cli/commands/doctor_cmd.py
index 6bc8e8289..45fc32673 100644
--- a/pipelex/cli/commands/doctor_cmd.py
+++ b/pipelex/cli/commands/doctor_cmd.py
@@ -667,8 +667,10 @@ def check_deck_sync(config_dir: Path | None = None) -> tuple[bool, DeckSyncRepor
Returns:
Tuple of (is_healthy, sync_report, summary_message)
"""
- effective_config_dir = config_dir or config_manager.pipelex_config_dir
- deck_dir = Path(effective_config_dir) / "inference" / "deck"
+ # When no explicit config_dir is given, mirror runtime layered resolution so we report
+ # against the deck that's actually in use (project .pipelex/ wins when it ships a deck,
+ # otherwise we fall through to the global deck).
+ deck_dir = Path(config_dir) / "inference" / "deck" if config_dir is not None else config_manager.model_decks_dir_path
if not deck_dir.exists():
# Match the existing doctor pattern: surface as healthy when the area isn't initialized,
diff --git a/pipelex/cli/commands/update_cmd.py b/pipelex/cli/commands/update_cmd.py
index f60fd45fc..d488a0469 100644
--- a/pipelex/cli/commands/update_cmd.py
+++ b/pipelex/cli/commands/update_cmd.py
@@ -92,9 +92,10 @@ def _resolve_deck_dir(local: bool) -> Path:
if local:
project_root = config_manager.project_root
base = project_root / ".pipelex" if project_root is not None else Path.cwd() / ".pipelex"
- else:
- base = config_manager.pipelex_config_dir
- return base / "inference" / "deck"
+ return base / "inference" / "deck"
+ # Match runtime resolution: fall through to the global deck when the project .pipelex/
+ # does not contain inference/deck, so update targets the deck actually in use.
+ return config_manager.model_decks_dir_path
def _print_status_table(report: DeckSyncReport, deck_dir: Path) -> None:
diff --git a/pipelex/core/concepts/structure_generation/generator.py b/pipelex/core/concepts/structure_generation/generator.py
index 635e83042..a119f386b 100644
--- a/pipelex/core/concepts/structure_generation/generator.py
+++ b/pipelex/core/concepts/structure_generation/generator.py
@@ -219,12 +219,14 @@ class StructureGenerator:
return f"description={escaped}"
# Join trailing space on each chunk except the last so the concatenation reads
# naturally; textwrap dropped the original spaces.
+ # Indent chunk literals (and the closing paren) so `ruff format` preserves the
+ # implicit-string-concat — un-indented chunks get collapsed back to a single line.
chunk_literals: list[str] = []
for index, chunk in enumerate(chunks):
content = chunk if index == len(chunks) - 1 else f"{chunk} "
- chunk_literals.append(self._escape_string_for_python(content))
+ chunk_literals.append(f" {self._escape_string_for_python(content)}")
body = "\n".join(chunk_literals)
- return f"description=(\n{body}\n)"
+ return f"description=(\n{body}\n )"
def _generate_class_source_code_from_blueprint(
self,
diff --git a/tests/unit/pipelex/core/concepts/structure_generation/test_structure_generator_wrapping.py b/tests/unit/pipelex/core/concepts/structure_generation/test_structure_generator_wrapping.py
index 4197426ba..f911318a5 100644
--- a/tests/unit/pipelex/core/concepts/structure_generation/test_structure_generator_wrapping.py
+++ b/tests/unit/pipelex/core/concepts/structure_generation/test_structure_generator_wrapping.py
@@ -12,6 +12,12 @@ Generated structure files must stay under the project's ruff line-length limit
For short descriptions, both fall back to the compact single-line form.
"""
+import shutil
+import subprocess # noqa: S404
+from pathlib import Path
+
+import pytest
+
from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldType
from pipelex.core.concepts.structure_generation.generator import StructureGenerator
@@ -120,6 +126,57 @@ class TestStructureGeneratorWrapping:
]:
assert fragment in code
+ def test_long_field_description_survives_ruff_format(self, tmp_path: Path):
+ """Generated multi-line description blocks must survive `ruff format` without
+ the chunks being collapsed back into a single line. Un-indented chunks under a
+ hanging-indent paren block get joined by ruff format, defeating the wrap.
+ """
+ ruff_bin = shutil.which("ruff")
+ if ruff_bin is None:
+ pytest.skip("ruff not on PATH")
+
+ long_description = (
+ "Whether a factual answer could in principle be derived from documents. False for counterfactual, opinion, "
+ "and out_of_scope questions. This field is the central gate that prevents synthesis from forcing a question "
+ "into an answerable type just to be helpful."
+ )
+ blueprint = {
+ "is_answerable_from_documents": ConceptStructureBlueprint(
+ description=long_description,
+ type=ConceptStructureBlueprintFieldType.BOOLEAN,
+ required=True,
+ ),
+ }
+ code, _ = StructureGenerator().generate_from_structure_blueprint(
+ class_name="QuestionAnalysis",
+ structure_blueprint=blueprint,
+ )
+
+ target = tmp_path / "generated.py"
+ target.write_text(code)
+ subprocess.run([ruff_bin, "format", str(target)], check=True, capture_output=True) # noqa: S603
+ formatted = target.read_text()
+
+ # The implicit-string-concat must still be present after formatting — i.e. ruff
+ # didn't merge the chunks. We check by counting string literal lines inside the
+ # description block.
+ assert "description=(" in formatted
+ # At least two string-literal lines remain inside the description block.
+ in_block = False
+ literal_lines = 0
+ for line in formatted.splitlines():
+ stripped = line.strip()
+ if "description=(" in stripped:
+ in_block = True
+ continue
+ if in_block:
+ if stripped.startswith((")", "),")):
+ break
+ if stripped.startswith('"'):
+ literal_lines += 1
+ assert literal_lines >= 2, f"ruff format collapsed the description chunks; got {literal_lines} literal line(s)"
+ assert _max_line_length(formatted) <= _LINE_LIMIT
+
def test_long_descriptions_in_long_class_produce_clean_output(self):
"""End-to-end: a class with a long docstring AND multiple long field descriptions
still stays under the line limit on every emitted line.