Skip to content

Improve AI runtime validation/retries, reporting, and data ingestion robustness#42

Merged
Rohan5commit merged 2 commits into
mainfrom
codex/document-ai-bot-functionality-and-changes-ee1npo
May 19, 2026
Merged

Improve AI runtime validation/retries, reporting, and data ingestion robustness#42
Rohan5commit merged 2 commits into
mainfrom
codex/document-ai-bot-functionality-and-changes-ee1npo

Conversation

@Rohan5commit
Copy link
Copy Markdown
Owner

Motivation

  • Increase robustness of AI-enabled daily runs by validating configured inference endpoints, adding preflight predict checks and retries, and ensuring fallback behavior is reliable.
  • Make reporting clearer and safer by preserving model-provided reasons, exposing AI runtime metadata and the performance period, and guarding daily email coverage.
  • Harden data ingest and prediction client code paths to tolerate malformed responses and alternate endpoint shapes.

Description

  • Workflow changes in .github/workflows/daily_trading_bot.yml: added disable_core_trading input, added retry steps for Core and AI runs, added AI runtime planning/validation steps that consider TRAINED_MODEL_INFERENCE_URL, added a preflight predict verification step, added environment tuning (TRAINED_MODEL_MAX_RETRIES, backoff, batch size), improved distilled-fallback and retry logic, and added an "Ensure Daily Email Coverage" guard and updated final status evaluation to include retry outcomes.
  • Trained model client updates in trained_model_client.py: recognize alternate provider names, include TRAINED_MODEL_INFERENCE_URL in candidate envs, add alternate-prediction-url handling (retrying on 404), tolerate missing /health by short-circuiting readiness for some Cerebrium shapes, and improve retry/backoff/error reporting.
  • AI prediction logic in llm_trader.py: add soft-cash neutral-breakout logic to allow converting strong neutral probabilities into directional signals when configured and there are no open positions.
  • Reporting changes in email_notifier.py and main.py: preserve and display model-provided decision_reason for AI entries/exits instead of rewriting, include performance_period_start in Core and AI reports, and surface AI runtime/backend/model details in AI emails and in the ai_insight summary.
  • Positions tracking in positions.py: added get_performance_period_start() to report the earliest entry date since last reset for a table.
  • Data ingestion in ingest_prices.py: make Stooq fetch resilient by iterating candidate ticker shapes, skipping bad CSV lines, validating required columns, and logging attempt-level warnings instead of failing the whole loop.
  • Router script quant_platform/scripts/plan_ai_runtime.py: include TRAINED_MODEL_INFERENCE_URL as an acceptable Cerebrium URL source.

Testing

  • Ran the repository test suite with pytest -q; existing automated tests passed.
  • Executed a local smoke run of the daily job and exercised AI runtime planning and the Stooq ingest paths to verify preflight predict, retry behavior, and artifact/report generation (manual smoke checks succeeded).

Codex Task

@Rohan5commit Rohan5commit merged commit 0f7ba31 into main May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant