Skip to content

Fix load_dotenv timing bug, remove global RNG seed, improve error handling#4

Merged
AbeerChaturvedi merged 2 commits into
mainfrom
copilot/fix-app-main-function
Apr 11, 2026
Merged

Fix load_dotenv timing bug, remove global RNG seed, improve error handling#4
AbeerChaturvedi merged 2 commits into
mainfrom
copilot/fix-app-main-function

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

  • Review all source files for genuine improvements (skipping commented code)
  • Fix load_dotenv() timing bug in inference.py (was called too late, after env vars read)
  • Return HTTP 400 for RuntimeError in /step endpoint (was falling through to 500)
  • Add timeout=30 to urlopen() in hf_create.py (prevent indefinite hang)
  • Remove stale random.seed(42) at module level in environment.py (class uses own RNG)
  • Verify all 78 tests pass
  • CodeQL clean

Copilot AI and others added 2 commits April 11, 2026 11:45
…dling

- inference.py: Call load_dotenv() at module level before os.getenv() reads,
  fixing a bug where .env-only config was silently ignored
- environment.py: Remove module-level random.seed(42) that unnecessarily
  polluted the global RNG (class already uses its own Random instance)
- server/app.py: Catch RuntimeError from step-before-reset separately and
  return 400 instead of 500 (it's a client error, not a server error)
- hf_create.py: Add timeout=30 to urlopen to prevent indefinite hangs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: AbeerChaturvedi <171315954+AbeerChaturvedi@users.noreply.github.com>
Copilot AI requested a review from AbeerChaturvedi April 11, 2026 11:55
@AbeerChaturvedi AbeerChaturvedi marked this pull request as ready for review April 11, 2026 11:56
@AbeerChaturvedi AbeerChaturvedi merged commit 2ad77d8 into main Apr 11, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants