Skip to content

Fix AI cash reporting and require email failures to surface#77

Merged
Rohan5commit merged 2 commits into
mainfrom
codex/fix-ai-cash-email-root-cause
May 29, 2026
Merged

Fix AI cash reporting and require email failures to surface#77
Rohan5commit merged 2 commits into
mainfrom
codex/fix-ai-cash-email-root-cause

Conversation

@Rohan5commit
Copy link
Copy Markdown
Owner

Fixes the root cause of negative AI cash reports by making cash calculations side-aware for short positions, and removes the direct Cerebrium runner email bypass so AI email failures are not hidden. Includes py_compile and side-aware cash smoke validation.

codex added 2 commits May 29, 2026 04:47
…ation, and harden Cerebrium preflight

### Motivation

- Prevent unintended Sunday scheduled executions and ensure scheduled runs only occur Tuesday through Saturday in UTC.
- Fail early when AI report email configuration is incomplete to avoid silent AI report failures.
- Make the Cerebrium predict preflight more resilient to transient network/server errors.

### Description

- Changed the scheduled cron from `0 0 * * 2-7` to `0 0 * * 2-6` to run Tue–Sat only and added an `Enforce schedule day guard (Tue-Sat only)` step that checks UTC weekday and aborts non-permitted scheduled runs.
- Added `Validate SMTP configuration for AI reports` step to fail fast if any of `SMTP_SERVER`, `SMTP_PORT`, `SENDER_EMAIL`, `SENDER_PASSWORD`, or `RECIPIENT_EMAIL` secrets are missing when AI trading is expected to run.
- Normalized and tightened many workflow `if:` conditions to use `((github.event_name != 'workflow_dispatch') || !inputs.disable_ai_trading)` so AI-path expectations and gating are consistent across steps.
- Updated `AI_EXPECTED` expressions used by `Ensure Daily Email Coverage` and `Evaluate Scheduled/Runner Run Status` to reflect the `disable_ai_trading` input instead of a static `false` value.
- Hardened `run_ai_daily_cerebrium.py` by adding `time` import and rewriting `_preflight_predict` to perform up to 3 attempts with exponential-ish backoff, treat common transient statuses (`429, 500, 502, 503, 504`) as retryable, and return joined attempt details for diagnostics.

### Testing

- Validated Python syntax for the modified file by running `python -m compileall` which completed successfully.
- Linted/checked the workflow YAML with a YAML linter to ensure no obvious syntax errors which completed successfully.
- No additional automated unit tests were added or modified in this change.
@Rohan5commit Rohan5commit merged commit 7f05070 into main May 29, 2026
1 of 2 checks passed
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