Skip to content

Add robust AI runtime validation, retries and email coverage; harden model client and ingest logic#43

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

Add robust AI runtime validation, retries and email coverage; harden model client and ingest logic#43
Rohan5commit merged 2 commits into
mainfrom
codex/document-ai-bot-functionality-and-changes-p8k648

Conversation

@Rohan5commit
Copy link
Copy Markdown
Owner

Motivation

  • Improve reliability of AI trading runs by validating configured Cerebrium/trained-model URLs, preflighting the predict endpoint, and adding retry/fallback paths so AI failures do not silently break nightly runs.
  • Provide operational controls and clearer workflow behaviors by allowing AI-only / core-only manual runs and avoiding duplicate failure reports.
  • Make the trained-model HTTP client more resilient to alternate endpoint shapes and intermittent HTTP errors.
  • Harden data ingestion and email reporting with safer CSV parsing and include performance-period metadata for better observability.

Description

  • GitHub Actions workflow (.github/workflows/daily_trading_bot.yml) enhancements include a new disable_core_trading input, added core and AI retry steps, explicit Cerebrium configuration validation, predict preflight (Verify Cerebrium predict endpoint), expanded runtime planning to consider TRAINED_MODEL_INFERENCE_URL, new retry/backoff envs, distilled fallback/emergency retry paths, better fallback routing logic, and a new Ensure Daily Email Coverage guard to emit failure emails if expected reports were not produced.
  • trained_model_client.py changes add support for provider name variants, include extra candidate envs for inference URLs and API keys, try alternate prediction URL shapes on 404s, handle transient HTTP errors with backoff, and tolerate missing /health by treating certain 404s as a skipped health probe.
  • llm_trader.py updates implement neutral-breakout logic that can convert neutral predictions into directional soft-cash deployments when enabled and when there are no open positions, and track related counters to report behavior.
  • ingest_prices.py now parses Stooq CSV responses with on_bad_lines="skip", validates required columns and logs per-attempt warnings instead of failing the whole lookup, and continues trying alternative ticker shapes.
  • Reporting and state improvements across positions.py, main.py, and email_notifier.py include a get_performance_period_start accessor, attaching performance_period_start to Core and AI reports, suppressing AI rotation closes when the manager explicitly skipped actions, simplifying manager-provided reasons in emails, and enriching AI runtime metadata in email bodies.

Testing

  • No automated unit or integration tests were executed as part of this change; the edits focus on CI workflow orchestration, runtime resilience, and operational logging.

Codex Task

@Rohan5commit Rohan5commit merged commit 7a6f0df 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