Commit 00e8012
committed
fix(showcase): claude-sdk-python missing openai dep crashed agent on import
Root cause: src/agents/a2ui_dynamic.py imported `openai` at module top
level, but openai was not in requirements.txt. The agent_server.py imports
a2ui_dynamic at top level too, so on container startup the entire FastAPI
module failed to load with ModuleNotFoundError. entrypoint.sh's startup
gate ("Agent failed to start - exiting") then bailed before Next.js
launched, taking the whole container down. Railway's restart loop made
every /demos/<id> route unreachable, which is exactly the symptom the
D2 e2e-readiness probe reports as red across all 9 features in this
framework column.
Two-part fix:
- Add openai>=1.50.0 to requirements.txt so the dep is actually
installed in the agent-builder stage.
- Move the `import openai` to a lazy import inside _generate_a2ui
(mirroring the same pattern in agents/agent.py:339), so a future
requirements regression localizes the failure to the one
declarative-gen-ui demo instead of nuking the whole backend on
module load.1 parent 360cfb9 commit 00e8012
2 files changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
83 | 82 | | |
84 | 83 | | |
85 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
87 | 93 | | |
88 | 94 | | |
| |||
0 commit comments