Skip to content

Add AI inference validation & retries, improve reporting, and harden data/clients#44

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

Add AI inference validation & retries, improve reporting, and harden data/clients#44
Rohan5commit merged 2 commits into
mainfrom
codex/document-ai-bot-functionality-and-changes-lwnoss

Conversation

@Rohan5commit
Copy link
Copy Markdown
Owner

Motivation

  • Improve reliability of daily runs by validating and retrying AI and Core execution paths and ensuring end-to-end email coverage.
  • Prefer and validate configured remote inference endpoints (Cerebrium / trained-model) and fall back cleanly to local distilled runtime.
  • Simplify email rationale to surface model-provided reasons and surface AI runtime metadata in reports.
  • Harden price ingestion and trained-model HTTP client to tolerate malformed CSVs, alternate endpoint shapes and transient errors.

Description

  • Workflow: added disable_core_trading input, added core and AI retry steps, added a Validate Cerebrium primary configuration step, a Verify Cerebrium predict endpoint preflight that POSTs a sample payload, updated plan_ai_runtime usage to consider TRAINED_MODEL_INFERENCE_URL, and added an Ensure Daily Email Coverage guard and more granular failure reporting conditions in /.github/workflows/daily_trading_bot.yml.
  • Email/reporting: updated email_notifier.py to stop rewriting model reasons and instead return model-provided decision_reason, include performance_period_start and detailed AI runtime metadata when subject_tag == 'AI', and adjust pipeline summary behavior.
  • Ingestion: improved Stooq fetching in ingest_prices.py to iterate candidate tickers robustly, use on_bad_lines='skip', validate required columns, and log warnings rather than failing.
  • LLM/Ai logic: in llm_trader.py added neutral-breakout soft-cash deployment logic that can convert neutral predictions into directional signals under controlled criteria and introduced guards using soft_cash_deploy_enabled and whether positions are open.
  • Main/backtest and positions: added performance_period_start propagation to core and AI reports in main.py, suppressed rotation closes when the model signalled skipped reasons (e.g. all_neutral/no_action) and record a HOLD decision, and added get_performance_period_start helper to positions.py.
  • Trained model client: in trained_model_client.py added support for additional provider name variants, improved retry/backoff logic including trying alternate prediction URL shapes on 404, made /health handling tolerant for providers that lack a /health route, and exposed additional settings like backoff and batch sizing.

Testing

  • No automated test suite was executed as part of this change; changes were limited to CI workflow, email formatting, ingestion/client robustness, and runtime decision logic and should be validated in integration runs under the updated GitHub Actions workflow.

Codex Task

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