This repository was archived by the owner on May 11, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 823
fix: production hardening — crash bugs, security, logging, 47 tests #225
Open
TheophilusChinomona
wants to merge
4
commits into
Polymarket:main
Choose a base branch
from
TheophilusChinomona:fix/production-hardening
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ab4ef92
fix: production hardening — crash bugs, security, logging, tests
1bbf34c
fix: adversarial review findings — 10 issues caught
f292ed9
fix: lazy CLOB client init + paper trading script
b4f14ad
feat: support any OpenAI-compatible LLM provider (OpenRouter, Groq, e…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| .git | ||
| .gitignore | ||
| .github | ||
| .venv | ||
| __pycache__ | ||
| *.pyc | ||
| *.pyo | ||
| .env | ||
| .env.* | ||
| !.env.example | ||
| tests/ | ||
| docs/images/ | ||
| *.md | ||
| !README.md | ||
| .pre-commit-config.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,15 @@ | ||
| FROM python:3.9 | ||
| FROM python:3.9-slim | ||
|
|
||
| COPY . /home | ||
| WORKDIR /home | ||
| WORKDIR /app | ||
|
|
||
| RUN pip3 install -r requirements.txt | ||
| # Install dependencies first for layer caching | ||
| COPY requirements.txt . | ||
| RUN pip install --no-cache-dir -r requirements.txt | ||
|
|
||
| # Copy application code | ||
| COPY agents/ agents/ | ||
| COPY scripts/ scripts/ | ||
|
|
||
| ENV PYTHONPATH="/app" | ||
|
|
||
| CMD ["python", "scripts/python/cli.py"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,27 @@ | ||
| from agents.application.trade import Trader | ||
|
|
||
| import logging | ||
| import time | ||
|
|
||
| from scheduler import Scheduler | ||
| from scheduler import Scheduler as TimeScheduler | ||
| from scheduler.trigger import Monday | ||
|
|
||
| from agents.application.trade import Trader | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| class Scheduler: | ||
| class TradingScheduler: | ||
| def __init__(self) -> None: | ||
| self.trader = Trader() | ||
| self.schedule = Scheduler() | ||
| self.schedule = TimeScheduler() | ||
|
|
||
| def start(self) -> None: | ||
| logger.info("Starting trading scheduler loop") | ||
| while True: | ||
| self.schedule.exec_jobs() | ||
| time.sleep(1) | ||
|
|
||
|
|
||
| class TradingAgent(Scheduler): | ||
| class TradingAgent(TradingScheduler): | ||
| def __init__(self) -> None: | ||
| super() | ||
| self.trader = Trader() | ||
| self.weekly(Monday(), self.trader.one_best_trade) | ||
| super().__init__() | ||
| self.schedule.weekly(Monday(), self.trader.one_best_trade) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI is running pytest directly against the source tree, but the added tests import
agents.*and current CI output indicatesModuleNotFoundError: No module named 'agents'. Make the package importable in the workflow (e.g., exportPYTHONPATH=$GITHUB_WORKSPACE, add a minimal packaging config andpip install -e ., and/or addagents/__init__.py).