Run events in the database: Runs page and Agent run card on the Dokploy Portal

Snapshot of D:\Ecw Process 65c92c5 (2026-10-30).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ManikandanandClaude Opus 5.5 committed 2026-10-30 11:28:26 +05:30
1 parent d500f750da
commit 840272032a
9 files changed
+655 -46

No files matched your search

+35 -6
View File
@@ -348,7 +348,7 @@ that box and on the per-claim save box means Cancel.
| `flows/recovery.py` | A stuck screen inside a pass (§2): `recover()` (logout check, Escape + Patient Information close + clear, reopen search) and `run_claim()` (one retry per claim, 2 in a row → `PageStuck`, exit 9) |
| `core/notify.py` | The agent's mail (§2): `incident()` / `summary()`; claim numbers masked, login / error PNGs only; never fatal |
| `core/watchdog.py` | Claim watchdog (2026-10-22): `watching(limit)` around the claim loop, `beat(where)` at each claim step and every message box, `check()` raises `Stalled` → exit 8; on a stall it closes this process's Playwright driver (`node.exe`) so the frozen call returns, and exits 8 itself if the main thread never comes back |
| `core/run_events.py` | A Run's timed events → `Logs\events_<run>.jsonl` (`start`, `emit`, `warning`, `claim_error`, `run_error` with traceback, `login_attempt_start/end`, `login_step`); never raises, never writes an OTP code / password / username |
| `core/run_events.py` | A Run's timed events → `Logs\events_<run>.jsonl` (`start`, `emit`, `warning`, `claim_error`, `run_error` with traceback, `login_attempt_start/end`, `login_step`); never raises, never writes an OTP code / password / username. Since `c9a43ac` (2026-10-30) each line is also copied to `dbo.CV_RunEvent` (§5) — only for a Run in the real `Logs` folder with `RESULTS_DB=1`; the first database error turns the copy off for that Run |
| `core/browser.py` | `launch()`: Playwright Chromium with the eCW proxy, or (`BROWSER_CDP_URL`) attach to the operator's Chrome — `clear_ecw_data()` at attach and close, `cdp_ready()` checked before login |
| `core/msgbox.py` | Timed Windows message boxes; `default_cancel=True` makes Enter mean Cancel |
| `core/text.py` | `first_line()` shared by core / conditions / flows |
@@ -641,6 +641,24 @@ the Portal (restarted 2026-10-26, [portal] terminal tab).
queue file — the agent would have to write the queue size to the DB).
The mockup canvas: claude.ai artifact "Charge Validation Portal Mockups"
(private to the operator).
- **Runs on Dokploy (2026-10-30, `c9a43ac`).** The Dokploy Portal cannot
read the bot PC's `Logs` folder, so its Runs page showed "No runs
match" for every date. Now every Run event is also a row in
`dbo.CV_RunEvent` (run_id, at, kind, body = the same JSON line;
created in SSMS by the operator that day, script in
`tools/sql/create_tables.sql`; `cv_portal` reads it through
`db_datareader`). `web/runs.py` reads Runs through an events source:
`FileEvents` (the PC's local Portal, as before) or `DbEvents` (a
`PORTAL_SERVER` Portal; one query per page). On Dokploy the Runs list,
filter, run detail and last-run banner come from the table, and the
Dashboard's Agent run card from `runs.live_status()` (the newest Run;
"running" = no end and an event in the last 10 minutes). Failure
screenshots stay on the PC (PHI): a server shows their names only.
`tools/import_run_events.py` loaded the 34 older Runs (2,043 events,
22–29/10) once; a second run adds nothing. Checked live: 28–29/10 lists
15 Runs; the 21:10 Run's detail shows the 7 m 7 s 2FA mail wait. ADR
0001 (run events in files) still holds: the file is the record, the row
a copy.
---
@@ -753,7 +771,9 @@ the Portal (restarted 2026-10-26, [portal] terminal tab).
History: `git log --oneline`.
Last code commits: `78409f0` (2026-10-30, Portal sage redesign — §5;
Last code commits: `c9a43ac` (2026-10-30, run events in the database —
Runs page and Agent run card on Dokploy, §5; deployed from
`portal-20261030-runs.zip`), `78409f0` (2026-10-30, Portal sage redesign — §5;
deployed to Dokploy from the working tree before this commit, same
files), `24c9ce4` (2026-10-30, the self-healing agent: supervisor,
recovery, security image Continue, Resend pickup, operator mail — §2,
@@ -898,10 +918,19 @@ test claim ids — new posts must not (§7).
`.env` (the operator's address) and one test mail; a first `python
agent.py` to see the security image Continue click on the real page
(its HTML is saved as `security_image_page` — tighten the selector from
it) and a late-mail Resend pickup. Not built: the agent's status in the
Portal (it runs on the bot PC; the Dokploy Portal sees only the
database — a status / queue-size row would carry it), Queue / Pending
tiles.
it) and a late-mail Resend pickup. The Dokploy Dashboard's Agent run
card shows the newest bot Run from `CV_RunEvent` (`c9a43ac`), but not the
agent's own passes or waits (the supervisor writes no events yet), and
there are no Queue / Pending tiles (no queue size in the database).
- **Dokploy wording (2026-10-30, asked, not done):** the Agent run card
says "see the log" and "CAPTCHA and 2FA boxes still come up on this PC"
— true for the PC's local Portal, misleading on Dokploy; reword for a
server Portal.
- **A public IP in the Dokploy logs (2026-10-30):** `/api/bot/status`
polls from `43.254.111.194` beside the internal `10.200.1.15`. The
Portal is meant to be Ecare network / VPN only — IT to confirm the
address is Ecare's own; if not, the domain is reachable from the
internet (PHI).
- **29/10 live queue (690 claims).** 208 got a result in two runs (17:18
126, 19:29 82); the rest were not reached: Ctrl-C would not stop a
run blocked in a Playwright call (the tab was closed instead), a stuck