fix(ops): scope terminal veto to recovery epoch - #100
Conversation
Co-Authored-By: Codex <noreply@openai.com>
🤖 Codex PR Review🚫 Merge blocked: 1 serious issue(s) found in high-risk files 🚫 Blocking IssuesThese issues must be fixed before this PR can be merged: 1. 🟠 [HIGH] Logic in
|
|
PERMANENT_FREEZE / HUMAN_REQUIRED Stopping under the cross-reslice repeated-finding rule at head Boundary design required before any future implementation:
The current reslice starts the epoch before restart/recreate, so disconnect emitted by the old container can self-veto replacement startup. No new Gateway fix PR will be created in this run. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbff862236
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ! gateway_recently_progressing; then | ||
| return 1 | ||
| fi | ||
| activity="$(gateway_epoch_activity "${attempt_start}")" |
There was a problem hiding this comment.
Keep progress checks from reusing stale epoch logs
With progress_extensions greater than 1, this re-scans from the original attempt start on every extension check, so a single early line such as IBC: Starting Gateway makes gateway_epoch_activity return progress for every loop iteration even after another full progress_wait_seconds passes with no new activity. In a hung startup that logs once and then stalls, the recovery now burns all configured extensions before restarting/recreating instead of requiring fresh progress for each extension; keep the terminal veto epoch-wide, but base progress on activity since the previous wait/check.
Useful? React with 👍 / 👎.
| if (fraction_at == 0) { | ||
| return raw ".000000000" |
There was a problem hiding this comment.
Do not backdate second-precision file log entries
For file logs that only include whole-second timestamps, this normalizes the event to the start of that second. Since attempt_start is recorded with nanoseconds, any real in-epoch file log emitted later in the same second (for example 2fa.log, whose Python formatter uses %Y-%m-%d %H:%M:%S) compares as older than the epoch and is ignored. When the only 2FA/login progress after a restart happens in that sub-second window, recovery will miss it and proceed to the next external action instead of extending the wait.
Useful? React with 👍 / 👎.
| continue | ||
| fi | ||
| for log_path in /home/ibgateway/Jts/launcher.log /home/ibgateway/2fa.log; do | ||
| { timeout "${log_probe_timeout_seconds}" docker exec "${container_name}" tail -n 400 "${log_path}" 2>/dev/null || true; } \ |
There was a problem hiding this comment.
Preserve the sticky veto across verbose file logs
This fallback only classifies the last 400 lines even though the new policy makes a terminal auth/disconnect line sticky for the whole recovery epoch. If Docker logs are unavailable/rotated or time out and an in-epoch terminal line in launcher.log or 2fa.log scrolls past those last 400 lines before the readiness wait finishes, the fallback can return later progress (or nothing) and allow extensions/retries instead of honoring the terminal veto; scan from the epoch boundary or otherwise remember terminal state across the full epoch.
Useful? React with 👍 / 👎.
Summary
Contract evidence
Validation
tests/test_*.shpython3 -m py_compile 2fa_bot.pybash -nfor shell scripts/tests/overridesactionlint .github/workflows/*.ymlshellcheck -S warninggit diff --checkSafety
No deploy, restart, recreate, Scheduler trigger,
/run,/dry-run, order, funds, position, leverage, live config, or secret operation was performed.