cezarthegreat Aksel Joonas Reedi commited on
Commit
f893532
·
unverified ·
1 Parent(s): 98e4465

fix(packaging): ship configs/ directory so non-editable installs work (#133)

Browse files

* fix(packaging): ship configs/ directory so non-editable installs work

CLI_CONFIG_PATH in agent.main resolves to <site-packages>/configs/cli_agent_config.json,
but [tool.setuptools.packages.find] only included "agent*" so neither configs/
nor its JSON files were copied during a non-editable install (uv tool install,
pip install without -e). Editable installs worked by accident because they
reference the source tree directly.

Result: ml-intern crashed at startup with FileNotFoundError on every fresh
non-editable install, until the configs were manually copied into site-packages.

Make configs/ a real package (empty __init__.py) and ship its JSON via
[tool.setuptools.package-data]. Verified with uv tool install --reinstall.

* fix(packaging): also ship agent/prompts/*.yaml + agent/README.md

Same root cause as the configs/ shipping fix in the prior commit, with a
worse symptom: ContextManager._load_system_prompt opens
agent/prompts/system_prompt_v3.yaml at runtime, but setuptools doesn't
include non-Python files inside packages without explicit package-data.

Symptom in headless mode: Session() → ContextManager() raises
FileNotFoundError inside submission_loop; agent_task is set to "done with
exception" but headless_main awaits event_queue.get() forever waiting for
"ready", so the process hangs indefinitely with no log output. The
exception is recoverable only via an asyncio task dump.

Editable installs ship the source tree as-is, which is why this didn't
surface until non-editable reinstall.

---------

Co-authored-by: Aksel Joonas Reedi <125026660+akseljoonas@users.noreply.github.com>

Files changed (2) hide show
  1. configs/__init__.py +0 -0
  2. pyproject.toml +14 -1
configs/__init__.py ADDED
File without changes
pyproject.toml CHANGED
@@ -58,7 +58,20 @@ requires = ["setuptools>=64"]
58
  build-backend = "setuptools.build_meta"
59
 
60
  [tool.setuptools.packages.find]
61
- include = ["agent*"]
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  [tool.uv]
64
  package = true
 
58
  build-backend = "setuptools.build_meta"
59
 
60
  [tool.setuptools.packages.find]
61
+ # `configs` ships the JSON files loaded by agent.main.CLI_CONFIG_PATH at
62
+ # runtime (resolves to <site-packages>/configs/cli_agent_config.json).
63
+ # Without it, `uv tool install` / `pip install` produce a broken install
64
+ # that imports fine but crashes at startup with FileNotFoundError.
65
+ include = ["agent*", "configs"]
66
+
67
+ [tool.setuptools.package-data]
68
+ configs = ["*.json"]
69
+ # Agent data files: system prompts loaded by ContextManager._load_system_prompt
70
+ # at runtime (`<site-packages>/agent/prompts/system_prompt_v3.yaml`), plus the
71
+ # package README. Without these, headless_main hangs forever — submission_loop
72
+ # crashes with FileNotFoundError but headless_main doesn't check agent_task.done()
73
+ # and just keeps awaiting the "ready" event_queue item that will never come.
74
+ agent = ["README.md", "prompts/*.yaml"]
75
 
76
  [tool.uv]
77
  package = true